newby help

gotsring gotsring at
Tue Mar 30 14:23:09 UTC 2021

In this case, I don't think you need to iterate over all the elements
manually. You're just trying to grab references to the xvimagesink, correct?
If so, use gst_bin_get_by_name(), which returns a reference to the element
in question (or NULL). You can name your elements in gst_parse_launch to
make them easier to find.

Something like:
// Name the xvimagesinks in the parse string (just add "name=custom_name")
char cmdline[1024];
   cmdline, 1024,
   "v4l2src device=%s ! tee name=t "
   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
   "videoconvert ! xvimagesink name=sink1 force-aspect-ratio=false "
   "t. ! queue ! videoscale ! video/x-raw,width=768,height=576 ! "
   "videoconvert ! xvimagesink name=sink2 force-aspect-ratio=false",
pipeline = gst_parse_launch(cmdline, NULL);

// Get references to the xvimagesink elements, we called them sink1 and
GstElement* sink1 = gst_bin_get_by_name(GST_BIN(pipeline), "sink1");
GstElement* sink2 = gst_bin_get_by_name(GST_BIN(pipeline), "sink2");

Sent from:

More information about the gstreamer-devel mailing list