qtdemux: fix language code parsing for 3-letter codes starting with 'a'
authorTim-Philipp Müller <tim@centricular.com>
Mon, 21 Jul 2014 17:11:16 +0000 (18:11 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 21 Jul 2014 17:21:50 +0000 (18:21 +0100)
And handle special value for 'unspecified' explicitly.

https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html

gst/isomp4/qtdemux.c
gst/isomp4/qtdemux_lang.c

index f2ea73b..4348d12 100644 (file)
@@ -7321,8 +7321,10 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
     lang_code = QT_UINT16 ((guint8 *) mdhd->data + 28);
   }
 
-  if (lang_code < 0x800) {
+  if (lang_code < 0x400) {
     qtdemux_lang_map_qt_code_to_iso (stream->lang_id, lang_code);
+  } else if (lang_code == 0x7fff) {
+    stream->lang_id[0] = 0;     /* unspecified */
   } else {
     stream->lang_id[0] = 0x60 + ((lang_code >> 10) & 0x1F);
     stream->lang_id[1] = 0x60 + ((lang_code >> 5) & 0x1F);
index 0c7a5d9..59a78d7 100644 (file)
@@ -189,7 +189,7 @@ qtdemux_lang_map_qt_code_to_iso (gchar id[4], guint16 qt_lang_code)
 {
   const gchar *iso_code;
 
-  g_assert (qt_lang_code < 0x800);
+  g_assert (qt_lang_code < 0x400);
 
   if (qt_lang_code < G_N_ELEMENTS (qt_lang_map))
     iso_code = qt_lang_map[qt_lang_code];