[transmageddon] Commit fixes and improvements towards making tag writing work, not done



commit aa50227b49882cf33fc2cf16b55bcfdbd28b660b
Author: Christian Fredrik Kalager Schaller <uraeus linuxrisin org>
Date:   Wed Sep 12 00:03:37 2012 +0200

    Commit fixes and improvements towards making tag writing work, not done

 profiles/ipod.xml        |    2 +-
 src/codecfinder.py       |    1 -
 src/transcoder_engine.py |   34 +++++++++++++++-------------------
 src/transmageddon.py     |    5 +++--
 4 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/profiles/ipod.xml b/profiles/ipod.xml
index 7423628..dd969f3 100644
--- a/profiles/ipod.xml
+++ b/profiles/ipod.xml
@@ -21,7 +21,7 @@
         </audio>
         <video>
             <name>video/x-h264, profile=constrained-baseline</name>
-            <passes>0</passes>
+            <passes>2</passes>
             <pixelaspectratio>0/0</pixelaspectratio>
             <width>320, 640</width>
             <height>240, 480</height>
diff --git a/src/codecfinder.py b/src/codecfinder.py
index a85aa2a..44e6fde 100644
--- a/src/codecfinder.py
+++ b/src/codecfinder.py
@@ -254,5 +254,4 @@ def get_video_encoder_element(videoencodercaps):
                        original = Gst.PluginFeature.get_rank(encoderfeature[elementname])
                        if mostrecent >= original:
                            elementname = element
-   print "elementname is " +str(elementname)
    return elementname
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index 926c301..0928989 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -174,10 +174,9 @@ class Transcoder(GObject.GObject):
 
        else:
            self.encodebin = Gst.ElementFactory.make ("encodebin", None)
+           self.encodebin.connect("element-added", self.OnEncodebinElementAdd)
            self.encodebin.set_property("profile", self.encodebinprofile)
            self.encodebin.set_property("avoid-reencoding", True)
-           if (self.multipass != 0) and (self.passcounter == int(0)):
-               self.encodebin.connect("element-added", self.SetCacheFileProperty)
            self.pipeline.add(self.encodebin)
            self.encodebin.set_state(Gst.State.PAUSED)
        
@@ -389,7 +388,6 @@ class Transcoder(GObject.GObject):
                            videoencoderpad = self.videoencoder.get_static_pad("sink")
                            src_pad.link(videoencoderpad)
                        else:
-                       # port fix- should be self.deinterlacer
                        # print "self.colorspaceconverter before use " + str(self.colorspaceconverter)
                            deinterlacerpad = self.deinterlacer.get_static_pad("sink")
                            src_pad.link(deinterlacerpad)
@@ -397,24 +395,22 @@ class Transcoder(GObject.GObject):
                    else:
                            src_pad.link(sinkpad)
 
-   def SetCacheFileProperty(self, encodebin, element):
+   def OnEncodebinElementAdd(self, encodebin, element):
        factory=element.get_factory()
+       name=element.get_name()
        if factory != None:
-           if Gst.ElementFactory.list_is_type(factory, 2814749767106562):
-               print "we have a winner"
-               element.set_property("multipass-cache-file", self.cachefile)
-
-       # Grab element from encodebin which supports tagsetter interface and set app name
-       # to Transmageddon
-       #GstTagSetterType = GObject.type_from_name("GstTagSetter")
-       #tag_setting_element=self.encodebin.get_by_interface(GstTagSetterType)
-       #if tag_setting_element != None:
-       #    taglist=Gst.TagList.new_empty()
-       #    taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_ENCODER, "Transmageddon encoder") 
-           # the tag above should probably be set to string combining audio+video
-           # encoder implementations
-           #taglist[Gst.TAG_APPLICATION_NAME] = "Transmageddon transcoder"
-           #tag_setting_element.merge_tags(taglist, Gst.TAG_MERGE_APPEND)
+           # set multipass cache file on video encoder element
+           if (self.multipass != 0) and (self.passcounter == int(0)):
+               if Gst.ElementFactory.list_is_type(factory, 2814749767106562): # this is the factory code for Video encoders
+                   element.set_property("multipass-cache-file", self.cachefile)
+           
+           # Set Transmageddon as Application name using Tagsetter interface
+           tagyes = factory.has_interface("GstTagSetter")
+           # print str(name) + " got GstTagSetter Interface " +str(tagyes)
+           if tagyes ==True:
+               taglist=Gst.TagList.new_empty()
+               # Gst.TagList.add_value(taglist, Gst.TAG_MERGE_APPEND, Gst.TAG_APPLICATION_NAME], "Transmageddon transcoder"
+               # tag_setting_element.merge_tags(taglist, Gst.TAG_MERGE_APPEND)
 
    def Pipeline (self, state):
        if state == ("playing"):
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 2bf6eb0..aad6790 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -523,13 +523,14 @@ class TransmageddonUI:
                                  # this toggle to avoid errors when cleaning
                                  # the codec comboboxes
        else:
-           self.StatusBar.push(context_id, (_("Pass %(count)d Complete") % \
-                   {'count': self.passcounter}))
            self.start_time = False
            if self.passcounter == (self.multipass-1):
+               self.StatusBar.push(context_id, (_("Encoding file")))
                self.passcounter = int(0)
                self._start_transcoding()
            else:
+               self.StatusBar.push(context_id, (_("Pass %(count)d Complete. ") % \
+                   {'count': self.passcounter}))
                self.passcounter = self.passcounter+1
                self._start_transcoding()
 



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