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>
pull/228/head
James Almer 9 years ago
parent b3820cabad
commit 1582e306a4
  1. 2
      libavformat/asfdec_f.c
  2. 2
      libavformat/asfdec_o.c
  3. 2
      libavformat/asfenc.c
  4. 2
      libavformat/avienc.c
  5. 11
      libavformat/avlanguage.c
  6. 7
      libavformat/avlanguage.h
  7. 2
      libavformat/matroskaenc.c

@ -912,7 +912,7 @@ static int asf_read_header(AVFormatContext *s)
const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index]; const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index];
if (rfc1766 && strlen(rfc1766) > 1) { if (rfc1766 && strlen(rfc1766) > 1) {
const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any 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); AV_LANG_ISO639_2_BIBL);
if (iso6392) if (iso6392)
av_dict_set(&st->metadata, "language", iso6392, 0); av_dict_set(&st->metadata, "language", iso6392, 0);

@ -828,7 +828,7 @@ static void set_language(AVFormatContext *s, const char *rfc1766, AVDictionary *
// language abbr should contain at least 2 chars // language abbr should contain at least 2 chars
if (rfc1766 && strlen(rfc1766) > 1) { if (rfc1766 && strlen(rfc1766) > 1) {
const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any 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); AV_LANG_ISO639_2_BIBL);
if (iso6392) if (iso6392)
if (av_dict_set(met, "language", iso6392, 0) < 0) if (av_dict_set(met, "language", iso6392, 0) < 0)

@ -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); entry = av_dict_get(s->streams[n]->metadata, "language", NULL, 0);
if (entry) { 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) { if (iso6391lang) {
int i; int i;
for (i = 0; i < asf->nb_languages; i++) { for (i = 0; i < asf->nb_languages; i++) {

@ -435,7 +435,7 @@ static int avi_write_header(AVFormatContext *s)
} }
if (par->codec_id == AV_CODEC_ID_XSUB if (par->codec_id == AV_CODEC_ID_XSUB
&& (t = av_dict_get(s->streams[i]->metadata, "language", NULL, 0))) { && (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; t = NULL;
if (langstr) { if (langstr) {
char* str = av_asprintf("Subtitle - %s-xx;02", langstr); char* str = av_asprintf("Subtitle - %s-xx;02", langstr);

@ -733,7 +733,7 @@ static int lang_table_compare(const void *lhs, const void *rhs)
return strcmp(lhs, ((const LangEntry *)rhs)->str); 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; int i;
const LangEntry *entry = NULL; 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; entry = lang_table + entry->next_equivalent;
if (target_codespace == AV_LANG_ISO639_2_TERM) 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; 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

@ -21,6 +21,9 @@
#ifndef AVFORMAT_AVLANGUAGE_H #ifndef AVFORMAT_AVLANGUAGE_H
#define AVFORMAT_AVLANGUAGE_H #define AVFORMAT_AVLANGUAGE_H
#include "libavutil/attributes.h"
#include "libavformat/version.h"
/** /**
* Known language codespaces * Known language codespaces
*/ */
@ -34,6 +37,10 @@ enum AVLangCodespace {
* Convert a language code to a target codespace. The source codespace is guessed. * Convert a language code to a target codespace. The source codespace is guessed.
* @return NULL if the provided lang is null or invalid. * @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); const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace);
#endif
#endif /* AVFORMAT_AVLANGUAGE_H */ #endif /* AVFORMAT_AVLANGUAGE_H */

@ -1261,7 +1261,7 @@ static int mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if ((p = strrchr(p, '-')) && 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 = 0;
p = key; p = key;

Loading…
Cancel
Save