GhostPad and Playbin2

Rodney Dowdall rdowdall at cranksoftware.com
Mon Mar 28 08:06:20 PDT 2011


Hello

I'm trying to setup a video sink that will do some video conversion and 
attach that to a playbin2 element.  Here is a snippet of what I am 
trying to do:

     gs_data->video = gst_bin_new("videobin");
     flt = gst_element_factory_make ("capsfilter", "flt");
     g_object_set (G_OBJECT (flt), "caps", gst_caps_new_simple 
("video/x-raw-rgb", "red_mask", G_TYPE_INT, 65280, "green_mask", 
G_TYPE_INT, 16711680, "blue_mask", G_TYPE_INT, 4278190080, "width", 
G_TYPE_INT, gs_data->render_info->output_width,
                                 "height", 
G_TYPE_INT,gs_data->render_info->output_height , "framerate",    
GST_TYPE_FRACTION, 24, 1, NULL), NULL);
     videoconv = gst_element_factory_make ("ffmpegcolorspace", "conv");
     videorate = gst_element_factory_make ("videorate", "vrate");
     videoscale = gst_element_factory_make ("videoscale", "scaler");

     videosink = gst_element_factory_make ("fakesink", "sink");


     g_object_set (G_OBJECT (videosink), "signal-handoffs", TRUE,  NULL);
     g_object_set (G_OBJECT (videosink), "sync", TRUE,  NULL);
     g_signal_connect (videosink, "handoff", G_CALLBACK (cb_handoff), 
gs_data);
     gst_element_link_many(videoconv, videoqueue, videoscale, videorate, 
flt,  videosink, NULL);
     gst_bin_add_many(GST_BIN(gs_data->video), videoconv, videoqueue, 
videoscale, videorate, flt, videosink,  NULL);
     //
     videopad = gst_element_get_static_pad(videoconv, "sink");
     gst_element_add_pad(gs_data->video, 
gst_ghost_pad_new("ghost",videopad));
     gst_object_unref(videopad);

     gs_data->pipeline = gst_element_factory_make ("playbin2", "player");
     pthread_mutex_lock(&gs_data->channel_mutex);
     gs_data->loop = g_main_loop_new (NULL, FALSE);
     bus = gst_pipeline_get_bus (GST_PIPELINE (gs_data->pipeline));

     gst_bus_add_watch (bus, bus_call, gs_data);
     gst_object_unref (bus);
     g_object_set(G_OBJECT(gs_data->pipeline), "uri", 
gs_data->media_name, NULL);
     g_object_set(G_OBJECT(gs_data->pipeline), "volume", 
gs_data->volume,  NULL);
     g_object_set(G_OBJECT(gs_data->pipeline), "video-sink", 
gs_data->video, NULL);


The problem is that my handler for the handoff never gets called for the 
fakesink, and I get a pad has no peer error on my fakesink element.  
Previously, I was using a decodebin and I had to link my ghost pad to 
the video pad in a new_decoded_pad handler.  Do I have to do the same 
sort of thing for playbin2?  I was thinking that I had to setup a 
handler for the video_changed signal, and in that handler, grab the pad 
for the stream and then link my pad to the video pad.  Does that sound 
about right, or am I way out in the weeds on this one?

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/>
*There is a better way to build user interfaces for embedded devices.
Download a 30 day evaluation 
<http://www.cranksoftware.com/products/eval.php> of Crank Storyboard 
Suite today!*




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


More information about the gstreamer-devel mailing list