"GstRTPHeaderExtensionClass::get_max_size",
"GstRTPHeaderExtensionClass::get_supported_flags",
"GstRTPHeaderExtensionClass::read",
- "GstRTPHeaderExtensionClass::set_attributes_from_caps",
+ "GstRTPHeaderExtensionClass::set_attributes",
"GstRTPHeaderExtensionClass::set_caps_from_attributes",
"GstRTPHeaderExtensionClass::set_non_rtp_sink_caps",
"GstRTPHeaderExtensionClass::update_non_rtp_src_caps",
"zbar:message",
"zebrastripe",
"zebrastripe:threshold"
-]
\ No newline at end of file
+]
GstStructure *structure;
gchar *field_name;
const GValue *val;
+ GstRTPHeaderExtensionDirection direction =
+ GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT;
+ const gchar *attributes = "";
+ gboolean ret = TRUE;
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
const gchar *dir = g_value_get_string (inner_val);
if (!strcmp (dir, ""))
- priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT;
+ direction = GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT;
else if (!strcmp (dir, "sendrecv"))
- priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV;
+ direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV;
else if (!strcmp (dir, "sendonly"))
- priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY;
+ direction = GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY;
else if (!strcmp (dir, "recvonly"))
- priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY;
+ direction = GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY;
else if (!strcmp (dir, "inactive"))
- priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE;
+ direction = GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE;
else
goto error;
} else {
inner_val = gst_value_array_get_value (val, 2);
if (!G_VALUE_HOLDS_STRING (inner_val))
goto error;
+
+ attributes = g_value_get_string (inner_val);
} else {
/* unknown caps format */
goto error;
}
- if (klass->set_attributes_from_caps)
- return klass->set_attributes_from_caps (ext, caps);
- else
- return TRUE;
+ if (klass->set_attributes)
+ ret = klass->set_attributes (ext, direction, attributes);
+
+ if (ret)
+ priv->direction = direction;
+
+ return ret;
error:
return FALSE;
* extension needs for its function.
* @update_non_rtp_src_caps: update depayloader non-RTP (depayloaded) caps with
* the information parsed from RTP header.
- * @set_attributes_from_caps: read the caps information to set the necessary
- * attributes that may be signaled e.g. with an SDP.
+ * @set_attributes: set the necessary attributes that may be signaled e.g. with
+ * an SDP.
* @set_caps_from_attributes: write the necessary caps field/s for the configured
* attributes e.g. as signalled with SDP.
*
const GstCaps * caps);
gboolean (*update_non_rtp_src_caps) (GstRTPHeaderExtension * ext,
GstCaps * caps);
- gboolean (*set_attributes_from_caps) (GstRTPHeaderExtension * ext,
- const GstCaps * caps);
+ gboolean (*set_attributes) (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction,
+ const gchar * attributes);
gboolean (*set_caps_from_attributes) (GstRTPHeaderExtension * ext,
GstCaps * caps);
gst_rtp_dummy_hdr_ext_set_caps_from_attributes (GstRTPHeaderExtension * ext,
GstCaps * caps);
static gboolean
-gst_rtp_dummy_hdr_ext_set_attributes_from_caps (GstRTPHeaderExtension * ext,
- const GstCaps * caps);
+gst_rtp_dummy_hdr_ext_set_attributes (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction, const gchar * attributes);
static gboolean
gst_rtp_dummy_hdr_ext_update_non_rtp_src_caps (GstRTPHeaderExtension * ext,
GstCaps * caps);
gst_rtp_dummy_hdr_ext_get_max_size;
gstrtpheaderextension_class->write = gst_rtp_dummy_hdr_ext_write;
gstrtpheaderextension_class->read = gst_rtp_dummy_hdr_ext_read;
- gstrtpheaderextension_class->set_attributes_from_caps =
- gst_rtp_dummy_hdr_ext_set_attributes_from_caps;
+ gstrtpheaderextension_class->set_attributes =
+ gst_rtp_dummy_hdr_ext_set_attributes;
gstrtpheaderextension_class->set_caps_from_attributes =
gst_rtp_dummy_hdr_ext_set_caps_from_attributes;
gstrtpheaderextension_class->update_non_rtp_src_caps =
}
static gboolean
-gst_rtp_dummy_hdr_ext_set_attributes_from_caps (GstRTPHeaderExtension * ext,
- const GstCaps * caps)
+gst_rtp_dummy_hdr_ext_set_attributes (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction, const gchar * attributes)
{
GstRTPDummyHdrExt *dummy = GST_RTP_DUMMY_HDR_EXT (ext);
- gchar *field_name = gst_rtp_header_extension_get_sdp_caps_field_name (ext);
- GstStructure *s = gst_caps_get_structure (caps, 0);
- const gchar *ext_uri;
- const GValue *arr;
- gchar *new_attrs = NULL;
dummy->set_attributes_count++;
- if (!field_name)
- return FALSE;
-
- if ((ext_uri = gst_structure_get_string (s, field_name))) {
- if (g_strcmp0 (ext_uri, gst_rtp_header_extension_get_uri (ext)) != 0) {
- /* incompatible extension uri for this instance */
- goto error;
- }
- } else if ((arr = gst_structure_get_value (s, field_name))
- && GST_VALUE_HOLDS_ARRAY (arr)
- && gst_value_array_get_size (arr) == 3) {
- const GValue *val;
-
- val = gst_value_array_get_value (arr, 1);
- if (!G_VALUE_HOLDS_STRING (val))
- goto error;
- if (g_strcmp0 (g_value_get_string (val),
- gst_rtp_header_extension_get_uri (ext)) != 0)
- goto error;
-
- val = gst_value_array_get_value (arr, 2);
- if (!G_VALUE_HOLDS_STRING (val))
- goto error;
- new_attrs = g_value_dup_string (val);
- } else {
- /* unknown caps format */
- goto error;
- }
-
g_free (dummy->attributes);
- dummy->attributes = new_attrs;
+ dummy->attributes = g_strdup (attributes);
- g_free (field_name);
return TRUE;
-
-error:
- g_free (field_name);
- g_free (new_attrs);
- return FALSE;
}
static gboolean
}
static gboolean
-gst_rtp_header_extension_rfc6464_set_attributes_from_caps (GstRTPHeaderExtension
- * ext, const GstCaps * caps)
+gst_rtp_header_extension_rfc6464_set_attributes (GstRTPHeaderExtension * ext,
+ GstRTPHeaderExtensionDirection direction, const gchar * attributes)
{
- gchar *field_name = gst_rtp_header_extension_get_sdp_caps_field_name (ext);
- GstStructure *s = gst_caps_get_structure (caps, 0);
- const GValue *arr;
-
- arr = gst_structure_get_value (s, field_name);
- g_free (field_name);
-
- if (GST_VALUE_HOLDS_ARRAY (arr)) {
- const GValue *val = gst_value_array_get_value (arr, 2);
- const gchar *vad_attr = g_value_get_string (val);
-
- if (g_str_equal (vad_attr, "vad=on"))
- set_vad (ext, TRUE);
- else if (g_str_equal (vad_attr, "vad=off"))
- set_vad (ext, FALSE);
- else {
- GST_WARNING_OBJECT (ext, "Invalid attribute: %s", vad_attr);
- return FALSE;
- }
+ if (g_str_equal (attributes, "vad=on") || g_str_equal (attributes, "")) {
+ set_vad (ext, TRUE);
+ } else if (g_str_equal (attributes, "vad=off")) {
+ set_vad (ext, FALSE);
+ } else {
+ GST_WARNING_OBJECT (ext, "Invalid attribute: %s", attributes);
+ return FALSE;
}
return TRUE;
rtp_hdr_class->get_supported_flags =
gst_rtp_header_extension_rfc6464_get_supported_flags;
rtp_hdr_class->get_max_size = gst_rtp_header_extension_rfc6464_get_max_size;
- rtp_hdr_class->set_attributes_from_caps =
- gst_rtp_header_extension_rfc6464_set_attributes_from_caps;
+ rtp_hdr_class->set_attributes =
+ gst_rtp_header_extension_rfc6464_set_attributes;
rtp_hdr_class->set_caps_from_attributes =
gst_rtp_header_extension_rfc6464_set_caps_from_attributes;
rtp_hdr_class->write = gst_rtp_header_extension_rfc6464_write;