mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
wrap state_change_async and show that it works
Original commit message from CVS: wrap state_change_async and show that it works
This commit is contained in:
parent
a74cc80a77
commit
9aa8bb0b72
3 changed files with 51 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-09-12 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* gst/gst.defs:
|
||||||
|
* testsuite/test_pipeline.py:
|
||||||
|
wrap state_change_async and show that it works
|
||||||
|
|
||||||
2005-09-12 Thomas Vander Stichele <thomas at apestaart dot org>
|
2005-09-12 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* examples/vumeter.py:
|
* examples/vumeter.py:
|
||||||
|
|
|
@ -1055,6 +1055,15 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(define-method set_state_async
|
||||||
|
(of-object "GstElement")
|
||||||
|
(c-name "gst_element_set_state_async")
|
||||||
|
(return-type "GstStateChangeReturn")
|
||||||
|
(parameters
|
||||||
|
'("GstState" "state")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(define-method abort_state
|
(define-method abort_state
|
||||||
(of-object "GstElement")
|
(of-object "GstElement")
|
||||||
(c-name "gst_element_abort_state")
|
(c-name "gst_element_abort_state")
|
||||||
|
|
|
@ -24,6 +24,8 @@ import time
|
||||||
|
|
||||||
from common import gst, unittest
|
from common import gst, unittest
|
||||||
|
|
||||||
|
import gobject
|
||||||
|
|
||||||
class PipelineConstructor(unittest.TestCase):
|
class PipelineConstructor(unittest.TestCase):
|
||||||
def testGoodConstructor(self):
|
def testGoodConstructor(self):
|
||||||
name = 'test-pipeline'
|
name = 'test-pipeline'
|
||||||
|
@ -52,5 +54,39 @@ class Pipeline(unittest.TestCase):
|
||||||
self.pipeline.set_state(gst.STATE_NULL)
|
self.pipeline.set_state(gst.STATE_NULL)
|
||||||
self.assertEqual(self.pipeline.get_state(None)[1], gst.STATE_NULL)
|
self.assertEqual(self.pipeline.get_state(None)[1], gst.STATE_NULL)
|
||||||
|
|
||||||
|
class PipelineAndBus(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.pipeline = gst.Pipeline('test-pipeline')
|
||||||
|
self.pipeline.set_property('play-timeout', 0L)
|
||||||
|
source = gst.element_factory_make('fakesrc', 'source')
|
||||||
|
sink = gst.element_factory_make('fakesink', 'sink')
|
||||||
|
self.pipeline.add_many(source, sink)
|
||||||
|
gst.element_link_many(source, sink)
|
||||||
|
|
||||||
|
self.bus = self.pipeline.get_bus()
|
||||||
|
self.bus.add_watch(self._message_received)
|
||||||
|
|
||||||
|
self.loop = gobject.MainLoop()
|
||||||
|
|
||||||
|
def _message_received(self, bus, message):
|
||||||
|
gst.debug('received message: %s, %s' % (
|
||||||
|
message.src.get_path_string(), message.type.value_nicks[1]))
|
||||||
|
t = message.type
|
||||||
|
if t == gst.MESSAGE_STATE_CHANGED:
|
||||||
|
old, new = message.parse_state_changed()
|
||||||
|
gst.debug('%r state change from %r to %r' % (
|
||||||
|
message.src.get_path_string(), old, new))
|
||||||
|
if message.src == self.pipeline and new == gst.STATE_PLAYING:
|
||||||
|
self.loop.quit()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def testPlaying(self):
|
||||||
|
ret = self.pipeline.set_state_async(gst.STATE_PLAYING)
|
||||||
|
self.assertEquals(ret, gst.STATE_CHANGE_ASYNC)
|
||||||
|
|
||||||
|
# go into a main loop to wait for messages
|
||||||
|
self.loop.run()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue