From 1c9bbb1e00a06a3ca97730f16bca032b9d2e0ba7 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Wed, 28 May 2014 12:19:43 +0200 Subject: [PATCH] example: ts-parser: add component descriptor https://bugzilla.gnome.org/show_bug.cgi?id=730854 --- gst-libs/gst/mpegts/gst-dvb-descriptor.c | 1 + gst-libs/gst/mpegts/gst-dvb-descriptor.h | 11 +++++++++++ tests/examples/mpegts/ts-parser.c | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 47e818e50c..7a2332a293 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -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; diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h index 9d2b251e29..19fc1f71f2 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -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 { diff --git a/tests/examples/mpegts/ts-parser.c b/tests/examples/mpegts/ts-parser.c index 9a4eeed6a3..d157702d70 100644 --- a/tests/examples/mpegts/ts-parser.c +++ b/tests/examples/mpegts/ts-parser.c @@ -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);