Getting size size with playbin2

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Jun 11 03:05:03 PDT 2013


On Tue, 2013-06-11 at 09:20 +0200, Sebastian Dröge wrote:

> On Di, 2013-06-11 at 10:11 +0300, Nikos Chantziaras wrote:
> > There doesn't seem to be a direct way to get the video size (its 
> > resolution, not byte size) in GStreamer.  I'm not sure how to do this. 
> > It seems I have to watch for some signal from the pipeline (I'm using 
> > playbin2) which is emitted when that information becomes available.  But 
> > which signal?  And once it's emitted, how do I extract that information?
> > 
> > It all seems awfully round-about for such a simple operation, and it's 
> > not clear at all how to proceed with this.  Any hints?
> > 
> > I'm on GStreamer 0.10.36.
> 
> You could connect to the "notify::caps" signal of the sinkpad of the
> video sink, then get the caps (gst_pad_get_negotiated_caps()) and then
> use the GstCaps and GstStructure API to extract width, height and
> pixel-aspect-ratio.

You can also use the get-video-pad action signal on playbin(2) after it
has reached paused state (ASYNC_DONE message), and then get the
negotiated/current caps from that pad.

Cheers
 -Tim



More information about the gstreamer-devel mailing list