summaryrefslogtreecommitdiff
path: root/gst-libs/gst/mpegts
diff options
context:
space:
mode:
authorStefan Ringel <linuxtv@stefanringel.de>2014-04-17 18:20:39 +0200
committerEdward Hervey <bilboed@bilboed.com>2014-05-27 15:34:40 +0200
commit0168160863da286216e420dd0ab48ecb4db2314a (patch)
treed577c86cffe650350df6364bd146532460f49311 /gst-libs/gst/mpegts
parentb0f3892ae5070f51bc4f1101b8f24c6df72baf5f (diff)
downloadgstreamer-plugins-bad-0168160863da286216e420dd0ab48ecb4db2314a.tar.gz
mpegts: add multilingual component descriptor
https://bugzilla.gnome.org/show_bug.cgi?id=728429
Diffstat (limited to 'gst-libs/gst/mpegts')
-rw-r--r--gst-libs/gst/mpegts/gst-dvb-descriptor.c59
-rw-r--r--gst-libs/gst/mpegts/gst-dvb-descriptor.h17
2 files changed, 76 insertions, 0 deletions
diff --git a/gst-libs/gst/mpegts/gst-dvb-descriptor.c b/gst-libs/gst/mpegts/gst-dvb-descriptor.c
index 45de0f867..7e09c5351 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 c93657296..edf5309f6 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,