On Sat, 4 Jul 2020, Zhao Zhili wrote:



On Jul 4, 2020, at 2:29 AM, Marton Balint <c...@passwd.hu> wrote:



On Sat, 27 Jun 2020, Zhao Zhili wrote:

This is a map from 'Macintosh Language Codes' to 'ISO639-2/T'. Some items
in the map were ISO639-2/B, some were ISO639-1.

FFMpeg is using ISO639-2/B for language metadata according to docs. So if you 
change these tables, some functions relying on that these tables contain 
ISO639-2/B entires will break.

From "QuickTime File Format Specification":
the QuickTime file format uses either language codes from the Macintosh
Script Manager or ISO language codes (as specified in ISO 639-2/T )

ISO/IEC 14496-12 only specify ISO 639-2/T as language codes.

In my opinion, mov_mdhd_language_map only handle the difference between the
two specification.

This is one way to look at it. Another way to look at it is that the table is there to convert between Macintosh Language Code and ISO639-2/B (the format used by ffmpeg internally for language description).

So I don't really see the benefit of changing the table to map to ISO639-2/T, because in this case an additional conversation step is necessary for the ffmpeg internal format ISO639-2/B.

Regards,
Marton

mov_mdhd_language_map shouldn't map to ISO 639-2/B,
otherwise ff_mov_iso639_to_lang

1. may return ISO 639-2/B if the format is quicktime
2. return ISO 639-2/T if the format is 14496-12

If we need transform between mov language codes and what FFmpeg uses, fix
the implementation of ff_mov_iso639_to_lang and ff_mov_lang_to_iso639, or
add wrapper on them. I think it's better to keep the duty of
mov_mdhd_language_map simple and clear.


You should check which functions are using these tables, and update them 
accordingly. Or maybe you need to update the code which is calling those 
functions. There is also some infrastructure in place for converting between 
languages, see libavformat/avlanguage.h.

Regards,
Marton

---
libavformat/isom.c | 50 +++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 209bbac5d1..e6b9506f67 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -397,10 +397,10 @@ const AVCodecTag ff_codec_movdata_tags[] = {
static const char mov_mdhd_language_map[][4] = {
   "eng",    /*   0 English */
   "fra",    /*   1 French */
-    "ger",    /*   2 German */
+    "deu",    /*   2 German */
   "ita",    /*   3 Italian */
-    "dut",    /*   4 Dutch */
-    "sve",    /*   5 Swedish */
+    "nld",    /*   4 Dutch */
+    "swe",    /*   5 Swedish */
   "spa",    /*   6 Spanish */
   "dan",    /*   7 Danish */
   "por",    /*   8 Portuguese */
@@ -410,11 +410,11 @@ static const char mov_mdhd_language_map[][4] = {
   "ara",    /*  12 Arabic */
   "fin",    /*  13 Finnish */
   "gre",    /*  14 Greek */
-    "ice",    /*  15 Icelandic */
+    "isl",    /*  15 Icelandic */
   "mlt",    /*  16 Maltese */
   "tur",    /*  17 Turkish */
-    "hr ",    /*  18 Croatian */
-    "chi",    /*  19 Traditional Chinese */
+    "hrv",    /*  18 Croatian */
+    "zho",    /*  19 Traditional Chinese */
   "urd",    /*  20 Urdu */
   "hin",    /*  21 Hindi */
   "tha",    /*  22 Thai */
@@ -425,20 +425,20 @@ static const char mov_mdhd_language_map[][4] = {
   "est",    /*  27 Estonian */
   "lav",    /*  28 Latvian */
      "",    /*  29 Sami */
-    "fo ",    /*  30 Faroese */
-       "",    /*  31 Farsi */
+    "fao",    /*  30 Faroese */
+    "fas",    /*  31 Farsi */
   "rus",    /*  32 Russian */
-    "chi",    /*  33 Simplified Chinese */
-       "",    /*  34 Flemish */
-    "iri",    /*  35 Irish */
-    "alb",    /*  36 Albanian */
+    "zho",    /*  33 Simplified Chinese */
+    "nld",    /*  34 Flemish */
+    "gle",    /*  35 Irish */
+    "sqi",    /*  36 Albanian */
   "ron",    /*  37 Romanian */
   "ces",    /*  38 Czech */
   "slk",    /*  39 Slovak */
   "slv",    /*  40 Slovenian */
   "yid",    /*  41 Yiddish */
-    "sr ",    /*  42 Serbian */
-    "mac",    /*  43 Macedonian */
+    "srp",    /*  42 Serbian */
+    "mkd",    /*  43 Macedonian */
   "bul",    /*  44 Bulgarian */
   "ukr",    /*  45 Ukrainian */
   "bel",    /*  46 Belarusian */
@@ -446,33 +446,33 @@ static const char mov_mdhd_language_map[][4] = {
   "kaz",    /*  48 Kazakh */
   "aze",    /*  49 Azerbaijani */
   "aze",    /*  50 AzerbaijanAr */
-    "arm",    /*  51 Armenian */
-    "geo",    /*  52 Georgian */
+    "hye",    /*  51 Armenian */
+    "kat",    /*  52 Georgian */
   "mol",    /*  53 Moldavian */
   "kir",    /*  54 Kirghiz */
   "tgk",    /*  55 Tajiki */
   "tuk",    /*  56 Turkmen */
   "mon",    /*  57 Mongolian */
-       "",    /*  58 MongolianCyr */
+    "mon",    /*  58 MongolianCyr */
   "pus",    /*  59 Pashto */
   "kur",    /*  60 Kurdish */
   "kas",    /*  61 Kashmiri */
   "snd",    /*  62 Sindhi */
-    "tib",    /*  63 Tibetan */
+    "bod",    /*  63 Tibetan */
   "nep",    /*  64 Nepali */
   "san",    /*  65 Sanskrit */
   "mar",    /*  66 Marathi */
   "ben",    /*  67 Bengali */
   "asm",    /*  68 Assamese */
   "guj",    /*  69 Gujarati */
-    "pa ",    /*  70 Punjabi */
+    "pan",    /*  70 Punjabi */
   "ori",    /*  71 Oriya */
   "mal",    /*  72 Malayalam */
   "kan",    /*  73 Kannada */
   "tam",    /*  74 Tamil */
   "tel",    /*  75 Telugu */
-       "",    /*  76 Sinhala */
-    "bur",    /*  77 Burmese */
+    "sin",    /*  76 Sinhala */
+    "mya",    /*  77 Burmese */
   "khm",    /*  78 Khmer */
   "lao",    /*  79 Lao */
   "vie",    /*  80 Vietnamese */
@@ -485,9 +485,9 @@ static const char mov_mdhd_language_map[][4] = {
   "orm",    /*  87 Oromo */
   "som",    /*  88 Somali */
   "swa",    /*  89 Swahili */
-       "",    /*  90 Kinyarwanda */
+    "kin",    /*  90 Kinyarwanda */
   "run",    /*  91 Rundi */
-       "",    /*  92 Nyanja */
+    "nya",    /*  92 Nyanja */
   "mlg",    /*  93 Malagasy */
   "epo",    /*  94 Esperanto */
      "",    /*  95  */
@@ -523,8 +523,8 @@ static const char mov_mdhd_language_map[][4] = {
      "",    /* 125  */
      "",    /* 126  */
      "",    /* 127  */
-    "wel",    /* 128 Welsh */
-    "baq",    /* 129 Basque */
+    "cym",    /* 128 Welsh */
+    "eus",    /* 129 Basque */
   "cat",    /* 130 Catalan */
   "lat",    /* 131 Latin */
   "que",    /* 132 Quechua */
--
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to