mpegts: add multilingual component descriptor

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

View file

@ -336,6 +336,9 @@ gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name
<SUBSECTION multilingual_service_name>
GstMpegTsDvbMultilingualServiceNameItem
gst_mpegts_descriptor_parse_dvb_multilingual_service_name
<SUBSECTION multilingual_component>
GstMpegTsDvbMultilingualComponentItem
gst_mpegts_descriptor_parse_dvb_multilingual_component
<SUBSECTION Standard>
GST_TYPE_MPEG_TSDVB_CODE_RATE
gst_mpegts_dvb_code_rate_get_type

View file

@ -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:

View file

@ -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,