static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,

                                     AVStream *st, int read_all)

{

    RMDemuxContext *rm = s->priv_data;

    char buf[256];

    uint32_t version;

    int i;



    /* ra type header */

    version = get_be32(pb); /* version */

    if (((version >> 16) & 0xff) == 3) {

        int64_t startpos = url_ftell(pb);

        /* very old version */

        for(i = 0; i < 14; i++)

            get_byte(pb);

        get_str8(pb, s->title, sizeof(s->title));

        get_str8(pb, s->author, sizeof(s->author));

        get_str8(pb, s->copyright, sizeof(s->copyright));

        get_str8(pb, s->comment, sizeof(s->comment));

        if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {

            // fourcc (should always be "lpcJ")

            get_byte(pb);

            get_str8(pb, buf, sizeof(buf));

        }

        // Skip extra header crap (this should never happen)

        if ((startpos + (version & 0xffff)) > url_ftell(pb))

            url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));

        st->codec->sample_rate = 8000;

        st->codec->channels = 1;

        st->codec->codec_type = CODEC_TYPE_AUDIO;

        st->codec->codec_id = CODEC_ID_RA_144;

    } else {

        int flavor, sub_packet_h, coded_framesize, sub_packet_size;

        /* old version (4) */

        get_be32(pb); /* .ra4 */

        get_be32(pb); /* data size */

        get_be16(pb); /* version2 */

        get_be32(pb); /* header size */

        flavor= get_be16(pb); /* add codec info / flavor */

        rm->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */

        get_be32(pb); /* ??? */

        get_be32(pb); /* ??? */

        get_be32(pb); /* ??? */

        rm->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */

        st->codec->block_align= get_be16(pb); /* frame size */

        rm->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */

        get_be16(pb); /* ??? */

        if (((version >> 16) & 0xff) == 5) {

            get_be16(pb); get_be16(pb); get_be16(pb);

        }

        st->codec->sample_rate = get_be16(pb);

        get_be32(pb);

        st->codec->channels = get_be16(pb);

        if (((version >> 16) & 0xff) == 5) {

            get_be32(pb);

            buf[0] = get_byte(pb);

            buf[1] = get_byte(pb);

            buf[2] = get_byte(pb);

            buf[3] = get_byte(pb);

            buf[4] = 0;

        } else {

            get_str8(pb, buf, sizeof(buf)); /* desc */

            get_str8(pb, buf, sizeof(buf)); /* desc */

        }

        st->codec->codec_type = CODEC_TYPE_AUDIO;

        if (!strcmp(buf, "dnet")) {

            st->codec->codec_id = CODEC_ID_AC3;

            st->need_parsing = AVSTREAM_PARSE_FULL;

        } else if (!strcmp(buf, "28_8")) {

            st->codec->codec_id = CODEC_ID_RA_288;

            st->codec->extradata_size= 0;

            rm->audio_framesize = st->codec->block_align;

            st->codec->block_align = coded_framesize;



            if(rm->audio_framesize >= UINT_MAX / sub_packet_h){

                av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);

        } else if ((!strcmp(buf, "cook")) || (!strcmp(buf, "atrc")) || (!strcmp(buf, "sipr"))) {

            int codecdata_length, i;

            get_be16(pb); get_byte(pb);

            if (((version >> 16) & 0xff) == 5)

                get_byte(pb);

            codecdata_length = get_be32(pb);

            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){

                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");

                return -1;

            }



            if(sub_packet_size <= 0){

                av_log(s, AV_LOG_ERROR, "sub_packet_size is invalid\n");

                return -1;

            }



            if (!strcmp(buf, "cook")) st->codec->codec_id = CODEC_ID_COOK;

            else if (!strcmp(buf, "sipr")) st->codec->codec_id = CODEC_ID_SIPR;

            else st->codec->codec_id = CODEC_ID_ATRAC3;

            st->codec->extradata_size= codecdata_length;

            st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

            for(i = 0; i < codecdata_length; i++)

                ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);

            rm->audio_framesize = st->codec->block_align;

            st->codec->block_align = rm->sub_packet_size;



            if(rm->audio_framesize >= UINT_MAX / sub_packet_h){

                av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);

        } else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) {

            int codecdata_length, i;

            get_be16(pb); get_byte(pb);

            if (((version >> 16) & 0xff) == 5)

                get_byte(pb);

            st->codec->codec_id = CODEC_ID_AAC;

            codecdata_length = get_be32(pb);

            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){

                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");

                return -1;

            }

            if (codecdata_length >= 1) {

                st->codec->extradata_size = codecdata_length - 1;

                st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

                get_byte(pb);

                for(i = 0; i < st->codec->extradata_size; i++)

                    ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);

            }

        } else {

            st->codec->codec_id = CODEC_ID_NONE;

            av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));

        }

        if (read_all) {

            get_byte(pb);

            get_byte(pb);

            get_byte(pb);



            get_str8(pb, s->title, sizeof(s->title));

            get_str8(pb, s->author, sizeof(s->author));

            get_str8(pb, s->copyright, sizeof(s->copyright));

            get_str8(pb, s->comment, sizeof(s->comment));

        }

    }

    return 0;

}

