[FFmpeg-devel] Suggestion for a centralized language-tag facility in libavformat

Michael Niedermayer michaelni
Wed Apr 15 22:12:27 CEST 2009


On Wed, Apr 15, 2009 at 03:03:17PM +0200, cyril comparon wrote:
> Hi, here are my latest patches. I tried to correct everything you said.
> Cyril

[...]
[...]


> +typedef struct TableEntry {
> +    const char iso6392bibl[4];  /* 3-letter bibliographic language code as per ISO/IEC 639-2 (always exists) */
> +    const char iso6392term[4];  /* 3-letter terminologic language code as per ISO/IEC 639-2 (may be empty) */
> +    const char iso6391[3];      /* 2-letter code of language as per ISO/IEC 639-1, (may be empty) */

the comments dont look doxygen compatible


> +} TableEntry;
> +
> +static TableEntry languageTable[] = {
> +    { "aar", "", "aa" },
> +    { "abk", "", "ab" },
> +    { "ace", "", "" },
> +    { "ach", "", "" },
> +    { "ada", "", "" },
> +    { "ady", "", "" },
> +    { "afa", "", "" },
> +    { "afh", "", "" },
> +    { "afr", "", "af" },
> +    { "ain", "", "" },
> +    { "aka", "", "ak" },
> +    { "akk", "", "" },
> +    { "alb", "sqi", "sq" },

vertical align
also its not true that there are no T code for some, rather they are
identical


[...]
> +
> +static int priv_rowByISO6392(const char *lang)
> +{
> +    int i;
> +    if (lang)
> +        for (i=0; languageTable[i].iso6392bibl[0] != '\0'; i++)
> +            if (!strcmp(lang, languageTable[i].iso6392bibl) ||
> +                !strcmp(lang, languageTable[i].iso6392term))
> +                return i;
> +    return -1;
> +}
> +
> +/**
> + * Returns the 2-letter ISO639-1 code associated with a given 3-letter ISO639-2 code,
> + * or NULL if the latter is null or invalid, or has no ISO639-1 representation.
> + * ISO639-1 and ISO639-2 codes are lower case.
> + */
> +const char *av_langISO6392toISO6391(const char *lang)
> +{
> +    const int row = priv_rowByISO6392(lang);
> +    return row == -1 ? NULL : languageTable[row].iso6391;
> +}
> +
> +/**
> + * Returns a 3-letter ISO639-2 code associated with a given 2-letter ISO639-1 code,
> + * or NULL if the latter is null or invalid.
> + * ISO639-1 and ISO639-2 codes are lower case.
> + */
> +const char *av_langISO6391toISO6392(const char *lang)

The B and T lists arent the same, this returns the B one, it should be
documented, also the doxy belongs in the header not the c file



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090415/750b723c/attachment.pgp>



More information about the ffmpeg-devel mailing list