mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 01:32:42 +00:00
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>
This commit is contained in:
parent
0551d68bbb
commit
29c507bf3a
1 changed files with 14 additions and 5 deletions
|
@ -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)
|
#define dump_memory_content(desc, spacing) dump_memory_bytes((desc)->data + 2, (desc)->length, spacing)
|
||||||
|
|
||||||
static const gchar *
|
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
|
/* Treat extended descriptors */
|
||||||
(GST_TYPE_MPEGTS_DESCRIPTOR_TYPE)), val);
|
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)
|
if (en == NULL)
|
||||||
/* Else try with DVB enum types */
|
/* Else try with DVB enum types */
|
||||||
en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
|
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++) {
|
for (i = 0; i < descriptors->len; i++) {
|
||||||
GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i);
|
GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i);
|
||||||
g_printf ("%*s [descriptor 0x%02x (%s) length:%d]\n", spacing, "",
|
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)
|
if (DUMP_DESCRIPTORS)
|
||||||
dump_memory_content (desc, spacing + 2);
|
dump_memory_content (desc, spacing + 2);
|
||||||
switch (desc->tag) {
|
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_RUNNING_STATUS);
|
||||||
g_type_class_ref (GST_TYPE_MPEGTS_DESCRIPTOR_TYPE);
|
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_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_ATSC_DESCRIPTOR_TYPE);
|
||||||
g_type_class_ref (GST_TYPE_MPEGTS_ISDB_DESCRIPTOR_TYPE);
|
g_type_class_ref (GST_TYPE_MPEGTS_ISDB_DESCRIPTOR_TYPE);
|
||||||
g_type_class_ref (GST_TYPE_MPEGTS_MISC_DESCRIPTOR_TYPE);
|
g_type_class_ref (GST_TYPE_MPEGTS_MISC_DESCRIPTOR_TYPE);
|
||||||
|
|
Loading…
Reference in a new issue