2005-09-01 10:36:07 +00:00
|
|
|
# -*- Mode: Python -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
#
|
|
|
|
# gst-python - Python bindings for GStreamer
|
|
|
|
# Copyright (C) 2002 David I. Lehn
|
|
|
|
# Copyright (C) 2004 Johan Dahlin
|
|
|
|
# Copyright (C) 2005 Edward Hervey
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
2004-03-08 19:22:15 +00:00
|
|
|
from common import gst, unittest
|
|
|
|
|
2004-04-16 13:56:39 +00:00
|
|
|
class PipelineConstructor(unittest.TestCase):
|
|
|
|
def testGoodConstructor(self):
|
|
|
|
name = 'test-pipeline'
|
|
|
|
pipeline = gst.Pipeline(name)
|
|
|
|
assert pipeline is not None, 'pipeline is None'
|
|
|
|
assert isinstance(pipeline, gst.Pipeline), 'pipeline is not a GstPipline'
|
|
|
|
assert pipeline.get_name() == name, 'pipelines name is wrong'
|
|
|
|
|
gst/: Added GError wrapping,
Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Added GError wrapping,
Removed data field from Buffer,
Added virtual methods to object
Updated to latest API
* gst/gst.override:
wrapped gst_plugin_get_feature_list(), gst_uri_handler_get_protocols(),
gst_registry_pool_list()
* gst/gstbuffer.override:
gst.Buffer() works
get/setters fixed
wrapped gst_buffer_stamp()
* gst/gstbus.override:
wrapped gst_bus_set_sync_handler() and gst_bus_add_watch()
* gst/gstelement.override:
wrapped gst_element_send_event(), gst_element_factory_get_pad_templates()
gst_element_query_convert(), gst_element_get_query_types()
* gst/gstevent.override:
wrapped gst_event_discont_get_value()
* gst/gstmessage.override:
wrapped gst_message_parse_state_changed(), gst_message_parse_error(),
gst_message_parse_warning(), gst_message_parse_tag()
* gst/gstmodule.c:
Added registration of new fundamental type with pygtk
* gst/gstpad.override:
wrapped gst_pad_query(), gst_pad_[add|remove]_[data|event|buffer]_probe(),
gst_pad_query_position(), gst_pad_query_convert()
* gst/gstquery.override:
wrapped gst_query_parse_position(), gst_query_parse_convert(),
gst_query_parse_seeking_query(), gst_query_parse_seeking_reponse()
* gst/pygstminiobject.c:
fixes
* gst/Makefile.am:
added gstbus.override, gstmessage.override, gstquery.override
* testsuite/test_buffer.py:
* testsuite/test_element.py:
* testsuite/test_event.py:
* testsuite/test_pipeline.py:
Updating testsuites
2005-07-12 09:45:58 +00:00
|
|
|
## class ThreadConstructor(unittest.TestCase):
|
|
|
|
## def testCreate(self):
|
|
|
|
## thread = gst.Thread('test-thread')
|
|
|
|
## assert thread is not None, 'thread is None'
|
|
|
|
## assert isinstance(thread, gst.Thread)
|
2004-04-16 13:56:39 +00:00
|
|
|
|
|
|
|
class Pipeline(unittest.TestCase):
|
2004-03-08 19:22:15 +00:00
|
|
|
def setUp(self):
|
|
|
|
self.pipeline = gst.Pipeline('test-pipeline')
|
2004-10-11 08:47:37 +00:00
|
|
|
source = gst.element_factory_make('fakesrc', 'source')
|
2004-03-08 19:22:15 +00:00
|
|
|
source.set_property('num-buffers', 5)
|
2004-10-11 08:47:37 +00:00
|
|
|
sink = gst.element_factory_make('fakesink', 'sink')
|
2004-03-08 19:22:15 +00:00
|
|
|
self.pipeline.add_many(source, sink)
|
|
|
|
gst.element_link_many(source, sink)
|
|
|
|
|
|
|
|
def testRun(self):
|
|
|
|
self.assertEqual(self.pipeline.get_state(), gst.STATE_NULL)
|
|
|
|
self.pipeline.set_state(gst.STATE_PLAYING)
|
|
|
|
self.assertEqual(self.pipeline.get_state(), gst.STATE_PLAYING)
|
|
|
|
|
|
|
|
while self.pipeline.iterate():
|
|
|
|
pass
|
|
|
|
|
|
|
|
self.assertEqual(self.pipeline.get_state(), gst.STATE_PAUSED)
|
|
|
|
self.pipeline.set_state(gst.STATE_NULL)
|
|
|
|
self.assertEqual(self.pipeline.get_state(), gst.STATE_NULL)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|