static int r3d_read_red1(AVFormatContext *s)

{

    AVStream *st = avformat_new_stream(s, NULL);

    char filename[258];

    int tmp;

    int av_unused tmp2;

    AVRational framerate;



    if (!st)

        return AVERROR(ENOMEM);

    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    st->codec->codec_id = CODEC_ID_JPEG2000;



    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, "unknown1 %d\n", tmp);



    tmp = avio_rb32(s->pb);

    avpriv_set_pts_info(st, 32, 1, tmp);



    tmp = avio_rb32(s->pb); // filenum

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



    avio_skip(s->pb, 32); // unknown



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

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



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

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



    framerate.num = avio_rb16(s->pb);

    framerate.den = avio_rb16(s->pb);

    if (framerate.num && framerate.den)

        st->r_frame_rate = st->avg_frame_rate = framerate;



    tmp = avio_r8(s->pb); // audio channels

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

    if (tmp > 0) {

        AVStream *ast = avformat_new_stream(s, NULL);

        if (!ast)

            return AVERROR(ENOMEM);

        ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;

        ast->codec->codec_id = CODEC_ID_PCM_S32BE;

        ast->codec->channels = tmp;

        avpriv_set_pts_info(ast, 32, 1, st->time_base.den);

    }



    avio_read(s->pb, filename, 257);

    filename[sizeof(filename)-1] = 0;

    av_dict_set(&st->metadata, "filename", filename, 0);



    av_dlog(s, "filename %s\n", filename);

    av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height);

    av_dlog(s, "timescale %d\n", st->time_base.den);

    av_dlog(s, "frame rate %d/%d\n",

            framerate.num, framerate.den);



    return 0;

}

static int r3d_read_red1(AVFormatContext *s)

{

    AVStream *st = avformat_new_stream(s, NULL);

    char filename[258];

    int tmp;

    int av_unused tmp2;

    AVRational framerate;



    if (!st)

        return AVERROR(ENOMEM);

    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    st->codec->codec_id = CODEC_ID_JPEG2000;



    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, "unknown1 %d\n", tmp);



    tmp = avio_rb32(s->pb);

    avpriv_set_pts_info(st, 32, 1, tmp);



    tmp = avio_rb32(s->pb); 

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



    avio_skip(s->pb, 32); 



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

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



    tmp = avio_rb16(s->pb); 

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



    framerate.num = avio_rb16(s->pb);

    framerate.den = avio_rb16(s->pb);

    if (framerate.num && framerate.den)

        st->r_frame_rate = st->avg_frame_rate = framerate;



    tmp = avio_r8(s->pb); 

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

    if (tmp > 0) {

        AVStream *ast = avformat_new_stream(s, NULL);

        if (!ast)

            return AVERROR(ENOMEM);

        ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;

        ast->codec->codec_id = CODEC_ID_PCM_S32BE;

        ast->codec->channels = tmp;

        avpriv_set_pts_info(ast, 32, 1, st->time_base.den);

    }



    avio_read(s->pb, filename, 257);

    filename[sizeof(filename)-1] = 0;

    av_dict_set(&st->metadata, "filename", filename, 0);



    av_dlog(s, "filename %s\n", filename);

    av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height);

    av_dlog(s, "timescale %d\n", st->time_base.den);

    av_dlog(s, "frame rate %d/%d\n",

            framerate.num, framerate.den);



    return 0;

}

    if (framerate.num && framerate.den)         st->r_frame_rate = st->avg_frame_rate = framerate;
static int FUNC_0(AVFormatContext *VAR_0)

