[transmageddon] Various fixes for transcoding without audio or video



commit 0e4a5c850c9e8ffbc2e31d586e6f57e070ad8cd6
Author: Christian Fredrik Kalager Schaller <uraeus linuxrising org>
Date:   Fri Jun 27 10:59:10 2014 +0200

    Various fixes for transcoding without audio or video

 src/transcoder_engine.py |   53 +++++++++++++++++++--------------------------
 src/transmageddon.py     |   11 +++++++-
 2 files changed, 31 insertions(+), 33 deletions(-)
---
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index d0f6542..6d13e18 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -173,7 +173,6 @@ class Transcoder(GObject.GObject):
        self.pipeline.add(self.uridecoder)
        
        if self.streamdata['passcounter'] != int(0):
-           print(self.streamdata['passcounter'])
            self.videoencoder.link(self.multipassfakesink)
        else:
            self.transcodefileoutput = Gst.ElementFactory.make("filesink", \
@@ -291,6 +290,7 @@ class Transcoder(GObject.GObject):
            while x < len(self.audiodata):
                if self.probestreamid==self.audiodata[x]['streamid']:
                    if self.probestreamid not in self.usedstreamids:
+                       print(self.usedstreamids)
                        #FIXME - Need to clean usedstreamid list at some point
                        self.usedstreamids.append(self.probestreamid)
                        if self.audiodata[x]['outputaudiocaps'] != 'noaud':
@@ -342,39 +342,30 @@ class Transcoder(GObject.GObject):
        if (self.streamdata['container']==False):
            a =  origin.to_string()
            if a.startswith("audio/"): # this is for audio only files
-               sinkpad = self.encodebin.get_static_pad("audio_0")
-               src_pad.link(sinkpad)
+               src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
+
        else:
-           if self.videodata[0]['outputvideocaps'] == False:
-               c = origin.to_string()
-               if c.startswith("audio/"):
-                   sinkpad = self.encodebin.get_static_pad("audio_0")
-                   src_pad.link(sinkpad)
-           else:
-               # Checking if its a subtitle pad which we can't deal with
-               # currently.
-               # Making sure that when we remove video from a file we don't
-               # bother with the video pad.
-               c = origin.to_string()
-               if not (c.startswith("text/") or c.startswith("subpicture/")):
-                   if not (c.startswith("video/") and (self.videodata[0]['outputvideocaps'] == False)):
-                       if self.streamdata['passcounter'] == int(0):
-                           if not c.startswith("audio/"):
-                               self.sinkpad = self.encodebin.emit("request-pad", origin)
-               if c.startswith("audio/"):
+           c = origin.to_string()
+           if not (c.startswith("text/") or c.startswith("subpicture/")):
+               if not (c.startswith("video/") and (self.videodata[0]['outputvideocaps'] == False)):
                    if self.streamdata['passcounter'] == int(0):
-                       src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
-               elif ((c.startswith("video/") or c.startswith("image/")) and 
(self.videodata[0]['outputvideocaps'] != False)):
-                   if (self.videodata[0]['dopassthrough']==False):
-                       if (self.streamdata['passcounter'] != int(0) and self.streamdata['multipass'] != 
int(0)):
-                           videoencoderpad = self.videoencoder.get_static_pad("sink")
-                           src_pad.link(videoencoderpad)
-                       else:
-                           deinterlacerpad = self.deinterlacer.get_static_pad("sink")
-                           src_pad.link(deinterlacerpad)
-                           self.videoflipper.get_static_pad("src").link(self.sinkpad)
+                       if not c.startswith("audio/"):
+                           self.sinkpad = self.encodebin.emit("request-pad", origin)
+           if c.startswith("audio/"):
+               if self.streamdata['passcounter'] == int(0):
+                   src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
+           elif ((c.startswith("video/") or c.startswith("image/")) and 
(self.videodata[0]['outputvideocaps'] != False)):
+               if (self.videodata[0]['dopassthrough']==False):
+                   if (self.streamdata['passcounter'] != int(0) and self.streamdata['multipass'] != int(0)):
+                       videoencoderpad = self.videoencoder.get_static_pad("sink")
+                       src_pad.link(videoencoderpad)
                    else:
-                       src_pad.link(self.sinkpad)
+                       deinterlacerpad = self.deinterlacer.get_static_pad("sink")
+                       src_pad.link(deinterlacerpad)
+                       print("self.sinkpad is " + str(self.sinkpad))
+                       self.videoflipper.get_static_pad("src").link(self.sinkpad)
+               else:
+                   src_pad.link(self.sinkpad)
  
    def on_autoplug_continue(self, element, pad, caps):
        event=pad.get_sticky_event(Gst.EventType.STREAM_START, 0)
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 7fb757f..080c47a 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -849,7 +849,6 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.context.set_xid(self.get_window().get_xid())
        GstPbutils.install_plugins_async (missing, self.context, \
                        self.donemessage, "NULL")
-       # self.on_cancelbutton_clicked("clicked")
 
    def donemessage(self, donemessage, null):
        if donemessage == GstPbutils.InstallPluginsReturn.SUCCESS:
@@ -993,6 +992,10 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            else:
                self.streamdata['passcounter']=int(1)
                self.StatusBar.push(context_id, (_("Pass %(count)d Progress") % {'count': 
self.streamdata['passcounter']}))
+       print("on transcode")
+       print(self.audiodata)
+       print(self.videodata)
+       print(self.streamdata)
        if self.haveaudio:
            if "samplerate" in self.audiodata[0]:
                # self.check_for_elements()
@@ -1014,7 +1017,11 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.CodecBox.set_sensitive(True)
        self.presetchoice.set_sensitive(True)
        self.rotationchoice.set_sensitive(True)
-       self.presetchoice.set_active(0)
+       # self.presetchoice.set_active(0)
+       print("on cancel")
+       print(self.audiodata)
+       print(self.videodata)
+       print(self.streamdata)
        self.cancelbutton.set_sensitive(False)
        self.transcodebutton.set_sensitive(True)
        self._cancel_encoding = \


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