[gst-devel] How to overcome the caps limitation of peers during caps negotiation?
Stefan Kost
ensonic at hora-obscura.de
Wed Dec 12 20:40:33 CET 2007
Hi,
Sharath Mudalamane schrieb:
> To: 'gstreamer-devel at lists.sourceforge.net'
> Subject: How to overcome the caps limitation of peers during caps
> negotiation?
>
>
>
>
>
> Hello all,
>
>
>
>
>
> PROBLEM DESCRIPTION:
>
>
>
> I have developed a gstreamer filter (say "wow").
>
> I am trying to play a 6 channel (> 2 channels) wav file with my filter
> in the pipeline (on Nokia 770) as follows:
>
> Gst-launch-0.10 filesrc location=6channel.wav ! wavparse ! wow ! dsppcmsink
>
>
> But, this fails during caps negotiation due to the fact that
> dsppcmsink’s sink pad supports only a MAX of 2 channels.
>
Your src-pad has fixed 2 channels. So no need to negotiate there. What I belive
is that you forget to set the caps on the buffer you sent out. How do you
allocate your output buffers? Are you using gst_pad_alloc_buffer_and_set_caps()?
Can you post the chain-function of your code?
Stefan
>
>
> How should I implement my gst_wow_getcaps (GstPad) function to overcome
> this peer caps limitation?
>
> I read in Plug-in writer’s guide section 10.5. about implementating
> _getcaps() to overcome such limitations and setting order of preferences.
>
> But, I need more information and guidelines about how this _getcaps is
> used by gstreamer during caps negotiation.
>
>
>
>
>
>
>
>
>
> DETAILS OF MY PLUGIN:
>
>
>
>
>
> My plugin’s sink and src pads are like this:
>
> NOTE: my plugin can take 1 to 6 channels and outputs 2 channels always.
>
>
>
> ----------------------------------------------------------------------------------------
>
> static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
>
> GST_PAD_SINK,
>
> GST_PAD_ALWAYS,
>
> GST_STATIC_CAPS (
>
> "audio/x-raw-int, "
>
> "signed = (boolean){ true, false }, "
>
> "width = (int) 16, "
>
> "depth = (int) 16, "
>
> "endianess = (int) 1234, "
>
> "channels = (int) [ 1 , 6 ], "
>
> "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000,
> 44100, 48000 } "
>
> )
>
> );
>
>
>
> static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
>
> GST_PAD_SRC,
>
> GST_PAD_ALWAYS,
>
> GST_STATIC_CAPS (
>
> "audio/x-raw-int, "
>
> "signed = (boolean){ true, false }, "
>
> "width = (int) 16, "
>
> "depth = (int) 16, "
>
> "endianess = (int) 1234, "
>
> "channels = (int) 2, "
>
> "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000,
> 44100, 48000 } "
>
> )
>
> );
>
>
>
> -----------------------------------------------------------------------------------------------
>
>
>
>
>
> Nokia770-49:~# gst-inspect-0.10 wow
>
> Factory Details:
>
> Long name:
>
> Class: Filter/Audio
>
> Description: Enhances stereo content for headphones
>
> Author(s): Sharath Mudalamane <sharath_m at mindtree.com>
>
> Rank: none (0)
>
>
>
> Plugin Details:
>
> Name: wow
>
> Description: Enhances stereo content for mobile device
>
> Filename: /usr/lib/gstreamer-0.10/libgstwow.so
>
> Version: 0.10.0.1
>
> License: LGPL
>
> Source module: gst-plugin
>
> Binary package: GStreamer
>
> Origin URL:
>
>
>
> GObject
>
> +----GstObject
>
> +----GstElement
>
> +----GstWow
>
>
>
> Pad Templates:
>
> SRC template: 'src'
>
> Availability: Always
>
> Capabilities:
>
> audio/x-raw-int
>
> signed: { true, false }
>
> width: 16
>
> depth: 16
>
> endianess: 1234
>
> channels: 2
>
> rate: { 8000, 11025, 12000, 16000, 22050, 24000,
> 32000, 44100, 48000 }
>
>
>
> SINK template: 'sink'
>
> Availability: Always
>
> Capabilities:
>
> audio/x-raw-int
>
> signed: { true, false }
>
> width: 16
>
> depth: 16
>
> endianess: 1234
>
> channels: [ 1, 6 ]
>
> rate: { 8000, 11025, 12000, 16000, 22050, 24000,
> 32000, 44100, 48000 }
>
>
>
>
>
> Element Flags:
>
> no flags set
>
>
>
> Element Implementation:
>
> No loopfunc(), must be chain-based or not configured yet
>
> Has change_state() function: 0x40040ba1
>
> Has custom save_thyself() function: 0x40040f09
>
> Has custom restore_thyself() function: 0x40041191
>
>
>
> Element has no clocking capabilities.
>
> Element has no indexing capabilities.
>
>
>
> Pads:
>
> SRC: 'src'
>
> Implementation:
>
> Pad Template: 'src'
>
> SINK: 'sink'
>
> Implementation:
>
> Has chainfunc(): 0x4068fde8
>
> Pad Template: 'sink'
>
>
>
> Element Properties:
>
>
>
> [ not shown ]
>
>
>
> Nokia770-49:~#
>
>
>
> ----------------------------------------------------------------------------------------
>
>
>
> OTHER OBSERVATIONS:
>
>
>
> Gst-launch-0.10 filesrc location=6channel.wav ! wavparse ! wow ! dsppcmsink
>
> The above pipeline worked for wav files with 1 and 2 channels. */It
> fails (hang up) for 3,4,5,6 channels/*.
>
>
>
> The logs are provided below
>
> -----------------------------------------------------------------------------------------------
>
> Nokia770-49:/home/user/media_samples# gst-launch-0.10 -m filesrc
> location=SigAudistry_2ch_48k.wav ! wavparse ! wow ! dsppcmsink
>
> Setting pipeline to PAUSED ...
>
> Pipeline is PREROLLING ...
>
> Got Message from element "dsppcmsink0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_PAUSED
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
>
>
> #[gst_wow_set_caps] called !!... GstPad = <0x50180>, GstCaps = <0x180b0>
>
> #[gst_wow_set_caps] Proposed Capabilities by the stream:
>
> [ audio/x-raw-int, endianness=(int)1234, channels=(int)2,
> width=(int)16, depth=(int)16, signed=(boolean)true, rate=(int)48000 ]
>
> Got Message from element "wavparse0" (tag): taglist,
> audio-codec=(string)"Uncompressed\ 16-bit\ PCM\ audio"
>
> Got Message from element "dsppcmsink0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Pipeline is PREROLLED ...
>
> Setting pipeline to PLAYING ...
>
> Got Message from element "pipeline0" (new-clock): GstMessageNewClock,
> clock=(GstClock)(NULL)
>
> New clock: GstSystemClock
>
> Got Message from element "dsppcmsink0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_PAUSED,
> new-state=(GstState)GST_STATE_PLAYING,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_PAUSED,
> new-state=(GstState)GST_STATE_PLAYING,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_PAUSED,
> new-state=(GstState)GST_STATE_PLAYING,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_PAUSED,
> new-state=(GstState)GST_STATE_PLAYING,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_PAUSED,
> new-state=(GstState)GST_STATE_PLAYING,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (eos): no message details
>
> Got EOS from element "pipeline0".
>
> Execution ended after 2938873000 ns.
>
> Setting pipeline to PAUSED ...
>
> Setting pipeline to READY ...
>
> Setting pipeline to NULL ...
>
> FREEING pipeline ...
>
> Nokia770-49:/home/user/media_samples#
>
>
>
>
>
>
>
> Nokia770-49:/home/user/media_samples# gst-launch-0.10 -m filesrc
> location=SigAudistry_6ch_48k.wav ! wavparse ! wow ! dsppcmsink
>
> Setting pipeline to PAUSED ...
>
> Pipeline is PREROLLING ...
>
> Got Message from element "dsppcmsink0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_PAUSED
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (tag): taglist,
> audio-codec=(string)"Uncompressed\ 16-bit\ PCM\ audio"
>
> Caught interrupt --
>
> Nokia770-49:/home/user/media_samples#
>
> Nokia770-49:/home/user/media_samples#
>
> Nokia770-49:/home/user/media_samples#
>
> Nokia770-49:/home/user/media_samples#
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Nokia770-49:/home/user/media_samples# gst-launch-0.10 -m filesrc
> location=SigAudistry_5ch_48k.wav ! wavparse ! wow ! dsppcmsink
>
> Setting pipeline to PAUSED ...
>
> Pipeline is PREROLLING ...
>
> Got Message from element "dsppcmsink0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "pipeline0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY,
> pending-state=(GstState)GST_STATE_PAUSED
>
> Got Message from element "wow0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "filesrc0" (state-changed): GstMessageState,
> old-state=(GstState)GST_STATE_READY,
> new-state=(GstState)GST_STATE_PAUSED,
> pending-state=(GstState)GST_STATE_VOID_PENDING
>
> Got Message from element "wavparse0" (tag): taglist,
> audio-codec=(string)"Uncompressed\ 16-bit\ PCM\ audio"
>
> Caught interrupt --
>
> Nokia770-49:/home/user/media_samples#
>
>
>
>
>
> -----------------------------------------------------------------------------------------------
>
>
>
> (2)
>
>
>
> Also I tried writing a typical */hello world program/* to check
> capabilities during negotiation. I have collected the capabilities of my
> filter wow during the linking of the wavparse dynamic pad (sinkpad) and
> my filter’s static source pad in the callback function. Below is my
> observation:
>
>
>
> FOR 6CHANNEL: the gst_pad_link () fails and also I observed the filter’s
> capabilities limited to 2 channels.
>
> ----------------------------------------------------------
>
> Nokia770-49:/home/user/bin# ./wav_hell01
> ../media_samples/SigAudistry_6ch_48k.wav
>
>
>
> [main()] Calling ... gst_init()
>
>
>
> [main()] AFTER Calling... gst_init()
>
>
>
> [main()] Calling... factory_make( wow)
>
>
>
> [main()] AFTER Calling... factory_make( wow) handle = <358504>
>
>
>
> [main()] Adding wow to the pipeline BIN
>
>
>
> [main()] AFTER Adding wow to the pipeline BIN
>
>
>
>
>
> [main()] Setting to PLAYING
>
>
>
>
>
> [main()] Running
>
>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <4>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> */ /*
>
> */ [new_pad()] The Capabilities of dynamic pad of wavparse:/*
>
> */ [ audio/x-raw-int, endianness=(int)1234, channels=(int)6,
> width=(int)16, depth=(int)16, signed=(boolean)true,
> channel-positions=(GstAudioChannelPosition)<
> GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
> GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
> GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_LFE,
> GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
> GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT >, rate=(int)48000 ]/*
>
> */ /*
>
> */ /*
>
> */ /*
>
> */ [new_pad()] The Caps of sinkPad of wow filter:/*
>
> */ [ audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true,
> false }, width=(int)16, depth=(int)16, rate=(int){ 8000, 11025, 12000,
> 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ],
> endianess=(int)1234 ]/*
>
>
>
>
>
>
>
> [new_pad()] Dynamic pad created, linking parser-filter
>
>
>
>
>
> */[NEW_PAD()] gst_pad_link() returns [-4]/*
>
>
>
> Nokia770-49:/home/user/bin#
>
>
>
> -------------------------------------------------------
>
>
>
> FOR 2 CHANNEL:
>
> --------------------------------------------------------
>
> Nokia770-49:/home/user/bin# ./wav_hell01
> ../media_samples/SigAudistry_2ch_48k.wav
>
>
>
> [main()] Calling ... gst_init()
>
>
>
> [main()] AFTER Calling... gst_init()
>
>
>
> [main()] Calling... factory_make( wow)
>
>
>
> [main()] AFTER Calling... factory_make( wow) handle = <358504>
>
>
>
> [main()] Adding wow to the pipeline BIN
>
>
>
> [main()] AFTER Adding wow to the pipeline BIN
>
>
>
>
>
> [main()] Setting to PLAYING
>
>
>
>
>
> [main()] Running
>
>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <1> new <2> pending <4>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
>
>
> */ [new_pad()] The Capabilities of dynamic pad of wavparse:/*
>
> */ [ audio/x-raw-int, endianness=(int)1234, channels=(int)2,
> width=(int)16, depth=(int)16, signed=(boolean)true, rate=(int)48000 ]/*
>
> */ /*
>
> */ /*
>
> */ /*
>
> */ [new_pad()] The Caps of sinkPad of wow filter:/*
>
> */ [ audio/x-raw-int, endianness=(int)1234, signed=(boolean){ true,
> false }, width=(int)16, depth=(int)16, rate=(int){ 8000, 11025, 12000,
> 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ],
> endianess=(int)1234 ]/*
>
>
>
>
>
>
>
> [new_pad()] Dynamic pad created, linking parser-filter
>
>
>
>
>
> */[NEW_PAD()] gst_pad_link() returns [0]/*
>
>
>
> #[gst_wow_set_caps] called !!... GstPad = <0x511c0>, GstCaps = <0x65fd0>
>
> #[gst_wow_set_caps] Proposed Capabilities by the stream:
>
> [ audio/x-raw-int, endianness=(int)1234, channels=(int)2,
> width=(int)16, depth=(int)16, signed=(boolean)true, rate=(int)48000 ]
>
>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <2> new <3> pending <4>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <3> new <4> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <3> new <4> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <3> new <4> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <3> new <4> pending <0>
>
> [GST_MESSAGE_STATE_CHANGED] recvd! old <3> new <4> pending <0>
>
>
>
> [bus_call()] End-of-stream
>
>
>
>
>
> [main()] Returned, stopping playback
>
>
>
>
>
> [main()] Deleting pipeline ... Here wow will also be de-referenced...!
>
>
>
> [main()] AFTER Deleting pipeline ... Here wow will also be de-referenced...!
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------------------------------------
>
>
>
> Please provide help.
>
>
>
> Thanks and regards,
>
> Sharath
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list