2

I am developing a gstreamer application (plugin) that sinks from a video stream, analyzes each buffer for a certain condition and then if that condition is present passes the buffer to the plugin source. If the condition is not present for a given buffer, the buffer should be dropped and the plugin source should not receive this buffer.

Upon looking through the gstreamer documentation and tutorials as a newcomer to gstreamer, I cannot find a way for my plugin to "drop" a buffer.

rpb
  • 87
  • 1
  • 8

1 Answers1

2

Try using GstProbe for data buffers and return GST_PAD_PROBE_DROP or GST_PAD_PROBE_HANDLED when yours conditions are met.

If your plugin is based on GstBaseTransform, you should implement your own transform_frame_ip or transform_frame. If so, you can return GST_BASE_TRANSFORM_FLOW_DROPPED:

/**
 * GST_BASE_TRANSFORM_FLOW_DROPPED:
 *
 * A #GstFlowReturn that can be returned from transform and transform_ip to
 * indicate that no output buffer was generated.
 */
#define GST_BASE_TRANSFORM_FLOW_DROPPED   GST_FLOW_CUSTOM_SUCCESS 
Quarra
  • 2,527
  • 1
  • 19
  • 27
  • Any idea how to do that in Python? I can't find the constant `GST_BASE_TRANSFORM_FLOW_DROPPED` in the Python API – user1315621 Mar 07 '22 at 23:05
  • I can confirm that in version 1.18.1, if you create a custom element from the videofilter template using the script gst-plugins-bad-1.18.1/tools/gst-element-maker , then, returning GST_BASE_TRANSFORM_FLOW_DROPPED from gst_my_element_transform_frame() gives the desired behavior. – Vincent Achard Mar 14 '23 at 09:19