diff --git a/morituri/common/gstreamer.py b/morituri/common/gstreamer.py index fd5c38a9..694a8d25 100644 --- a/morituri/common/gstreamer.py +++ b/morituri/common/gstreamer.py @@ -31,8 +31,10 @@ def removeAudioParsers(): log.debug('gstreamer', 'Removing buggy audioparsers plugin if needed') - import gst - registry = gst.registry_get_default() + import gi + gi.require_version('Gst', '1.0') + from gi.repository import Gst + registry = Gst.Registry.get() plugin = registry.find_plugin("audioparsersbad") if plugin: @@ -54,16 +56,22 @@ def removeAudioParsers(): registry.remove_plugin(plugin) def gstreamerVersion(): - import gst - return _versionify(gst.version()) + import gi + gi.require_version('Gst', '1.0') + from gi.repository import Gst + return _versionify(Gst.version()) -def gstPythonVersion(): - import gst - return _versionify(gst.pygst_version) +def pyGIVersion(): + import gi + gi.require_version('Gst', '1.0') + from gi.repository import Gst + return _versionify(gi.version_info) _VERSION_RE = re.compile( "Version:\s*(?P[\d.]+)") +# FIXME: gstreamer 1.x should have fix this bug +# FIXME: find a less hackish way in gstreamer 1.x to make this work def elementFactoryVersion(name): # surprisingly, there is no python way to get from an element factory # to its plugin and its version directly; you can only compare diff --git a/morituri/result/result.py b/morituri/result/result.py index 7d257074..c9abad53 100644 --- a/morituri/result/result.py +++ b/morituri/result/result.py @@ -106,7 +106,7 @@ class RipResult: cdparanoiaDefeatsCache = None gstreamerVersion = None - gstPythonVersion = None + pyGIVersion = None encoderVersion = None profileName = None diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index c787d3fe..9bc63966 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -274,7 +274,7 @@ def doCommand(self): self.program.result.profilePipeline = profile.pipeline elementFactory = profile.pipeline.split(' ')[0] self.program.result.gstreamerVersion = gstreamer.gstreamerVersion() - self.program.result.gstPythonVersion = gstreamer.gstPythonVersion() + self.program.result.PYGIVersion = gstreamer.PYGIVersion() self.program.result.encoderVersion = gstreamer.elementFactoryVersion( elementFactory) diff --git a/morituri/test/test_common_gstreamer.py b/morituri/test/test_common_gstreamer.py index 94de5c41..ff4fcf2e 100644 --- a/morituri/test/test_common_gstreamer.py +++ b/morituri/test/test_common_gstreamer.py @@ -13,7 +13,7 @@ def testGStreamer(self): self.failUnless(version.startswith('0.')) def testGSTPython(self): - version = gstreamer.gstPythonVersion() + version = gstreamer.pyGIVersion() self.failUnless(version.startswith('0.')) def testFlacEnc(self):