diff options
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mpegtsparse/gstmpegdesc.h | 9 | ||||
-rw-r--r-- | gst/mpegtsparse/mpegtspacketizer.c | 40 |
2 files changed, 49 insertions, 0 deletions
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) { |