example: ts-parser: add component descriptor

https://bugzilla.gnome.org/show_bug.cgi?id=730854
This commit is contained in:
Stefan Ringel 2014-05-28 12:19:43 +02:00 committed by Edward Hervey
parent 74681cf00a
commit 1c9bbb1e00
3 changed files with 36 additions and 0 deletions

View file

@ -1008,6 +1008,7 @@ gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor
data += 1;
memcpy (res->language_code, data, 3);
res->language_code[3] = 0;
data += 3;
len = descriptor->length - 6;

View file

@ -492,6 +492,17 @@ gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescript
GstMpegTsExtendedEventDescriptor *res);
/* GST_MTS_DESC_DVB_COMPONENT (0x50) */
typedef enum {
GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO = 0x01,
GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO = 0x02,
GST_MPEGTS_STREAM_CONTENT_TELETEXT_OR_SUBTITLE = 0x03,
GST_MPEGTS_STREAM_CONTENT_AC_3 = 0x04,
GST_MPEGTS_STREAM_CONTENT_AVC = 0x05,
GST_MPEGTS_STREAM_CONTENT_AAC = 0x06,
GST_MPEGTS_STREAM_CONTENT_DTS = 0x07,
GST_MPEGTS_STREAM_CONTENT_SRM_CPCM = 0x08
} GstMpegTsComponentStreamContent;
typedef struct _GstMpegTsComponentDescriptor GstMpegTsComponentDescriptor;
struct _GstMpegTsComponentDescriptor
{

View file

@ -406,6 +406,26 @@ dump_linkage (GstMpegTsDescriptor * desc, guint spacing)
}
}
static void
dump_component (GstMpegTsDescriptor * desc, guint spacing)
{
GstMpegTsComponentDescriptor res;
res.text = NULL;
if (gst_mpegts_descriptor_parse_dvb_component (desc, &res)) {
g_printf ("%*s stream_content : 0x%02x (%s)\n", spacing, "",
res.stream_content,
enum_name (GST_TYPE_MPEG_TS_COMPONENT_STREAM_CONTENT,
res.stream_content));
g_printf ("%*s component_type : 0x%02x\n", spacing, "", res.component_type);
g_printf ("%*s component_tag : 0x%02x\n", spacing, "", res.component_tag);
g_printf ("%*s language_code : %s\n", spacing, "", res.language_code);
g_printf ("%*s text : %s\n", spacing, "",
res.text ? res.text : "NULL");
}
}
static void
dump_iso_639_language (GstMpegTsDescriptor * desc, guint spacing)
{
@ -560,6 +580,9 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
case GST_MTS_DESC_DVB_LINKAGE:
dump_linkage (desc, spacing + 2);
break;
case GST_MTS_DESC_DVB_COMPONENT:
dump_component (desc, spacing + 2);
break;
case GST_MTS_DESC_ISO_639_LANGUAGE:
dump_iso_639_language (desc, spacing + 2);
break;
@ -1099,6 +1122,7 @@ main (int argc, gchar ** argv)
g_type_class_ref (GST_TYPE_MPEG_TS_TERRESTRIAL_HIERARCHY);
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_LINKAGE_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_LINKAGE_HAND_OVER_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_COMPONENT_STREAM_CONTENT);
mainloop = g_main_loop_new (NULL, FALSE);