[gst-devel] Getting file information

Ruben Gonzalez Gonzalez rubenrua at uvigo.es
Mon Mar 2 16:34:34 CET 2009


On Lunes 02 Marzo 2009 13:09:42 Albert Costa wrote:
Yuo can use gst.extend.discoverer

A python example:



import sys

import gobject
gobject.threads_init()

import pygst
pygst.require('0.10')
import gst
from gst.extend.discoverer import Discoverer


#
# NECESITA RELOJ PARA FUNCIONAR
#
def on_discovered(discoverer, ismedia, infile):
    print '\non_discovered:', infile
    discoverer.print_info()


if __name__ == '__main__':
    if len(sys.argv) >= 2:
        print 'ANALIZO: %s ' % sys.argv[0]
        discoverer = Discoverer(sys.argv[1])
        discoverer.connect('discovered', on_discovered, sys.argv[1])

        # The MainLoop
        mainloop = gobject.MainLoop()
        gobject.idle_add(discoverer.discover)
        mainloop.run()

    else:
        print 'Usage: %s <input_file>' % sys.argv[0]





> Hi All,
> a simple question, yet I haven't found how to achieve this: how can I retrieve information on the file I'm playing in my main loop?
> I create my pipeline with just a filesrc, decodebin, ffmpegcolorspace and directdrawsink. I do connect a callback on the decodebin 'new-decoded-pad' signal, and that's all fine, I can play my video file.
> But how can I retrieve the (width, height, framerate) inside my main loop? If I check the structure of the caps in the new-decoded-pad callback, there is no such properties...
> Regards,
> Al
> 
> 
>       




--
Un saludo
Ruben Gonzalez Gonzalez
rubenrua at uvigo.es




More information about the gstreamer-devel mailing list