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

{

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

    int tmp;

    int av_unused tmp2;

    uint64_t pos = avio_tell(s->pb);

    unsigned dts;

    int ret;



    dts = avio_rb32(s->pb);



    tmp = avio_rb32(s->pb);

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



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

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

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



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

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



    if (tmp > 4) {

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

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



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

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



        tmp = avio_rb32(s->pb);

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

        tmp = avio_rb32(s->pb);

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



        tmp = avio_rb32(s->pb);

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

    }

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

    if (tmp < 0)

        return -1;

    ret = av_get_packet(s->pb, pkt, tmp);

    if (ret < 0) {

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

        return -1;

    }



    pkt->stream_index = 0;

    pkt->dts = dts;

    if (st->avg_frame_rate.num)

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

            st->avg_frame_rate.den/st->avg_frame_rate.num;

    av_dlog(s, "pkt dts %"PRId64" 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;

    int av_unused tmp2;

    uint64_t pos = avio_tell(s->pb);

    unsigned dts;

    int ret;



    dts = avio_rb32(s->pb);



    tmp = avio_rb32(s->pb);

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



    tmp  = avio_r8(s->pb); 

    tmp2 = avio_r8(s->pb); 

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



    tmp = avio_rb16(s->pb); 

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



    if (tmp > 4) {

        tmp = avio_rb16(s->pb); 

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



        tmp = avio_rb16(s->pb); 

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



        tmp = avio_rb32(s->pb);

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

        tmp = avio_rb32(s->pb);

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



        tmp = avio_rb32(s->pb);

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

    }

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

    if (tmp < 0)

        return -1;

    ret = av_get_packet(s->pb, pkt, tmp);

    if (ret < 0) {

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

        return -1;

    }



    pkt->stream_index = 0;

    pkt->dts = dts;

    if (st->avg_frame_rate.num)

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

            st->avg_frame_rate.den/st->avg_frame_rate.num;

    av_dlog(s, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->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;

    int VAR_4 tmp2;

    uint64_t pos = avio_tell(VAR_0->pb);

    unsigned VAR_5;

    int VAR_6;



    VAR_5 = avio_rb32(VAR_0->pb);



    VAR_3 = avio_rb32(VAR_0->pb);

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



    VAR_3  = avio_r8(VAR_0->pb); 

    tmp2 = avio_r8(VAR_0->pb); 

    av_dlog(VAR_0, "version %d.%d\n", VAR_3, tmp2);



    VAR_3 = avio_rb16(VAR_0->pb); 

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



    if (VAR_3 > 4) {

        VAR_3 = avio_rb16(VAR_0->pb); 

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



        VAR_3 = avio_rb16(VAR_0->pb); 

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



        VAR_3 = avio_rb32(VAR_0->pb);

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

        VAR_3 = avio_rb32(VAR_0->pb);

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



        VAR_3 = avio_rb32(VAR_0->pb);

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

    }

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

    if (VAR_3 < 0)

        return -1;

    VAR_6 = av_get_packet(VAR_0->pb, VAR_1, VAR_3);

    if (VAR_6 < 0) {

        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->avg_frame_rate.num)

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

            st->avg_frame_rate.den/st->avg_frame_rate.num;

    av_dlog(VAR_0, "VAR_1 VAR_5 %"PRId64" 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; int VAR_4 tmp2; uint64_t pos = avio_tell(VAR_0->pb); unsigned VAR_5; int VAR_6; VAR_5 = avio_rb32(VAR_0->pb); VAR_3 = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "frame num %d\n", VAR_3); VAR_3  = avio_r8(VAR_0->pb); tmp2 = avio_r8(VAR_0->pb); av_dlog(VAR_0, "version %d.%d\n", VAR_3, tmp2); VAR_3 = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown %d\n", VAR_3); if (VAR_3 > 4) { VAR_3 = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown %d\n", VAR_3); VAR_3 = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown %d\n", VAR_3); VAR_3 = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "width %d\n", VAR_3); VAR_3 = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "height %d\n", VAR_3); VAR_3 = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "metadata len %d\n", VAR_3); } VAR_3 = VAR_2->size - 8 - (avio_tell(VAR_0->pb) - pos); if (VAR_3 < 0)
return -1; VAR_6 = av_get_packet(VAR_0->pb, VAR_1, VAR_3); if (VAR_6 < 0) { 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->avg_frame_rate.num)
VAR_1->duration = (uint64_t)st->time_base.den*
st->avg_frame_rate.den/st->avg_frame_rate.num; av_dlog(VAR_0, "VAR_1 VAR_5 %"PRId64" duration %d\n", VAR_1->VAR_5, VAR_1->duration); return 0; }