[transmageddon] Add fixes to make multistream file transcoding work
- From: Christian Fredrik Kalager Schaller <uraeus src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [transmageddon] Add fixes to make multistream file transcoding work
- Date: Fri, 29 Mar 2013 16:39:33 +0000 (UTC)
commit c2d1ddedbbca19bb706fab1d678cbdffb2d91488
Author: Christian Fredrik Kalager Schaller <uraeus linuxrising org>
Date: Fri Mar 29 14:36:29 2013 +0100
Add fixes to make multistream file transcoding work
src/transcoder_engine.py | 20 ++++++++++++----
src/transmageddon.py | 58 +++++++++++++++++++++++++++++----------------
2 files changed, 52 insertions(+), 26 deletions(-)
---
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index 887f579..b057367 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -141,6 +141,7 @@ class Transcoder(GObject.GObject):
# We do not need to do anything special for passthrough for audio, since we are not
# including any extra elements between uridecodebin and encodebin
x=0
+ self.audioprofilenames=[]
while x < len(self.audiodata):
if self.audiodata[x]['outputaudiocaps'] != False:
if self.container==False:
@@ -148,6 +149,8 @@ class Transcoder(GObject.GObject):
else:
audiopreset=None
self.audioprofile =
GstPbutils.EncodingAudioProfile.new(self.audiodata[x]['outputaudiocaps'], audiopreset, Gst.Caps.new_any(), 0)
+ self.audioprofilenames.append("audioprofilename"+str(x))
+ self.audioprofile.set_name(self.audioprofilenames[x])
self.encodebinprofile.add_profile(self.audioprofile)
x=x+1
@@ -315,13 +318,18 @@ class Transcoder(GObject.GObject):
bus.add_signal_watch()
bus.connect('message', self.on_message)
+ # this function probes for the stream id, then based on which
def padprobe(self, pad, probeinfo, userdata):
event = probeinfo.get_event()
eventtype=event.type
if eventtype==Gst.EventType.STREAM_START:
self.probestreamid = event.parse_stream_start()
- if self.probestreamid==self.audiodata[0]['streamid']:
- pad.link(self.sinkpad)
+ x=0
+ while x < len(self.audiodata):
+ if self.probestreamid==self.audiodata[x]['streamid']:
+ self.sinkpad = self.encodebin.emit("request-profile-pad", self.audioprofilenames[x])
+ pad.link(self.sinkpad)
+ x=x+1
return Gst.PadProbeReturn.OK
def on_message(self, bus, message):
@@ -363,7 +371,7 @@ class Transcoder(GObject.GObject):
origin = src_pad.query_caps(None)
if (self.container==False):
a = origin.to_string()
- if a.startswith("audio/"): # FIXME : Currently an assumption here of one audio stream
+ if a.startswith("audio/"):
sinkpad = self.encodebin.get_static_pad("audio_0")
src_pad.link(sinkpad)
else:
@@ -383,7 +391,8 @@ class Transcoder(GObject.GObject):
if not c.startswith("text/"):
if not (c.startswith("video/") and (self.videodata[0]['outputvideocaps'] == False)):
if self.passcounter == int(0):
- self.sinkpad = self.encodebin.emit("request-pad", origin)
+ if not c.startswith("audio/"):
+ self.sinkpad = self.encodebin.emit("request-pad", origin)
if c.startswith("audio/"):
if self.passcounter == int(0):
src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
@@ -416,7 +425,8 @@ class Transcoder(GObject.GObject):
element.merge_tags(taglist, Gst.TagMergeMode.REPLACE)
if Gst.ElementFactory.list_is_type(factory, 1125899906842626): # Audio Encoders factory code
taglist=Gst.TagList.new_empty()
- taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_LANGUAGE_CODE,
self.audiodata[0]['language']) # FIXME: Currently only doing 1 stream
+ if self.audiodata[0]['language'] != None:
+ taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_LANGUAGE_CODE,
self.audiodata[0]['language']) # FIXME: Currently only doing 1 stream
longname=factory.get_metadata('long-name')
taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_ENCODER, longname)
element.merge_tags(taglist, Gst.TagMergeMode.REPLACE)
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 9429e1e..4cba560 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -43,7 +43,7 @@ import about
import presets
import utils
import datetime
-import langchooser, batch
+# import langchooser
major, minor, patch, micro = Gst.version()
if (major == 1) and (patch < 0):
@@ -688,7 +688,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
if self.haveaudio:
self.markupaudioinfo=[]
if self.audiostreamcounter==0:
- self.markupaudioinfo.append(''.join(('<small>','Audio channels: ',
str(self.audiodata[self.audiostreamcounter]['audiochannels']), '</small>',"\n", '<small>','Audio codec:
',str(GstPbutils.pb_utils_get_codec_description(self.audiodata[self.audiostreamcounter]['inputaudiocaps'])),
"\n", 'Language: ', self.audiodata[self.audiostreamcounter]['language'],'</small>')))
+ self.markupaudioinfo.append(''.join(('<small>','Audio channels: ',
str(self.audiodata[self.audiostreamcounter]['audiochannels']), '</small>',"\n", '<small>','Audio codec:
',str(GstPbutils.pb_utils_get_codec_description(self.audiodata[self.audiostreamcounter]['inputaudiocaps'])),
"\n", 'Language: ', str(self.audiodata[self.audiostreamcounter]['language']),'</small>')))
self.audioinformation.set_markup("".join(self.markupaudioinfo))
else:
if self.audiostreamcounter==1:
@@ -986,7 +986,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
# clean up stuff from previous run
self.houseclean=True # set this to avoid triggering events when cleaning out menus
x=0
- while x <= self.audiostreamcounter:
+ while x < len(self.audiocodecs): #self.audiostreamcounter:
if self.audiocodecs:
for c in self.audiocodecs[x]: #
self.audiorows[x].remove(0)
@@ -999,8 +999,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
self.videocodecs=[]
x=x+1
self.houseclean=False
-
- # end of housecleaning
+ # end of housecleaning
# start filling audio
if self.haveaudio==True:
@@ -1010,36 +1009,52 @@ class TransmageddonUI(Gtk.ApplicationWindow):
if self.usingpreset==True: # First fill menu based on presetvalue
testforempty = self.presetaudiocodec.to_string()
if testforempty != "EMPTY":
-
self.audiorows[x].append_text(str(GstPbutils.pb_utils_get_codec_description(self.presetaudiocodec)))
- self.audiorows[x].set_active(0)
self.audiocodecs[x].append(self.presetaudiocodec)
elif self.streamdata['container']==False: # special setup for container less case, looks
ugly, but good enough for now
-
self.audiorows[x].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/mpeg,
mpegversion=(int)1, layer=(int)3"))))
-
self.audiorows[x].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/mpeg,
mpegversion=4, stream-format=adts"))))
-
self.audiorows[x].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/x-flac"))))
self.audiocodecs[x].append(Gst.caps_from_string("audio/mpeg, mpegversion=(int)1,
layer=(int)3"))
self.audiocodecs[x].append(Gst.caps_from_string("audio/mpeg, mpegversion=4,
stream-format=adts"))
self.audiocodecs[x].append(Gst.caps_from_string("audio/x-flac"))
- self.audiorows[x].set_active(0)
- self.audiorows[x].set_sensitive(True)
else:
audiolist = []
audio_codecs = supported_audio_container_map[self.containershort]
for c in audio_codecs:
self.audiocodecs[x].append(Gst.caps_from_string(codecfinder.codecmap[c]))
- for c in self.audiocodecs[x]: # Use codec descriptions from GStreamer
- self.audiorows[x].append_text(GstPbutils.pb_utils_get_codec_description(c))
-
if self.audiodata[x]['canpassthrough']==True:
- self.audiorows[x].append_text(_("Audio passthrough"))
self.audiocodecs[x].append("pass")
self.audiopassmenuno=(len(self.audiocodecs[x]))-1 #FIXME
- self.audiorows[x].set_sensitive(True)
- self.audiorows[x].set_active(0)
x=x+1
- else:
- self.audiorows[x].set_sensitive(False)
+
+ # populate menu
+
+ y=0
+ while y <= self.audiostreamcounter:
+ if self.usingpreset==True: # First fill menu based on presetvalue
+ testforempty = self.presetaudiocodec.to_string()
+ if testforempty != "EMPTY":
+
self.audiorows[y].append_text(str(GstPbutils.pb_utils_get_codec_description(self.presetaudiocodec)))
+ self.audiorows[y].set_active(0)
+ elif self.streamdata['container']==False: # special setup for container less case, looks
ugly, but good enough for now
+
self.audiorows[y].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/mpeg,
mpegversion=(int)1, layer=(int)3"))))
+
self.audiorows[y].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/mpeg,
mpegversion=4, stream-format=adts"))))
+
self.audiorows[y].append_text(str(GstPbutils.pb_utils_get_codec_description(Gst.caps_from_string("audio/x-flac"))))
+ self.audiorows[y].set_active(0)
+ self.audiorows[y].set_sensitive(True)
+ else:
+ audiolist = []
+ for c in self.audiocodecs[y]: # Use codec descriptions from GStreamer
+ if c != "pass":
+ self.audiorows[y].append_text(GstPbutils.pb_utils_get_codec_description(c))
+
+ if self.audiodata[y]['canpassthrough']==True:
+ self.audiorows[y].append_text(_("Audio passthrough"))
+
+ self.audiorows[y].set_sensitive(True)
+ self.audiorows[y].set_active(0)
+
+ else:
+ self.audiorows[y].set_sensitive(False)
+ y=y+1
# fill in with video
if self.havevideo==True:
@@ -1057,7 +1072,8 @@ class TransmageddonUI(Gtk.ApplicationWindow):
for c in video_codecs:
self.videocodecs.append(Gst.caps_from_string(codecfinder.codecmap[c]))
for c in self.videocodecs: # Use descriptions from GStreamer
- self.videorows[0].append_text(GstPbutils.pb_utils_get_codec_description(c))
+ if c != "pass" and c != "novid":
+ self.videorows[0].append_text(GstPbutils.pb_utils_get_codec_description(c))
self.videorows[0].set_sensitive(True)
self.videorows[0].set_active(0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]