[transmageddon] Update with patches from Luis and my own hacking



commit 68a1f2c401b2603d1c86430d011c82cd2204430a
Author: Christian Fredrik Kalager Schaller <christian schaller collabora co uk>
Date:   Wed Apr 13 23:35:14 2011 +0100

    Update with patches from Luis and my own hacking

 presets/GstLameMP3Enc.prs |    2 -
 src/Makefile.am           |    1 -
 src/codecfinder.py        |  130 ++++++++++++++------
 src/discoverer.py         |   50 +++++---
 src/transcoder_engine.py  |  146 +++++++++++++++-------
 src/transmageddon.py      |  298 ++++++++++++++++++++++++++++-----------------
 src/which.py              |    2 -
 7 files changed, 405 insertions(+), 224 deletions(-)
---
diff --git a/presets/GstLameMP3Enc.prs b/presets/GstLameMP3Enc.prs
index 5c7ef24..6a3eac9 100644
--- a/presets/GstLameMP3Enc.prs
+++ b/presets/GstLameMP3Enc.prs
@@ -34,5 +34,3 @@ _meta/comment=High quality VBR encoding
 target=0
 encoding-engine-quality=2
 quality=1
-
-
diff --git a/src/Makefile.am b/src/Makefile.am
index bd1802f..5d9f50d 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,6 @@ transmageddondir = $(datadir)/transmageddon
 transmageddon_PYTHON = \
 	transmageddon.py \
 	transcoder_engine.py \
-        transcoder_engine_preset.py \
 	transmageddon.ui \
 	codecfinder.py \
 	presets.py \
diff --git a/src/codecfinder.py b/src/codecfinder.py
index 4571d2e..c156c32 100644
--- a/src/codecfinder.py
+++ b/src/codecfinder.py
@@ -19,8 +19,9 @@
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# THIS CODE CAN PROBABLY BE REDUCED A LOT IN SIZE SINCE ITS 3 BIG FUNCTIONS DOING ESSENTIALLY THE SAME,
-# ESPECIALLY NOW THAT THE ONLY SPECIAL CASING REMAINING IS FFMUXERS AND WAVPACK
+# THIS CODE CAN PROBABLY BE REDUCED A LOT IN SIZE SINCE ITS 3 BIG FUNCTIONS
+# DOING ESSENTIALLY THE SAME, ESPECIALLY NOW THAT THE ONLY SPECIAL CASING
+# REMAINING IS FFMUXERS AND WAVPACK
 
 
 import pygst
@@ -33,29 +34,71 @@ def list_compat(a1, b1):
            return False
    return True
 
-containermap = { 'Ogg' : "application/ogg",'Matroska' : "video/x-matroska", 'MXF' : "application/mxf", 'AVI' : "video/x-msvideo", 
-                        'Quicktime' : "video/quicktime,variant=apple", 'MPEG4' : "video/quicktime,variant=iso", 
-                        'MPEG PS' : "video/mpeg,mpegversion=2,systemstream=true", 
-                        'MPEG TS' : "video/mpegts", 'FLV' : "video/x-flv", '3GPP' : "video/quicktime,variant=3gpp",
-                        'ASF' : "video/x-ms-asf", 'WebM' : "video/webm", 'No container' : False }
-
-csuffixmap =   { 'Ogg' : ".ogg", 'Matroska' : ".mkv", 'MXF' : ".mxf", 'AVI' : ".avi", 'Quicktime' : ".mov",
-                        'MPEG4' : ".mp4", 'MPEG PS' : ".mpg", 'MPEG TS' : ".ts", 'FLV' : ".flv", '3GPP' : ".3gp",
-                 'ASF' : ".asf", 'WebM' : ".webm", 'No container' : ".mp3" }
-
-audiosuffixmap =   { 'Ogg' : ".ogg", 'Matroska' : ".mkv", 'MXF' : ".mxf", 'AVI' : ".avi", 'Quicktime' : ".m4a",
-                        'MPEG4' : ".mp4", 'MPEG PS' : ".mpg", 'MPEG TS' : ".ts", 'FLV' : ".flv", '3GPP' : ".3gp",
-                      'ASF' : ".wma", 'WebM' : ".webm", 'No container' : ".mp3" }
-
-codecmap = {     'Vorbis' : "audio/x-vorbis", 'FLAC' : "audio/x-flac", 'mp3' : "audio/mpeg, mpegversion=(int)1, layer=(int)3", 
-                        'AAC' : "audio/mpeg,mpegversion=4", 'AC3' : "audio/x-ac3", 'Speex' : "audio/x-speex", 
-                        'Celt Ultra' : "audio/x-celt", 'ALAC' : "audio/x-alac", 'Windows Media Audio 2' : "audio/x-wma, wmaversion=(int)2", 
-                        'Theora' : "video/x-theora", 'Dirac' : "video/x-dirac", 'H264' : "video/x-h264", 
-                        'MPEG2' : "video/mpeg,mpegversion=2,systemstream=false", 'MPEG4' : "video/mpeg,mpegversion=4",
-                        'xvid' : "video/x-xvid", 'Windows Media Video 2' : "video/x-wmv,wmvversion=2",
-                        'dnxhd' : "video/x-dnxhd", 'divx5' : "video/x-divx,divxversion=5", 
-                        'divx4' : "video/x-divx,divxversion=4", 'AMR-NB' : "audio/AMR", 
-                        'H263+' : "video/x-h263,variant=itu,h263version=h263p", 'On2 vp8' : "video/x-vp8"}
+containermap = { 'Ogg' : "application/ogg", \
+        'Matroska' : "video/x-matroska", \
+        'MXF' : "application/mxf", \
+        'AVI' : "video/x-msvideo", \
+        'Quicktime' : "video/quicktime,variant=apple", \
+        'MPEG4' : "video/quicktime,variant=iso", \
+        'MPEG PS' : "video/mpeg,mpegversion=2,systemstream=true", \
+        'MPEG TS' : "video/mpegts", \
+        'FLV' : "video/x-flv", \
+        '3GPP' : "video/quicktime,variant=3gpp", \
+        'ASF' : "video/x-ms-asf", \
+        'WebM' : "video/webm", \
+        'No container' : False }
+
+csuffixmap =   { 'Ogg' : ".ogg", \
+        'Matroska' : ".mkv", \
+        'MXF' : ".mxf", \
+        'AVI' : ".avi", \
+        'Quicktime' : ".mov", \
+        'MPEG4' : ".mp4", \
+        'MPEG PS' : ".mpg", \
+        'MPEG TS' : ".ts", \
+        'FLV' : ".flv", \
+        '3GPP' : ".3gp",
+        'ASF' : ".asf", \
+        'WebM' : ".webm", \
+        'No container' : ".mp3" }
+
+audiosuffixmap =   { 'Ogg' : ".ogg", \
+        'Matroska' : ".mkv", \
+        'MXF' : ".mxf", \
+        'AVI' : ".avi", \
+        'Quicktime' : ".m4a",
+        'MPEG4' : ".mp4", \
+        'MPEG PS' : ".mpg", \
+        'MPEG TS' : ".ts", \
+        'FLV' : ".flv", \
+        '3GPP' : ".3gp", \
+        'ASF' : ".wma", \
+        'WebM' : ".webm", \
+        'No container' : ".mp3" }
+
+codecmap = { 'Vorbis' : "audio/x-vorbis", \
+        'FLAC' : "audio/x-flac", \
+        'mp3' : "audio/mpeg, mpegversion=(int)1, layer=(int)3", \
+        'AAC' : "audio/mpeg,mpegversion=4", \
+        'AC3' : "audio/x-ac3", \
+        'Speex' : "audio/x-speex",
+        'Celt Ultra' : "audio/x-celt", \
+        'ALAC' : "audio/x-alac", \
+        'Windows Media Audio 2' : "audio/x-wma, wmaversion=(int)2", \
+        'Theora' : "video/x-theora", \
+        'Dirac' : "video/x-dirac", \
+        'H264' : "video/x-h264", \
+        'MPEG2' : "video/mpeg,mpegversion=2,systemstream=false", \
+        'MPEG4' : "video/mpeg,mpegversion=4", \
+        'xvid' : "video/x-xvid", \
+        'Windows Media Video 2' : "video/x-wmv,wmvversion=2", \
+        'dnxhd' : "video/x-dnxhd", \
+        'divx5' : "video/x-divx,divxversion=5", \
+        'divx4' : "video/x-divx,divxversion=4", \
+        'AMR-NB' : "audio/AMR", \
+        'H263+' : "video/x-h263,variant=itu,h263version=h263p", \
+        'On2 vp8' : "video/x-vp8"}
+
 #####
 #This code checks for available muxers and return a unique caps string
 #for each. It also creates a python dictionary mapping the caps strings 
