gst_bin_get_by_name returns NULL

Michael Yarochkin michael.yarochkin at timetronics.be
Thu Oct 27 13:11:19 UTC 2016


Hello, Marcin


How you can see here

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html#gst-bin-get-by-name

It finding element by name.

But elements in you pipeline have no name.


If you will make elements like this

GstElement* element= gst_element_factory_make(videotestsrc , "videotestsrc");

you can find it latter by name

GstElement* sink = gst_bin_get_by_name(GST_BIN(pipeline), "videotestsrc");


Mikl

________________________________
From: gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> on behalf of Marcin Rosner <rsnr at tlen.pl>
Sent: Thursday, October 27, 2016 2:29:11 PM
To: gstreamer-devel at lists.freedesktop.org
Subject: gst_bin_get_by_name returns NULL

Hi all,

I am using gstreamer 1.2.4 and the function gst_bin_get_by_name always returns NULL when I pass a valid and working pipeline to it.
Here a code which I took from a gstreamer tutorial and modified a bit:

gst_init (NULL, NULL);

GstElement* pipeline = gst_parse_launch("videotestsrc ! xvimagesink", NULL);
GstElement* sink = gst_bin_get_by_name(GST_BIN(pipeline), "sink");
gst_element_set_state (pipeline, GST_STATE_PLAYING);

GMainLoop *loop;
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);

The code works and a test video is shown on a screen, but sink is NULL as also sinkpads and srcpads from the pipeline.
Why is that? How should I do it properly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161027/e98b2a3d/attachment.html>


More information about the gstreamer-devel mailing list