mpegts: Add creation of DVB Subtitling descriptor
authorJesper Larsen <jesper.larsen@ixonos.com>
Tue, 19 Nov 2013 10:15:52 +0000 (11:15 +0100)
committerJesper Larsen <jesper.larsen@ixonos.com>
Thu, 6 Feb 2014 14:55:40 +0000 (15:55 +0100)
Descriptor tag is 0x59

gst-libs/gst/mpegts/gst-dvb-descriptor.c
gst-libs/gst/mpegts/gst-dvb-descriptor.h

index 0db9e6215457eeacead84db31a7321db561b4d2c..fd46555df23d1b2a2b47565621249c75e2f51856 100644 (file)
@@ -390,7 +390,7 @@ gst_mpegts_descriptor_parse_dvb_teletext_nb (const GstMpegTsDescriptor *
  * gst_mpegts_descriptor_parse_dvb_subtitling_idx:
  * @descriptor: a %GST_MTS_DESC_DVB_SUBTITLING #GstMpegTsDescriptor
  * @idx: Table id of the entry to parse
- * @lang (out) (transfer none): 4-byte gchar array to hold the language code
+ * @lang: (out) (transfer none): 4-byte gchar array to hold the language code
  * @type: (out) (transfer none) (allow-none): the type of subtitling
  * @composition_page_id: (out) (transfer none) (allow-none): the composition page id
  * @ancillary_page_id: (out) (transfer none) (allow-none): the ancillary page id
@@ -450,3 +450,37 @@ gst_mpegts_descriptor_parse_dvb_subtitling_nb (const GstMpegTsDescriptor *
 
   return descriptor->length / 8;
 }
+
+/**
+ * gst_mpegts_descriptor_from_dvb_subtitling:
+ * @lang: (transfer none): a string containing the ISO639 language
+ * @type: subtitling type
+ * @composition: composition page id
+ * @ancillary: ancillary page id
+ */
+GstMpegTsDescriptor *
+gst_mpegts_descriptor_from_dvb_subtitling (const gchar * lang,
+    guint8 type, guint16 composition, guint16 ancillary)
+{
+  GstMpegTsDescriptor *descriptor;
+  guint8 *data;
+
+  g_return_val_if_fail (lang != NULL, NULL);
+
+  descriptor = _new_descriptor (GST_MTS_DESC_DVB_SUBTITLING, 8);
+
+  data = descriptor->data + 2;
+
+  memcpy (data, lang, 3);
+  data += 3;
+
+  *data++ = type;
+
+  GST_WRITE_UINT16_BE (data, composition);
+  data += 2;
+
+  GST_WRITE_UINT16_BE (data, ancillary);
+  data += 2;
+
+  return descriptor;
+}
index 0e429e09b4133f58339ee2ade3241f5df95e114d..3d703acc2df8463462cc915e0cf692767024ece4 100644 (file)
@@ -370,6 +370,9 @@ gboolean gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescript
                                                         guint16 *ancillary_page_id);
 guint gst_mpegts_descriptor_parse_dvb_subtitling_nb (const GstMpegTsDescriptor *descriptor);
 
+GstMpegTsDescriptor * gst_mpegts_descriptor_from_dvb_subtitling (const gchar *lang,
+    guint8 type, guint16 composition, guint16 ancillary);
+
 
 
 /* GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM (0x5A) */