[gst-devel] Dynamical pad -> no linking

niac78 at free.fr niac78 at free.fr
Tue Oct 5 04:15:39 CEST 2004


Hello,
I'm trying to make a pipeline in order to play mpeg2 video directly to my
framebuffer. It's working when I use the gst-launch binary but I can't have it
run in my own program.

The pipeline is quite simple:
/bin/gst-launch-0.8 filesrc <FILE> ! mpegdemux ! mpeg2dec ! ffmpegcolorspace !
fbvideosink

No problem, this works. Now I create m'y pipeline in a .c file like shown below:

    //Pipeline creation
    GstElement* pipeline = gst_pipeline_new ("pipeline");
    g_assert (pipeline);

    g_signal_connect (pipeline, "error",
		      G_CALLBACK (gst_element_default_error), NULL);

    g_signal_connect (pipeline, "eos",
		      G_CALLBACK (eos_pipeline_handler), pipeline);

    //Elements creation
    GstElement *filesrc = gst_element_factory_make ("filesrc", "filesrc");
    g_object_set (G_OBJECT (filesrc), "location", filename_, NULL);
    g_assert (filesrc);

    GstElement *demux = gst_element_factory_make ("mpegdemux", "demux");
    g_assert (demux);

    GstElement *decoder = gst_element_factory_make ("mpeg2dec", "decoder");
    g_assert (decoder);

    GstElement *converter = gst_element_factory_make ("ffmpegcolorspace",
						      "converter");
    g_assert (converter);

    GstElement *videosink = gst_element_factory_make ("fbvideosink",
						      "videosink");
    g_assert (videosink);


    //Elements Linking
    gst_bin_add_many (GST_BIN (pipeline), filesrc, demux, decoder,
                      converter, videosink, NULL);

    if (!gst_element_link (filesrc, demux))
      DEBUG ("01 gst_element_link failed.\n");

    if (!gst_element_link_filtered(demux, decoder, NULL))
      DEBUG ("02 gst_element_link failed.\n");

    if (!gst_element_link (decoder, converter))
      DEBUG ("03 gst_element_link failed.\n");

    if (!gst_element_link (converter, videosink))
      DEBUG ("04 gst_element_link failed.\n");

The second link fails, probably because the video src pad is dynamical and it
does not exist yet. Indeed, it's created once the pipeline is run but it's
never linked (unlike when using the gst-launch binary).

What is the best way to link the mpegdemux with the mpeg2dec plugin.Is there a
way to force the link? Maybe to create the src pad when the element is created?

Thanks for your help.

Sincerely,
Nicolas





More information about the gstreamer-devel mailing list