'Gstreamer plugin how to call parent method
I am working on a GStreamer pipeline using Python API. I need to create a plugin to drop video frames when the pipeline is not capable to consuming them fast enough. It is my understanding that I could use a leaky queue, but so far nobody has been able to help with it, therefore I am trying to create a new plugin using Python.
First of all, I would like to override do_src_event to register the timestamp of the src_event and subsequently call the parent method do_src_event to perform the src_event. However, this does not seem to work:
TypeError: GstBase.BaseTransform.src_event() takes exactly 2 arguments (1 given)
Code:
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GObject, GLib, GstBase, GstVideo # noqa:F401,F402
from gstreamer.utils import gst_buffer_with_caps_to_ndarray
Gst.init(None)
class GstDropFrames(GstBase.BaseTransform):
GST_PLUGIN_NAME = 'gstdropframes'
__gstmetadata__ = (
"GstDropFrames",
"Filter/Effect/Video",
"Description",
"Author"
)
__gsttemplates__ = (
Gst.PadTemplate.new(
"src",
Gst.PadDirection.SRC,
Gst.PadPresence.ALWAYS,
Gst.Caps.new_any(),
),
Gst.PadTemplate.new("sink",
Gst.PadDirection.SINK,
Gst.PadPresence.ALWAYS,
Gst.Caps.new_any(),
)
)
__gproperties__ = {}
def __init__(self):
super(GstDropFrames, self).__init__()
print("Initialized GstDropFrames")
def do_src_event(self, event):
super(GstDropFrames, self).do_src_event(event)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
