Advertisement
Guest User

Untitled

a guest
Jun 19th, 2013
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.13 KB | None | 0 0
  1.  from twisted.internet import defer
  2.  # moving this down causes havoc when running this file directly for some reason
  3.  from flumotion.common import errors, log
  4. -
  5. -import gobject
  6. -import gst
  7. +import gi
  8. +gi.require_version('Gst', '1.0')
  9. +from gi.repository import GObject, Gst
  10. +GObject.threads_init()
  11. +Gst.init(None)
  12.  
  13.  __version__ = "$Rev$"
  14.  
  15. @@ -47,13 +49,13 @@ def verbose_deep_notify_cb(object, orig, pspec, component):
  16.      A default deep-notify signal handler for pipelines.
  17.      """
  18.      value = orig.get_property(pspec.name)
  19. -    if pspec.value_type == gobject.TYPE_BOOLEAN:
  20. +    if pspec.value_type == GObject.TYPE_BOOLEAN:
  21.          if value:
  22.              value = 'TRUE'
  23.          else:
  24.              value = 'FALSE'
  25.          output = value
  26. -    elif pspec.value_type == gst.Caps.__gtype__:
  27. +    elif pspec.value_type == Gst.Caps.__gtype__:
  28.          output = caps_repr(value)
  29.      else:
  30.          output = value
  31. @@ -87,8 +89,8 @@ def element_factory_has_property(element_factory, property_nam
  32.      @rtype: boolean
  33.      """
  34. root@track-HP-ProBook-4520s:/flumotion# clear
  35.  
  36. root@track-HP-ProBook-4520s:/flumotion# git diff --color flumotion/test/test_common_gstreamer.py flumotion/test/test_common_gstreamer.py
  37. diff --git a/flumotion/test/test_common_gstreamer.py b/flumotion/test/test_commo
  38. index f075a45..2e4b543 100644
  39. --- a/flumotion/test/test_common_gstreamer.py
  40. +++ b/flumotion/test/test_common_gstreamer.py
  41. @@ -15,7 +15,9 @@
  42.  #
  43.  # Headers in this file shall remain intact.
  44.  
  45. -import gst
  46. +import gi
  47. +gi.require_version('Gst', '1.0')
  48. +from gi.repository import Gst
  49.  from twisted.trial import unittest
  50.  
  51.  from flumotion.common import gstreamer
  52. @@ -33,7 +35,7 @@ class Factory(unittest.TestCase):
  53. @@ -33,7 +35,7 @@ class Factory(unittest.TestCase):
  54.  class Caps(unittest.TestCase):
  55.  
  56.      def testCaps(self):
  57. -        caps = gst.caps_from_string(
  58. +        caps = Gst.caps_from_string(
  59.              'video/x-raw-yuv,width=10,framerate=5.0;video/x-raw-rgb,'
  60.              'width=15,framerate=10.0')
  61.          self.assertEquals(gstreamer.caps_repr(caps),
  62. @@ -42,7 +44,7 @@ class Caps(unittest.TestCase):
  63.                            'width=(int)15, framerate=(double)10')
  64.  
  65.      def testCapsStreamheader(self):
  66. -        caps = gst.caps_from_string('application/ogg,streamheader=abcd')
  67. +        caps = Gst.caps_from_string('application/ogg,streamheader=abcd')
  68.          self.assertEquals(gstreamer.caps_repr(caps),
  69.              'streamheader=<...>')
  70.  
  71. @@ -54,16 +56,16 @@ class FakeComponent:
  72.  
  73.  
  74.  def run_it_a_little_while(p):
  75. -    p.set_state(gst.STATE_PLAYING)
  76. -    m = p.get_bus().poll(gst.MESSAGE_EOS, -1)
  77. -    p.set_state(gst.STATE_NULL)
  78. +    p.set_state(Gst.STATE.PLAYING)
  79. +    m = p.get_bus().poll(Gst.MESSAGE_EOS, -1)
  80. +    p.set_state(Gst.STATE.NULL)
  81.  
  82.  
  83.  class DeepNotify(unittest.TestCase):
  84.  
  85.      def testDeepNotify(self):
  86.          component = FakeComponent()
  87. -        pipeline = gst.parse_launch('fakesrc num-buffers=3 ! fakesink')
  88. +        pipeline = Gst.parse_launch('fakesrc num-buffers=3 ! fakesink')
  89.          pipeline.connect('deep-notify', gstreamer.verbose_deep_notify_cb,
  90.              component)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement