mpegts: add multilingual service name descriptor

https://bugzilla.gnome.org/show_bug.cgi?id=728429
This commit is contained in:
Stefan Ringel 2014-04-17 18:20:03 +02:00 committed by Edward Hervey
parent cac329a621
commit b0f3892ae5
3 changed files with 83 additions and 0 deletions

View file

@ -333,6 +333,9 @@ gst_mpegts_descriptor_parse_dvb_multilingual_network_name
<SUBSECTION multilingual_bouquet_name>
GstMpegTsDvbMultilingualBouquetNameItem
gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name
<SUBSECTION multilingual_service_name>
GstMpegTsDvbMultilingualServiceNameItem
gst_mpegts_descriptor_parse_dvb_multilingual_service_name
<SUBSECTION Standard>
GST_TYPE_MPEG_TSDVB_CODE_RATE
gst_mpegts_dvb_code_rate_get_type

View file

@ -1487,6 +1487,65 @@ gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const
return TRUE;
}
/* GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME (0x5D) */
static void
_gst_mpegts_dvb_multilingual_service_name_item_free
(GstMpegTsDvbMultilingualServiceNameItem * item)
{
g_slice_free (GstMpegTsDvbMultilingualServiceNameItem, item);
}
/**
* gst_mpegts_descriptor_parse_dvb_multilingual_service_name:
* @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME
* #GstMpegTsDescriptor
* @service_name_items: (out) (element-type GstMpegTsDvbMultilingualServiceNameItem):
* a #GstMpegTsDvbMultilingualServiceNameItem
*
* Parses out the multilingual service name from the @descriptor.
*
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
*/
gboolean
gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const
GstMpegTsDescriptor * descriptor, GPtrArray ** service_name_items)
{
guint8 *data, i, len;
GstMpegTsDvbMultilingualServiceNameItem *item;
g_return_val_if_fail (descriptor != NULL && service_name_items != NULL,
FALSE);
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME,
7, FALSE);
data = (guint8 *) descriptor->data + 2;
*service_name_items = g_ptr_array_new_with_free_func ((GDestroyNotify)
_gst_mpegts_dvb_multilingual_service_name_item_free);
for (i = 0; i < descriptor->length - 3;) {
item = g_slice_new0 (GstMpegTsDvbMultilingualServiceNameItem);
g_ptr_array_add (*service_name_items, item);
memcpy (data, item->language_code, 3);
data += 3;
i += 3;
len = *data;
item->service_name =
get_encoding_and_convert ((const gchar *) data + 1, len);
data += len + 1;
i += len + 1;
len = *data;
item->provider_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:

View file

@ -694,6 +694,27 @@ struct _GstMpegTsDvbMultilingualBouquetNameItem
gboolean gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const GstMpegTsDescriptor
*descriptor, GPtrArray ** bouquet_name_items);
/* GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME (0x5D) */
typedef struct _GstMpegTsDvbMultilingualServiceNameItem GstMpegTsDvbMultilingualServiceNameItem;
/**
* GstMpegTsDvbMultilingualServiceNameItem:
* @language_code: the ISO 639 language code
* @provider_name: the provider name
* @service_name: the service name
*
* a multilingual service name entry
*/
struct _GstMpegTsDvbMultilingualServiceNameItem
{
gchar language_code[3];
gchar *provider_name;
gchar *service_name;
};
gboolean gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const GstMpegTsDescriptor
*descriptor, GPtrArray ** service_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,