diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 04cf3f3d7c..75cc02336f 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -336,6 +336,9 @@ gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name GstMpegTsDvbMultilingualServiceNameItem gst_mpegts_descriptor_parse_dvb_multilingual_service_name + +GstMpegTsDvbMultilingualComponentItem +gst_mpegts_descriptor_parse_dvb_multilingual_component GST_TYPE_MPEG_TSDVB_CODE_RATE gst_mpegts_dvb_code_rate_get_type diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c index 45de0f8679..7e09c5351f 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -1546,6 +1546,65 @@ gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const return TRUE; } +/* GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT (0x5E) */ +static void + _gst_mpegts_dvb_multilingual_component_item_free + (GstMpegTsDvbMultilingualComponentItem * item) +{ + g_slice_free (GstMpegTsDvbMultilingualComponentItem, item); +} + +/** + * gst_mpegts_descriptor_parse_dvb_multilingual_component: + * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT + * #GstMpegTsDescriptor + * @component_tag: the component tag + * @component_description_items: (out) (element-type GstMpegTsDvbMultilingualComponentItem): + * a #GstMpegTsDvbMultilingualComponentItem + * + * Parses out the multilingual component from the @descriptor. + * + * Returns: %TRUE if the parsing happened correctly, else %FALSE. + */ +gboolean +gst_mpegts_descriptor_parse_dvb_multilingual_component (const + GstMpegTsDescriptor * descriptor, guint8 * component_tag, + GPtrArray ** component_description_items) +{ + guint8 *data, i, len; + GstMpegTsDvbMultilingualComponentItem *item; + + g_return_val_if_fail (descriptor != NULL + && component_description_items != NULL && component_tag != NULL, FALSE); + __common_desc_checks (descriptor, GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT, 6, + FALSE); + + data = (guint8 *) descriptor->data + 2; + + *component_tag = *data; + data += 1; + + *component_description_items = + g_ptr_array_new_with_free_func ((GDestroyNotify) + _gst_mpegts_dvb_multilingual_component_item_free); + + for (i = 0; i < descriptor->length - 3;) { + item = g_slice_new0 (GstMpegTsDvbMultilingualComponentItem); + g_ptr_array_add (*component_description_items, item); + memcpy (data, item->language_code, 3); + data += 3; + i += 3; + + len = *data; + item->description = + get_encoding_and_convert ((const gchar *) data + 1, len); + data += len + 1; + i += len + 1; + } + + return TRUE; +} + /* GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER (0x5F) */ /** * gst_mpegts_descriptor_parse_dvb_private_data_specifier: diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.h b/gst-libs/gst/mpegts/gst-dvb-descriptor.h index c936572965..edf5309f69 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -715,6 +715,23 @@ struct _GstMpegTsDvbMultilingualServiceNameItem gboolean gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const GstMpegTsDescriptor *descriptor, GPtrArray ** service_name_items); +/* GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT (0x5E) */ +typedef struct _GstMpegTsDvbMultilingualComponentItem GstMpegTsDvbMultilingualComponentItem; + +/** + * GstMpegTsDvbMultilingualComponentItem: + * @language_code: the ISO 639 language code + * @description: the component description + */ +struct _GstMpegTsDvbMultilingualComponentItem +{ + gchar language_code[3]; + gchar *description; +}; + +gboolean gst_mpegts_descriptor_parse_dvb_multilingual_component (const GstMpegTsDescriptor + *descriptor, guint8 * component_tag, GPtrArray ** component_description_items); + /* GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER (0x5F) */ gboolean gst_mpegts_descriptor_parse_dvb_private_data_specifier (const GstMpegTsDescriptor * descriptor, guint32 * private_data_specifier, guint8 ** private_data,