Beispiel #1
0
 def __discover(self,filepath):
     discoverer = Discoverer(1*gst.SECOND)
     info = discoverer.discover_uri('file://'+filepath)
     self.duration = info.get_duration() / 1000000000
     log.info("Duration ON_DISCOVERED: "+str(self.duration))        
     self.run_pipeline()
     return True
Beispiel #2
0
def get_media_uri_info(uri):

    from gst.pbutils import Discoverer
    from gst import SECOND as GST_SECOND
    from glib import GError
    #import gobject
    GST_DISCOVER_TIMEOUT = 5000000000L
    uri_discoverer = Discoverer(GST_DISCOVER_TIMEOUT)
    try:
        uri_info = uri_discoverer.discover_uri(uri)
    except GError as e:
        raise IOError(e)
    info = dict()

    # Duration in seconds
    info['duration'] = uri_info.get_duration() / GST_SECOND

    audio_streams = uri_info.get_audio_streams()
    info['streams'] = []
    for stream in audio_streams:
        stream_info = {'bitrate': stream.get_bitrate(),
                       'channels': stream.get_channels(),
                       'depth': stream.get_depth(),
                       'max_bitrate': stream.get_max_bitrate(),
                       'samplerate': stream.get_sample_rate()
                       }
        info['streams'].append(stream_info)

    return info
Beispiel #3
0
def get_media_uri_info(uri):

    from gst.pbutils import Discoverer
    from gst import SECOND as GST_SECOND
    from glib import GError
    #import gobject
    GST_DISCOVER_TIMEOUT = 5000000000L
    uri_discoverer = Discoverer(GST_DISCOVER_TIMEOUT)
    try:
        uri_info = uri_discoverer.discover_uri(uri)
    except GError as e:
        raise IOError(e)
    info = dict()

    # Duration in seconds
    info['duration'] = uri_info.get_duration() / GST_SECOND

    audio_streams = uri_info.get_audio_streams()
    info['streams'] = []
    for stream in audio_streams:
        stream_info = {
            'bitrate': stream.get_bitrate(),
            'channels': stream.get_channels(),
            'depth': stream.get_depth(),
            'max_bitrate': stream.get_max_bitrate(),
            'samplerate': stream.get_sample_rate()
        }
        info['streams'].append(stream_info)

    return info
Beispiel #4
0
 def __discover(self, filepath):
     discoverer = Discoverer(1 * gst.SECOND)
     info = discoverer.discover_uri('file://' + filepath)
     self.duration = info.get_duration() / 1000000000
     log.info("Duration ON_DISCOVERED: " + str(self.duration))
     self.run_pipeline()
     return True