[FFmpeg-cvslog] avformat/avlanguage: make av_convert_lang_to() internal

James Almer git at videolan.org
Wed Jul 20 03:47:37 EEST 2016


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri May 13 18:03:28 2016 -0300| [1582e306a47977b09fddb029b999f99eb03cd485] | committer: James Almer

avformat/avlanguage: make av_convert_lang_to() internal

The header was never installed and the function is only used in libavformat

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1582e306a47977b09fddb029b999f99eb03cd485
---

 libavformat/asfdec_f.c    |    2 +-
 libavformat/asfdec_o.c    |    2 +-
 libavformat/asfenc.c      |    2 +-
 libavformat/avienc.c      |    2 +-
 libavformat/avlanguage.c  |   11 +++++++++--
 libavformat/avlanguage.h  |    7 +++++++
 libavformat/matroskaenc.c |    2 +-
 7 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 2c81b13..b973eff 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -912,7 +912,7 @@ static int asf_read_header(AVFormatContext *s)
                 const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index];
                 if (rfc1766 && strlen(rfc1766) > 1) {
                     const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any
-                    const char *iso6392       = av_convert_lang_to(primary_tag,
+                    const char *iso6392       = ff_convert_lang_to(primary_tag,
                                                                    AV_LANG_ISO639_2_BIBL);
                     if (iso6392)
                         av_dict_set(&st->metadata, "language", iso6392, 0);
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 9eefa5a..56f8446 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -828,7 +828,7 @@ static void set_language(AVFormatContext *s, const char *rfc1766, AVDictionary *
     // language abbr should contain at least 2 chars
     if (rfc1766 && strlen(rfc1766) > 1) {
         const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any
-        const char *iso6392       = av_convert_lang_to(primary_tag,
+        const char *iso6392       = ff_convert_lang_to(primary_tag,
                                                        AV_LANG_ISO639_2_BIBL);
         if (iso6392)
             if (av_dict_set(met, "language", iso6392, 0) < 0)
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 88f01e0..19dee3d 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -431,7 +431,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
 
         entry = av_dict_get(s->streams[n]->metadata, "language", NULL, 0);
         if (entry) {
-            const char *iso6391lang = av_convert_lang_to(entry->value, AV_LANG_ISO639_1);
+            const char *iso6391lang = ff_convert_lang_to(entry->value, AV_LANG_ISO639_1);
             if (iso6391lang) {
                 int i;
                 for (i = 0; i < asf->nb_languages; i++) {
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9504a02..fd16fff 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -435,7 +435,7 @@ static int avi_write_header(AVFormatContext *s)
             }
             if (par->codec_id == AV_CODEC_ID_XSUB
             && (t = av_dict_get(s->streams[i]->metadata, "language", NULL, 0))) {
-                const char* langstr = av_convert_lang_to(t->value, AV_LANG_ISO639_1);
+                const char* langstr = ff_convert_lang_to(t->value, AV_LANG_ISO639_1);
                 t = NULL;
                 if (langstr) {
                     char* str = av_asprintf("Subtitle - %s-xx;02", langstr);
diff --git a/libavformat/avlanguage.c b/libavformat/avlanguage.c
index 39f2560..f5d2ddf 100644
--- a/libavformat/avlanguage.c
+++ b/libavformat/avlanguage.c
@@ -733,7 +733,7 @@ static int lang_table_compare(const void *lhs, const void *rhs)
     return strcmp(lhs, ((const LangEntry *)rhs)->str);
 }
 
-const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
+const char *ff_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
 {
     int i;
     const LangEntry *entry = NULL;
@@ -759,7 +759,14 @@ const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_cod
             entry = lang_table + entry->next_equivalent;
 
     if (target_codespace == AV_LANG_ISO639_2_TERM)
-        return av_convert_lang_to(lang, AV_LANG_ISO639_2_BIBL);
+        return ff_convert_lang_to(lang, AV_LANG_ISO639_2_BIBL);
 
     return NULL;
 }
+
+#if LIBAVFORMAT_VERSION_MAJOR < 58
+const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
+{
+    return ff_convert_lang_to(lang, target_codespace);
+}
+#endif
diff --git a/libavformat/avlanguage.h b/libavformat/avlanguage.h
index 84bef58..1d72dcb 100644
--- a/libavformat/avlanguage.h
+++ b/libavformat/avlanguage.h
@@ -21,6 +21,9 @@
 #ifndef AVFORMAT_AVLANGUAGE_H
 #define AVFORMAT_AVLANGUAGE_H
 
+#include "libavutil/attributes.h"
+#include "libavformat/version.h"
+
 /**
  * Known language codespaces
  */
@@ -34,6 +37,10 @@ enum AVLangCodespace {
  * Convert a language code to a target codespace. The source codespace is guessed.
  * @return NULL if the provided lang is null or invalid.
  */
+const char *ff_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace);
+#if LIBAVFORMAT_VERSION_MAJOR < 58
+attribute_deprecated
 const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace);
+#endif
 
 #endif /* AVFORMAT_AVLANGUAGE_H */
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 53353bd..833e77d 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1261,7 +1261,7 @@ static int mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)
         return AVERROR(ENOMEM);
 
     if ((p = strrchr(p, '-')) &&
-        (lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL)))
+        (lang = ff_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL)))
         *p = 0;
 
     p = key;



More information about the ffmpeg-cvslog mailing list