diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 8e5d134f08..75b6d23b6f 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -330,6 +330,9 @@ gst_mpegts_descriptor_parse_dvb_bouquet_name GstMpegTsDvbMultilingualNetworkNameItem gst_mpegts_descriptor_parse_dvb_multilingual_network_name + +GstMpegTsDvbMultilingualBouquetNameItem +gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name 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 85e7813124..169ad83ec8 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.c +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.c @@ -1434,6 +1434,59 @@ gst_mpegts_descriptor_parse_dvb_multilingual_network_name (const return TRUE; } +/* GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME (0x5C) */ +static void + _gst_mpegts_dvb_multilingual_bouquet_name_item_free + (GstMpegTsDvbMultilingualBouquetNameItem * item) +{ + g_slice_free (GstMpegTsDvbMultilingualBouquetNameItem, item); +} + +/** + * gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name: + * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME + * #GstMpegTsDescriptor + * @bouquet_name_items: (out) (element-type GstMpegTsDvbMultilingualBouquetNameItem): + * a #GstMpegTsDvbMultilingualBouquetNameItem + * + * Parses out the multilingual bouquet name from the @descriptor. + * + * Returns: %TRUE if the parsing happened correctly, else %FALSE. + */ +gboolean +gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const + GstMpegTsDescriptor * descriptor, GPtrArray ** bouquet_name_items) +{ + guint8 *data, i, len; + GstMpegTsDvbMultilingualBouquetNameItem *item; + + g_return_val_if_fail (descriptor != NULL && bouquet_name_items != NULL, + FALSE); + __common_desc_checks (descriptor, GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME, + 5, FALSE); + + data = (guint8 *) descriptor->data + 2; + + *bouquet_name_items = g_ptr_array_new_with_free_func ((GDestroyNotify) + _gst_mpegts_dvb_multilingual_bouquet_name_item_free); + + for (i = 0; i < descriptor->length - 3;) { + item = g_slice_new0 (GstMpegTsDvbMultilingualBouquetNameItem); + g_ptr_array_add (*bouquet_name_items, item); + memcpy (data, item->language_code, 3); + data += 3; + i += 3; + + len = *data; + item->bouquet_name = + 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 2fbdea0fa4..7510b3f036 100644 --- a/gst-libs/gst/mpegts/gst-dvb-descriptor.h +++ b/gst-libs/gst/mpegts/gst-dvb-descriptor.h @@ -675,6 +675,25 @@ struct _GstMpegTsDvbMultilingualNetworkNameItem gboolean gst_mpegts_descriptor_parse_dvb_multilingual_network_name (const GstMpegTsDescriptor *descriptor, GPtrArray ** network_name_items); +/* GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME (0x5C) */ +typedef struct _GstMpegTsDvbMultilingualBouquetNameItem GstMpegTsDvbMultilingualBouquetNameItem; + +/** + * GstMpegTsDvbMultilingualBouquetNameItem: + * @language_code: the ISO 639 language code + * @bouquet_name: the bouquet name + * + * a multilingual bouquet name entry + */ +struct _GstMpegTsDvbMultilingualBouquetNameItem +{ + gchar language_code[3]; + gchar *bouquet_name; +}; + +gboolean gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const GstMpegTsDescriptor + *descriptor, GPtrArray ** bouquet_name_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,