help..gstbin pad connect...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

help..gstbin pad connect...

Cho Yool Je
Hello.
I created ghostpad for bin..and connected other elements.
but I met the error...

Error: Internal data flow error. (gstbasesrc.c(2234): gst_base_src_loop (): /GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0:
streaming task paused, reason not-linked (-1))

My code is below...

static GstElement *make_encoder (void)
{
        GstElement *result;
        GstElement *aconv;
        GstElement *codec;
        GstElement *mux;
        GstPad *pad;
        GstCaps *caps;

        /* create result bin */
        result = gst_bin_new("encoder");
        g_assert(result);

        aconv = gst_element_factory_make("audioconvert", NULL);
        g_assert(aconv);

        /* create elements */
        codec = gst_element_factory_make("vorbisenc", NULL);
        g_assert(codec);

        mux = gst_element_factory_make("oggmux", NULL);
        g_assert(mux);

        /* add elements to result bin */
        gst_bin_add(GST_BIN(result), aconv);
        gst_bin_add(GST_BIN(result), codec);
        gst_bin_add(GST_BIN(result), mux);

        /* link elements */
        gst_element_link_pads(aconv, "src", codec, "sink");
        gst_element_link_pads(codec, "src", mux, "sink");

        /* ghost src and sink pads */
        pad = gst_element_get_static_pad(aconv, "sink");
        gst_element_add_pad(result, gst_ghost_pad_new("sink", pad));
        gst_object_unref(pad);

        pad = gst_element_get_static_pad(mux, "src");
        gst_element_add_pad(result, gst_ghost_pad_new("src", pad));
        gst_object_unref(pad);

        return result;
}

static GstElement *make_pipeline(void)
{
        GstElement *result;
        GstElement *audiosrc;
        GstElement *audiocaps;
        GstCaps *caps;
        GstElement *aconv;
        GstElement *queue;
        GstElement *sink;
        GstElement *encoder;

        result = gst_pipeline_new(NULL);
        g_assert(result);

        /* create various elements */
        audiosrc = gst_element_factory_make("audiotestsrc", NULL);
        g_object_set(audiosrc, "num-buffers", 1000, NULL);
        g_assert(audiosrc);

        audiocaps = gst_element_factory_make("capsfilter", NULL);
        g_assert(audiocaps);

        caps = gst_caps_from_string
                ("audio/x-raw-int,signed=true,width=16,depth=16,rate=48000,channels=1");
        g_object_set(audiocaps, "caps", caps, NULL);
        gst_caps_unref(caps);


        queue = gst_element_factory_make("queue", NULL);
        g_assert(queue);

        sink = gst_element_factory_make("filesink", NULL);
        g_object_set(sink, "location", "audio.ogg", NULL);
        g_assert(sink);

        /* add elements */
        gst_bin_add(GST_BIN(result), audiosrc);
        gst_bin_add(GST_BIN(result), audiocaps);
        gst_bin_add(GST_BIN(result), queue);
        gst_bin_add(GST_BIN(result), sink);

        encoder = make_encoder();
        gst_bin_add(GST_BIN(result), encoder);

        /* link elements */
        gst_element_link_pads(audiosrc, "src", audiocaps, "sink");
        gst_element_link_pads(audiocaps, "src", queue, "sink");
        gst_element_link_pads(queue, "src", encoder, "sink");
        gst_element_link_pads(encoder, "src", sink, "sink");

        gst_element_set_state(result, GST_STATE_READY);

        return result;
}

Please explain the incorrect point..
Thank you



------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel