[gst-devel] How to overcome the caps limitation of peers during caps negotiation?

Sharath Mudalamane sharath_m at mindtree.com
Wed Dec 12 13:17:49 CET 2007


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.

 

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

 



DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited.
E-mail may contain viruses. Before opening attachments please check them for viruses and defects. While MindTree Consulting Limited (MindTree) has put in place checks to minimize the risks, MindTree will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.
Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
MindTree reserves the right to monitor and review the content of all messages sent to or from MindTree e-mail address. Messages sent to or from this e-mail address may be stored on the MindTree e-mail system or else where.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20071212/20fe51a4/attachment.htm>


More information about the gstreamer-devel mailing list