@@ -73,10 +116,11 @@ def get_muxer_element(containercaps):
    features = []
    elementname = False
    for fact in flist:
-       # FIXME: the 'and not' part of this line should be removed, but it has to stay in until Ranks have 
-       # been set on most muxers in GStreamer. If removed now we get lots of failures due to ending up 
-       # with broken muxers
-       if list_compat(["Codec", "Muxer"], fact.get_klass().split('/')) and not fact.get_name().startswith('ffmux'):
+       # FIXME: the 'and not' part of this line should be removed, but it has to
+       # stay in until Ranks have been set on most muxers in GStreamer. If
+       # removed now we get lots of failures due to ending up with broken muxers
+       if list_compat(["Codec", "Muxer"], fact.get_klass().split('/')) and not \
+               fact.get_name().startswith('ffmux'):
            muxers.append(fact.get_name())
            features.append(fact)
    muxerfeature = dict(zip(muxers, features))
@@ -84,7 +128,8 @@ def get_muxer_element(containercaps):
    for x in muxers:
            element = x
            factory = gst.registry_get_default().lookup_feature(str(x))
-           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
+           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
+                   if x.direction == gst.PAD_SRC]
            for caps in sinkcaps:
                if caps.intersect(incomingcaps):
                    if elementname == False:
@@ -97,9 +142,10 @@ def get_muxer_element(containercaps):
    return elementname
 
 ######
