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@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2016-05-13 18:03:28 -03:00
parent b3820cabad
commit 1582e306a4
7 changed files with 21 additions and 7 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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++) {

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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;