Pipeline for on-disk buffering using queue2 element

Bhavya bhavyar.1992 at gmail.com
Fri Jul 3 03:49:40 PDT 2015


Hi All,

As directly linking queue2 to demuxer is not working when property
temp-template was set, i tried to replicate how playbin2 is handling. But i
don't think i m doing it right. 
Also from going through logs, all i could figure out is element linked as
below, but dont understand how it is possible.
src->typefind->queue2->decodebin2 , then again typefind->decodebin... is
linked.  I m definitely going wrong somewhere 
Please help me out in understanding how playbin2 is handling
Below is code snippet which i tried :
    bin = gst_bin_new("bin_download");
    pipeline = gst_pipeline_new("pipeline");
    source = gst_element_factory_make("souphttpsrc",
            "source");
    g_object_set(G_OBJECT(source), "location",
            "http://192.168.0.144/big.avi", NULL);
    queue_download = gst_element_factory_make("queue2",
            "queue2");
    demuxer = gst_element_factory_make("avidemux",
            "demuxer");
    gst_bin_add(bin, queue_download);
    gst_bin_add(pipeline, demuxer);
    typefind = gst_element_factory_make ("typefind",
            "typefindelement");
    gst_bin_add(bin, source);
    gst_bin_add(bin, typefind);
    gst_element_link(source, typefind);
    typefind1 = gst_element_factory_make ("typefind",
            "typefind");
    gst_bin_add(pipeline, typefind1);
    videosink = gst_element_factory_make ("autovideosink",
            "videosink");
    gst_bin_add(pipeline, videosink);
    audiosink = gst_element_factory_make ("autovideosink",
            "audiosink");
    gst_bin_add(pipeline, audiosink);
    audiodec = gst_element_factory_make ("ffdec_mp3",
            "audiodec");
    gst_bin_add(pipeline, audiodec);
    videodec = gst_element_factory_make ("ffdec_h264",
            "videodec");
    gst_bin_add(pipeline, videodec);
    typefind_pad = gst_element_get_static_pad (typefind1, "sink");
    templ = gst_static_pad_template_get (&sinktemplate);
    newpad = gst_ghost_pad_new_from_template ("sink", typefind_pad, templ);
    gst_pad_set_active (newpad, TRUE);
    gst_element_add_pad (GST_ELEMENT (bin), newpad);
    gst_element_link(typefind, queue_download);
    gst_bin_add (GST_BIN (pipeline), bin);
    pad_tmpl_src = gst_static_pad_template_get (&srctemplate);
    typefind_src_pad = gst_element_get_static_pad (typefind1, "src");
    gst_pad_link(typefind_src_pad, demuxer_pad);
    demuxer_pad = gst_element_get_static_pad (demuxer, "sink");
    gst_pad_link(typefind_src_pad, demuxer_pad);
    g_signal_connect(demuxer, "pad-added",
            G_CALLBACK(gstreamer_on_pad_added), pipeline);
    gst_element_link(audiodec, audiosink);
    gst_element_link(videodec, videosink);
    gst_element_set_state(pipeline,
            GST_STATE_PLAYING);

gstreamer_on_pad_added(GstElement* element,
        GstPad* pad,
        gpointer data)
{
    GstElement *pipeline;
    GstCaps* caps;
    GstStructure* str;
    pipeline = (GstElement *) data;
    caps = gst_pad_get_caps(pad);
    str = gst_caps_get_structure(caps, 0);
    printf("PAD:  %s\n", gst_structure_get_name(str));
    if(g_strrstr(gst_structure_get_name(str), "video"))
    {
        GstElement* decvd =
            gst_bin_get_by_name((GstBin*)(pipeline),
                    "videodec");
        GstPad* targetsink = gst_element_get_pad(decvd, "sink");
        gst_pad_link(pad, targetsink);
    }
    else
    {
        GstElement* decvd =
            gst_bin_get_by_name((GstBin*)(pipeline),
                    "audiodec");
        GstPad* targetsink = gst_element_get_pad(decvd, "sink");
        gst_pad_link(pad, targetsink);
    }
}

Regards,
Bhavya R




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Pipeline-for-on-disk-buffering-using-queue2-element-tp4672538p4672554.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list