[transmageddon: 2/5] transmageddon: Prevent exceptions when there is no video



commit ec3affce831270087f127daa6068f3e6fe253888
Author: Thiago Santos <thiago sousa santos collabora co uk>
Date:   Sat Jul 30 14:55:40 2011 -0300

    transmageddon: Prevent exceptions when there is no video
    
    Only put video info on the screen if there is a video stream,
    otherwise we get exceptions

 src/transmageddon.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/transmageddon.py b/src/transmageddon.py
index a9bccac..cb10257 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -537,6 +537,8 @@ class TransmageddonUI:
        samplerate=[]
        inputaudiocaps=[]
        markupaudioinfo=[]
+       videowidth = None
+       videoheight = None
 
        for i in info.get_stream_list():
            if isinstance(i, gst.pbutils.DiscovererAudioInfo):
@@ -600,9 +602,10 @@ class TransmageddonUI:
            self.audiocodec.set_markup(''.join(('<small>','Audio codec: ', \
                        str(gst.pbutils.get_codec_description(inputaudiocaps[audiostreamcounter])), \
                        '</small>')))
-       self.videoinformation.set_markup(''.join(('<small>', 'Video width&#47;height: ', str(videowidth),
+       if videowidth and videoheight:
+           self.videoinformation.set_markup(''.join(('<small>', 'Video width&#47;height: ', str(videowidth),
                                             "x", str(videoheight), '</small>')))
-       self.videocodec.set_markup(''.join(('<small>', 'Video codec: ',
+           self.videocodec.set_markup(''.join(('<small>', 'Video codec: ',
                                        str(gst.pbutils.get_codec_description(self.inputvideocaps)),
                                       '</small>')))
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]