diff options
author | Edward Hervey <edward@centricular.com> | 2020-11-09 11:44:36 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2020-11-09 11:51:00 +0100 |
commit | 29c507bf3a685c2cc89971f4b6d87a9f6fd7a82f (patch) | |
tree | ac1b3ef8b447a1d1c751537ff4e8adea6142222c /tests | |
parent | 0551d68bbb3266b1a6440429d92c5e22fd054e36 (diff) | |
download | gstreamer-plugins-bad-29c507bf3a685c2cc89971f4b6d87a9f6fd7a82f.tar.gz |
examples: Properly handle extended descriptors
By checking the extended tag. Provides a bit more information (if extended tag
is known)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1781>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/mpegts/ts-parser.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/examples/mpegts/ts-parser.c b/tests/examples/mpegts/ts-parser.c index cf339f8a6..ad667f6ec 100644 --- a/tests/examples/mpegts/ts-parser.c +++ b/tests/examples/mpegts/ts-parser.c @@ -80,12 +80,20 @@ dump_memory_bytes (guint8 * data, guint len, guint spacing) #define dump_memory_content(desc, spacing) dump_memory_bytes((desc)->data + 2, (desc)->length, spacing) static const gchar * -descriptor_name (gint val) +descriptor_name (GstMpegtsDescriptor * desc) { - GEnumValue *en; + GEnumValue *en = NULL; + gint val = desc->tag; - en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek - (GST_TYPE_MPEGTS_DESCRIPTOR_TYPE)), val); + /* Treat extended descriptors */ + if (val == 0x7f) { + en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek + (GST_TYPE_MPEGTS_DVB_EXTENDED_DESCRIPTOR_TYPE)), + desc->tag_extension); + } + if (en == NULL) + en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek + (GST_TYPE_MPEGTS_DESCRIPTOR_TYPE)), val); if (en == NULL) /* Else try with DVB enum types */ en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek @@ -510,7 +518,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing) for (i = 0; i < descriptors->len; i++) { GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i); g_printf ("%*s [descriptor 0x%02x (%s) length:%d]\n", spacing, "", - desc->tag, descriptor_name (desc->tag), desc->length); + desc->tag, descriptor_name (desc), desc->length); if (DUMP_DESCRIPTORS) dump_memory_content (desc, spacing + 2); switch (desc->tag) { @@ -1340,6 +1348,7 @@ main (int argc, gchar ** argv) g_type_class_ref (GST_TYPE_MPEGTS_RUNNING_STATUS); g_type_class_ref (GST_TYPE_MPEGTS_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEGTS_DVB_DESCRIPTOR_TYPE); + g_type_class_ref (GST_TYPE_MPEGTS_DVB_EXTENDED_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEGTS_ATSC_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEGTS_ISDB_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEGTS_MISC_DESCRIPTOR_TYPE); |