svenyonson
svenyonson

Reputation: 1909

How to obtain pointer to GstPipeline from GstElement returned from gst_parse_launch?

I am porting a python GStreamer 1.0 example (play-master.py - noraisin.net), from python to C, and do not understand how to get a pointer to the pipeline. In the python bindings, it seems to be abstracted so the element and pipeline are used interchangeably.

...

GstElement* element = gst_parse_launch("playbin", &error);

gst_element_set_start_time(element, GST_CLOCK_TIME_NONE);

GstClock* clock = gst_element_get_clock(element);
gst_pipeline_use_clock( ???, clock);

...

So, gst_pipeline_use_clock needs a pointer to a GstPipeline struct, but gst_parse_launch returns a pointer to a GstElement which, if I understand correctly, has a pointer to the pipeline. How do I access it?

Here is same code in python:

Gst.init()

pipeline = Gst.parse_launch('playbin')

pipeline.set_start_time(Gst.CLOCK_TIME_NONE)

clock = pipeline.get_clock()
pipeline.use_clock(clock)

Upvotes: 1

Views: 1999

Answers (1)

DuBistKomisch
DuBistKomisch

Reputation: 1016

You wrap the GstElement* with the GST_PIPELINE macro, for example:

GstPipeline *pipeline = GST_PIPELINE(gst_parse_launch("playbin", &error));

Similar macros exist to convert to other element types.

Upvotes: 4

Related Questions