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.
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