newby help

James jam at tigger.ws
Tue Mar 30 23:20:42 UTC 2021



> On 30 Mar 2021, at 10:23 pm, gotsring <gotsring at live.com> wrote:
> 
> 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];
> snprintf(
>   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",
>   argv[1]
> );
> pipeline = gst_parse_launch(cmdline, NULL);
> 
> // Get references to the xvimagesink elements, we called them sink1 and
> sink2
> GstElement* sink1 = gst_bin_get_by_name(GST_BIN(pipeline), "sink1");
> GstElement* sink2 = gst_bin_get_by_name(GST_BIN(pipeline), "sink2");

Thank you lots

James


More information about the gstreamer-devel mailing list