mpeg4videoparse: allow sending config at IDR

Based on h264parse, also allow to send the config at every IDR.
This commit is contained in:
Marc Leeman 2019-07-31 18:03:19 +00:00 committed by Olivier Crête
parent 2a76807c9a
commit f5e7b4bd73
2 changed files with 12 additions and 7 deletions

View file

@ -103,7 +103,7 @@ gst_mpeg4vparse_set_property (GObject * object, guint property_id,
parse->drop = g_value_get_boolean (value); parse->drop = g_value_get_boolean (value);
break; break;
case PROP_CONFIG_INTERVAL: case PROP_CONFIG_INTERVAL:
parse->interval = g_value_get_uint (value); parse->interval = g_value_get_int (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -121,7 +121,7 @@ gst_mpeg4vparse_get_property (GObject * object, guint property_id,
g_value_set_boolean (value, parse->drop); g_value_set_boolean (value, parse->drop);
break; break;
case PROP_CONFIG_INTERVAL: case PROP_CONFIG_INTERVAL:
g_value_set_uint (value, parse->interval); g_value_set_int (value, parse->interval);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -142,16 +142,17 @@ gst_mpeg4vparse_class_init (GstMpeg4VParseClass * klass)
g_object_class_install_property (gobject_class, PROP_DROP, g_object_class_install_property (gobject_class, PROP_DROP,
g_param_spec_boolean ("drop", "drop", g_param_spec_boolean ("drop", "drop",
"Drop data untill valid configuration data is received either " "Drop data until valid configuration data is received either "
"in the stream or through caps", DEFAULT_PROP_DROP, "in the stream or through caps", DEFAULT_PROP_DROP,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CONFIG_INTERVAL, g_object_class_install_property (gobject_class, PROP_CONFIG_INTERVAL,
g_param_spec_uint ("config-interval", g_param_spec_int ("config-interval",
"Configuration Send Interval", "Configuration Send Interval",
"Send Configuration Insertion Interval in seconds (configuration headers " "Send Configuration Insertion Interval in seconds (configuration headers "
"will be multiplexed in the data stream when detected.) (0 = disabled)", "will be multiplexed in the data stream when detected.) "
0, 3600, DEFAULT_CONFIG_INTERVAL, "(0 = disabled, -1 = send with every IDR frame)",
-1, 3600, DEFAULT_CONFIG_INTERVAL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_static_pad_template (element_class, &src_template); gst_element_class_add_static_pad_template (element_class, &src_template);
@ -757,6 +758,10 @@ gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
push_codec = TRUE; push_codec = TRUE;
} }
if (mp4vparse->interval == -1) {
push_codec = TRUE;
}
/* periodic config sending */ /* periodic config sending */
if (mp4vparse->interval > 0 || push_codec) { if (mp4vparse->interval > 0 || push_codec) {
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer); GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);

View file

@ -68,7 +68,7 @@ struct _GstMpeg4VParse {
/* properties */ /* properties */
gboolean drop; gboolean drop;
guint interval; gint interval;
GstClockTime pending_key_unit_ts; GstClockTime pending_key_unit_ts;
GstEvent *force_key_unit_event; GstEvent *force_key_unit_event;
}; };