2015-02-05 39 views
0

我正在從python移植到python GStreamer 1.0示例(play-master.py - noraisin.net),並且不明白如何獲取指向管道的指針。在python綁定中,它似乎被抽象出來,所以元素和管道可以互換使用。如何從gst_parse_launch返回從GstElement獲取GstPipeline的指針?

... 

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); 

... 

所以,gst_pipeline_use_clock需要一個指向一個GstPipeline結構,但gst_parse_launch指針返回到GstElement,如果我理解正確的話,有一個指針指向管道。我如何訪問它?

下面是相同的代碼在Python:

Gst.init() 

pipeline = Gst.parse_launch('playbin') 

pipeline.set_start_time(Gst.CLOCK_TIME_NONE) 

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

回答

2

您纏繞GstElement*GST_PIPELINE宏,例如:

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

類似宏存在轉換爲其他元素類型。