[transmageddon] Add some inital code to handle missing decoders, not fully working yet



commit bb6eff728559c7416f7f08c229fcc3ec0c71bc78
Author: Christian Fredrik Kalager Schaller <uraeus linuxrisin org>
Date:   Wed Sep 26 17:02:21 2012 +0200

    Add some inital code to handle missing decoders, not fully working yet

 src/transcoder_engine.py |   12 +++++++++++-
 src/transmageddon.py     |   16 ++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index 0901a0e..b680803 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -32,6 +32,7 @@ class Transcoder(GObject.GObject):
    __gsignals__ = {
             'ready-for-querying' : (GObject.SignalFlags.RUN_LAST, None, []),
             'got-eos' : (GObject.SignalFlags.RUN_LAST, None, []),
+            'missing-plugin' : (GObject.SignalFlags.RUN_LAST, None, []),
             'got-error' : (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,))
                     }
 
@@ -77,6 +78,7 @@ class Transcoder(GObject.GObject):
        self.timestamp = TIMESTAMP
        self.rotationvalue = int(ROTATIONVALUE)
        self.vbox = {}
+       self.missingplugin= False
           
 
        # switching width and height around for rotationchoices where it makes sense
@@ -328,7 +330,7 @@ class Transcoder(GObject.GObject):
 
    def on_message(self, bus, message):
        mtype = message.type
-       # print mtype
+       # print(mtype)
        if mtype == Gst.MessageType.ERROR:
            print("we got an error, life is shit")
            err, debug = message.parse_error()
@@ -337,6 +339,14 @@ class Transcoder(GObject.GObject):
            Gst.debug_bin_to_dot_file (self.pipeline, \
            Gst.DebugGraphDetails.ALL, 'transmageddon-debug-graph')
            #self.emit('got-error', err.message)
+       elif mtype == Gst.MessageType.ELEMENT:
+           if GstPbutils.is_missing_plugin_message(message):
+               self.missingplugin=message
+               # output=GstPbutils.missing_plugin_message_get_description(message)
+               # print(output)
+               # GstPbutils.missing_plugin_message_get_installer_detail(message)
+               self.emit('missing-plugin')
+           
        elif mtype == Gst.MessageType.ASYNC_DONE:
            self.emit('ready-for-querying')
        elif mtype == Gst.MessageType.EOS:
diff --git a/src/transmageddon.py b/src/transmageddon.py
index d07b63d..926f26a 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -265,7 +265,6 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.builder.add_from_file(uifile)
 
        #Define functionality of our button and main window
-       # self.TopWindow = self.builder.get_object("TopWindow")
        self.box = self.builder.get_object("window")
        self.FileChooser = self.builder.get_object("FileChooser")
        self.videoinformation = self.builder.get_object("videoinformation")
@@ -290,7 +289,6 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.audiorows[0].connect("changed", self.on_audiocodec_changed)
        self.videorows[0].connect("changed", self.on_videocodec_changed)
        self.rotationchoice.connect("changed", self.on_rotationchoice_changed)
-       # self.TopWindow.connect("destroy", Gtk.main_quit)
 
 
        self.window=self.builder.get_object("window")
@@ -806,8 +804,19 @@ class TransmageddonUI(Gtk.ApplicationWindow):
 
        self._transcoder.connect("ready-for-querying", self.ProgressBarUpdate)
        self._transcoder.connect("got-eos", self._on_eos)
+       self._transcoder.connect("missing-plugin", self.install_plugin)
        return True
 
+   def install_plugin(self, signal):
+       plugin=GstPbutils.missing_plugin_message_get_installer_detail(self._transcoder.missingplugin)
+       missing = []
+       missing.append(plugin)
+       self.context = GstPbutils.InstallPluginsContext ()
+       self.context.set_xid(self.get_window().get_xid())
+       GstPbutils.install_plugins_async (missing, self.context, \
+                       self.donemessage, "NULL")
+       self.on_cancelbutton_clicked("click")
+
    def donemessage(self, donemessage, null):
        if donemessage == GstPbutils.InstallPluginsReturn.SUCCESS:
            if Gst.update_registry():
@@ -886,8 +895,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            for x in fail_info:
                missing.append(GstPbutils.missing_encoder_installer_detail_new(x))
            context = GstPbutils.InstallPluginsContext ()
-           context.set_xid(self.TopWindow.get_window().get_xid())
-           strmissing = str(missing)
+           context.set_xid(self.window.get_xid())
            GstPbutils.install_plugins_async (missing, context, \
                        self.donemessage, "NULL")
 



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