[transmageddon] More work on re-enabling presets, this update makes sure preset setting are actually applied. Code n



commit 0ea66093113bb8e4b17c3f26b17b7856234ffaaf
Author: Christian Fredrik Kalager Schaller <uraeus linuxrisin org>
Date:   Sat Aug 4 19:24:01 2012 +0200

    More work on re-enabling presets, this update makes sure preset setting are actually applied.
    Code not very sexy atm and lots of debug prints

 src/transcoder_engine.py |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index bdfb077..82356a7 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -91,6 +91,10 @@ class Transcoder(GObject.GObject):
            self.cachefile = (str (glib.get_user_cache_dir()) + "/" + \
                    "multipass-cache-file" + self.timestamp + ".log")
 
+       # gather preset data if relevant
+       if self.preset != "nopreset":
+           self.provide_presets()
+ 
        # Create transcoding pipeline
        self.pipeline = Gst.Pipeline()
        self.pipeline.set_state(Gst.State.PAUSED)
@@ -210,12 +214,11 @@ class Transcoder(GObject.GObject):
 
    # Gather preset values and create preset elements
    def provide_presets(self):
+       print "LOADING PRESETS IN TRANSCODER ENGINE"
        devices = presets.get()
        device = devices[self.preset]
        preset = device.presets["Normal"]
-       # set audio and video caps from preset file
-       self.audiocaps=Gst.caps_from_string(preset.acodec.name)
-       self.videocaps=Gst.caps_from_string(preset.vcodec.name)
+
        # Check for black border boolean
        border = preset.vcodec.border
        if border == "Y":
@@ -236,7 +239,10 @@ class Transcoder(GObject.GObject):
        wmin, wmax  =  preset.vcodec.width
        hmin, hmax = preset.vcodec.height
        width, height = self.owidth, self.oheight
-
+       print "wmax is " +str(wmax)
+       print "hmax is " +str(hmax)
+       print "width is " +str(width)
+       print "height is " +str(height)
        # Get Display aspect ratio
        pixelaspectratio = preset.vcodec.aspectratio
 
@@ -276,9 +282,19 @@ class Transcoder(GObject.GObject):
        else:
            num = self.fratenum
            denom = self.frateden
+       
+       print "audiocaps " +self.audiocaps.to_string()
+       print "videocaps " +self.videocaps.to_string()
+       # set audio and video caps from preset file
+       self.audiocaps=Gst.caps_from_string(preset.acodec.name+","+"channels="+str(self.channels))
+       self.videocaps=Gst.caps_from_string(preset.vcodec.name+","+"height="+str(height)+","+"width="+str(width)+","+"framerate="+str(num)+"/"+str(denom))
+       # self.videocaps.set_value("pixelaspectratio", pixelaspectratio) this doesn't work due to pixelaspectratio being a fraction, 
+       # needs further investigation
+       print "audiocaps " +str(self.audiocaps.to_string())
+       print "videocaps " + str(self.videocaps.to_string())
 
        # print "final height " + str(height) + " final width " + str(width)
-       return height, width, num, denom, pixelaspectratio
+       # return height, width, num, denom, pixelaspectratio
 
    def noMorePads(self, dbin):
        if (self.multipass == False) or (self.passcounter == int(0)):



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