[gst-devel] decodebin vs playbin

Rodney Dowdall rdowdall at cranksoftware.com
Tue Jun 1 15:53:25 CEST 2010


Hello Thiago

Thanks for your suggestions.  I read the playbin2 docs, and it said that 
I could use the fakesink's handoff signal to grab the buffer from the 
playbin2 video.  I tried to set that up, but my signal handler never 
gets called.  Here is the code snippet that I have:

static void
cb_handoff (GstElement *fakesink,
         GstBuffer   *buffer,
         GstPad      *pad,
         gpointer     user_data)
{
   static gboolean white = FALSE;

   /* this makes the image black/white */
   printf("new buffer is happening\n");
}


.... Initlization function stuff ....

         videosink = gst_element_factory_make ("fakesink", "videosink");
         g_object_set (G_OBJECT (videosink), "signal-handoffs", TRUE,  
NULL);
         g_signal_connect (videosink, "handoff", G_CALLBACK 
(cb_handoff), NULL);
         gs_data->pipeline = gst_element_factory_make ("playbin2", 
"my-player");
         g_object_set (G_OBJECT (gs_data->pipeline), "video-sink", 
videosink, NULL);
         g_object_set (G_OBJECT (gs_data->pipeline), "uri", 
"<path_to_mp4>", NULL);

This plays the sound from the mp4, but I can't grab the buffer.  Am I 
missing a step?  Do I have to setup a video-bin, with a filter, 
converter, and sink?

Thanks,
Rodney

On 10-05-31 11:40 PM, thiagossantos at gmail.com wrote:
>
>
> On Mon, May 31, 2010 at 11:53 PM, Rodney Dowdall 
> <rdowdall at cranksoftware.com <mailto:rdowdall at cranksoftware.com>> wrote:
>
>     Hello
>
>     I am trying to play the audio and the video from a mp4 file.  If I
>     run the following line:
>
>     gst-launch -vvvvv --gst-debug-level=2 playbin
>     uri=file:///<path_to_mp4_file>
>
>     Then it plays the file's audio.  I'm not putting the video
>     anywhere, so I can't see if it is playing or not, but I assume it
>     is based on the debug output.
>
>     If I do the following line:
>
>     gst-launch -vvv --gst-debug-level=2 filesrc
>     location=<path_to_mp4_file> ! decodebin2 name=decoder decoder. !
>     audioconvert ! audioresample ! osssink decoder. ! ffmpegcolorspace
>     ! xvimagesink
>
>     It hangs at:
>
>     Setting pipeline to PAUSED ..
>     /GstPipeline:pipeline0/GstDecodeBin2:decoder/GstTypeFindElement:typefind.GstPad:src:
>     caps = audio/x-m4a
>     Pipeline is PREROLLING ...
>     <audio debug output snipped>
>
>
> You need to put 'queue' after each decodebin2's branch to start a new 
> thread for them. The docs should have some more information about 
> this: 
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-threads.html#section-threads-uses
>
>
>     I need to open this file in C code, and grab access to the
>     buffers.  I was planning on using appsink to do it, but any time I
>     pass in a video sink to the pipeline, it just hangs, never playing
>     the audio, or moving forward.  As I said, I need access to the
>     video buffer, so either I need a way to grab it from the pipeline
>     created from gst_parse_launch, or I was thinking that if I set up
>     the pipeline myself, I could use a handoff signal on the last
>     video sink, or mayber use the appsink methods.
>
>
> FYI, you can set the video-sink property in playbin2 to your appsink 
> and get the buffers from there.
>
>
>     I have a feeling that I am missing something simple, and was
>     hoping someone could point that out.
>
>     Thanks,
>     Rodney
>     -- 
>
>     *Rodney Dowdall
>     **Crank Software Inc.
>     **Office*: 613-595-1999
>     *Online*: www.cranksoftware.com <http://www.cranksoftware.com/>
>     *Check out*: Crank Software’s Blog <http://cranksoftware.com/blog/>
>
>
>
>     ------------------------------------------------------------------------------
>
>
>     _______________________________________________
>     gstreamer-devel mailing list
>     gstreamer-devel at lists.sourceforge.net
>     <mailto:gstreamer-devel at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>
>
> -- 
> Thiago Sousa Santos


-- 

*
Rodney Dowdall
**Crank Software Inc.
**Office*: 613-595-1999
*Online*: www.cranksoftware.com <http://www.cranksoftware.com/>
*Check out*: Crank Software’s Blog <http://cranksoftware.com/blog/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100601/a2bb0863/attachment.htm>


More information about the gstreamer-devel mailing list