static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,

                                     AVStream *st, int read_all)

{

    RMDemuxContext *rm = s->priv_data;

    char buf[256];

    uint32_t version;

    int i;



    

    version = get_be32(pb); 

    if (((version >> 16) & 0xff) == 3) {

        int64_t startpos = url_ftell(pb);

        

        for(i = 0; i < 14; i++)

            get_byte(pb);

        get_str8(pb, s->title, sizeof(s->title));

        get_str8(pb, s->author, sizeof(s->author));

        get_str8(pb, s->copyright, sizeof(s->copyright));

        get_str8(pb, s->comment, sizeof(s->comment));

        if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {

            

            get_byte(pb);

            get_str8(pb, buf, sizeof(buf));

        }

        

        if ((startpos + (version & 0xffff)) > url_ftell(pb))

            url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));

        st->codec->sample_rate = 8000;

        st->codec->channels = 1;

        st->codec->codec_type = CODEC_TYPE_AUDIO;

        st->codec->codec_id = CODEC_ID_RA_144;

    } else {

        int flavor, sub_packet_h, coded_framesize, sub_packet_size;

        

        get_be32(pb); 

        get_be32(pb); 

        get_be16(pb); 

        get_be32(pb); 

        flavor= get_be16(pb); 

        rm->coded_framesize = coded_framesize = get_be32(pb); 

        get_be32(pb); 

        get_be32(pb); 

        get_be32(pb); 

        rm->sub_packet_h = sub_packet_h = get_be16(pb); 

        st->codec->block_align= get_be16(pb); 

        rm->sub_packet_size = sub_packet_size = get_be16(pb); 

        get_be16(pb); 

        if (((version >> 16) & 0xff) == 5) {

            get_be16(pb); get_be16(pb); get_be16(pb);

        }

        st->codec->sample_rate = get_be16(pb);

        get_be32(pb);

        st->codec->channels = get_be16(pb);

        if (((version >> 16) & 0xff) == 5) {

            get_be32(pb);

            buf[0] = get_byte(pb);

            buf[1] = get_byte(pb);

            buf[2] = get_byte(pb);

            buf[3] = get_byte(pb);

            buf[4] = 0;

        } else {

            get_str8(pb, buf, sizeof(buf)); 

            get_str8(pb, buf, sizeof(buf)); 

        }

        st->codec->codec_type = CODEC_TYPE_AUDIO;

        if (!strcmp(buf, "dnet")) {

            st->codec->codec_id = CODEC_ID_AC3;

            st->need_parsing = AVSTREAM_PARSE_FULL;

        } else if (!strcmp(buf, "28_8")) {

            st->codec->codec_id = CODEC_ID_RA_288;

            st->codec->extradata_size= 0;

            rm->audio_framesize = st->codec->block_align;

            st->codec->block_align = coded_framesize;



            if(rm->audio_framesize >= UINT_MAX / sub_packet_h){

                av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);

        } else if ((!strcmp(buf, "cook")) || (!strcmp(buf, "atrc")) || (!strcmp(buf, "sipr"))) {

            int codecdata_length, i;

            get_be16(pb); get_byte(pb);

            if (((version >> 16) & 0xff) == 5)

                get_byte(pb);

            codecdata_length = get_be32(pb);

            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){

                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");

                return -1;

            }



            if(sub_packet_size <= 0){

                av_log(s, AV_LOG_ERROR, "sub_packet_size is invalid\n");

                return -1;

            }



            if (!strcmp(buf, "cook")) st->codec->codec_id = CODEC_ID_COOK;

            else if (!strcmp(buf, "sipr")) st->codec->codec_id = CODEC_ID_SIPR;

            else st->codec->codec_id = CODEC_ID_ATRAC3;

            st->codec->extradata_size= codecdata_length;

            st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

            for(i = 0; i < codecdata_length; i++)

                ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);

            rm->audio_framesize = st->codec->block_align;

            st->codec->block_align = rm->sub_packet_size;



            if(rm->audio_framesize >= UINT_MAX / sub_packet_h){

                av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);

        } else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) {

            int codecdata_length, i;

            get_be16(pb); get_byte(pb);

            if (((version >> 16) & 0xff) == 5)

                get_byte(pb);

            st->codec->codec_id = CODEC_ID_AAC;

            codecdata_length = get_be32(pb);

            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){

                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");

                return -1;

            }

            if (codecdata_length >= 1) {

                st->codec->extradata_size = codecdata_length - 1;

                st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

                get_byte(pb);

                for(i = 0; i < st->codec->extradata_size; i++)

                    ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);

            }

        } else {

            st->codec->codec_id = CODEC_ID_NONE;

            av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));

        }

        if (read_all) {

            get_byte(pb);

            get_byte(pb);

            get_byte(pb);



            get_str8(pb, s->title, sizeof(s->title));

            get_str8(pb, s->author, sizeof(s->author));

            get_str8(pb, s->copyright, sizeof(s->copyright));

            get_str8(pb, s->comment, sizeof(s->comment));

        }

    }

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, ByteIOContext *VAR_1,

                                     AVStream *VAR_2, int VAR_3)

