GhostPad and Playbin2

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

GhostPad and Playbin2

Rodney Dowdall
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
Check out: Crank Software’s Blog
There is a better way to build user interfaces for embedded devices.
Download a 30 day evaluation of Crank Storyboard Suite today!





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

Re: GhostPad and Playbin2

Tim-Philipp Müller-2
On Mon, 2011-03-28 at 11:06 -0400, Rodney Dowdall wrote:

Hi,

>     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);

Try adding the elements before linking them.

You might also be interested in the appsink element btw. If it wasn't
for the videorate element you wouldn't need the whole bin at all with an
appsink element (it would be enough to just set the caps and let the
ffmpegcolorspace/videoscale in playbin2 do the conversions).

 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: GhostPad and Playbin2

Rodney Dowdall
Awesome, Thanks Tim, I'll give that a try, and I will look at the appsink.

Rodney

Rodney Dowdall
Crank Software Inc.
Office: 613-595-1999
Online: www.cranksoftware.com
Check out: Crank Software’s Blog
There is a better way to build user interfaces for embedded devices.
Download a 30 day evaluation of Crank Storyboard Suite today!





On 11-03-28 12:16 PM, Tim-Philipp Müller wrote:
On Mon, 2011-03-28 at 11:06 -0400, Rodney Dowdall wrote:

Hi,

    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);
Try adding the elements before linking them.

You might also be interested in the appsink element btw. If it wasn't
for the videorate element you wouldn't need the whole bin at all with an
appsink element (it would be enough to just set the caps and let the
ffmpegcolorspace/videoscale in playbin2 do the conversions).

 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
Reply | Threaded
Open this post in threaded view
|

Re: GhostPad and Playbin2

Rodney Dowdall
Hello Tim

Just so you know, flipping those calls did in fact work.  Now I am going to take a look at the appsink.  Thanks for the info.

Rodney

Rodney Dowdall
Crank Software Inc.
Office: 613-595-1999
Online: www.cranksoftware.com
Check out: Crank Software’s Blog
There is a better way to build user interfaces for embedded devices.
Download a 30 day evaluation of Crank Storyboard Suite today!





On 11-03-28 12:31 PM, Rodney Dowdall wrote:
Awesome, Thanks Tim, I'll give that a try, and I will look at the appsink.

Rodney

Rodney Dowdall
Crank Software Inc.
Office: 613-595-1999
Online: www.cranksoftware.com
Check out: Crank Software’s Blog
There is a better way to build user interfaces for embedded devices.
Download a 30 day evaluation of Crank Storyboard Suite today!





On 11-03-28 12:16 PM, Tim-Philipp Müller wrote:
On Mon, 2011-03-28 at 11:06 -0400, Rodney Dowdall wrote:

Hi,

    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);
Try adding the elements before linking them.

You might also be interested in the appsink element btw. If it wasn't
for the videorate element you wouldn't need the whole bin at all with an
appsink element (it would be enough to just set the caps and let the
ffmpegcolorspace/videoscale in playbin2 do the conversions).

 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

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