• Jetson Xavier NX
• DeepStream 6.1
• JetPack Version 5.0.1
I have written a gstreamer python plugin (gst-python) which works well on JetPack 4.6.1.
I want now to migrate to JP 5.0.1 and the same plugin gives me the following error:
Traceback (most recent call last):
File "/home/.../save_image_snapshot_py.py", line 91, in event_func
self.segment = segment
RuntimeError: field is not writable
The python plugin relevant code is:
class GstImgSnapShot(GstBase.BaseTransform):
GST_PLUGIN_NAME = "save_image_snapshot"
__gstmetadata__ = ("save-image-snapshot", # Name
"Tool", # Transform
"save-image-snapshot", # Description
"...") # Author
# Here we define the pads
__gsttemplates__ = (Gst.PadTemplate.new("src",
Gst.PadDirection.SRC,
Gst.PadPresence.ALWAYS,
# Set to RGB format
Gst.Caps.new_any()),
Gst.PadTemplate.new("sink",
Gst.PadDirection.SINK,
Gst.PadPresence.ALWAYS,
# Set to RGB format
Gst.Caps.new_any()))
# Here we define the possible parameters
__gproperties__ = {
"record-dict": (GObject.TYPE_PYOBJECT, # type
"record_dict", # nick
"record_dict", # blurb
GObject.ParamFlags.READWRITE # flags
)
}
def __init__(self):
# initialization function is called whenever the corresponding element is created in the application software
super(GstImgSnapShot, self).__init__()
# # set chain and event function on sinkpad
self.sinkpads[0].set_chain_function_full(self.chain_function, None)
self.sinkpads[0].set_event_function_full(self.event_func, None)
self.record_dict = {"do_record":False}
def do_get_property(self, prop: GObject.GParamSpec):
# getter function for the properties
raise NotImplementedError('Not implemented')
def do_set_property(self, prop: GObject.GParamSpec, setting_json):
# setter function for the properties
if prop.name == 'record-dict':
self.record_dict = setting_json
else:
raise AttributeError('unknown property %s' % prop.name)
def event_func(self, pad, parent, event):
# event function handling events on sinkpad
if event.type == Gst.EventType.CAPS:
# get the frame resolution from the caps
caps_structure = event.parse_caps().get_structure(0)
self.resolution = (caps_structure.get_value("height"), caps_structure.get_value("width"))
ret = self.srcpads[0].push_event (event)
if event.type == Gst.EventType.SEGMENT:
ret = pad.event_default (parent, event)
segment = event.parse_segment()
self.segment = segment # <----- the error seems to be here!
else:
ret = pad.event_default (parent, event)
return ret
The plugin inherits from GstBaseTransform
which does have the segment
property but I do not know why it is not set as writable.
Any help is very much appreciated.
Thanks!