-#   This code checks for available audio encoders and return a unique caps string for each.
-#   It also creates a python dictionary mapping the caps strings to concrete element
-#   names.
+#   This code checks for available audio encoders and return a unique caps
+#   string for each.
+#   It also creates a python dictionary mapping the caps strings to concrete
+#   element names.
 #####
 def get_audio_encoder_element(audioencodercaps):
    """
@@ -115,8 +161,10 @@ def get_audio_encoder_element(audioencodercaps):
    features = []
    elementname = False
    for fact in flist:
-       if list_compat(["Codec", "Encoder", "Audio"], fact.get_klass().split('/')):
-           # excluding wavpackenc as the fact that it got two SRC pads mess up the logic of this code
+       if list_compat(["Codec", "Encoder", "Audio"], \
+               fact.get_klass().split('/')):
+           # excluding wavpackenc as the fact that it got two SRC pads mess up
+           # the logic of this code
            if fact.get_name() != 'wavpackenc':
                encoders.append(fact.get_name())
                features.append(fact)
@@ -125,7 +173,8 @@ def get_audio_encoder_element(audioencodercaps):
    for x in encoders:
            element = x
            factory = gst.registry_get_default().lookup_feature(str(x))
-           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
+           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
+                   if x.direction == gst.PAD_SRC]
            for caps in sinkcaps:
                if caps.intersect(incomingcaps):
                    if elementname == False:
@@ -157,10 +206,12 @@ def get_video_encoder_element(videoencodercaps):
    features = []
    elementname = False
    for fact in flist:
-       if list_compat(["Codec", "Encoder", "Video"], fact.get_klass().split('/')):
+       if list_compat(["Codec", "Encoder", "Video"], \
+               fact.get_klass().split('/')):
            encoders.append(fact.get_name())
            features.append(fact) 
-       elif list_compat(["Codec", "Encoder", "Image"], fact.get_klass().split('/')):
+       elif list_compat(["Codec", "Encoder", "Image"], \
+               fact.get_klass().split('/')):
            encoders.append(fact.get_name())
            features.append(fact)
    encoderfeature = dict(zip(encoders, features))
@@ -168,7 +219,8 @@ def get_video_encoder_element(videoencodercaps):
    for x in encoders:
            element = x
            factory = gst.registry_get_default().lookup_feature(str(x))
-           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SRC]
+           sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
+                   if x.direction == gst.PAD_SRC]
            for caps in sinkcaps:
                if caps.intersect(incomingcaps):
                    if elementname == False:
diff --git a/src/discoverer.py b/src/discoverer.py
index 7ee372a..9b9c70d 100644
--- a/src/discoverer.py
+++ b/src/discoverer.py
@@ -142,7 +142,8 @@ class Discoverer(gst.Pipeline):
         # callbacks
         self.typefind.connect("have-type", self._have_type_cb)
         self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb)
-        self.dbin.connect("autoplug-continue", self._decodebin_autoplug_continue_cb)
+        self.dbin.connect("autoplug-continue", \
+                self._decodebin_autoplug_continue_cb)
         self.dbin.connect("no-more-pads", self._no_more_pads_cb)
         self.dbin.connect("unknown-type", self._unknown_type_cb)
 
@@ -194,7 +195,8 @@ class Discoverer(gst.Pipeline):
         self.bus.connect("message", self._bus_message_cb)
 
         # 3s timeout
-        self._timeoutid = gobject.timeout_add(self._timeout, self._timed_out_or_eos)
+        self._timeoutid = gobject.timeout_add(self._timeout, \
+                self._timed_out_or_eos)
 
         self.info("setting to PLAY")
         if not self.set_state(gst.STATE_PLAYING):
@@ -221,27 +223,28 @@ class Discoverer(gst.Pipeline):
         print "Mime Type :\t", self.mimetype
         if not self.is_video and not self.is_audio:
             return
-        print "Length :\t", self._time_to_string(max(self.audiolength, self.videolength))
-        print "\tAudio:", self._time_to_string(self.audiolength), "\tVideo:", self._time_to_string(self.videolength)
+        print "Length :\t", self._time_to_string(max(self.audiolength, \
+                self.videolength))
+        print "\tAudio:", self._time_to_string(self.audiolength), "\tVideo:", \
+                self._time_to_string(self.videolength)
         if self.is_video and self.videorate:
             print "Video :"
             print "Incoming video format :" + str(self.inputvideocaps)
-            print "\t%d x %d @ %d/%d fps" % (self.videowidth,
-                                            self.videoheight,
-                                            self.videorate.num, self.videorate.denom)
+            print "\t%d x %d @ %d/%d fps" % (self.videowidth, \
+                                            self.videoheight, \
+                                            self.videorate.num, \
+                                            self.videorate.denom)
             if self.tags.has_key("video-codec"):
                 print "\tCodec :", self.tags.pop("video-codec")
         if self.is_audio:
             print "Audio :"
             print "Incoming audio format :" + str(self.inputaudiocaps)
             if self.audiofloat:
-                print "\t%d channels(s) : %dHz @ %dbits (float)" % (self.audiochannels,
-                                                                    self.audiorate,
-                                                                    self.audiowidth)
+                print "\t%d channels(s) : %dHz @ %dbits (float)" % \
+                        (self.audiochannels, self.audiorate, self.audiowidth)
             else:
-                print "\t%d channels(s) : %dHz @ %dbits (int)" % (self.audiochannels,
-                                                                  self.audiorate,
-                                                                  self.audiodepth)
+                print "\t%d channels(s) : %dHz @ %dbits (int)" % \
+                        (self.audiochannels, self.audiorate, self.audiodepth)
             if self.tags.has_key("audio-codec"):
                 print "\tCodec :", self.tags.pop("audio-codec")
         for stream in self.otherstreams:
@@ -322,20 +325,24 @@ class Discoverer(gst.Pipeline):
                    # print "discoverer: c is audio " + str(c)
                    # if caps[0].has_field("rate"):
                        if caps.is_fixed():
-                           blacklist = ['rate','channels','bitrate','block_align','mode','subbands'
-                                        ,'allocation','bitpool','blocks','width','depth'
-                                        ,'codec_data']
+                           blacklist = ['rate', 'channels', 'bitrate', \
+                                   'block_align', 'mode', 'subbands', \
+                                   'allocation', 'bitpool', 'blocks', 'width', \
+                                   'depth', 'codec_data']
                            for x in caps:
                                aresult = caps[0].get_name();
                                for attr in caps[0].keys():
                                    if attr not in blacklist:
                                        aresult += ","+attr+"="+str(caps[0][attr])
                            self.inputaudiocaps = aresult
-                           # print "discoverer: self.inputaudiocaps " + str(self.inputaudiocaps)
+                           # print "discoverer: self.inputaudiocaps " + \
+                           # str(self.inputaudiocaps)
            elif c.startswith("video/") or c.startswith("image/"):
-              if c.startswith("video/x-raw-yuv") == False or c.startswith("video/x-raw-rgb") == False:
+              if c.startswith("video/x-raw-yuv") == False or \
+                      c.startswith("video/x-raw-rgb") == False:
                   if caps.is_fixed():
-                      blacklist = ['height','width','framerate','depth','codec_data','pixel-aspect-ratio','format']
+                      blacklist = ['height', 'width', 'framerate', 'depth', \
+                              'codec_data', 'pixel-aspect-ratio', 'format']
                       for x in caps:
                            vresult = caps[0].get_name();
                            for attr in caps[0].keys():
@@ -362,8 +369,9 @@ class Discoverer(gst.Pipeline):
             return
         # we connect a fakesink to the new pad...
         pad.info("adding queue->fakesink")
-        fakesink = gst.element_factory_make("fakesink", "fakesink%d-%s" % 
-            (self.sinknumber, "audio" in caps.to_string() and "audio" or "video"))
+        fakesink = gst.element_factory_make("fakesink", "fakesink%d-%s" % \
+                (self.sinknumber, "audio" in caps.to_string() and \
+                "audio" or "video"))
         self.sinknumber += 1
         queue = gst.element_factory_make("queue")
         # we want the queue to buffer up to the specified amount of data 
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index 6e175be..01b6e2e 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -1,5 +1,5 @@
 # Transmageddon
-# Copyright (C) 2009 Christian Schaller <uraeus gnome org>
+# Copyright (C) 2009-2011 Christian Schaller <uraeus gnome org>
 # 
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -42,25 +42,32 @@ class Transcoder(gobject.GObject):
 
    def __init__(self, FILECHOSEN, FILENAME, DESTDIR, CONTAINERCHOICE, AUDIOCODECVALUE, VIDEOCODECVALUE, PRESET, 
                       OHEIGHT, OWIDTH, FRATENUM, FRATEDEN, ACHANNELS, MULTIPASS, PASSCOUNTER, OUTPUTNAME, 
-                      TIMESTAMP, ROTATIONVALUE, AUDIOPASSTOGGLE, VIDEOPASSTOGGLE, INTERLACED):
+                      TIMESTAMP, ROTATIONVALUE, AUDIOPASSTOGGLE, VIDEOPASSTOGGLE, INTERLACED, INPUTVIDEOCAPS):
        gobject.GObject.__init__(self)
 
        # Choose plugin based on Container name
-       self.containercaps = gst.Caps(codecfinder.containermap[CONTAINERCHOICE])
+       self.container = CONTAINERCHOICE
+       if self.container != False:
+           self.containercaps = gst.Caps(codecfinder.containermap[CONTAINERCHOICE])
 
        # Choose plugin based on Codec Name
        # or switch to remuxing mode if any of the values are set to 'pastr'
        self.stoptoggle=False
        self.audiocaps = gst.Caps(AUDIOCODECVALUE)
-       self.videocaps = gst.Caps(VIDEOCODECVALUE)
+       print "VIDEOCODECVALUE is " + str(VIDEOCODECVALUE)
+       if VIDEOCODECVALUE != False:
+          self.videocaps = gst.Caps(VIDEOCODECVALUE)
        self.audiopasstoggle = AUDIOPASSTOGGLE
        self.interlaced = INTERLACED
        self.videopasstoggle = VIDEOPASSTOGGLE
+       self.inputvideocaps = INPUTVIDEOCAPS
        self.doaudio= False
        # if self.audiopasstoggle == False:
-       #    self.AudioEncoderPlugin = codecfinder.get_audio_encoder_element(self.audiocaps)
-       #if self.videopasstoggle == False:
-       #    self.VideoEncoderPlugin = codecfinder.get_video_encoder_element(self.videocaps)
+       #    self.AudioEncoderPlugin = \
+       #            codecfinder.get_audio_encoder_element(self.audiocaps)
+       # if self.videopasstoggle == False:
+       #    self.VideoEncoderPlugin = \
+       #            codecfinder.get_video_encoder_element(self.videocaps)
        self.preset = PRESET
        self.oheight = OHEIGHT
        self.owidth = OWIDTH
@@ -76,11 +83,13 @@ class Transcoder(gobject.GObject):
        self.rotationvalue = int(ROTATIONVALUE)
        self.vbox = {}
 
-       # if needed create a variable to store the filename of the multipass statistics file
+       # if needed create a variable to store the filename of the multipass \
+       # statistics file
        if self.multipass != False:
-           self.cachefile = (str(glib.get_user_cache_dir())+"/"+"multipass-cache-file"+self.timestamp+".log")
+           self.cachefile = (str (glib.get_user_cache_dir()) + "/" + \
+                   "multipass-cache-file" + self.timestamp + ".log")
 
-       #gather preset data if relevant
+       # gather preset data if relevant
        if self.preset != "nopreset":
            height, width, num, denom, pixelaspectratio = self.provide_presets()
            for acap in self.audiocaps:
@@ -102,20 +111,40 @@ class Transcoder(gobject.GObject):
        self.uridecoder.set_property("uri", FILECHOSEN)
        self.uridecoder.connect("pad-added", self.OnDynamicPad)
 
-       self.encodebinprofile = gst.pbutils.EncodingContainerProfile ("containerformat", None , self.containercaps, None)
-       print "self.containercaps is " + str(self.containercaps)
-       print "self.videocaps is " + str(self.videocaps)
-       print "self.audiocaps is " + str(self.audiocaps) 
-       self.videoprofile = gst.pbutils.EncodingVideoProfile (self.videocaps, None, gst.caps_new_any(), 0)
-       self.audioprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
-       self.encodebinprofile.add_profile(self.videoprofile)
-       self.encodebinprofile.add_profile(self.audioprofile)
-
+       # first check if we have a container format, if not set up output for possible outputs
+       if self.container==False:
+           print "self.audiocaps are here set to " + str(self.audiocaps)
+           if self.audiocaps.intersect(gst.Caps("audio/mpeg, mpegversion=1, layer=3")):
+               self.container=gst.Caps("application/x-id3")
+               self.encodebinprofile = gst.pbutils.EncodingContainerProfile ("id3mux", None, self.container, None)
+               print "self.encodebinprofile is set to id3mux"
+           elif self.audiocaps.intersect(gst.Caps("audio/mpeg, mpegversion=4")):
+               print "they do intersect AAC"
+               self.audiocaps=gst.Caps("audio/mpeg, mpegversion=4, stream-format=adts")
+       else:
+           print "creating encoderbinprofile with muxer " + str(self.containercaps)
+           self.encodebinprofile = gst.pbutils.EncodingContainerProfile ("containerformat", None , self.containercaps, None)
+       if self.container==False:
+           print "setting encodebinprofile to audioprofile if no container"
+           self.encodebinprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
+       else:
+           print "adding audioprofile to muxer profile " + str(self.audiocaps)
+           self.audioprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
+           self.encodebinprofile.add_profile(self.audioprofile)
+       if self.videocaps != "novid":
+           print "not like novid"
+           self.videoprofile = gst.pbutils.EncodingVideoProfile (self.videocaps, None, gst.caps_new_any(), 0)
+           self.encodebinprofile.add_profile(self.videoprofile)
        self.encodebin = gst.element_factory_make ("encodebin", None)
        self.encodebin.set_property("profile", self.encodebinprofile)
        self.encodebin.set_property("avoid-reencoding", True)
        self.pipeline.add(self.encodebin)
 
+       if self.videocaps=="novid":
+           self.fakesink = gst.element_factory_make("fakesink", "fakesink")
+           self.fakesink.set_property("sync", True)
+           self.pipeline.add(self.fakesink)
+
        self.remuxcaps = gst.Caps()
        if self.audiopasstoggle:
           self.remuxcaps.append(self.audiocaps)
@@ -126,19 +155,28 @@ class Transcoder(gobject.GObject):
           self.remuxcaps.append_structure(gst.Structure("video/x-raw-yuv"))
        if self.videopasstoggle and not self.audiopasstoggle:
           self.remuxcaps.append_structure(gst.Structure("audio/x-raw-float"))
-          self.remuxcaps.append_structure(gst.Structure("audio/x-raw-int"))  
+          self.remuxcaps.append_structure(gst.Structure("audio/x-raw-int"))
+       if self.videocaps=="novid":
+          self.remuxcaps.append(self.inputvideocaps)
+          self.remuxcaps.append_structure(gst.Structure("audio/x-raw-float"))
+          self.remuxcaps.append_structure(gst.Structure("audio/x-raw-int"))
+
 
-       if (self.audiopasstoggle) or (self.videopasstoggle):
+       if (self.audiopasstoggle) or (self.videopasstoggle) or (self.videocaps=="novid"):
            # print "remuxcaps is " + str(self.remuxcaps)
            self.uridecoder.set_property("caps", self.remuxcaps)
+ 
        self.pipeline.add(self.uridecoder)
 
-       self.transcodefileoutput = gst.element_factory_make("filesink", "transcodefileoutput")
-       self.transcodefileoutput.set_property("location", (DESTDIR+"/"+self.outputfilename))
+       self.transcodefileoutput = gst.element_factory_make("filesink", \
+               "transcodefileoutput")
+       self.transcodefileoutput.set_property("location", \
+               (DESTDIR+"/"+self.outputfilename))
        self.pipeline.add(self.transcodefileoutput)
        self.encodebin.link(self.transcodefileoutput)
 
-       # print "reached end of first pipeline bulk, next step dynamic audio/video pads"
+       # print "reached end of first pipeline bulk, next step dynamic
+       # audio/video pads"
 
        if self.rotationvalue == 1 or self.rotationvalue == 3:
            # print "switching height and with around"
@@ -146,13 +184,14 @@ class Transcoder(gobject.GObject):
            nheight = width
            height = nheight
            width = nwidth 
-
+       self.fakesink.set_state(gst.STATE_PAUSED)
        self.uridecoder.set_state(gst.STATE_PAUSED)
        self.encodebin.set_state(gst.STATE_PAUSED)
        # print "setting uridcodebin to paused"
        self.BusMessages = self.BusWatcher()
 
-       self.uridecoder.connect("no-more-pads", self.noMorePads) # we need to wait on this one before going further
+       # we need to wait on this one before going further
+       self.uridecoder.connect("no-more-pads", self.noMorePads)
        # print "connecting to no-more-pads"
 
    # Get all preset values
@@ -167,7 +206,6 @@ class Transcoder(gobject.GObject):
        devices = presets.get()
        device = devices[self.preset]
        preset = device.presets["Normal"]
-    
        # set audio and video caps from preset file
        self.audiocaps=gst.Caps(preset.acodec.name)
        self.videocaps=gst.Caps(preset.vcodec.name)
@@ -179,10 +217,8 @@ class Transcoder(gobject.GObject):
            self.blackborderflag = True
        else:
            self.blackborderflag = False
-
        # Check for audio samplerate
        self.samplerate = int(preset.acodec.samplerate)
-
        # calculate number of channels
        chanmin, chanmax = preset.acodec.channels
        if int(self.achannels) < int(chanmax):
@@ -192,7 +228,6 @@ class Transcoder(gobject.GObject):
                self.channels = int(chanmin)
        else:
            self.channels = int(chanmax)
-
        # Check if rescaling is needed and calculate new video width/height keeping aspect ratio
        # Also add black borders if needed
        wmin, wmax  =  preset.vcodec.width
@@ -207,7 +242,6 @@ class Transcoder(gobject.GObject):
        aoutput = preset.acodec.presets[0].split(", ")
        for x in aoutput:
            self.apreset.append(x)
-         
        # Get Display aspect ratio
        pixelaspectratio = preset.vcodec.aspectratio[0]
 
@@ -296,7 +330,8 @@ class Transcoder(gobject.GObject):
            err, debug = message.parse_error()
            print err 
            print debug
-           gst.DEBUG_BIN_TO_DOT_FILE (self.pipeline, gst.DEBUG_GRAPH_SHOW_ALL, 'transmageddon.dot')
+           gst.DEBUG_BIN_TO_DOT_FILE (self.pipeline, gst.DEBUG_GRAPH_SHOW_ALL, \
+                   'transmageddon.dot')
        elif mtype == gst.MESSAGE_ASYNC_DONE:
            self.emit('ready-for-querying')
        elif mtype == gst.MESSAGE_EOS:
@@ -315,20 +350,41 @@ class Transcoder(gobject.GObject):
 
    def OnDynamicPad(self, uridecodebin, src_pad):
        # c = src_pad.get_caps().to_string()
-       sinkpad = self.encodebin.emit("request-pad", src_pad.get_caps())
-       c = sinkpad.get_caps().to_string()
-       if c.startswith("audio/"):
-          src_pad.link(sinkpad)
-       elif c.startswith("video/"):
-           if self.videopasstoggle==False:
-               self.videoflipper = gst.element_factory_make("videoflip")
-               self.videoflipper.set_property("method", self.rotationvalue)
-               self.pipeline.add(self.videoflipper)
-               src_pad.link(self.videoflipper.get_static_pad("sink"))
-               self.videoflipper.get_static_pad("src").link(sinkpad)
-               self.videoflipper.set_state(gst.STATE_PAUSED)
+       print "what is self.VideoCodec in transcoder engine " + str(self.videocaps)
+       if (self.container==False):
+           sinkpad = self.encodebin.get_static_pad("audio_0")
+           print "using static audio pad " + str(sinkpad) 
+           src_pad.link(sinkpad)
+       else:
+           if self.videocaps == "novid":
+               a =  src_pad.get_caps().to_string()
+               if a.startswith("audio/"):
+                   print "a starts with audio"
+                   sinkpad = self.encodebin.emit("request-pad", src_pad.get_caps())
+                   c = sinkpad.get_caps().to_string()
+                   if c.startswith("audio/"):
+                       print "using dynamic pad for audio only"
+                       src_pad.link(sinkpad)
+               elif a.startswith("video/"):
+                   print " trying to link fakesink"
+                   src_pad.link(self.fakesink.get_static_pad("sink"))
            else:
-               src_pad.link(sinkpad)
+               print "should not happen in audio only pipeline"
+               sinkpad = self.encodebin.emit("request-pad", src_pad.get_caps())
+               c = sinkpad.get_caps().to_string()
+               if c.startswith("audio/"):
+                   print "using dynamic pad"
+                   src_pad.link(sinkpad)
+               elif c.startswith("video/"):
+                   if self.videopasstoggle==False:
+                       self.videoflipper = gst.element_factory_make("videoflip")
+                       self.videoflipper.set_property("method", self.rotationvalue)
+                       self.pipeline.add(self.videoflipper)
+                       src_pad.link(self.videoflipper.get_static_pad("sink"))
+                       self.videoflipper.get_static_pad("src").link(sinkpad)
+                       self.videoflipper.set_state(gst.STATE_PAUSED)
+                   else:
+                       src_pad.link(sinkpad)
 
    def Pipeline (self, state):
        if state == ("playing"):
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 547fdf9..a0882b7 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -106,8 +106,9 @@ supported_video_container_map = {
     'Ogg':        [ 'Theora', 'Dirac', 'On2 vp8' ],
     'MXF':        [ 'H264', 'MPEG2', 'MPEG4' ],
     'Matroska':   [ 'Dirac', 'Theora', 'H264', 'On2 vp8',
-    'MPEG4', 'MPEG2', 'xvid', 'H263+' ],
-    'AVI':        [ 'H264', 'Dirac', 'MPEG2', 'MPEG4', 'xvid','Windows Media Video 2', 'On2 vp8' ],
+                    'MPEG4', 'MPEG2', 'xvid', 'H263+' ],
+    'AVI':        [ 'H264', 'Dirac', 'MPEG2', 'MPEG4', 'xvid',
+                    'Windows Media Video 2', 'On2 vp8' ],
     'Quicktime':  [ 'H264', 'Dirac', 'MPEG2', 'MPEG4', 'On2 vp8' ],
     'MPEG4':      [ 'H264', 'MPEG2', 'MPEG4' ],
     '3GPP':       [ 'H264', 'MPEG2', 'MPEG4', 'H263+' ],
@@ -130,8 +131,9 @@ supported_audio_container_map = {
     'MPEG TS':     [ 'mp3', 'AC3', 'AAC' ],
     'FLV':         [ 'mp3' ],
     'ASF':         [ 'Windows Media Audio 2', 'mp3'],
-    'WebM':        [ 'Vorbis'],
-    'No container':[ 'mp3','AAC','FLAC']
+    'WebM':        [ 'Vorbis']
+    # "No container" is 13th option here
+    # if adding more containers make sure to update code for 'No container as it is placement tied'
 }
 
 
@@ -228,23 +230,26 @@ class TransmageddonUI:
                path = uri[5:] # 5 is len('file:')
            return path
 
-       def on_drag_data_received(widget, context, x, y, selection, target_type, timestamp):
+       def on_drag_data_received(widget, context, x, y, selection, target_type, \
+               timestamp):
            if target_type == TARGET_TYPE_URI_LIST:
                uri = selection.data.strip('\r\n\x00')
                self.builder.get_object ("FileChooser").set_uri(uri)
 
        self.TopWindow.connect('drag_data_received', on_drag_data_received)
        self.TopWindow.drag_dest_set( gtk.DEST_DEFAULT_MOTION |
-           gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, dnd_list, gtk.gdk.ACTION_COPY)
+               gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, dnd_list, \
+               gtk.gdk.ACTION_COPY)
 
        self.start_time = False
        self.multipass = False
        self.passcounter = False
        
-       # Set the Videos XDG UserDir as the default directory for the filechooser, 
+       # Set the Videos XDG UserDir as the default directory for the filechooser
        # also make sure directory exists
        if 'get_user_special_dir' in glib.__dict__:
-           self.videodirectory = glib.get_user_special_dir(glib.USER_DIRECTORY_VIDEOS)
+           self.videodirectory = \
+                   glib.get_user_special_dir(glib.USER_DIRECTORY_VIDEOS)
        else:
            print "XDG video directory not available"
            self.videodirectory = os.getenv('HOME')
@@ -259,7 +264,8 @@ class TransmageddonUI:
        # Setting AppIcon
        FileExist = os.path.isfile("../../share/pixmaps/transmageddon.svg")
        if FileExist:
-           self.TopWindow.set_icon_from_file("../../share/pixmaps/transmageddon.svg")
+           self.TopWindow.set_icon_from_file( \
+                   "../../share/pixmaps/transmageddon.svg")
 
        else:
            try:
@@ -285,7 +291,7 @@ class TransmageddonUI:
        self.asourcecaps = False
        self.videopasstoggle=False
        self.audiopasstoggle=False
-       self.containertoggle=False # this toggle is used to not check for encoders with pbutils
+       self.containertoggle=False # used to not check for encoders with pbutils
        self.discover_done=False # lets us know that discover is finished
        self.missingtoggle=False
        self.oldaudiocodec={}
@@ -295,11 +301,15 @@ class TransmageddonUI:
        self.haveaudio=False
        self.devicename = "nopreset"
        self.nocontaineroptiontoggle=False
-       self.audiopassmenuno=1 # create variables to store passthrough options slot in the menu
+       # create variables to store passthrough options slot in the menu
+       self.audiopassmenuno=1
        self.videopassmenuno=1
-       self.usingpreset=False # create toggle so I can split codepath depending on if I using a preset or not
+       # create toggle so I can split codepath depending on if I using a preset
+       # or not
+       self.usingpreset=False
        self.presetaudiocodec="None"
        self.presetvideocodec="None"
+       self.inputvideocaps=None # using this value to store videocodec name to feed uridecodebin to avoid decoding video when not keeping video
 
        self.p_duration = gst.CLOCK_TIME_NONE
        self.p_time = gst.FORMAT_TIME
@@ -308,12 +318,18 @@ class TransmageddonUI:
        self.lst = supported_containers
        for i in self.lst:
            self.containerchoice.append_text(i)
+       # add i18n "No container"option
+       self.containerchoice.append_text(_("No container (Audio-only)"))
 
        # Populate the rotatation box
-       self.rotationlist = [_("No rotation (default)"), _("Clockwise 90 degrees"), _("Rotate 180 degrees"), 
-                           _("Counterclockwise 90 degrees"), _("Horizontal flip"),
-                           _("Vertical flip"), _("Upper left diagonal flip"),
-                           _("Upper right diagnonal flip") ]
+       self.rotationlist = [_("No rotation (default)"),\
+                            _("Clockwise 90 degrees"), \
+                            _("Rotate 180 degrees"),
+                            _("Counterclockwise 90 degrees"), \
+                            _("Horizontal flip"),
+                            _("Vertical flip"), \
+                            _("Upper left diagonal flip"),
+                            _("Upper right diagnonal flip") ]
 
        for y in self.rotationlist: 
            self.rotationchoice.append_text(y)
@@ -395,12 +411,14 @@ class TransmageddonUI:
        if self.start_time == False:  
            self.start_time = time.time()
        try:
-           position, format = self._transcoder.uridecoder.query_position(gst.FORMAT_TIME)
+           position, format = \
+                   self._transcoder.uridecoder.query_position(gst.FORMAT_TIME)
        except:
            position = gst.CLOCK_TIME_NONE
 
        try:
-           duration, format = self._transcoder.uridecoder.query_duration(gst.FORMAT_TIME)
+           duration, format = \
+                   self._transcoder.uridecoder.query_duration(gst.FORMAT_TIME)
        except:
            duration = gst.CLOCK_TIME_NONE
        if position != gst.CLOCK_TIME_NONE:
@@ -423,12 +441,14 @@ class TransmageddonUI:
                    }
                if percent_remain > 0.5:
                    if self.passcounter == int(0):
-                       self.ProgressBar.set_text(_("Estimated time remaining: %(time)s") % {'time': str(time_rem)})
+                       txt = "Estimated time remaining: %(time)s"
+                       self.ProgressBar.set_text(_(txt) % \
+                               {'time': str(time_rem)})
                    else:
-                       self.ProgressBar.set_text(_("Pass %(count)d time remaining: %(time)s") % {
-                           'count': self.passcounter,
-                           'time': str(time_rem),
-                           })
+                       txt = "Pass %(count)d time remaining: %(time)s"
+                       self.ProgressBar.set_text(_(txt) % { \
+                               'count': self.passcounter, \
+                               'time': str(time_rem), })
                return True
            else:
                self.ProgressBar.set_fraction(0.0)
@@ -436,7 +456,8 @@ class TransmageddonUI:
        else:
            return False
 
-   # Call gobject.timeout_add with a value of 500millisecond to regularly poll for position so we can
+   # Call gobject.timeout_add with a value of 500millisecond to regularly poll
+   # for position so we can
    # use it for the progressbar
    def ProgressBarUpdate(self, source):
        gobject.timeout_add(500, self.Increment_Progressbar)
@@ -445,7 +466,8 @@ class TransmageddonUI:
    def _on_eos(self, source):
        context_id = self.StatusBar.get_context_id("EOS")
        if (self.multipass ==  False) or (self.passcounter == int(0)):
-           self.StatusBar.push(context_id, (_("File saved to %(dir)s") % {'dir': self.videodirectory}))
+           self.StatusBar.push(context_id, (_("File saved to %(dir)s") % \
+                   {'dir': self.videodirectory}))
            self.FileChooser.set_sensitive(True)
            self.containerchoice.set_sensitive(True)
            self.CodecBox.set_sensitive(True)
@@ -461,10 +483,12 @@ class TransmageddonUI:
            self.passcounter = False
            self.audiopasstoggle=False
            self.videopasstoggle=False
-           self.houseclean=False # due to me not knowing which APIs to use I need this toggle to avoid errors when cleaning 
+           self.houseclean=False # due to not knowing which APIs to use I need
+                                 # this toggle to avoid errors when cleaning
                                  # the codec comboboxes
        else:
-           self.StatusBar.push(context_id, (_("Pass %(count)d Complete") % {'count': self.passcounter}))
+           self.StatusBar.push(context_id, (_("Pass %(count)d Complete") % \
+                   {'count': self.passcounter}))
            self.start_time = False
            self.ProgressBar.set_text(_("Start next pass"))
            if self.passcounter == (self.multipass-1):
@@ -475,7 +499,8 @@ class TransmageddonUI:
                self._start_transcoding()
 
 
-   # Use the pygst extension 'discoverer' to get information about the incoming media. Probably need to get codec data in another way.
+   # Use the pygst extension 'discoverer' to get information about the incoming
+   # media. Probably need to get codec data in another way.
    # this code is probably more complex than it needs to be currently
  
    def succeed(self, discoverer, info, error):
@@ -491,17 +516,23 @@ class TransmageddonUI:
            audiostreamcounter=audiostreamcounter+1
            if isinstance(i, gst.pbutils.DiscovererAudioInfo):
                inputaudiocaps=i.get_caps()
-               audiostreams.append(gst.pbutils.get_codec_description(inputaudiocaps))
+               audiostreams.append( \
+                       gst.pbutils.get_codec_description(inputaudiocaps))
                audiotags=i.get_tags()
                audiochannels=i.get_channels()
                samplerate=i.get_sample_rate()
                self.haveaudio=True
-               self.audiodata = { 'audiochannels' : audiochannels, 'samplerate' : samplerate, 'audiotype' : inputaudiocaps, 'clipduration' : clipduration }
-               self.audioinformation.set_markup(''.join(('<small>', 'Audio channels: ', str(audiochannels) ,'</small>')))
-               self.audiocodec.set_markup(''.join(('<small>','Audio codec: ', str(gst.pbutils.get_codec_description(inputaudiocaps)),'</small>')))
+               self.audiodata = { 'audiochannels' : audiochannels, \
+                       'samplerate' : samplerate, 'audiotype' : inputaudiocaps, \
+                       'clipduration' : clipduration }
+               self.audioinformation.set_markup(''.join(('<small>', \
+                       'Audio channels: ', str(audiochannels) ,'</small>')))
+               self.audiocodec.set_markup(''.join(('<small>','Audio codec: ', \
+                       str(gst.pbutils.get_codec_description(inputaudiocaps)), \
+                       '</small>')))
 
            if isinstance(i, gst.pbutils.DiscovererVideoInfo):
-               inputvideocaps=i.get_caps()
+               self.inputvideocaps=i.get_caps()
                videotags=i.get_tags()
                interlacedbool = i.is_interlaced()
                if interlacedbool is True:
@@ -512,12 +543,12 @@ class TransmageddonUI:
                videodenom=i.get_framerate_denom()
                videonum=i.get_framerate_num()
 
-               self.videodata = { 'videowidth' : videowidth, 'videoheight' : videoheight, 'videotype' : inputvideocaps,
+               self.videodata = { 'videowidth' : videowidth, 'videoheight' : videoheight, 'videotype' : self.inputvideocaps,
                               'fratenum' : videonum, 'frateden' :  videodenom }
                self.videoinformation.set_markup(''.join(('<small>', 'Video width&#47;height: ', str(videowidth),
                                             "x", str(videoheight), '</small>')))
                self.videocodec.set_markup(''.join(('<small>', 'Video codec: ',
-                                       str(gst.pbutils.get_codec_description(inputvideocaps)),
+                                       str(gst.pbutils.get_codec_description(self.inputvideocaps)),
                                       '</small>')))
 #
 
@@ -550,7 +581,7 @@ class TransmageddonUI:
        videointersect = ("EMPTY")
        audiointersect = ("EMPTY")
        print "containerchoice is " + str(containerchoice)
-       if containerchoice != "No container":
+       if containerchoice != False:
            # print "container is " + str(containerchoice)
            container = codecfinder.containermap[containerchoice]
            containerelement = codecfinder.get_muxer_element(container)
@@ -563,7 +594,7 @@ class TransmageddonUI:
                for x in factory.get_static_pad_templates():
                    if (x.direction == gst.PAD_SINK):
                        sourcecaps = x.get_caps()
-                       if self.havevideo==True:
+                       if self.havevideo == True:
                           if videointersect == ("EMPTY"):
                               videointersect = sourcecaps.intersect(self.videodata['videotype'])
                               if videointersect != ("EMPTY"):
@@ -610,29 +641,35 @@ class TransmageddonUI:
            ratenum = self.videodata['fratenum']
            ratednom = self.videodata['frateden']
            if self.videopasstoggle == False:
+               print "videopasstoggle set to False and self.VideoCodec is " + str(self.VideoCodec)
                videocodec = self.VideoCodec
            else:
                videocodec = gst.Caps.to_string(self.vsourcecaps)
+       else:
+           videocodec=False
+           vheight=False
+           vwidth=False
+           ratenum=False
+           ratednom=False
        achannels = self.audiodata['audiochannels']
        if self.audiopasstoggle == False:
+
            audiocodec = self.AudioCodec
        else:
            audiocodec = gst.Caps.to_string(self.asourcecaps)
-       container = self.builder.get_object ("containerchoice").get_active_text ()
        # non-preset transcoding with audio and video
-       self._transcoder = transcoder_engine.Transcoder(filechoice, self.filename, self.videodirectory, container, 
+       self._transcoder = transcoder_engine.Transcoder(filechoice, self.filename, self.videodirectory, self.container, 
                                                        audiocodec, videocodec, self.devicename, 
                                                        vheight, vwidth, ratenum, ratednom, achannels, 
                                                        self.multipass, self.passcounter, self.outputfilename,
                                                        self.timestamp, self.rotationvalue, self.audiopasstoggle, 
-                                                       self.videopasstoggle, self.interlaced)
+                                                       self.videopasstoggle, self.interlaced, self.inputvideocaps)
 
        self._transcoder.connect("ready-for-querying", self.ProgressBarUpdate)
        self._transcoder.connect("got-eos", self._on_eos)
-       self._transcoder.connect("got-error", self.show_error) 
+       self._transcoder.connect("got-error", self.show_error)
        return True
 
-
    def donemessage(self, donemessage, null):
        if donemessage == gst.pbutils.INSTALL_PLUGINS_SUCCESS:
            # print "success " + str(donemessage)
@@ -642,7 +679,8 @@ class TransmageddonUI:
                print "GStreamer registry update failed"
            if self.containertoggle == False:
                # print "done installing plugins, starting transcode"
-               # FIXME - might want some test here to check plugins needed are actually installed
+               # FIXME - might want some test here to check plugins needed are
+               # actually installed
                # but it is a rather narrow corner case when it fails
                self._start_transcoding()
        elif donemessage == gst.pbutils.INSTALL_PLUGINS_PARTIAL_SUCCESS:
@@ -650,7 +688,8 @@ class TransmageddonUI:
            self.check_for_elements()
        elif donemessage == gst.pbutils.INSTALL_PLUGINS_NOT_FOUND:
            context_id = self.StatusBar.get_context_id("EOS")
-           self.StatusBar.push(context_id, _("Plugins not found, choose different codecs."))
+           self.StatusBar.push(context_id, \
+                   _("Plugins not found, choose different codecs."))
            self.FileChooser.set_sensitive(True)
            self.containerchoice.set_sensitive(True)
            self.CodecBox.set_sensitive(True)
@@ -669,23 +708,28 @@ class TransmageddonUI:
            self.StatusBar.push(context_id, _("Missing plugin installation failed: ")) + gst.pbutils.InstallPluginsReturn()
 
    def check_for_elements(self):
-       containerchoice = self.builder.get_object ("containerchoice").get_active_text ()
-       if containerchoice == "No container":
+       if self.container==False:
            containerstatus=True
+           videostatus=True
        else:
+           containerchoice = self.builder.get_object ("containerchoice").get_active_text ()
            containerstatus = codecfinder.get_muxer_element(codecfinder.containermap[containerchoice])
+           if self.havevideo:
+               print "self.VideoCodec is before test " + str(self.VideoCodec)
+               if self.videopasstoggle != True:
+                   if self.VideoCodec == "novid":
+                       videostatus=True
+                   else:
+                       print "self.VideoCodec is " + str(self.VideoCodec)
+                       videostatus = codecfinder.get_video_encoder_element(self.VideoCodec)
+                       print "videostatus is " + str(videostatus)
+               else:
+                   videostatus=True
 
        if self.audiopasstoggle != True:
            audiostatus = codecfinder.get_audio_encoder_element(self.AudioCodec)
        else:
            audiostatus=True
-       if self.havevideo:
-           if self.videopasstoggle != True:
-               print "self.VideoCodec is " + str(self.VideoCodec)
-               videostatus = codecfinder.get_video_encoder_element(self.VideoCodec)
-               print "videostatus is " + str(videostatus)
-           else:
-               videostatus=True
 
        if not containerstatus or not videostatus or not audiostatus:
            self.missingtoggle=True
@@ -705,9 +749,11 @@ class TransmageddonUI:
            context = gst.pbutils.InstallPluginsContext ()
            context.set_xid(self.TopWindow.get_window().xid)
            strmissing = str(missing)
-           gst.pbutils.install_plugins_async (missing, context, self.donemessage, "NULL")
+           gst.pbutils.install_plugins_async (missing, context, \
+                   self.donemessage, "NULL")
 
-   # The transcodebutton is the one that calls the Transcoder class and thus starts the transcoding
+   # The transcodebutton is the one that calls the Transcoder class and thus
+   # starts the transcoding
    def on_transcodebutton_clicked(self, widget):
        self.containertoggle = False
        self.FileChooser.set_sensitive(False)
@@ -725,7 +771,10 @@ class TransmageddonUI:
        self.nosuffix = os.path.splitext(os.path.basename(self.filename))[0]
        # pick output suffix
        container = self.builder.get_object ("containerchoice").get_active_text ()
-       self.ContainerFormatSuffix = codecfinder.csuffixmap[container]
+       if self.container==False:
+           self.ContainerFormatSuffix=".mp3"
+       else:
+           self.ContainerFormatSuffix = codecfinder.csuffixmap[container]
        self.outputfilename = str(self.nosuffix+self.timestamp+self.ContainerFormatSuffix)
        context_id = self.StatusBar.get_context_id("EOS")
        self.StatusBar.push(context_id, (_("Writing %(filename)s") % {'filename': self.outputfilename}))
@@ -751,7 +800,8 @@ class TransmageddonUI:
        self.presetchoice.set_active(0)
        self.cancelbutton.set_sensitive(False)
        self.transcodebutton.set_sensitive(True)
-       self._cancel_encoding = transcoder_engine.Transcoder.Pipeline(self._transcoder,"null")
+       self._cancel_encoding = \
+               transcoder_engine.Transcoder.Pipeline(self._transcoder,"null")
        self.ProgressBar.set_fraction(0.0)
        self.ProgressBar.set_text(_("Transcoding Progress"))
        context_id = self.StatusBar.get_context_id("EOS")
@@ -762,55 +812,69 @@ class TransmageddonUI:
        self.CodecBox.set_sensitive(True)
        self.ProgressBar.set_fraction(0.0)
        self.ProgressBar.set_text(_("Transcoding Progress"))
-       self.container = self.builder.get_object ("containerchoice").get_active_text ()
-       self.transcodebutton.set_sensitive(True)
-       audio_codecs = supported_audio_container_map[self.container]
-       self.audiocodecs =[]
-       for c in self.oldaudiocodec:
-           self.houseclean=True
-           self.audiorows[0].remove_text(0)
-       self.houseclean=False
-       if self.usingpreset==True:
-           print "setting preset codec into drop down list"
-           self.audiorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetaudiocodec)))
-           print "preset codec name is " + str(gst.pbutils.get_codec_description(self.presetaudiocodec))
-           self.audiorows[0].set_active(0)
-       else:
-           for c in audio_codecs:
-               self.audiocodecs.append(gst.Caps(codecfinder.codecmap[c]))
-           for c in audio_codecs:
-               self.audiorows[0].append_text(c)
-               self.audiorows[0].set_sensitive(True)
-               self.audiorows[0].set_active(0)
-           print "self.audiocodecs has just been populated and is " + str(self.audiocodecs)
-       self.oldaudiocodec=audio_codecs
-       print "self.audiocodecs is " + str(self.audiocodecs)
-       if self.havevideo==True:
-           self.rotationchoice.set_sensitive(True)
-           video_codecs = supported_video_container_map[self.container]
-           self.videocodecs=[]
-           for c in self.oldvideocodec:
+       if self.builder.get_object("containerchoice").get_active()!= -1:
+           self.container = self.builder.get_object ("containerchoice").get_active_text ()
+       if self.builder.get_object("containerchoice").get_active()!= -1:
+           self.transcodebutton.set_sensitive(True)
+           if self.builder.get_object("containerchoice").get_active()==12:
+               print "choosing no container"
+               self.container=False
+               audio_codecs = [ 'mp3', 'AAC', 'FLAC' ]
+               self.audiocodecs =[]
+               print "self.videonovideomenuno is " + str(self.videonovideomenuno)
+               self.videorows[0].set_active(self.videonovideomenuno)
+           else:
+               audio_codecs = supported_audio_container_map[self.container]
+               self.audiocodecs =[]
+           for c in self.oldaudiocodec:
                self.houseclean=True
-               self.videorows[0].remove_text(0)
+               self.audiorows[0].remove_text(0)
            self.houseclean=False
            if self.usingpreset==True:
                print "setting preset codec into drop down list"
-               self.videorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetvideocodec)))
-               print "preset codec name is " + str(gst.pbutils.get_codec_description(self.presetvideocodec))
-               self.videorows[0].set_active(0)
+               self.audiorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetaudiocodec)))
+               print "preset codec name is " + str(gst.pbutils.get_codec_description(self.presetaudiocodec))
+               self.audiorows[0].set_active(0)
            else:
-               for c in video_codecs:
-                   self.videocodecs.append(gst.Caps(codecfinder.codecmap[c]))
-               for c in video_codecs: # I can't update the menu with loop append
-                   self.videorows[0].append_text(c)
-                   self.videorows[0].set_sensitive(True)
-                   self.videorows[0].set_active(0)
-
-           self.oldvideocodec=video_codecs
-           print "self.videocodecs is " + str(self.videocodecs)
-
-       if self.discover_done == True:
-           self.check_for_passthrough(self.container)
+               for c in audio_codecs:
+                   self.audiocodecs.append(gst.Caps(codecfinder.codecmap[c]))
+               for c in audio_codecs:
+                   self.audiorows[0].append_text(c)
+                   self.audiorows[0].set_sensitive(True)
+                   self.audiorows[0].set_active(0)
+               print "self.audiocodecs has just been populated and is " + str(self.audiocodecs)
+           self.oldaudiocodec=audio_codecs
+           print "self.audiocodecs is " + str(self.audiocodecs)
+           if self.havevideo==True:
+               print "self.container in have_video is " + str(self.container)
+               if self.container != False:
+                   self.rotationchoice.set_sensitive(True)
+                   video_codecs = supported_video_container_map[self.container]
+                   self.videocodecs=[]
+                   for c in self.oldvideocodec:
+                       self.houseclean=True
+                       self.videorows[0].remove_text(0)
+                   self.houseclean=False
+                   if self.usingpreset==True:
+                       print "setting preset codec into drop down list"
+                       self.videorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetvideocodec)))
+                       print "preset codec name is " + str(gst.pbutils.get_codec_description(self.presetvideocodec))
+                       self.videorows[0].set_active(0)
+                   else:
+                       for c in video_codecs:
+                           self.videocodecs.append(gst.Caps(codecfinder.codecmap[c]))
+                       for c in video_codecs: # I can't update the menu with loop append
+                           self.videorows[0].append_text(c)
+                       self.videorows[0].set_sensitive(True)
+                       self.videorows[0].set_active(0)
+                    # add a 'No Video option'
+                   self.videorows[0].append_text("No Video")
+                   self.videocodecs.append("novid")
+                   self.videonovideomenuno=(len(self.videocodecs))-1
+                   self.oldvideocodec=video_codecs
+                   print "self.videocodecs is " + str(self.videocodecs)
+           if self.discover_done == True:
+               self.check_for_passthrough(self.container)
 
    def on_presetchoice_changed(self, widget):
        presetchoice = self.builder.get_object ("presetchoice").get_active_text ()
@@ -848,16 +912,21 @@ class TransmageddonUI:
            self.AudioCodec = self.audiocodecs[self.audiorows[0].get_active()]
            print "self.AudioCodec is " + str(self.AudioCodec)
            print self.audiorows[0].get_active()
-           if self.audiorows[0].get_active() ==  self.audiopassmenuno:
-               self.audiopasstoggle=True
-               print "you choose audio passthrough"
+           print "self container is set to and needs to be acted upon " + str(self.container)
+           if self.container != False:
+               if self.audiorows[0].get_active() ==  self.audiopassmenuno:
+                   self.audiopasstoggle=True
+                   print "you choose audio passthrough"
        elif self.usingpreset==True:
            self.AudioCodec = gst.Caps(self.presetaudiocodec)    
            print "self.AudioCodec is (from preset) " + str(self.AudioCodec)
 
    def on_videocodec_changed(self, widget):
        if (self.houseclean == False and self.usingpreset==False):
-           self.VideoCodec = self.videocodecs[self.videorows[0].get_active()]
+           if self.container != False:
+               self.VideoCodec = self.videocodecs[self.videorows[0].get_active()]
+           else:
+               self.VideoCodec = False
            print "self.VideoCodec is " + str(self.VideoCodec)
            print self.videorows[0].get_active()
            if self.videorows[0].get_active() == self.videopassmenuno:
@@ -867,14 +936,14 @@ class TransmageddonUI:
            self.VideoCodec = gst.Caps(self.presetvideocodec)
 
 
-   def on_videobutton_pressed(self, widget, codec):
-       self.VideoCodec = codec
-       if self.VideoCodec == "Video passthrough":
-           self.videopasstoggle=True
-           self.rotationchoice.set_sensitive(False)
-           self.rotationchoice.set_active(0)
-       else:
-           self.rotationchoice.set_sensitive(True)
+   #def on_videobutton_pressed(self, widget, codec):
+   #    self.VideoCodec = codec
+   #    if self.VideoCodec == "Video passthrough":
+   #        self.videopasstoggle=True
+   #        self.rotationchoice.set_sensitive(False)
+   #        self.rotationchoice.set_active(0)
+   #    else:
+   #        self.rotationchoice.set_sensitive(True)
 
    def on_about_dialog_activate(self, widget):
        """
@@ -918,7 +987,8 @@ class TransmageddonUI:
            os.remove(dotfile)
        if os.access(pngfile, os.F_OK):
            os.remove(pngfile)
-       gst.DEBUG_BIN_TO_DOT_FILE (self._transcoder.pipeline, gst.DEBUG_GRAPH_SHOW_ALL, 'transmageddon-debug-graph')
+       gst.DEBUG_BIN_TO_DOT_FILE (self._transcoder.pipeline, \
+               gst.DEBUG_GRAPH_SHOW_ALL, 'transmageddon-debug-graph')
        # check if graphviz is installed with a simple test
        try:
            dot = which.which("dot")
diff --git a/src/which.py b/src/which.py
index 8dd7905..32b9ca7 100644
--- a/src/which.py
+++ b/src/which.py
@@ -331,5 +331,3 @@ def main(argv):
 
 if __name__ == "__main__":
     sys.exit( main(sys.argv) )
-
-



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