Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
Change morituri/common/gstreamer.py to use gstreamer 1.x.
Browse files Browse the repository at this point in the history
We have to change other files since we (gently) break internal API.
  • Loading branch information
Alex Vong committed Nov 29, 2015
1 parent 135b2f7 commit 607f3e9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
22 changes: 15 additions & 7 deletions morituri/common/gstreamer.py
Expand Up @@ -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:
Expand All @@ -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<version>[\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
Expand Down
2 changes: 1 addition & 1 deletion morituri/result/result.py
Expand Up @@ -106,7 +106,7 @@ class RipResult:
cdparanoiaDefeatsCache = None

gstreamerVersion = None
gstPythonVersion = None
pyGIVersion = None
encoderVersion = None

profileName = None
Expand Down
2 changes: 1 addition & 1 deletion morituri/rip/cd.py
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion morituri/test/test_common_gstreamer.py
Expand Up @@ -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):
Expand Down

0 comments on commit 607f3e9

Please sign in to comment.