Q: HowTo: Detect video/audio DecodeBin's before linking Pads?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Q: HowTo: Detect video/audio DecodeBin's before linking Pads?

Izzy Softy
hi All,

1st time poster. 2 months since i started. :)
GStreamer looks awesome. ;)

Now... down to the nitty gritty.

Problem:
 - I want to automatically detect if a DecodeBin has Audio and Video.
 - If just Audio, then Tee DecodeBin's Src0 pad to create a VideoSink for GOOM (or other Visualizers)
   and Tee DecodeBin's Src0 pad for AlsaSink (or whatever)

Tried:
  - g_signal_connect( decoder, "new-decoded-pad", G_CALLBACK( on_decoder_pad_added ), NULL );
  - on_decoder_pad_added(...) is only aware of One pad at a time. is there no way to check for audio/video?

Tried:
  - I removed "new-decoded-pad", and instead added this (src follows) after gst_element_link( src, decoder );

res = gst_element_set_state( pipeline, GST_STATE_PAUSED );
if (res == GST_STATE_CHANGE_FAILURE)
{
g_print("Gstreamer ERROR: could not pause\n");
gst_object_unref(GST_OBJECT (pipeline));
return FALSE;
}

res = gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
if (res != GST_STATE_CHANGE_SUCCESS)
{
g_print("Gstreamer ERROR: could not complete pause\n");
gst_object_unref(GST_OBJECT (pipeline));
return FALSE;
}

    it = gst_element_iterate_src_pads( decoder );
    while (gst_iterator_next (it, &data) == GST_ITERATOR_OK)
    {
        GstPad *pad = GST_PAD (data);
        ...
        // added a Bin and Queues etc...,  works fine when done in "new-decoded-pad" method.
    }

Answer: ????

Any help is Greatly Appreciated, Any!  I accepet PayPay!  :D     No wait... They deleted that account. :(
hehe

mucho thanks,
Izzy.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Q: HowTo: Detect video/audio DecodeBin's before linking Pads?

Tim-Philipp Müller-2
On Tue, 2012-03-20 at 21:33 -0700, Izzy Softy wrote:

Hello,

> Problem:
>  - I want to automatically detect if a DecodeBin has Audio and Video.
>  - If just Audio, then Tee DecodeBin's Src0 pad to create a VideoSink
> for GOOM (or other Visualizers)
>    and Tee DecodeBin's Src0 pad for AlsaSink (or whatever)
>
>
> Tried:
>   - g_signal_connect( decoder, "new-decoded-pad",
> G_CALLBACK( on_decoder_pad_added ), NULL );
>   - on_decoder_pad_added(...) is only aware of One pad at a time. is
> there no way to check for audio/video?

Indeed, you only get one pad at a time from (uri)decodebin(2).

First of all, are you aware of playbin2 ? It looks like you're trying to
re-implement what it does already, namely show visualisations if there's
no video. If you're writing a playback application of some sort, you
probably want to use playbin2.

To answer your question, you can "block" the new pads you get notified
about by (uri)decodebin(2), and decide what to do with them (link
+unblock or just unblock+leave unlinked) once you've seen all pads (you
get a "no-more-pads" signal).

 Cheers
  -Tim


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Q: HowTo: Detect video/audio DecodeBin's before linking Pads?

Izzy Softy
Thank you Tim,

playbin2 is what i want to use eventually.

I just wanted to learn more about decodebin2.
I think i might have a working solution now. 
(see attached zip file for C src, uses Clutter-Gst, Linux)

Anything in the src i might be doing wrong?

Side Note:   When playing  S3M, XM, MOD's, the Visualizer doesnt always work.
Well, "goom" seems to work... but "monoscope" does not! :(  Why is this?  maybe it Failed to convert samples? :(

Thanks again for your help,
Izzy.



On Wed, Mar 21, 2012 at 2:43 AM, Tim-Philipp Müller <[hidden email]> wrote:
On Tue, 2012-03-20 at 21:33 -0700, Izzy Softy wrote:

Hello,

> Problem:
>  - I want to automatically detect if a DecodeBin has Audio and Video.
>  - If just Audio, then Tee DecodeBin's Src0 pad to create a VideoSink
> for GOOM (or other Visualizers)
>    and Tee DecodeBin's Src0 pad for AlsaSink (or whatever)
>
>
> Tried:
>   - g_signal_connect( decoder, "new-decoded-pad",
> G_CALLBACK( on_decoder_pad_added ), NULL );
>   - on_decoder_pad_added(...) is only aware of One pad at a time. is
> there no way to check for audio/video?

Indeed, you only get one pad at a time from (uri)decodebin(2).

First of all, are you aware of playbin2 ? It looks like you're trying to
re-implement what it does already, namely show visualisations if there's
no video. If you're writing a playback application of some sort, you
probably want to use playbin2.

To answer your question, you can "block" the new pads you get notified
about by (uri)decodebin(2), and decide what to do with them (link
+unblock or just unblock+leave unlinked) once you've seen all pads (you
get a "no-more-pads" signal).

 Cheers
 -Tim


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

clutter_player.c.zip (4K) Download Attachment