Playbin2 pipeline with custom plugins...

Michael CORACIN michael.coracin at st.com
Mon Oct 3 07:15:49 PDT 2011


Hello,

I'm developping a gstreamer based mediaplayer, on a embedded platform, and I'm having troubles to get the elapsed time and duration information for MP3 files (but it works when playing audio/video streams like AVI,MKV files...).

This mediaplayer is based on Playbin2, but uses custom plugins to work with our audio/video drivers.

Our custom audio plugin acts as a decoder and a renderer (done on kernel side), this means that the gstreamer audio sink is a fakesink. (I know it is not a good idea, but it is temporary).
The ranking of our audio plaugin (GstCustomAudio) is set to GST_RANK_PRIMARY+10, to ensure it will be selected as audio decoder for all audio format we support.

The pipeline created at runtime is the following:
GstFileSrc -> GstTypeFindElement -> GstID3Demux -> GstCustomAudio -> fakesink

The sink caps of GstCustomAudio are:
(
    "sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("audio/mpeg,"
                     "  mpegversion = (int) {1, 2, 4},"
                     "  layer = (int) {1, 2, 3};"
                     "audio/x-aac;"
                     "audio/x-ac3;"
                     "audio/x-private1-ac3;"
                     "audio/x-eac3;"
                     "audio/x-dd;"
                     "audio/x-dts;"
                     "audio/x-private1-dts;"
                     "audio/x-flac;"
                     "audio/x-mlp;"
                     "audio/x-raw-int;"
                     "audio/x-private1-lpcm;"
                     "audio/x-private-ts-lpcm;"
                     "audio/x-pn-realaudio;"
                     "audio/x-vorbis;"
                     "audio/x-wma;"
                     "audio/x-dra;")
);

I'm trying to solve the issue of not getting the time information, by forcing gstreamer to insert mpegaudioparse plugin before GstCustomAudio. It would also give me the seek capability.
The the wanted pipeline would be:
GstFileSrc -> GstTypeFindElement -> GstID3Demux -> mpegaudioparse -> GstCustomAudio -> fakesink

I'm a gstreamer beginner, but if I understood well, gstreamer will look for a decoder in the available list that is capable of decoding the media type that has been detected by the typefinder. It will select the proper decoder based on its RANK (and alphabetic name if rank is equal).
So here it will select my GstCustomAudio plugin decoder, because we set it to GST_RANK_PRIMARY+10.
Then gstreamer will check the sink caps of this plugin to know what needs to be inserted before it, in order to complete the pipeline.
As the SRC caps of GstID3Demux are compatible with the SINK caps of GstCustomAudio, it will directly plug those 2 plugins... right?

The idea now, is to force gstreamer to add mpegaudioparse in the pipeline. As mpegaudioparse RANK is GST_RANK_PRIMARY+2, I've tried to set GstCustomAudio RANK to GST_RANK_PRIMARY+1 so that it is below mpegaudioparse.
That way, I get it working, mpegaudioparse is inserted before GstCustomAudio, and I get the elapsed time and duration information.
But then it breaks the mediaplayer for other media types (TS...).

So i'm confused on how to manage this to have it working for all media types.

So, my first question, is:
Do you think changing the RANK of our plugin this way is a good way for forcing gstreamer to add the mpegaudioparse in the pipeline?
If not, what would be the good way? Could we do it by changing the sink caps of GstCustomAudio? (I've tried to set parsed=true, but it didn't work).

More generally, could you explain me in deeper detail how gstreamer is building the pipeline?
When does it decide to add a demux, a parser, a decoder to the pipeline? based on which criteria?

Thanks in advance, and sorry for the long description! :)
Best regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111003/1c345635/attachment-0001.htm>


More information about the gstreamer-devel mailing list