[transmageddon] Update with further fixes for plugin installation, not perfect yet, but better
- From: Christian Fredrik Kalager Schaller <uraeus src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [transmageddon] Update with further fixes for plugin installation, not perfect yet, but better
- Date: Sun, 5 Aug 2012 08:34:37 +0000 (UTC)
commit 437893af1d82ebb790fe88b3e8db0a5e78f85a09
Author: Christian Fredrik Kalager Schaller <uraeus linuxrisin org>
Date: Sun Aug 5 10:34:12 2012 +0200
Update with further fixes for plugin installation, not perfect yet, but better
src/codecfinder.py | 42 +++++++++++++++++++-------------
src/transmageddon.py | 64 ++++++++++++++++++++++++++++++++------------------
2 files changed, 66 insertions(+), 40 deletions(-)
---
diff --git a/src/codecfinder.py b/src/codecfinder.py
index 6180ca0..7ec73b2 100644
--- a/src/codecfinder.py
+++ b/src/codecfinder.py
@@ -130,8 +130,6 @@ def get_muxer_element(containercaps):
# This code is a lot simpler than what I used with 0.10 thanks to the list_is_type call.
# 16 is the 'muxer' class of plugins
if Gst.ElementFactory.list_is_type(fact, 16):
- test=fact.get_name()
- # print "muxer is " + str(test)
muxers.append(fact.get_name())
features.append(fact)
muxerfeature = dict(zip(muxers, features))
@@ -177,22 +175,30 @@ def get_audio_encoder_element(audioencodercaps):
features = []
elementname = False
for fact in flist:
- if list_compat(["Codec", "Encoder", "Audio"], \
- fact.get_metadata().split('/')):
+ if Gst.ElementFactory.list_is_type(fact, 2):
+ test=fact.get_name()
+ # print "audioencoder is " + str(test)
# 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)
+ if fact.get_name() != 'encodebin':
+ encoders.append(fact.get_name())
+ features.append(fact)
encoderfeature = dict(zip(encoders, features))
- incomingcaps = audioencodercaps
+
+ if isinstance(audioencodercaps, str): # this value should always be a caps value, so this sometimes being a string is a bug
+ incomingcaps = Gst.caps_from_string(audioencodercaps)
+ else:
+ incomingcaps = audioencodercaps
for x in encoders:
element = x
factory = Gst.Registry.get().lookup_feature(str(x))
sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
- if x.direction == Gst.PAD_SRC]
+ if x.direction == Gst.PadDirection.SRC]
for caps in sinkcaps:
- if caps.intersect(incomingcaps):
+ # print "incomingcaps is " +str(incomingcaps)
+ intersect= caps.intersect(incomingcaps).to_string()
+ if intersect != "EMPTY":
if elementname == False:
elementname = element
else:
@@ -222,23 +228,25 @@ def get_video_encoder_element(videoencodercaps):
features = []
elementname = False
for fact in flist:
- if list_compat(["Codec", "Encoder", "Video"], \
- fact.get_metadata().split('/')):
+ if Gst.ElementFactory.list_is_type(fact, 21):
encoders.append(fact.get_name())
features.append(fact)
- elif list_compat(["Codec", "Encoder", "Image"], \
- fact.get_metadata().split('/')):
- encoders.append(fact.get_name())
- features.append(fact)
+ # elif list_compat(["Codec", "Encoder", "Image"], \
+ # fact.get_metadata().split('/')):
+ # encoders.append(fact.get_name())
+ # features.append(fact)
encoderfeature = dict(zip(encoders, features))
+ # print "videoencodercaps is " + str(videoencodercaps)
incomingcaps = videoencodercaps
for x in encoders:
element = x
factory = Gst.Registry.get().lookup_feature(str(x))
sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() \
- if x.direction == Gst.PAD_SRC]
+ if x.direction == Gst.PadDirection.SRC]
for caps in sinkcaps:
- if caps.intersect(incomingcaps):
+ # print "incoming caps is " + str(incomingcaps)
+ intersect= caps.intersect(incomingcaps).to_string()
+ if intersect != "EMPTY":
if elementname == False:
elementname = element
else:
diff --git a/src/transmageddon.py b/src/transmageddon.py
index cebed6e..b91ad77 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -769,31 +769,49 @@ class TransmageddonUI:
def check_for_elements(self):
- containerstatus=False
- # This function checks for missing muxers and encoders
+ # this function checks for missing plugins using pbutils
if self.container==False:
containerstatus=True
videostatus=True
else:
- containerchoice = self.builder.get_object ("containerchoice").get_active_text()
- if containerchoice != None:
- containerstatus = codecfinder.get_muxer_element(codecfinder.containermap[containerchoice])
-
- if not containerstatus: # or not videostatus or not audiostatus:
- self.missingtoggle=True
- fail_info = []
- if containerstatus == False:
- print "containerchoice is " +str(containerchoice)
- muxercaps=Gst.caps_from_string(codecfinder.containermap[containerchoice])
- fail_info.append(muxercaps)
- missing = []
- for x in fail_info:
- missing.append(GstPbutils.missing_encoder_installer_detail_new(x))
- context = GstPbutils.InstallPluginsContext ()
- context.set_xid(self.TopWindow.get_window().get_xid())
- strmissing = str(missing)
- print strmissing
- GstPbutils.install_plugins_async (missing, context, \
+ containerchoice = self.builder.get_object ("containerchoice").get_active_text ()
+ containerstatus = codecfinder.get_muxer_element(codecfinder.containermap[containerchoice])
+ if self.havevideo:
+ if self.videopasstoggle != True:
+ if self.VideoCodec == "novid":
+ videostatus=True
+ else:
+ videostatus = codecfinder.get_video_encoder_element(self.VideoCodec)
+ else:
+ videostatus=True
+ if self.haveaudio:
+ if self.audiopasstoggle != True:
+ audiostatus = codecfinder.get_audio_encoder_element(self.AudioCodec)
+ else:
+ audiostatus=True
+ else:
+ audiostatus=True
+ if self.havevideo == False: # this flags help check if input is audio-only file
+ videostatus=True
+ if not containerstatus or not videostatus or not audiostatus:
+ self.missingtoggle=True
+ fail_info = []
+ if self.containertoggle==True:
+ audiostatus=True
+ videostatus=True
+ if containerstatus == False:
+ fail_info.append(Gst.caps_from_string(codecfinder.containermap[containerchoice]))
+ if audiostatus == False:
+ fail_info.append(self.AudioCodec)
+ if videostatus == False:
+ fail_info.append(self.VideoCodec)
+ missing = []
+ for x in fail_info:
+ missing.append(GstPbutils.missing_encoder_installer_detail_new(x))
+ context = GstPbutils.InstallPluginsContext ()
+ context.set_xid(self.TopWindow.get_window().get_xid())
+ strmissing = str(missing)
+ GstPbutils.install_plugins_async (missing, context, \
self.donemessage, "NULL")
# The transcodebutton is the one that calls the Transcoder class and thus
@@ -832,14 +850,14 @@ class TransmageddonUI:
self.ProgressBar.set_text(_("Pass %(count)d Progress") % {'count': self.passcounter})
if self.haveaudio:
if self.audiodata.has_key("samplerate"):
- # self.check_for_elements()
+ self.check_for_elements()
if self.missingtoggle==False:
self._start_transcoding()
else:
self.waiting_for_signal="True"
elif self.havevideo:
if self.videodata.has_key("videoheight"):
- # self.check_for_elements()
+ self.check_for_elements()
if self.missingtoggle==False:
self._start_transcoding()
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]