baseparse: Add disable-clip property

Adding a property to allow pushing buffers that are out of segment,
and do not drop out of segment buffers by default

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8773>
This commit is contained in:
Seungha Yang 2025-04-04 04:41:24 +09:00 committed by GStreamer Marge Bot
parent 1688d2c410
commit ba05421ab2
2 changed files with 28 additions and 1 deletions

View File

@ -3760,6 +3760,10 @@ into the frame data that the picture starts.</doc>
</parameter>
</parameters>
</method>
<property name="disable-clip" version="1.28" writable="1" transfer-ownership="none" default-value="TRUE">
<doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstbaseparse.c">Disable dropping buffers that are out of segment</doc>
<type name="gboolean" c:type="gboolean"/>
</property>
<property name="disable-passthrough" writable="1" transfer-ownership="none" default-value="FALSE">
<doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstbaseparse.c">If set to %TRUE, baseparse will unconditionally force parsing of the
incoming data. This can be required in the rare cases where the incoming

View File

@ -220,6 +220,7 @@ struct _GstBaseParsePrivate
guint min_frame_size;
gboolean disable_passthrough;
gboolean disable_clip;
gboolean passthrough;
gboolean pts_interpolate;
gboolean infer_ts;
@ -356,11 +357,13 @@ typedef struct _GstBaseParseSeek
} GstBaseParseSeek;
#define DEFAULT_DISABLE_PASSTHROUGH FALSE
#define DEFAULT_DISABLE_CLIP TRUE
enum
{
PROP_0,
PROP_DISABLE_PASSTHROUGH,
PROP_DISABLE_CLIP,
PROP_LAST
};
@ -567,6 +570,18 @@ gst_base_parse_class_init (GstBaseParseClass * klass)
DEFAULT_DISABLE_PASSTHROUGH,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstBaseParse:disable-clip:
*
* Disable dropping buffers that are out of segment
*
* Since: 1.28
*/
g_object_class_install_property (gobject_class, PROP_DISABLE_CLIP,
g_param_spec_boolean ("disable-clip", "Disable Clip",
"Disable buffer dropping that are out of segment",
DEFAULT_DISABLE_CLIP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_parse_change_state);
@ -645,6 +660,7 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
parse->priv->parser_tags = NULL;
parse->priv->parser_tags_merge_mode = GST_TAG_MERGE_APPEND;
parse->priv->disable_passthrough = DEFAULT_DISABLE_PASSTHROUGH;
parse->priv->disable_clip = DEFAULT_DISABLE_CLIP;
}
static void
@ -657,6 +673,9 @@ gst_base_parse_set_property (GObject * object, guint prop_id,
case PROP_DISABLE_PASSTHROUGH:
parse->priv->disable_passthrough = g_value_get_boolean (value);
break;
case PROP_DISABLE_CLIP:
parse->priv->disable_clip = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -673,6 +692,9 @@ gst_base_parse_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_DISABLE_PASSTHROUGH:
g_value_set_boolean (value, parse->priv->disable_passthrough);
break;
case PROP_DISABLE_CLIP:
g_value_set_boolean (value, parse->priv->disable_clip);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -2582,7 +2604,8 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
parse->segment.stop + parse->priv->lead_out_ts) {
GST_LOG_OBJECT (parse, "Dropped frame, after segment");
ret = GST_FLOW_EOS;
} else if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
} else if (!parse->priv->disable_clip &&
GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
GST_BUFFER_DURATION_IS_VALID (buffer) &&
GST_CLOCK_TIME_IS_VALID (parse->segment.start) &&
GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer) +