newbie help writing plugin

Rainer Clasen bj at
Wed Jun 22 08:13:02 PDT 2011


in theory I just wanted to scan my music collection for replay gain.
So basically I need something like

 gst-launch filesrc location=[all files] ! decodebin2 ! rganalysis num-tracks=[count] ! fakesink

and change the src location on each EOS.

This is supposed to be integrated into an existing collection of perl
applications. Unfortunatly there's a bug, that keeps me from using any of
the decodebin signals:

After plenty other attempts, I'm currently trying to work around this
issue by writing my own "decodebin" with a static src pad in C and hide
all the callback stuff deep inside. I'd limit this to decoding a single
audio/x-raw-(float/int) stream to keep thinks simple.

The idea was to subclass GstBin, embed decodebin2 and dynamically link it
to some ghost pads.

So in my element's _init function I
- create decodebin2, gst_bin_add() it to $self
- set caps property on decodebin2 to "audio/x-raw-int;audio/x-raw-float"
- create sink ghostpad for decodebin2:sink, gst_element_add_pad() it to
- create src ghostpad without target, gst_element_add_pad() it to $self
- setup a "pad-added" signal handler on decodebin2 to issue
  gst_ghost_pad_set_target() for the src ghostpad.

I've tried this with an ANY and an "audio/x-raw..." caps on the src
template of my element without success.

Is this something that's supposed to work in the described way - i.e. I
just need to "fix" it? Is something missing from my aproach? Or is my
aproach too twisted?

Can somebody give me a hint what's neccessary to write such an element?
Do I have to do the caps negotiation (_setcaps and friends) myself?


KeyID=759975BD fingerprint=887A 4BE3 6AB7 EE3C 4AE0  B0E1 0556 E25A 7599 75BD

More information about the gstreamer-devel mailing list