{

    AVStream *st = avformat_new_stream(VAR_0, NULL);

    char VAR_1[258];

    int VAR_2;

    int VAR_3 tmp2;

    AVRational framerate;



    if (!st)

        return AVERROR(ENOMEM);

    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    st->codec->codec_id = CODEC_ID_JPEG2000;



    VAR_2  = avio_r8(VAR_0->pb); 

    tmp2 = avio_r8(VAR_0->pb); 

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



    VAR_2 = avio_rb16(VAR_0->pb); 

    av_dlog(VAR_0, "unknown1 %d\n", VAR_2);



    VAR_2 = avio_rb32(VAR_0->pb);

    avpriv_set_pts_info(st, 32, 1, VAR_2);



    VAR_2 = avio_rb32(VAR_0->pb); 

    av_dlog(VAR_0, "filenum %d\n", VAR_2);



    avio_skip(VAR_0->pb, 32); 



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

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



    VAR_2 = avio_rb16(VAR_0->pb); 

    av_dlog(VAR_0, "unknown2 %d\n", VAR_2);



    framerate.num = avio_rb16(VAR_0->pb);

    framerate.den = avio_rb16(VAR_0->pb);

    if (framerate.num && framerate.den)

        st->r_frame_rate = st->avg_frame_rate = framerate;



    VAR_2 = avio_r8(VAR_0->pb); 

    av_dlog(VAR_0, "audio channels %d\n", VAR_2);

    if (VAR_2 > 0) {

        AVStream *ast = avformat_new_stream(VAR_0, NULL);

        if (!ast)

            return AVERROR(ENOMEM);

        ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;

        ast->codec->codec_id = CODEC_ID_PCM_S32BE;

        ast->codec->channels = VAR_2;

        avpriv_set_pts_info(ast, 32, 1, st->time_base.den);

    }



    avio_read(VAR_0->pb, VAR_1, 257);

    VAR_1[sizeof(VAR_1)-1] = 0;

    av_dict_set(&st->metadata, "VAR_1", VAR_1, 0);



    av_dlog(VAR_0, "VAR_1 %VAR_0\n", VAR_1);

    av_dlog(VAR_0, "resolution %dx%d\n", st->codec->width, st->codec->height);

    av_dlog(VAR_0, "timescale %d\n", st->time_base.den);

    av_dlog(VAR_0, "frame rate %d/%d\n",

            framerate.num, framerate.den);



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ AVStream *st = avformat_new_stream(VAR_0, NULL); char VAR_1[258]; int VAR_2; int VAR_3 tmp2; AVRational framerate; if (!st)
return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_JPEG2000; VAR_2  = avio_r8(VAR_0->pb); tmp2 = avio_r8(VAR_0->pb); av_dlog(VAR_0, "version %d.%d\n", VAR_2, tmp2); VAR_2 = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown1 %d\n", VAR_2); VAR_2 = avio_rb32(VAR_0->pb); avpriv_set_pts_info(st, 32, 1, VAR_2); VAR_2 = avio_rb32(VAR_0->pb); av_dlog(VAR_0, "filenum %d\n", VAR_2); avio_skip(VAR_0->pb, 32); st->codec->width  = avio_rb32(VAR_0->pb); st->codec->height = avio_rb32(VAR_0->pb); VAR_2 = avio_rb16(VAR_0->pb); av_dlog(VAR_0, "unknown2 %d\n", VAR_2); framerate.num = avio_rb16(VAR_0->pb); framerate.den = avio_rb16(VAR_0->pb); if (framerate.num && framerate.den)
st->r_frame_rate = st->avg_frame_rate = framerate; VAR_2 = avio_r8(VAR_0->pb); av_dlog(VAR_0, "audio channels %d\n", VAR_2); if (VAR_2 > 0) { AVStream *ast = avformat_new_stream(VAR_0, NULL); if (!ast)
return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = CODEC_ID_PCM_S32BE; ast->codec->channels = VAR_2; avpriv_set_pts_info(ast, 32, 1, st->time_base.den); } avio_read(VAR_0->pb, VAR_1, 257); VAR_1[sizeof(VAR_1)-1] = 0; av_dict_set(&st->metadata, "VAR_1", VAR_1, 0); av_dlog(VAR_0, "VAR_1 %VAR_0\n", VAR_1); av_dlog(VAR_0, "resolution %dx%d\n", st->codec->width, st->codec->height); av_dlog(VAR_0, "timescale %d\n", st->time_base.den); av_dlog(VAR_0, "frame rate %d/%d\n",
framerate.num, framerate.den); return 0; }