{

    RMDemuxContext *rm = VAR_0->priv_data;

    char VAR_4[256];

    uint32_t version;

    int VAR_11;



    

    version = get_be32(VAR_1); 

    if (((version >> 16) & 0xff) == 3) {

        int64_t startpos = url_ftell(VAR_1);

        

        for(VAR_11 = 0; VAR_11 < 14; VAR_11++)

            get_byte(VAR_1);

        get_str8(VAR_1, VAR_0->title, sizeof(VAR_0->title));

        get_str8(VAR_1, VAR_0->author, sizeof(VAR_0->author));

        get_str8(VAR_1, VAR_0->copyright, sizeof(VAR_0->copyright));

        get_str8(VAR_1, VAR_0->comment, sizeof(VAR_0->comment));

        if ((startpos + (version & 0xffff)) >= url_ftell(VAR_1) + 2) {

            

            get_byte(VAR_1);

            get_str8(VAR_1, VAR_4, sizeof(VAR_4));

        }

        

        if ((startpos + (version & 0xffff)) > url_ftell(VAR_1))

            url_fskip(VAR_1, (version & 0xffff) + startpos - url_ftell(VAR_1));

        VAR_2->codec->sample_rate = 8000;

        VAR_2->codec->channels = 1;

        VAR_2->codec->codec_type = CODEC_TYPE_AUDIO;

        VAR_2->codec->codec_id = CODEC_ID_RA_144;

    } else {

        int VAR_6, VAR_7, VAR_8, VAR_9;

        

        get_be32(VAR_1); 

        get_be32(VAR_1); 

        get_be16(VAR_1); 

        get_be32(VAR_1); 

        VAR_6= get_be16(VAR_1); 

        rm->VAR_8 = VAR_8 = get_be32(VAR_1); 

        get_be32(VAR_1); 

        get_be32(VAR_1); 

        get_be32(VAR_1); 

        rm->VAR_7 = VAR_7 = get_be16(VAR_1); 

        VAR_2->codec->block_align= get_be16(VAR_1); 

        rm->VAR_9 = VAR_9 = get_be16(VAR_1); 

        get_be16(VAR_1); 

        if (((version >> 16) & 0xff) == 5) {

            get_be16(VAR_1); get_be16(VAR_1); get_be16(VAR_1);

        }

        VAR_2->codec->sample_rate = get_be16(VAR_1);

        get_be32(VAR_1);

        VAR_2->codec->channels = get_be16(VAR_1);

        if (((version >> 16) & 0xff) == 5) {

            get_be32(VAR_1);

            VAR_4[0] = get_byte(VAR_1);

            VAR_4[1] = get_byte(VAR_1);

            VAR_4[2] = get_byte(VAR_1);

            VAR_4[3] = get_byte(VAR_1);

            VAR_4[4] = 0;

        } else {

            get_str8(VAR_1, VAR_4, sizeof(VAR_4)); 

            get_str8(VAR_1, VAR_4, sizeof(VAR_4)); 

        }

        VAR_2->codec->codec_type = CODEC_TYPE_AUDIO;

        if (!strcmp(VAR_4, "dnet")) {

            VAR_2->codec->codec_id = CODEC_ID_AC3;

            VAR_2->need_parsing = AVSTREAM_PARSE_FULL;

        } else if (!strcmp(VAR_4, "28_8")) {

            VAR_2->codec->codec_id = CODEC_ID_RA_288;

            VAR_2->codec->extradata_size= 0;

            rm->audio_framesize = VAR_2->codec->block_align;

            VAR_2->codec->block_align = VAR_8;



            if(rm->audio_framesize >= UINT_MAX / VAR_7){

                av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_7 too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * VAR_7);

        } else if ((!strcmp(VAR_4, "cook")) || (!strcmp(VAR_4, "atrc")) || (!strcmp(VAR_4, "sipr"))) {

            int VAR_11, VAR_11;

            get_be16(VAR_1); get_byte(VAR_1);

            if (((version >> 16) & 0xff) == 5)

                get_byte(VAR_1);

            VAR_11 = get_be32(VAR_1);

            if(VAR_11 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_11){

                av_log(VAR_0, AV_LOG_ERROR, "VAR_11 too large\n");

                return -1;

            }



            if(VAR_9 <= 0){

                av_log(VAR_0, AV_LOG_ERROR, "VAR_9 is invalid\n");

                return -1;

            }



            if (!strcmp(VAR_4, "cook")) VAR_2->codec->codec_id = CODEC_ID_COOK;

            else if (!strcmp(VAR_4, "sipr")) VAR_2->codec->codec_id = CODEC_ID_SIPR;

            else VAR_2->codec->codec_id = CODEC_ID_ATRAC3;

            VAR_2->codec->extradata_size= VAR_11;

            VAR_2->codec->extradata= av_mallocz(VAR_2->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

            for(VAR_11 = 0; VAR_11 < VAR_11; VAR_11++)

                ((uint8_t*)VAR_2->codec->extradata)[VAR_11] = get_byte(VAR_1);

            rm->audio_framesize = VAR_2->codec->block_align;

            VAR_2->codec->block_align = rm->VAR_9;



            if(rm->audio_framesize >= UINT_MAX / VAR_7){

                av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_7 too large\n");

                return -1;

            }



            rm->audiobuf = av_malloc(rm->audio_framesize * VAR_7);

        } else if (!strcmp(VAR_4, "raac") || !strcmp(VAR_4, "racp")) {

            int VAR_11, VAR_11;

            get_be16(VAR_1); get_byte(VAR_1);

            if (((version >> 16) & 0xff) == 5)

                get_byte(VAR_1);

            VAR_2->codec->codec_id = CODEC_ID_AAC;

            VAR_11 = get_be32(VAR_1);

            if(VAR_11 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_11){

                av_log(VAR_0, AV_LOG_ERROR, "VAR_11 too large\n");

                return -1;

            }

            if (VAR_11 >= 1) {

                VAR_2->codec->extradata_size = VAR_11 - 1;

                VAR_2->codec->extradata = av_mallocz(VAR_2->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);

                get_byte(VAR_1);

                for(VAR_11 = 0; VAR_11 < VAR_2->codec->extradata_size; VAR_11++)

                    ((uint8_t*)VAR_2->codec->extradata)[VAR_11] = get_byte(VAR_1);

            }

        } else {

            VAR_2->codec->codec_id = CODEC_ID_NONE;

            av_strlcpy(VAR_2->codec->codec_name, VAR_4, sizeof(VAR_2->codec->codec_name));

        }

        if (VAR_3) {

            get_byte(VAR_1);

            get_byte(VAR_1);

            get_byte(VAR_1);



            get_str8(VAR_1, VAR_0->title, sizeof(VAR_0->title));

            get_str8(VAR_1, VAR_0->author, sizeof(VAR_0->author));

            get_str8(VAR_1, VAR_0->copyright, sizeof(VAR_0->copyright));

            get_str8(VAR_1, VAR_0->comment, sizeof(VAR_0->comment));

        }

    }

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, ByteIOContext *VAR_1,
AVStream *VAR_2, int VAR_3)
{ RMDemuxContext *rm = VAR_0->priv_data; char VAR_4[256]; uint32_t version; int VAR_11; version = get_be32(VAR_1); if (((version >> 16) & 0xff) == 3) { int64_t startpos = url_ftell(VAR_1); for(VAR_11 = 0; VAR_11 < 14; VAR_11++) get_byte(VAR_1); get_str8(VAR_1, VAR_0->title, sizeof(VAR_0->title)); get_str8(VAR_1, VAR_0->author, sizeof(VAR_0->author)); get_str8(VAR_1, VAR_0->copyright, sizeof(VAR_0->copyright)); get_str8(VAR_1, VAR_0->comment, sizeof(VAR_0->comment)); if ((startpos + (version & 0xffff)) >= url_ftell(VAR_1) + 2) { get_byte(VAR_1); get_str8(VAR_1, VAR_4, sizeof(VAR_4)); } if ((startpos + (version & 0xffff)) > url_ftell(VAR_1))
url_fskip(VAR_1, (version & 0xffff) + startpos - url_ftell(VAR_1)); VAR_2->codec->sample_rate = 8000; VAR_2->codec->channels = 1; VAR_2->codec->codec_type = CODEC_TYPE_AUDIO; VAR_2->codec->codec_id = CODEC_ID_RA_144; } else { int VAR_6, VAR_7, VAR_8, VAR_9; get_be32(VAR_1); get_be32(VAR_1); get_be16(VAR_1); get_be32(VAR_1); VAR_6= get_be16(VAR_1); rm->VAR_8 = VAR_8 = get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); rm->VAR_7 = VAR_7 = get_be16(VAR_1); VAR_2->codec->block_align= get_be16(VAR_1); rm->VAR_9 = VAR_9 = get_be16(VAR_1); get_be16(VAR_1); if (((version >> 16) & 0xff) == 5) { get_be16(VAR_1); get_be16(VAR_1); get_be16(VAR_1); } VAR_2->codec->sample_rate = get_be16(VAR_1); get_be32(VAR_1); VAR_2->codec->channels = get_be16(VAR_1); if (((version >> 16) & 0xff) == 5) { get_be32(VAR_1); VAR_4[0] = get_byte(VAR_1); VAR_4[1] = get_byte(VAR_1); VAR_4[2] = get_byte(VAR_1); VAR_4[3] = get_byte(VAR_1); VAR_4[4] = 0; } else { get_str8(VAR_1, VAR_4, sizeof(VAR_4)); get_str8(VAR_1, VAR_4, sizeof(VAR_4)); } VAR_2->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(VAR_4, "dnet")) { VAR_2->codec->codec_id = CODEC_ID_AC3; VAR_2->need_parsing = AVSTREAM_PARSE_FULL; } else if (!strcmp(VAR_4, "28_8")) { VAR_2->codec->codec_id = CODEC_ID_RA_288; VAR_2->codec->extradata_size= 0; rm->audio_framesize = VAR_2->codec->block_align; VAR_2->codec->block_align = VAR_8; if(rm->audio_framesize >= UINT_MAX / VAR_7){ av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_7 too large\n"); return -1; } rm->audiobuf = av_malloc(rm->audio_framesize * VAR_7); } else if ((!strcmp(VAR_4, "cook")) || (!strcmp(VAR_4, "atrc")) || (!strcmp(VAR_4, "sipr"))) { int VAR_11, VAR_11; get_be16(VAR_1); get_byte(VAR_1); if (((version >> 16) & 0xff) == 5)
get_byte(VAR_1); VAR_11 = get_be32(VAR_1); if(VAR_11 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_11){ av_log(VAR_0, AV_LOG_ERROR, "VAR_11 too large\n"); return -1; } if(VAR_9 <= 0){ av_log(VAR_0, AV_LOG_ERROR, "VAR_9 is invalid\n"); return -1; } if (!strcmp(VAR_4, "cook")) VAR_2->codec->codec_id = CODEC_ID_COOK; else if (!strcmp(VAR_4, "sipr")) VAR_2->codec->codec_id = CODEC_ID_SIPR; else VAR_2->codec->codec_id = CODEC_ID_ATRAC3; VAR_2->codec->extradata_size= VAR_11; VAR_2->codec->extradata= av_mallocz(VAR_2->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(VAR_11 = 0; VAR_11 < VAR_11; VAR_11++) ((uint8_t*)VAR_2->codec->extradata)[VAR_11] = get_byte(VAR_1); rm->audio_framesize = VAR_2->codec->block_align; VAR_2->codec->block_align = rm->VAR_9; if(rm->audio_framesize >= UINT_MAX / VAR_7){ av_log(VAR_0, AV_LOG_ERROR, "rm->audio_framesize * VAR_7 too large\n"); return -1; } rm->audiobuf = av_malloc(rm->audio_framesize * VAR_7); } else if (!strcmp(VAR_4, "raac") || !strcmp(VAR_4, "racp")) { int VAR_11, VAR_11; get_be16(VAR_1); get_byte(VAR_1); if (((version >> 16) & 0xff) == 5)
get_byte(VAR_1); VAR_2->codec->codec_id = CODEC_ID_AAC; VAR_11 = get_be32(VAR_1); if(VAR_11 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_11){ av_log(VAR_0, AV_LOG_ERROR, "VAR_11 too large\n"); return -1; } if (VAR_11 >= 1) { VAR_2->codec->extradata_size = VAR_11 - 1; VAR_2->codec->extradata = av_mallocz(VAR_2->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_byte(VAR_1); for(VAR_11 = 0; VAR_11 < VAR_2->codec->extradata_size; VAR_11++) ((uint8_t*)VAR_2->codec->extradata)[VAR_11] = get_byte(VAR_1); } } else { VAR_2->codec->codec_id = CODEC_ID_NONE; av_strlcpy(VAR_2->codec->codec_name, VAR_4, sizeof(VAR_2->codec->codec_name)); } if (VAR_3) { get_byte(VAR_1); get_byte(VAR_1); get_byte(VAR_1); get_str8(VAR_1, VAR_0->title, sizeof(VAR_0->title)); get_str8(VAR_1, VAR_0->author, sizeof(VAR_0->author)); get_str8(VAR_1, VAR_0->copyright, sizeof(VAR_0->copyright)); get_str8(VAR_1, VAR_0->comment, sizeof(VAR_0->comment)); } } return 0; }