dont try to detect anything if files is empty
This commit is contained in:
parent
9f489d306b
commit
ca83c75a9e
1 changed files with 24 additions and 24 deletions
|
@ -35,34 +35,34 @@ class Info:
|
|||
self.dbin = self.pipeline.get_by_name('dbin')
|
||||
|
||||
self.metadata['size'] = os.stat(videofile).st_size
|
||||
if self.metadata['size'] != 0:
|
||||
self.bus = self.pipeline.get_bus()
|
||||
self.dbin.connect('new-decoded-pad', self.demux_pad_added)
|
||||
|
||||
self.bus = self.pipeline.get_bus()
|
||||
self.dbin.connect('new-decoded-pad', self.demux_pad_added)
|
||||
self.bus.add_signal_watch()
|
||||
self.watch_id = self.bus.connect("message", self.onBusMessage)
|
||||
|
||||
self.bus.add_signal_watch()
|
||||
self.watch_id = self.bus.connect("message", self.onBusMessage)
|
||||
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||
self.pipeline.get_state()
|
||||
|
||||
self.pipeline.set_state(gst.STATE_PAUSED)
|
||||
self.pipeline.get_state()
|
||||
#duration
|
||||
pads = None
|
||||
if self.video:
|
||||
pads = self.video.sink_pads()
|
||||
elif self.audio:
|
||||
pads = self.audio.sink_pads()
|
||||
if pads:
|
||||
q = gst.query_new_duration(gst.FORMAT_TIME)
|
||||
for pad in pads:
|
||||
if pad.get_peer() and pad.get_peer().query(q):
|
||||
format, self.duration = q.parse_duration()
|
||||
self.metadata["duration"] = self.duration/gst.MSECOND
|
||||
|
||||
#duration
|
||||
pads = None
|
||||
if self.video:
|
||||
pads = self.video.sink_pads()
|
||||
elif self.audio:
|
||||
pads = self.audio.sink_pads()
|
||||
if pads:
|
||||
q = gst.query_new_duration(gst.FORMAT_TIME)
|
||||
for pad in pads:
|
||||
if pad.get_peer() and pad.get_peer().query(q):
|
||||
format, self.duration = q.parse_duration()
|
||||
self.metadata["duration"] = self.duration/gst.MSECOND
|
||||
|
||||
self.mainloop.run()
|
||||
if 'video-codec' in self.tags:
|
||||
self.metadata['video-codec'] = codec_list.get(self.tags['video-codec'], self.tags['video-codec'])
|
||||
if 'audio-codec' in self.tags:
|
||||
self.metadata['audio-codec'] = codec_list.get(self.tags['audio-codec'], self.tags['audio-codec'])
|
||||
self.mainloop.run()
|
||||
if 'video-codec' in self.tags:
|
||||
self.metadata['video-codec'] = codec_list.get(self.tags['video-codec'], self.tags['video-codec'])
|
||||
if 'audio-codec' in self.tags:
|
||||
self.metadata['audio-codec'] = codec_list.get(self.tags['audio-codec'], self.tags['audio-codec'])
|
||||
|
||||
def get_audio_info_cb(self, sink, buffer, pad):
|
||||
caps = sink.sink_pads().next().get_negotiated_caps()
|
||||
|
|
Loading…
Reference in a new issue