From 2e1ed2dcba463cc803f3b3cca272cb35215ce5d8 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Mon, 16 Jun 2008 09:22:30 +0000 Subject: gst/mpegtsparse/: Parse the extended event descriptor. Original commit message from CVS: * gst/mpegtsparse/gstmpegdesc.h: * gst/mpegtsparse/mpegtspacketizer.c: Parse the extended event descriptor. --- ChangeLog | 6 ++++++ gst/mpegtsparse/gstmpegdesc.h | 9 +++++++++ gst/mpegtsparse/mpegtspacketizer.c | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index 209858a5..1981971a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-16 Zaheer Abbas Merali + + * gst/mpegtsparse/gstmpegdesc.h: + * gst/mpegtsparse/mpegtspacketizer.c: + Parse the extended event descriptor. + 2008-06-16 Stefan Kost * gst/rtpmanager/gstrtpjitterbuffer.c: diff --git a/gst/mpegtsparse/gstmpegdesc.h b/gst/mpegtsparse/gstmpegdesc.h index 494a2498..0513fa94 100644 --- a/gst/mpegtsparse/gstmpegdesc.h +++ b/gst/mpegtsparse/gstmpegdesc.h @@ -266,6 +266,15 @@ #define DESC_DVB_SHORT_EVENT_description_text(desc) (desc + 6 + DESC_DVB_SHORT_EVENT_name_length(desc) + 1) #define DESC_DVB_SHORT_EVENT_description_length(desc) (desc[6 + DESC_DVB_SHORT_EVENT_name_length(desc)]) +/* DVB Extended Event Descriptor */ +#define DESC_DVB_EXTENDED_EVENT_descriptor_number(desc) ((desc[2] & 0xF0) >> 4) +#define DESC_DVB_EXTENDED_EVENT_last_descriptor_number(desc) (desc[2] & 0x0F) +#define DESC_DVB_EXTENDED_EVENT_iso639_language_code(desc) (desc + 3) +#define DESC_DVB_EXTENDED_EVENT_items_length(desc) (desc[6]) +#define DESC_DVB_EXTENDED_EVENT_items(desc) (desc + 7) +#define DESC_DVB_EXTENDED_EVENT_text_length(desc) (desc[6 + DESC_DVB_EXTENDED_EVENT_items_length(desc)]) +#define DESC_DVB_EXTENDED_EVENT_text(desc) (desc + 6 + DESC_DVB_EXTENDED_EVENT_items_length(desc) + 1) + /* DVB Satellite Delivery System Descriptor */ #define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_frequency(desc) (desc + 2) #define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_orbital_position(desc) (desc + 6) diff --git a/gst/mpegtsparse/mpegtspacketizer.c b/gst/mpegtsparse/mpegtspacketizer.c index 220bd49b..3b108f99 100644 --- a/gst/mpegtsparse/mpegtspacketizer.c +++ b/gst/mpegtsparse/mpegtspacketizer.c @@ -1419,6 +1419,7 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer, if (descriptors_loop_length) { guint8 *event_descriptor; GArray *component_descriptors; + GArray *extended_event_descriptors; GstMPEGDescriptor *mpegdescriptor; if (data + descriptors_loop_length > end - 4) { @@ -1457,6 +1458,45 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer, g_free (eventdescription_tmp); } } + extended_event_descriptors = gst_mpeg_descriptor_find_all (mpegdescriptor, + DESC_DVB_EXTENDED_EVENT); + if (extended_event_descriptors) { + int i; + guint8 *extended_descriptor; + /*GValue extended_items = { 0 }; */ + gchar *extended_text = NULL; + /*g_value_init (&extended_items, GST_TYPE_LIST); */ + for (i = 0; i < extended_event_descriptors->len; i++) { + extended_descriptor = g_array_index (extended_event_descriptors, + guint8 *, i); + if (DESC_DVB_EXTENDED_EVENT_descriptor_number (extended_descriptor) == + i) { + if (extended_text) { + gchar *tmp; + gchar *old_extended_text = extended_text; + tmp = + g_strndup ((gchar *) + DESC_DVB_EXTENDED_EVENT_text (extended_descriptor), + DESC_DVB_EXTENDED_EVENT_text_length (extended_descriptor)); + extended_text = g_strdup_printf ("%s%s", extended_text, tmp); + g_free (old_extended_text); + g_free (tmp); + } else { + extended_text = + g_strndup ((gchar *) + DESC_DVB_EXTENDED_EVENT_text (extended_descriptor), + DESC_DVB_EXTENDED_EVENT_text_length (extended_descriptor)); + } + } + } + if (extended_text) { + gst_structure_set (event, "extended-text", G_TYPE_STRING, + extended_text, NULL); + g_free (extended_text); + } + g_array_free (extended_event_descriptors, TRUE); + } + component_descriptors = gst_mpeg_descriptor_find_all (mpegdescriptor, DESC_DVB_COMPONENT); if (component_descriptors) { -- cgit v1.2.1