summaryrefslogtreecommitdiff
path: root/subprojects/gst-editing-services/tests
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/gst-editing-services/tests')
-rw-r--r--subprojects/gst-editing-services/tests/check/python/common.py13
-rw-r--r--subprojects/gst-editing-services/tests/check/python/test_assets.py6
2 files changed, 12 insertions, 7 deletions
diff --git a/subprojects/gst-editing-services/tests/check/python/common.py b/subprojects/gst-editing-services/tests/check/python/common.py
index 1593d68982..a07fd8f447 100644
--- a/subprojects/gst-editing-services/tests/check/python/common.py
+++ b/subprojects/gst-editing-services/tests/check/python/common.py
@@ -18,6 +18,7 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+from urllib.parse import urlparse
import gi
gi.require_version("Gst", "1.0")
@@ -116,13 +117,17 @@ def can_generate_assets():
@contextlib.contextmanager
-def created_video_asset(uri=None, num_bufs=30):
+def created_video_asset(uri=None, num_bufs=30, framerate="30/1"):
with tempfile.NamedTemporaryFile(suffix=".ogg") as f:
if not uri:
uri = Gst.filename_to_uri(f.name)
- transcoder = GstTranscoder.Transcoder.new("testbin://video,num-buffers=%s" % num_bufs,
- uri, "application/ogg:video/x-theora:audio/x-vorbis")
- transcoder.run()
+ name = f.name
+ else:
+ name = urlparse(uri).path
+ pipe = Gst.parse_launch(f"videotestsrc num-buffers={num_bufs} ! video/x-raw,framerate={framerate} ! theoraenc ! oggmux ! filesink location={name}")
+ pipe.set_state(Gst.State.PLAYING)
+ assert pipe.get_bus().timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)
+ pipe.set_state(Gst.State.NULL)
yield uri
diff --git a/subprojects/gst-editing-services/tests/check/python/test_assets.py b/subprojects/gst-editing-services/tests/check/python/test_assets.py
index e33c623009..9e6f6437cc 100644
--- a/subprojects/gst-editing-services/tests/check/python/test_assets.py
+++ b/subprojects/gst-editing-services/tests/check/python/test_assets.py
@@ -62,17 +62,17 @@ class TestTimeline(GESSimpleTimelineTest):
@unittest.skipUnless(*common.can_generate_assets())
def test_reload_asset(self):
- with common.created_video_asset() as uri:
+ with common.created_video_asset(num_bufs=2, framerate="2/1") as uri:
asset0 = GES.UriClipAsset.request_sync(uri)
self.assertEqual(asset0.props.duration, Gst.SECOND)
- with common.created_video_asset(uri, 60) as uri:
+ with common.created_video_asset(uri, 4, framerate="2/1") as uri:
GES.Asset.needs_reload(GES.UriClip, uri)
asset1 = GES.UriClipAsset.request_sync(uri)
self.assertEqual(asset1.props.duration, 2 * Gst.SECOND)
self.assertEqual(asset1, asset0)
- with common.created_video_asset(uri, 90) as uri:
+ with common.created_video_asset(uri, 6, framerate="2/1") as uri:
mainloop = common.create_main_loop()
def asset_loaded_cb(_, res, mainloop):
asset2 = GES.Asset.request_finish(res)