custom pipeline for android application

Vito De Tullio vito.detullio at gmail.com
Wed Dec 2 03:06:22 PST 2015


Hi.

I'm trying to set up an Android application based on gstreamer. I need to
set up a custom pipeline because I want to intercept some metadata embedded
in the video stream. I'm struggling with the basics of gstreamer.

ATM I am starting from a slightly modified version of
http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/android-tutorial-4/jni/tutorial-4.c

I have created a new pipeline, created some elements to analize an HLS
stream, send it to the video and audio parsers and demuxers.

If there is no audio, I can see the video. 
If I just add (not link) an "autoaudiosink" element to the pipeline, there
is no audio and the video is not visible.


this is the code:

    data->pipeline = gst_pipeline_new("somestring");

    GstElement* souphttpsrc = gst_element_factory_make("souphttpsrc", NULL);
    g_object_set(souphttpsrc, "location",
"http://my/custom/hls/playlist.m3u8", NULL);
    gst_bin_add(GST_BIN(data->pipeline), souphttpsrc);

    GstElement* hlsdemux = gst_element_factory_make("hlsdemux", NULL);
    gst_bin_add(GST_BIN(data->pipeline), hlsdemux);

    GstElement* tsdemux = gst_element_factory_make("tsdemux", NULL);
    gst_bin_add(GST_BIN(data->pipeline), tsdemux);

    GstElement* queue1 = gst_element_factory_make("queue", NULL);
    gst_bin_add(GST_BIN(data->pipeline), queue1);
    GstElement* h264parse = gst_element_factory_make("h264parse", NULL);
    gst_bin_add(GST_BIN(data->pipeline), h264parse);
    GstElement* avdec_h264 = gst_element_factory_make("avdec_h264", NULL);
    gst_bin_add(GST_BIN(data->pipeline), avdec_h264);
    GstElement* autovideosink = gst_element_factory_make("autovideosink", NULL);
    gst_bin_add(GST_BIN(data->pipeline), autovideosink);

    GstElement* queue2 = gst_element_factory_make("queue", NULL);
    gst_bin_add(GST_BIN(data->pipeline), queue2);
    GstElement* aacparse = gst_element_factory_make("aacparse", NULL);
    gst_bin_add(GST_BIN(data->pipeline), aacparse);
    GstElement* avdec_aac = gst_element_factory_make("avdec_aac", NULL);
    gst_bin_add(GST_BIN(data->pipeline), avdec_aac);
    //GstElement* autoaudiosink = gst_element_factory_make("autoaudiosink",
NULL);
    //gst_bin_add(GST_BIN(data->pipeline), autoaudiosink);

    gst_element_link(souphttpsrc, hlsdemux);
    g_signal_connect(hlsdemux, "pad-added", G_CALLBACK(on_pad_added), tsdemux);
    g_signal_connect(tsdemux, "pad-added", G_CALLBACK(on_pad_added_VIDEO),
queue1);
    g_signal_connect(tsdemux, "pad-added", G_CALLBACK(on_pad_added_AUDIO),
queue2);
    gst_element_link_many(queue1, h264parse, avdec_h264, autovideosink, NULL);
    gst_element_link_many(queue2, aacparse, avdec_aac/*, autoaudiosink*/, NULL);

if I decomment the autoaudiosink, everything is frozen.

What I'm doing wrong?



More information about the gstreamer-devel mailing list