int ff_mov_iso639_to_lang(const char *lang, int mp4)

{

    int i, code = 0;



    /* old way, only for QT? */

    for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {

        if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))

            return i;

    }

    /* XXX:can we do that in mov too? */

    if (!mp4)

        return 0;

    /* handle undefined as such */

    if (lang[0] == '\0')

        lang = "und";

    /* 5bit ascii */

    for (i = 0; i < 3; i++) {

        unsigned char c = (unsigned char)lang[i];

        if (c < 0x60)

            return 0;

        if (c > 0x60 + 0x1f)

            return 0;

        code <<= 5;

        code |= (c - 0x60);

    }

    return code;

}

int ff_mov_iso639_to_lang(const char *lang, int mp4)

{

    int i, code = 0;



    

    for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {

        if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))

            return i;

    }

    

    if (!mp4)

        return 0;

    

    if (lang[0] == '\0')

        lang = "und";

    

    for (i = 0; i < 3; i++) {

        unsigned char c = (unsigned char)lang[i];

        if (c < 0x60)

            return 0;

        if (c > 0x60 + 0x1f)

            return 0;

        code <<= 5;

        code |= (c - 0x60);

    }

    return code;

}

int FUNC_0(const char *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3 = 0;



    

    for (VAR_2 = 0; !VAR_1 && VAR_2 < FF_ARRAY_ELEMS(mov_mdhd_language_map); VAR_2++) {

        if (mov_mdhd_language_map[VAR_2] && !strcmp(VAR_0, mov_mdhd_language_map[VAR_2]))

            return VAR_2;

    }

    

    if (!VAR_1)

        return 0;

    

    if (VAR_0[0] == '\0')

        VAR_0 = "und";

    

    for (VAR_2 = 0; VAR_2 < 3; VAR_2++) {

        unsigned char VAR_4 = (unsigned char)VAR_0[VAR_2];

        if (VAR_4 < 0x60)

            return 0;

        if (VAR_4 > 0x60 + 0x1f)

            return 0;

        VAR_3 <<= 5;

        VAR_3 |= (VAR_4 - 0x60);

    }

    return VAR_3;

}

int FUNC_0(const char *VAR_0, int VAR_1)
{ int VAR_2, VAR_3 = 0; for (VAR_2 = 0; !VAR_1 && VAR_2 < FF_ARRAY_ELEMS(mov_mdhd_language_map); VAR_2++) { if (mov_mdhd_language_map[VAR_2] && !strcmp(VAR_0, mov_mdhd_language_map[VAR_2]))
return VAR_2; } if (!VAR_1)
return 0; if (VAR_0[0] == '\0')
VAR_0 = "und"; for (VAR_2 = 0; VAR_2 < 3; VAR_2++) { unsigned char VAR_4 = (unsigned char)VAR_0[VAR_2]; if (VAR_4 < 0x60)
return 0; if (VAR_4 > 0x60 + 0x1f)
return 0; VAR_3 <<= 5; VAR_3 |= (VAR_4 - 0x60); } return VAR_3; }