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

{

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

    int av_unused tmp, tmp2;

    int samples, size;

    uint64_t pos = avio_tell(s->pb);

    unsigned dts;

    int ret;



    dts = avio_rb32(s->pb);



    st->codec->sample_rate = avio_rb32(s->pb);



    samples = avio_rb32(s->pb);



    tmp = avio_rb32(s->pb);

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



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

    av_dlog(s, "unknown %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_rb32(s->pb); // unknown

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



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

    if (size < 0)

        return -1;

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

    if (ret < 0) {

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

        return ret;

    }



    pkt->stream_index = 1;

    pkt->dts = dts;

    pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);

    av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n",

            pkt->dts, pkt->duration, samples, st->codec->sample_rate);



    return 0;

}

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

{

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

    int av_unused tmp, tmp2;

    int samples, size;

    uint64_t pos = avio_tell(s->pb);

    unsigned dts;

    int ret;



    dts = avio_rb32(s->pb);



    st->codec->sample_rate = avio_rb32(s->pb);



    samples = avio_rb32(s->pb);



    tmp = avio_rb32(s->pb);

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



    tmp = avio_rb16(s->pb); 

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



    tmp  = avio_r8(s->pb); 

    tmp2 = avio_r8(s->pb); 

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



    tmp = avio_rb32(s->pb); 

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



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

    if (size < 0)

        return -1;

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

    if (ret < 0) {

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

        return ret;

    }



    pkt->stream_index = 1;

    pkt->dts = dts;

    pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);

    av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n",

            pkt->dts, pkt->duration, samples, st->codec->sample_rate);



    return 0;

}

    pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, Atom *VAR_2)

{

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

    int VAR_3 tmp, tmp2;

    int VAR_4, VAR_5;

    uint64_t pos = avio_tell(VAR_0->pb);

    unsigned VAR_6;

    int VAR_7;



    VAR_6 = avio_rb32(VAR_0->pb);



    st->codec->sample_rate = avio_rb32(VAR_0->pb);



    VAR_4 = avio_rb32(VAR_0->pb);



    tmp = avio_rb32(VAR_0->pb);

    av_dlog(VAR_0, "packet num %d\n", tmp);



    tmp = avio_rb16(VAR_0->pb); 

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



    tmp  = avio_r8(VAR_0->pb); 

    tmp2 = avio_r8(VAR_0->pb); 

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



    tmp = avio_rb32(VAR_0->pb); 

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



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

    if (VAR_5 < 0)

        return -1;

    VAR_7 = av_get_packet(VAR_0->pb, VAR_1, VAR_5);

    if (VAR_7 < 0) {

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

        return VAR_7;

    }



    VAR_1->stream_index = 1;

    VAR_1->VAR_6 = VAR_6;

    VAR_1->duration = av_rescale(VAR_4, st->time_base.den, st->codec->sample_rate);

    av_dlog(VAR_0, "VAR_1 VAR_6 %"PRId64" duration %d VAR_4 %d sample rate %d\n",

            VAR_1->VAR_6, VAR_1->duration, VAR_4, st->codec->sample_rate);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, Atom *VAR_2)
{ AVStream *st = VAR_0->streams[1]; int VAR_3 tmp, tmp2; int VAR_4, VAR_5; uint64_t pos = avio_tell(VAR_0->pb); unsigned VAR_6; int VAR_7; VAR_6 = avio_rb32(VAR_0->pb); st->codec->sample_rate = avio_rb32(VAR_0->pb); VAR_4 = avio_rb32(VAR_0->pb); tmp = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "packet num %d\n", tmp); tmp = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown %d\n", tmp); tmp  = avio_r8(VAR_0->pb); tmp2 = avio_r8(VAR_0->pb); av_dlog(VAR_0, "version %d.%d\n", tmp, tmp2); tmp = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "unknown %d\n", tmp); VAR_5 = VAR_2->VAR_5 - 8 - (avio_tell(VAR_0->pb) - pos); if (VAR_5 < 0)
return -1; VAR_7 = av_get_packet(VAR_0->pb, VAR_1, VAR_5); if (VAR_7 < 0) { av_log(VAR_0, AV_LOG_ERROR, "error reading audio packet\n"); return VAR_7; } VAR_1->stream_index = 1; VAR_1->VAR_6 = VAR_6; VAR_1->duration = av_rescale(VAR_4, st->time_base.den, st->codec->sample_rate); av_dlog(VAR_0, "VAR_1 VAR_6 %"PRId64" duration %d VAR_4 %d sample rate %d\n",
VAR_1->VAR_6, VAR_1->duration, VAR_4, st->codec->sample_rate); return 0; }