From ace60abef5e5a90b216e30f67142a957fa964b5e Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Thu, 10 Apr 2014 16:00:50 +0200 Subject: [PATCH] mpegts: add data broadcast id descriptor https://bugzilla.gnome.org/show_bug.cgi?id=727403 --- docs/libs/gst-plugins-bad-libs-sections.txt | 2 ++ gst-libs/gst/mpegts/gst-dvb-descriptor.c | 36 +++++++++++++++++++++ gst-libs/gst/mpegts/gst-dvb-descriptor.h | 3 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 25f1b1a32e..7a039ef3b3 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -305,6 +305,8 @@ gst_mpegts_descriptor_parse_dvb_private_data_specifier GstMpegTsDataBroadcastDescriptor gst_mpegts_descriptor_parse_dvb_data_broadcast + +gst_mpegts_descriptor_parse_dvb_data_broadcast_id GstMpegTsDVBParentalRatingItem gst_mpegts_descriptor_parse_dvb_parental_rating diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 735821a1c0..b84c564a5d 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -1325,6 +1325,42 @@ gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor return TRUE; } +/* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */ +/** + * gst_mpegts_descriptor_parse_dvb_data_broadcast_id: + * @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST_ID #GstMpegTsDescriptor + * @data_broadcast_id: (out): the data broadcast id + * @id_selector_bytes: (out): the selector bytes, if present + * @len: (out): the length of #id_selector_bytes + * + * Parses out the data broadcast id from the @descriptor. + * + * Returns: %TRUE if the parsing happened correctly, else %FALSE. + */ +gboolean +gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegTsDescriptor + * descriptor, guint16 * data_broadcast_id, guint8 ** id_selector_bytes, + guint8 * len) +{ + guint8 *data; + + g_return_val_if_fail (descriptor != NULL && data_broadcast_id != NULL && + id_selector_bytes != NULL, FALSE); + __common_desc_checks (descriptor, GST_MTS_DESC_DVB_DATA_BROADCAST_ID, 2, + FALSE); + + data = (guint8 *) descriptor->data + 2; + + *data_broadcast_id = GST_READ_UINT16_BE (data); + data += 2; + + *len = descriptor->length - 2; + + *id_selector_bytes = g_memdup (data, *len); + + return TRUE; +} + /* GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM (0x7F && 0x04) */ static void _gst_mpegts_t2_delivery_system_cell_extension_free diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h index 95fb9a510b..a556ddfa46 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -658,7 +658,8 @@ gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescript *descriptor, GstMpegTsDataBroadcastDescriptor * res); /* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */ -/* FIXME : Implement */ +gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegTsDescriptor + * descriptor, guint16 * data_broadcast_id, guint8 ** id_selector_bytes, guint8 * len); /* GST_MTS_DESC_DVB_AC3 (0x6a) */ /* FIXME : Implement */