static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

    AVStream *st = c->fc->streams[c->fc->nb_streams-1];

    MOVStreamContext *sc = st->priv_data;

    int version = get_byte(pb);

    char language[4] = {0};

    unsigned lang;



    if (version > 1)

        return -1; /* unsupported */



    get_be24(pb); /* flags */

    if (version == 1) {

        get_be64(pb);

        get_be64(pb);

    } else {

        get_be32(pb); /* creation time */

        get_be32(pb); /* modification time */

    }



    sc->time_scale = get_be32(pb);

    st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */



    lang = get_be16(pb); /* language */

    if (ff_mov_lang_to_iso639(lang, language))

        av_metadata_set(&st->metadata, "language", language);

    get_be16(pb); /* quality */



    return 0;

}

static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

    AVStream *st = c->fc->streams[c->fc->nb_streams-1];

    MOVStreamContext *sc = st->priv_data;

    int version = get_byte(pb);

    char language[4] = {0};

    unsigned lang;



    if (version > 1)

        return -1; 



    get_be24(pb); 

    if (version == 1) {

        get_be64(pb);

        get_be64(pb);

    } else {

        get_be32(pb); 

        get_be32(pb); 

    }



    sc->time_scale = get_be32(pb);

    st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); 



    lang = get_be16(pb); 

    if (ff_mov_lang_to_iso639(lang, language))

        av_metadata_set(&st->metadata, "language", language);

    get_be16(pb); 



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)

{

    AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];

    MOVStreamContext *sc = st->priv_data;

    int VAR_3 = get_byte(VAR_1);

    char VAR_4[4] = {0};

    unsigned VAR_5;



    if (VAR_3 > 1)

        return -1; 



    get_be24(VAR_1); 

    if (VAR_3 == 1) {

        get_be64(VAR_1);

        get_be64(VAR_1);

    } else {

        get_be32(VAR_1); 

        get_be32(VAR_1); 

    }



    sc->time_scale = get_be32(VAR_1);

    st->duration = (VAR_3 == 1) ? get_be64(VAR_1) : get_be32(VAR_1); 



    VAR_5 = get_be16(VAR_1); 

    if (ff_mov_lang_to_iso639(VAR_5, VAR_4))

        av_metadata_set(&st->metadata, "VAR_4", VAR_4);

    get_be16(VAR_1); 



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)
{ AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int VAR_3 = get_byte(VAR_1); char VAR_4[4] = {0}; unsigned VAR_5; if (VAR_3 > 1)
return -1; get_be24(VAR_1); if (VAR_3 == 1) { get_be64(VAR_1); get_be64(VAR_1); } else { get_be32(VAR_1); get_be32(VAR_1); } sc->time_scale = get_be32(VAR_1); st->duration = (VAR_3 == 1) ? get_be64(VAR_1) : get_be32(VAR_1); VAR_5 = get_be16(VAR_1); if (ff_mov_lang_to_iso639(VAR_5, VAR_4))
av_metadata_set(&st->metadata, "VAR_4", VAR_4); get_be16(VAR_1); return 0; }