[gst-devel] getting display dimensions for a theora video with pygst
Jason Gerard DeRose
jderose at jasonderose.org
Tue Nov 7 18:23:49 CET 2006
One way to do this is with a handler for the 'notify::caps' signal
emitted by the 'src' pad on your theoradec element, as this excerpt shows:
def _on_notify_caps(self, pad, args):
caps = pad.get_negotiated_caps()
if caps == None:
width = caps['width']
height = caps['height']
frac = caps['pixel-aspect-ratio']
aspect = float(width) / height * frac.num / frac.denom
If you are writing a player, I highly recommend using the high level
'playbin' element as your backend. You can get the above information (I
think) from the 'stream-info' property on your playbin. However, your
playbin must be at gst.STATE_PAUSED or above to get anything useful.
Also, depending upon what elements your playbin has loaded, the state
changes might be asynchronous, so you need to do something like this:
if gst.STATE_CHANGE_ASYNC == playbin.set_state(gst.STATE_PAUSED):
playbin.get_state(1000) # Wait for up to 1 second
info = playbin.get_property('stream-info')
Erik Blankinship wrote:
> Using pygst, I have loaded in an ogg theora video and would like to know the video's dimensions or at least the video's aspect ratio.
> I do not know how to do this using pygst.
> This sample code from the manual seems to describe what I want to do, but I am not sure how to make calls like these work with pygst:
> If anyone can help out, it would be much appreciated.
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
More information about the gstreamer-devel