Udpsrc to autovideosink
Ian Davidson
id012c3076 at blueyonder.co.uk
Wed Sep 13 08:12:32 UTC 2017
Hi Christian,
Some elements have Dynamic Source Pads - so they do not have the source
pad until they have examined what is coming in to them. Such elements
cannot be linked until the element has created the pad.
You need to examine the documentation for each element to see whether
the pads are static or dynamic. If it is a dynamic pad, you need to
watch for messages from that element - and then dynamically link when
the pad has been created.
gst-launch is clever enough to know that it has to do that!
On 13/09/2017 08:49, chrplus3 wrote:
> I've just seen, that raw text is not working in this mailing list.
>
> Here is the code again:
> Working:
> gst-launch-1.0 -v \
> udpsrc port=5016 caps="application/x-rtp,encoding-name=JPEG,payload=26" ! \
> rtpjpegdepay ! jpegparse ! queue max-size-time=0 max-size-buffers=0 !
> jpegdec ! autovideosink
>
> Not working (because element link failed):
> ...
> GstElement *pipeline, *source, *depay, *parse, *queue, *decode, *sink;
> GstCaps *caps;
> gst_init(&argc, &argv);
> pipeline = gst_pipeline_new("pipe");
> source = gst_element_factory_make("udpsrc", "source");
> depay = gst_element_factory_make("rtpjpegdepay", "depay");
> parse = gst_element_factory_make("jpegparse", "parse");
> queue = gst_element_factory_make("queue", "queue");
> decode = gst_element_factory_make("jpegdec", "decode");
> sink = gst_element_factory_make("autovideosink", "sink");
> caps = gst_caps_new_simple(
> "video/x-rtp",
> "encoding-name", G_TYPE_STRING, "JPEG",
> "payload", G_TYPE_INT, 26, NULL);
> g_object_set(G_OBJECT(source),
> "port", 5016,
> "caps", caps, NULL);
> g_object_set(G_OBJECT(queue),
> "max-size-time", 0,
> "max-size-buffers", 0, NULL);
> gst_bin_add_many(GST_BIN(pipeline), source, depay, parse, queue, decode,
> sink, NULL);
> if(!gst_element_link_many(source, depay, parse, queue, decode, sink, NULL))
> {
> g_printerr("Elements could not be linked.\n");
> gst_object_unref(pipeline);
> return -1;
> }
> gst_element_set_state(pipeline, GST_STATE_PLAYING);
> ...
>
> --
Ian Davidson
More information about the gstreamer-devel
mailing list