summaryrefslogtreecommitdiff
path: root/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
diff options
context:
space:
mode:
authorJesper Larsen <jesper.larsen@ixonos.com>2013-11-19 11:30:33 +0100
committerJesper Larsen <jesper.larsen@ixonos.com>2014-02-06 15:55:46 +0100
commitb7d256b4c292d0a83f8c7eb2a02de9700082700b (patch)
tree10bb26b95e9b91f456b7bf42b7efdced889e42ea /gst-libs/gst/mpegts/gstmpegtsdescriptor.c
parent05bf952384b11fe2ab389b161c989522c3517b23 (diff)
downloadgstreamer-plugins-bad-b7d256b4c292d0a83f8c7eb2a02de9700082700b.tar.gz
mpegts: Support registration and custom descriptor
Support for registration descriptor (0x05) Add function to create a descriptor with custom tag and data
Diffstat (limited to 'gst-libs/gst/mpegts/gstmpegtsdescriptor.c')
-rw-r--r--gst-libs/gst/mpegts/gstmpegtsdescriptor.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
index 35a8f89fd..be2773548 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
@@ -830,6 +830,34 @@ gst_mpegts_find_descriptor (GPtrArray * descriptors, guint8 tag)
return NULL;
}
+/* GST_MTS_DESC_REGISTRATION (0x05) */
+/**
+ * gst_mpegts_descriptor_from_registration:
+ * @format_identifier: (transfer none): a 4 character format identifier string
+ * @additional_info: (transfer none) (allow-none): pointer to optional additional info
+ * @additional_info_length: length of the optional @additional_info
+ *
+ * Creates a %GST_MTS_DESC_REGISTRATION #GstMpegTsDescriptor
+ *
+ * Return: #GstMpegTsDescriptor, %NULL on failure
+ */
+GstMpegTsDescriptor *
+gst_mpegts_descriptor_from_registration (const gchar * format_identifier,
+ guint8 * additional_info, gsize additional_info_length)
+{
+ GstMpegTsDescriptor *descriptor;
+
+ g_return_val_if_fail (format_identifier != NULL, NULL);
+
+ descriptor = _new_descriptor (GST_MTS_DESC_REGISTRATION,
+ 4 + additional_info_length);
+
+ memcpy (descriptor->data + 2, format_identifier, 4);
+ if (additional_info && (additional_info_length > 0))
+ memcpy (descriptor->data + 6, additional_info, additional_info_length);
+
+ return descriptor;
+}
/* GST_MTS_DESC_ISO_639_LANGUAGE (0x0A) */
/**
@@ -957,3 +985,27 @@ gst_mpegts_descriptor_parse_logical_channel (const GstMpegTsDescriptor *
return TRUE;
}
+
+/**
+ * gst_mpegts_descriptor_from_custom:
+ * @tag: descriptor tag
+ * @data: (transfer none): descriptor data (after tag and length field)
+ * @length: length of @data
+ *
+ * Creates a #GstMpegTsDescriptor with custom @tag and @data
+ *
+ * Returns: #GstMpegTsDescriptor
+ */
+GstMpegTsDescriptor *
+gst_mpegts_descriptor_from_custom (guint8 tag, const guint8 * data,
+ gsize length)
+{
+ GstMpegTsDescriptor *descriptor;
+
+ descriptor = _new_descriptor (tag, length);
+
+ if (data && (length > 0))
+ memcpy (descriptor->data + 2, data, length);
+
+ return descriptor;
+}