Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from twisted.internet import defer
- # moving this down causes havoc when running this file directly for some reason
- from flumotion.common import errors, log
- -
- -import gobject
- -import gst
- +import gi
- +gi.require_version('Gst', '1.0')
- +from gi.repository import GObject, Gst
- +GObject.threads_init()
- +Gst.init(None)
- __version__ = "$Rev$"
- @@ -47,13 +49,13 @@ def verbose_deep_notify_cb(object, orig, pspec, component):
- A default deep-notify signal handler for pipelines.
- """
- value = orig.get_property(pspec.name)
- - if pspec.value_type == gobject.TYPE_BOOLEAN:
- + if pspec.value_type == GObject.TYPE_BOOLEAN:
- if value:
- value = 'TRUE'
- else:
- value = 'FALSE'
- output = value
- - elif pspec.value_type == gst.Caps.__gtype__:
- + elif pspec.value_type == Gst.Caps.__gtype__:
- output = caps_repr(value)
- else:
- output = value
- @@ -87,8 +89,8 @@ def element_factory_has_property(element_factory, property_nam
- @rtype: boolean
- """
- root@track-HP-ProBook-4520s:/flumotion# clear
- root@track-HP-ProBook-4520s:/flumotion# git diff --color flumotion/test/test_common_gstreamer.py flumotion/test/test_common_gstreamer.py
- diff --git a/flumotion/test/test_common_gstreamer.py b/flumotion/test/test_commo
- index f075a45..2e4b543 100644
- --- a/flumotion/test/test_common_gstreamer.py
- +++ b/flumotion/test/test_common_gstreamer.py
- @@ -15,7 +15,9 @@
- #
- # Headers in this file shall remain intact.
- -import gst
- +import gi
- +gi.require_version('Gst', '1.0')
- +from gi.repository import Gst
- from twisted.trial import unittest
- from flumotion.common import gstreamer
- @@ -33,7 +35,7 @@ class Factory(unittest.TestCase):
- @@ -33,7 +35,7 @@ class Factory(unittest.TestCase):
- class Caps(unittest.TestCase):
- def testCaps(self):
- - caps = gst.caps_from_string(
- + caps = Gst.caps_from_string(
- 'video/x-raw-yuv,width=10,framerate=5.0;video/x-raw-rgb,'
- 'width=15,framerate=10.0')
- self.assertEquals(gstreamer.caps_repr(caps),
- @@ -42,7 +44,7 @@ class Caps(unittest.TestCase):
- 'width=(int)15, framerate=(double)10')
- def testCapsStreamheader(self):
- - caps = gst.caps_from_string('application/ogg,streamheader=abcd')
- + caps = Gst.caps_from_string('application/ogg,streamheader=abcd')
- self.assertEquals(gstreamer.caps_repr(caps),
- 'streamheader=<...>')
- @@ -54,16 +56,16 @@ class FakeComponent:
- def run_it_a_little_while(p):
- - p.set_state(gst.STATE_PLAYING)
- - m = p.get_bus().poll(gst.MESSAGE_EOS, -1)
- - p.set_state(gst.STATE_NULL)
- + p.set_state(Gst.STATE.PLAYING)
- + m = p.get_bus().poll(Gst.MESSAGE_EOS, -1)
- + p.set_state(Gst.STATE.NULL)
- class DeepNotify(unittest.TestCase):
- def testDeepNotify(self):
- component = FakeComponent()
- - pipeline = gst.parse_launch('fakesrc num-buffers=3 ! fakesink')
- + pipeline = Gst.parse_launch('fakesrc num-buffers=3 ! fakesink')
- pipeline.connect('deep-notify', gstreamer.verbose_deep_notify_cb,
- component)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement