Skip to content
Snippets Groups Projects
Commit 46acb896 authored by Patrick Godwin's avatar Patrick Godwin
Browse files

pipeparts.py: special handling of 'async' property due to it being a reserved...

pipeparts.py: special handling of 'async' property due to it being a reserved keyword in python 3.7+
parent c7c8e721
No related branches found
No related tags found
1 merge request!30`async` gstreamer property handling in pipeparts.py
......@@ -93,6 +93,9 @@ def mkgeneric(pipeline, src, elem_type_name, **properties):
elem = Gst.ElementFactory.make(elem_type_name, None)
if elem is None:
raise RuntimeError("unknown failure creating \"%s\" element: confirm that the correct plugins are being loaded" % elem_type_name)
# handle properties with names that collide with reserved keywords
if "async_" in properties:
properties["async"] = properties.pop("async_")
for name, value in properties.items():
elem.set_property(name.replace("_", "-"), value)
pipeline.add(elem)
......@@ -399,8 +402,9 @@ def mkframecppfilesink(pipeline, src, message_forward = True, **properties):
## Adds a <a href="@gstpluginsgooddoc/gst-plugins-good-plugins-multifilesink.html">multifilesink</a> element to a pipeline with useful default properties
def mkmultifilesink(pipeline, src, next_file = 0, sync = False, async = False, **properties):
return mkgeneric(pipeline, src, "multifilesink", next_file = next_file, sync = sync, async = async, **properties)
def mkmultifilesink(pipeline, src, next_file = 0, sync = False, async_ = False, **properties):
properties["async"] = async_
return mkgeneric(pipeline, src, "multifilesink", next_file = next_file, sync = sync, **properties)
def mkndssrc(pipeline, host, instrument, channel_name, channel_type, blocksize = 16384 * 8 * 1, port = 31200):
......@@ -653,12 +657,12 @@ def mkautochisq(pipeline, src, autocorrelation_matrix = None, mask_matrix = None
## Adds a <a href="@gstdoc/gstreamer-plugins-fakesink.html">fakesink</a> element to a pipeline with useful default properties
def mkfakesink(pipeline, src):
return mkgeneric(pipeline, src, "fakesink", sync = False, async = False)
return mkgeneric(pipeline, src, "fakesink", sync = False, **{"async": False})
## Adds a <a href="@gstdoc/gstreamer-plugins-filesink.html">filesink</a> element to a pipeline with useful default properties
def mkfilesink(pipeline, src, filename, sync = False, async = False):
return mkgeneric(pipeline, src, "filesink", sync = sync, async = async, buffer_mode = 2, location = filename)
def mkfilesink(pipeline, src, filename, sync = False, async_ = False):
return mkgeneric(pipeline, src, "filesink", sync = sync, buffer_mode = 2, location = filename, **{"async": async_})
## Adds a <a href="@gstlalgtkdoc/GstTSVEnc.html">lal_nxydump</a> element to a pipeline with useful default properties
......@@ -693,7 +697,7 @@ def mktriggergen(pipeline, snr, chisq, template_bank_filename, snr_threshold, si
def mktriggerxmlwritersink(pipeline, src, filename):
return mkgeneric(pipeline, src, "lal_triggerxmlwriter", sync = False, async = False, location = filename)
return mkgeneric(pipeline, src, "lal_triggerxmlwriter", location = filename, sync = False, **{"async": False})
## Adds a <a href="@gstpluginsgooddoc/gst-plugins-good-plugins-wavenc.html">wavenc</a> element to a pipeline with useful default properties
......@@ -788,8 +792,9 @@ def mkdeglitcher(pipeline, src, segment_list):
# FIXME no specific alias for this url since this library only has one element.
# DO NOT DOCUMENT OTHER CODES THIS WAY! Use @gstdoc @gstpluginsbasedoc etc.
## Adds a <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gstreamer-app.html">appsink</a> element to a pipeline with useful default properties
def mkappsink(pipeline, src, max_buffers = 1, drop = False, sync = False, async = False, **properties):
return mkgeneric(pipeline, src, "appsink", sync = sync, async = async, emit_signals = True, max_buffers = max_buffers, drop = drop, **properties)
def mkappsink(pipeline, src, max_buffers = 1, drop = False, sync = False, async_ = False, **properties):
properties["async"] = async_
return mkgeneric(pipeline, src, "appsink", sync = sync, emit_signals = True, max_buffers = max_buffers, drop = drop, **properties)
class AppSync(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment