diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 6facefab58..c4d660152b 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -43,7 +43,6 @@ * * Add parsing methods for the following descriptors that were previously * handled in mpegtsbase: * * GST_MTS_DESC_DVB_DATA_BROADCAST_ID - * * GST_MTS_DESC_DVB_DATA_BROADCAST * * GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER * * GST_MTS_DESC_DVB_FREQUENCY_LIST */ @@ -921,3 +920,45 @@ gst_mpegts_descriptor_parse_terrestrial_delivery_system (const return TRUE; } + +/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */ +/** + * gst_mpegts_descriptor_parse_data_broadcast: + * @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST #GstMpegTsDescriptor + * @res: (out) (transfer none): #GstMpegTsDataBroadcastDescriptor + * + * Parses out the data broadcast from the @descriptor. + * + * Returns: %TRUE if the parsing happened correctly, else %FALSE. + */ +gboolean +gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor + * descriptor, GstMpegTsDataBroadcastDescriptor * res) +{ + guint8 *data; + guint8 len; + + g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); + __common_desc_checks (descriptor, GST_MTS_DESC_DVB_DATA_BROADCAST, 8, FALSE); + + data = (guint8 *) descriptor->data + 2; + + res->data_broadcast_id = GST_READ_UINT16_BE (data); + data += 2; + + res->component_tag = *data; + data += 1; + + len = *data; + data += 1; + + res->selector_bytes = g_memdup (data, len); + data += len; + + memcpy (data, res->language_code, 3); + data += 3; + + res->text = get_encoding_and_convert ((const gchar *) data + 1, *data); + + return TRUE; +} diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h index 0e5bfdce51..7ef6701912 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -480,7 +480,27 @@ gboolean gst_mpegts_descriptor_parse_terrestrial_delivery_system (const GstMpegT /* FIXME : Implement */ /* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */ -/* FIXME: Implement */ +typedef struct _GstMpegTsDataBroadcastDescriptor GstMpegTsDataBroadcastDescriptor; + +/** + * GstMpegTsDataBroadcastDescriptor: + * @data_broadcast_id: the data broadcast id + * @component_tag: the component tag + * @selector_bytes: the selector byte field + * @language_code: language of @text + * @text: description of data broadcast + */ +struct _GstMpegTsDataBroadcastDescriptor +{ + guint16 data_broadcast_id; + guint8 component_tag; + guint8 *selector_bytes; + gchar language_code[3]; + gchar *text; +}; + +gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor + *descriptor, GstMpegTsDataBroadcastDescriptor * res); /* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */ /* FIXME : Implement */ diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c index d6884ecefd..eceaf9fcbe 100644 --- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c +++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c @@ -64,7 +64,6 @@ * * Add parsing methods for the following descriptors that were previously * handled in mpegtsbase: * * GST_MTS_DESC_DVB_DATA_BROADCAST_ID - * * GST_MTS_DESC_DVB_DATA_BROADCAST * * GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER * * GST_MTS_DESC_DVB_FREQUENCY_LIST */