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
|
#define SAFE_CHAR(a) (g_ascii_isprint(a) ? a : '.')
|
||||||
dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
for (i = 0; i < descriptors->len; i++) {
|
/* Single descriptor dump
|
||||||
GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i);
|
* Descriptors that can only appear in specific tables should be handled before */
|
||||||
g_printf ("%*s [descriptor 0x%02x (%s) length:%d]\n", spacing, "",
|
static void
|
||||||
desc->tag, descriptor_name (desc), desc->length);
|
dump_generic_descriptor (GstMpegtsDescriptor * desc, guint spacing)
|
||||||
if (DUMP_DESCRIPTORS)
|
{
|
||||||
dump_memory_content (desc, spacing + 2);
|
|
||||||
switch (desc->tag) {
|
switch (desc->tag) {
|
||||||
case GST_MTS_DESC_REGISTRATION:
|
case GST_MTS_DESC_REGISTRATION:
|
||||||
{
|
{
|
||||||
const guint8 *data = desc->data + 2;
|
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,
|
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[0]), SAFE_CHAR (data[1]), SAFE_CHAR (data[2]),
|
||||||
SAFE_CHAR (data[3]), data[0], data[1], data[2], data[3]);
|
SAFE_CHAR (data[3]), data[0], data[1], data[2], data[3]);
|
||||||
@ -587,9 +582,6 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_MTS_DESC_DTG_LOGICAL_CHANNEL:
|
|
||||||
dump_logical_channel_descriptor (desc, spacing + 2);
|
|
||||||
break;
|
|
||||||
case GST_MTS_DESC_DVB_SERVICE:
|
case GST_MTS_DESC_DVB_SERVICE:
|
||||||
{
|
{
|
||||||
gchar *service_name, *provider_name;
|
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, enum_name (GST_TYPE_MPEGTS_DVB_SERVICE_TYPE,
|
||||||
service_type));
|
service_type));
|
||||||
g_printf ("%*s service_name : %s\n", spacing, "", service_name);
|
g_printf ("%*s service_name : %s\n", spacing, "", service_name);
|
||||||
g_printf ("%*s provider_name : %s\n", spacing, "",
|
g_printf ("%*s provider_name : %s\n", spacing, "", provider_name);
|
||||||
provider_name);
|
|
||||||
g_free (service_name);
|
g_free (service_name);
|
||||||
g_free (provider_name);
|
g_free (provider_name);
|
||||||
|
|
||||||
@ -648,8 +639,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||||||
{
|
{
|
||||||
gboolean offset;
|
gboolean offset;
|
||||||
GArray *list;
|
GArray *list;
|
||||||
if (gst_mpegts_descriptor_parse_dvb_frequency_list (desc, &offset,
|
if (gst_mpegts_descriptor_parse_dvb_frequency_list (desc, &offset, &list)) {
|
||||||
&list)) {
|
|
||||||
guint j;
|
guint j;
|
||||||
for (j = 0; j < list->len; j++) {
|
for (j = 0; j < list->len; j++) {
|
||||||
guint32 freq = g_array_index (list, guint32, 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)) {
|
if (gst_mpegts_descriptor_parse_dvb_parental_rating (desc, &ratings)) {
|
||||||
for (j = 0; j < ratings->len; j++) {
|
for (j = 0; j < ratings->len; j++) {
|
||||||
GstMpegtsDVBParentalRatingItem *item =
|
GstMpegtsDVBParentalRatingItem *item = g_ptr_array_index (ratings, j);
|
||||||
g_ptr_array_index (ratings, j);
|
|
||||||
g_printf ("%*s country_code : %s\n", spacing, "",
|
g_printf ("%*s country_code : %s\n", spacing, "",
|
||||||
item->country_code);
|
item->country_code);
|
||||||
g_printf ("%*s rating age : %d\n", spacing, "", item->rating);
|
g_printf ("%*s rating age : %d\n", spacing, "", item->rating);
|
||||||
@ -794,7 +783,45 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
|
|||||||
break;
|
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
|
static void
|
||||||
dump_pat (GstMpegtsSection * section)
|
dump_pat (GstMpegtsSection * section)
|
||||||
@ -989,7 +1016,7 @@ dump_nit (GstMpegtsSection * section)
|
|||||||
g_printf
|
g_printf
|
||||||
(" transport_stream_id:0x%04x , original_network_id:0x%02x\n",
|
(" transport_stream_id:0x%04x , original_network_id:0x%02x\n",
|
||||||
stream->transport_stream_id, stream->original_network_id);
|
stream->transport_stream_id, stream->original_network_id);
|
||||||
dump_descriptors (stream->descriptors, 9);
|
dump_nit_descriptors (stream->descriptors, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user