summaryrefslogtreecommitdiff
path: root/gst-libs/gst/mpegts
diff options
context:
space:
mode:
authoryychao <yychao@realtek.com>2020-09-04 23:28:58 +0800
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-09-14 06:27:07 +0000
commit5269777a9743beb1e63d02b1ee008ac1518c0f6f (patch)
tree3304edda2a7ae7aaa8d4cd9118173849db87e527 /gst-libs/gst/mpegts
parente2d88f05691d5b14023b70bb6be29326eba92b87 (diff)
downloadgstreamer-plugins-bad-5269777a9743beb1e63d02b1ee008ac1518c0f6f.tar.gz
tsdemux: Add new API for fetching extended descriptors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1555>
Diffstat (limited to 'gst-libs/gst/mpegts')
-rw-r--r--gst-libs/gst/mpegts/gstmpegtsdescriptor.c32
-rw-r--r--gst-libs/gst/mpegts/gstmpegtsdescriptor.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
index 34bee7919..c5b758ae4 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
@@ -988,6 +988,38 @@ gst_mpegts_find_descriptor (GPtrArray * descriptors, guint8 tag)
return NULL;
}
+/**
+ * gst_mpegts_find_descriptor_with_extension:
+ * @descriptors: (element-type GstMpegtsDescriptor) (transfer none): an array
+ * of #GstMpegtsDescriptor
+ * @tag: the tag to look for
+ *
+ * Finds the first descriptor of type @tag with @tag_extension in the array.
+ *
+ * Note: To look for descriptors that can be present more than once in an
+ * array of descriptors, iterate the #GArray manually.
+ *
+ * Returns: (transfer none): the first descriptor matchin @tag with @tag_extension, else %NULL.
+ *
+ * Since: 1.20
+ */
+const GstMpegtsDescriptor *
+gst_mpegts_find_descriptor_with_extension (GPtrArray * descriptors, guint8 tag,
+ guint8 tag_extension)
+{
+ guint i, nb_desc;
+
+ g_return_val_if_fail (descriptors != NULL, NULL);
+
+ nb_desc = descriptors->len;
+ for (i = 0; i < nb_desc; i++) {
+ GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i);
+ if ((desc->tag == tag) && (desc->tag_extension == tag_extension))
+ return (const GstMpegtsDescriptor *) desc;
+ }
+ return NULL;
+}
+
/* GST_MTS_DESC_REGISTRATION (0x05) */
/**
* gst_mpegts_descriptor_from_registration:
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.h b/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
index 73f6c748d..70c1be7a7 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
@@ -274,6 +274,10 @@ GST_MPEGTS_API
const GstMpegtsDescriptor * gst_mpegts_find_descriptor (GPtrArray *descriptors,
guint8 tag);
+GST_MPEGTS_API
+const GstMpegtsDescriptor * gst_mpegts_find_descriptor_with_extension (GPtrArray *descriptors,
+ guint8 tag, guint8 tag_extension);
+
/* GST_MTS_DESC_REGISTRATION (0x05) */
GST_MPEGTS_API
@@ -375,6 +379,12 @@ GST_MPEGTS_API
GstMpegtsDescriptor *
gst_mpegts_descriptor_from_custom (guint8 tag, const guint8 *data, gsize length);
+
+/**
+ * gst_mpegts_descriptor_from_custom_with_extension:
+ *
+ * Since: 1.20
+ */
GST_MPEGTS_API
GstMpegtsDescriptor *
gst_mpegts_descriptor_from_custom_with_extension (guint8 tag, guint8 tag_extension, const guint8 *data, gsize length);