mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-04 05:35:53 +00:00
examples/ts-parser: Use the section type for descriptor identification
Some descriptors can only be present in some section Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>
This commit is contained in:
parent
160106885a
commit
d75ee7b16d
|
@ -518,22 +518,17 @@ dump_dvb_extended_event (GstMpegtsDescriptor * desc, guint spacing)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_descriptors (GPtrArray * descriptors, guint spacing)
|
||||
{
|
||||
guint i;
|
||||
#define SAFE_CHAR(a) (g_ascii_isprint(a) ? a : '.')
|
||||
|
||||
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), desc->length);
|
||||
if (DUMP_DESCRIPTORS)
|
||||
dump_memory_content (desc, spacing + 2);
|
||||
/* Single descriptor dump
|
||||
* Descriptors that can only appear in specific tables should be handled before */
|
||||
static void
|
||||
dump_generic_descriptor (GstMpegtsDescriptor * desc, guint spacing)
|
||||
{
|
||||
switch (desc->tag) {
|
||||
case GST_MTS_DESC_REGISTRATION:
|
||||
{
|
||||
const guint8 *data = desc->data + 2;
|
||||
#define SAFE_CHAR(a) (g_ascii_isprint(a) ? a : '.')
|
||||
g_printf ("%*s Registration : %c%c%c%c [%02x%02x%02x%02x]\n", spacing,
|
||||
"", SAFE_CHAR (data[0]), SAFE_CHAR (data[1]), SAFE_CHAR (data[2]),
|
||||
SAFE_CHAR (data[3]), data[0], data[1], data[2], data[3]);
|
||||
|
@ -587,9 +582,6 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GST_MTS_DESC_DTG_LOGICAL_CHANNEL:
|
||||
dump_logical_channel_descriptor (desc, spacing + 2);
|
||||
break;
|
||||
case GST_MTS_DESC_DVB_SERVICE:
|
||||
{
|
||||
gchar *service_name, *provider_name;
|
||||
|
@ -600,8 +592,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||
service_type, enum_name (GST_TYPE_MPEGTS_DVB_SERVICE_TYPE,
|
||||
service_type));
|
||||
g_printf ("%*s service_name : %s\n", spacing, "", service_name);
|
||||
g_printf ("%*s provider_name : %s\n", spacing, "",
|
||||
provider_name);
|
||||
g_printf ("%*s provider_name : %s\n", spacing, "", provider_name);
|
||||
g_free (service_name);
|
||||
g_free (provider_name);
|
||||
|
||||
|
@ -648,8 +639,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||
{
|
||||
gboolean offset;
|
||||
GArray *list;
|
||||
if (gst_mpegts_descriptor_parse_dvb_frequency_list (desc, &offset,
|
||||
&list)) {
|
||||
if (gst_mpegts_descriptor_parse_dvb_frequency_list (desc, &offset, &list)) {
|
||||
guint j;
|
||||
for (j = 0; j < list->len; j++) {
|
||||
guint32 freq = g_array_index (list, guint32, j);
|
||||
|
@ -698,8 +688,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||
|
||||
if (gst_mpegts_descriptor_parse_dvb_parental_rating (desc, &ratings)) {
|
||||
for (j = 0; j < ratings->len; j++) {
|
||||
GstMpegtsDVBParentalRatingItem *item =
|
||||
g_ptr_array_index (ratings, j);
|
||||
GstMpegtsDVBParentalRatingItem *item = g_ptr_array_index (ratings, j);
|
||||
g_printf ("%*s country_code : %s\n", spacing, "",
|
||||
item->country_code);
|
||||
g_printf ("%*s rating age : %d\n", spacing, "", item->rating);
|
||||
|
@ -794,7 +783,45 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_descriptors (GPtrArray * descriptors, guint spacing)
|
||||
{
|
||||
guint i;
|
||||
|
||||
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), desc->length);
|
||||
if (DUMP_DESCRIPTORS)
|
||||
dump_memory_content (desc, spacing + 2);
|
||||
dump_generic_descriptor (desc, spacing + 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_nit_descriptors (GPtrArray * descriptors, guint spacing)
|
||||
{
|
||||
/* Descriptors that can only appear in NIT */
|
||||
guint i;
|
||||
|
||||
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), desc->length);
|
||||
if (DUMP_DESCRIPTORS)
|
||||
dump_memory_content (desc, spacing + 2);
|
||||
switch (desc->tag) {
|
||||
case GST_MTS_DESC_DTG_LOGICAL_CHANNEL:
|
||||
dump_logical_channel_descriptor (desc, spacing + 2);
|
||||
break;
|
||||
default:
|
||||
dump_generic_descriptor (desc, spacing + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dump_pat (GstMpegtsSection * section)
|
||||
|
@ -989,7 +1016,7 @@ dump_nit (GstMpegtsSection * section)
|
|||
g_printf
|
||||
(" transport_stream_id:0x%04x , original_network_id:0x%02x\n",
|
||||
stream->transport_stream_id, stream->original_network_id);
|
||||
dump_descriptors (stream->descriptors, 9);
|
||||
dump_nit_descriptors (stream->descriptors, 9);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue