static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)

{

    AVStream *st = s->streams[0];

    int tmp, tmp2;

    uint64_t pos = url_ftell(s->pb);

    unsigned dts;



    dts = get_be32(s->pb);



    tmp = get_be32(s->pb);

    dprintf(s, "frame num %d\n", tmp);



    tmp  = get_byte(s->pb); // major version

    tmp2 = get_byte(s->pb); // minor version

    dprintf(s, "version %d.%d\n", tmp, tmp2);



    tmp = get_be16(s->pb); // unknown

    dprintf(s, "unknown %d\n", tmp);



    if (tmp > 4) {

        tmp = get_be16(s->pb); // unknown

        dprintf(s, "unknown %d\n", tmp);



        tmp = get_be16(s->pb); // unknown

        dprintf(s, "unknown %d\n", tmp);



        tmp = get_be32(s->pb);

        dprintf(s, "width %d\n", tmp);

        tmp = get_be32(s->pb);

        dprintf(s, "height %d\n", tmp);



        tmp = get_be32(s->pb);

        dprintf(s, "metadata len %d\n", tmp);

    }

    tmp = atom->size - 8 - (url_ftell(s->pb) - pos);

    if (tmp < 0)

        return -1;



    if (av_get_packet(s->pb, pkt, tmp) != tmp) {

        av_log(s, AV_LOG_ERROR, "error reading video packet\n");

        return -1;

    }



    pkt->stream_index = 0;

    pkt->dts = dts;

    if (st->codec->time_base.den)

        pkt->duration = (uint64_t)st->time_base.den*

            st->codec->time_base.num/st->codec->time_base.den;

    dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);



    return 0;

}

static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)

{

    AVStream *st = s->streams[0];

    int tmp, tmp2;

    uint64_t pos = url_ftell(s->pb);

    unsigned dts;



    dts = get_be32(s->pb);



    tmp = get_be32(s->pb);

    dprintf(s, "frame num %d\n", tmp);



    tmp  = get_byte(s->pb); 

    tmp2 = get_byte(s->pb); 

    dprintf(s, "version %d.%d\n", tmp, tmp2);



    tmp = get_be16(s->pb); 

    dprintf(s, "unknown %d\n", tmp);



    if (tmp > 4) {

        tmp = get_be16(s->pb); 

        dprintf(s, "unknown %d\n", tmp);



        tmp = get_be16(s->pb); 

        dprintf(s, "unknown %d\n", tmp);



        tmp = get_be32(s->pb);

        dprintf(s, "width %d\n", tmp);

        tmp = get_be32(s->pb);

        dprintf(s, "height %d\n", tmp);



        tmp = get_be32(s->pb);

        dprintf(s, "metadata len %d\n", tmp);

    }

    tmp = atom->size - 8 - (url_ftell(s->pb) - pos);

    if (tmp < 0)

        return -1;



    if (av_get_packet(s->pb, pkt, tmp) != tmp) {

        av_log(s, AV_LOG_ERROR, "error reading video packet\n");

        return -1;

    }



    pkt->stream_index = 0;

    pkt->dts = dts;

    if (st->codec->time_base.den)

        pkt->duration = (uint64_t)st->time_base.den*

            st->codec->time_base.num/st->codec->time_base.den;

    dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);



    return 0;

}

    if (av_get_packet(s->pb, pkt, tmp) != tmp) {         av_log(s, AV_LOG_ERROR, "error reading video packet\n");         return -1;
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, Atom *VAR_2)

{

    AVStream *st = VAR_0->streams[0];

    int VAR_3, VAR_4;

    uint64_t pos = url_ftell(VAR_0->pb);

    unsigned VAR_5;



    VAR_5 = get_be32(VAR_0->pb);



    VAR_3 = get_be32(VAR_0->pb);

    dprintf(VAR_0, "frame num %d\n", VAR_3);



    VAR_3  = get_byte(VAR_0->pb); 

    VAR_4 = get_byte(VAR_0->pb); 

    dprintf(VAR_0, "version %d.%d\n", VAR_3, VAR_4);



    VAR_3 = get_be16(VAR_0->pb); 

    dprintf(VAR_0, "unknown %d\n", VAR_3);



    if (VAR_3 > 4) {

        VAR_3 = get_be16(VAR_0->pb); 

        dprintf(VAR_0, "unknown %d\n", VAR_3);



        VAR_3 = get_be16(VAR_0->pb); 

        dprintf(VAR_0, "unknown %d\n", VAR_3);



        VAR_3 = get_be32(VAR_0->pb);

        dprintf(VAR_0, "width %d\n", VAR_3);

        VAR_3 = get_be32(VAR_0->pb);

        dprintf(VAR_0, "height %d\n", VAR_3);



        VAR_3 = get_be32(VAR_0->pb);

        dprintf(VAR_0, "metadata len %d\n", VAR_3);

    }

    VAR_3 = VAR_2->size - 8 - (url_ftell(VAR_0->pb) - pos);

    if (VAR_3 < 0)

        return -1;



    if (av_get_packet(VAR_0->pb, VAR_1, VAR_3) != VAR_3) {

        av_log(VAR_0, AV_LOG_ERROR, "error reading video packet\n");

        return -1;

    }



    VAR_1->stream_index = 0;

    VAR_1->VAR_5 = VAR_5;

    if (st->codec->time_base.den)

        VAR_1->duration = (uint64_t)st->time_base.den*

            st->codec->time_base.num/st->codec->time_base.den;

    dprintf(VAR_0, "VAR_1 VAR_5 %lld duration %d\n", VAR_1->VAR_5, VAR_1->duration);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, Atom *VAR_2)
{ AVStream *st = VAR_0->streams[0]; int VAR_3, VAR_4; uint64_t pos = url_ftell(VAR_0->pb); unsigned VAR_5; VAR_5 = get_be32(VAR_0->pb); VAR_3 = get_be32(VAR_0->pb); dprintf(VAR_0, "frame num %d\n", VAR_3); VAR_3  = get_byte(VAR_0->pb); VAR_4 = get_byte(VAR_0->pb); dprintf(VAR_0, "version %d.%d\n", VAR_3, VAR_4); VAR_3 = get_be16(VAR_0->pb); dprintf(VAR_0, "unknown %d\n", VAR_3); if (VAR_3 > 4) { VAR_3 = get_be16(VAR_0->pb); dprintf(VAR_0, "unknown %d\n", VAR_3); VAR_3 = get_be16(VAR_0->pb); dprintf(VAR_0, "unknown %d\n", VAR_3); VAR_3 = get_be32(VAR_0->pb); dprintf(VAR_0, "width %d\n", VAR_3); VAR_3 = get_be32(VAR_0->pb); dprintf(VAR_0, "height %d\n", VAR_3); VAR_3 = get_be32(VAR_0->pb); dprintf(VAR_0, "metadata len %d\n", VAR_3); } VAR_3 = VAR_2->size - 8 - (url_ftell(VAR_0->pb) - pos); if (VAR_3 < 0)
return -1; if (av_get_packet(VAR_0->pb, VAR_1, VAR_3) != VAR_3) { av_log(VAR_0, AV_LOG_ERROR, "error reading video packet\n"); return -1; } VAR_1->stream_index = 0; VAR_1->VAR_5 = VAR_5; if (st->codec->time_base.den)
VAR_1->duration = (uint64_t)st->time_base.den*
st->codec->time_base.num/st->codec->time_base.den; dprintf(VAR_0, "VAR_1 VAR_5 %lld duration %d\n", VAR_1->VAR_5, VAR_1->duration); return 0; }