static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,

                        AVFormatContext *s, int len, uint8_t version,

                        uint8_t flags, ID3v2ExtraMeta **extra_meta)

{

    int isv34, unsync;

    unsigned tlen;

    char tag[5];

    int64_t next, end = avio_tell(pb) + len;

    int taghdrlen;

    const char *reason = NULL;

    AVIOContext pb_local;

    AVIOContext *pbx;

    unsigned char *buffer = NULL;

    int buffer_size       = 0;

    const ID3v2EMFunc *extra_func = NULL;

    unsigned char *uncompressed_buffer = NULL;

    av_unused int uncompressed_buffer_size = 0;



    av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len);



    switch (version) {

    case 2:

        if (flags & 0x40) {

            reason = "compression";

            goto error;

        }

        isv34     = 0;

        taghdrlen = 6;

        break;



    case 3:

    case 4:

        isv34     = 1;

        taghdrlen = 10;

        break;



    default:

        reason = "version";

        goto error;

    }



    unsync = flags & 0x80;



    if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */

        int extlen = get_size(pb, 4);

        if (version == 4)

            /* In v2.4 the length includes the length field we just read. */

            extlen -= 4;



        if (extlen < 0) {

            reason = "invalid extended header length";

            goto error;

        }

        avio_skip(pb, extlen);

        len -= extlen + 4;

        if (len < 0) {

            reason = "extended header too long.";

            goto error;

        }

    }



    while (len >= taghdrlen) {

        unsigned int tflags = 0;

        int tunsync         = 0;

        int tcomp           = 0;

        int tencr           = 0;

        unsigned long av_unused dlen;



        if (isv34) {

            if (avio_read(pb, tag, 4) < 4)

                break;

            tag[4] = 0;

            if (version == 3) {

                tlen = avio_rb32(pb);

            } else

                tlen = get_size(pb, 4);

            tflags  = avio_rb16(pb);

            tunsync = tflags & ID3v2_FLAG_UNSYNCH;

        } else {

            if (avio_read(pb, tag, 3) < 3)

                break;

            tag[3] = 0;

            tlen   = avio_rb24(pb);

        }

        if (tlen > (1<<28))

            break;

        len -= taghdrlen + tlen;



        if (len < 0)

            break;



        next = avio_tell(pb) + tlen;



        if (!tlen) {

            if (tag[0])

                av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n",

                       tag);

            continue;

        }



        if (tflags & ID3v2_FLAG_DATALEN) {

            if (tlen < 4)

                break;

            dlen = avio_rb32(pb);

            tlen -= 4;

        } else

            dlen = tlen;



        tcomp = tflags & ID3v2_FLAG_COMPRESSION;

        tencr = tflags & ID3v2_FLAG_ENCRYPTION;



        /* skip encrypted tags and, if no zlib, compressed tags */

        if (tencr || (!CONFIG_ZLIB && tcomp)) {

            const char *type;

            if (!tcomp)

                type = "encrypted";

            else if (!tencr)

                type = "compressed";

            else

                type = "encrypted and compressed";



            av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag);

            avio_skip(pb, tlen);

        /* check for text tag or supported special meta tag */

        } else if (tag[0] == 'T' ||

                   (extra_meta &&

                    (extra_func = get_extra_meta_func(tag, isv34)))) {

            pbx = pb;



            if (unsync || tunsync || tcomp) {

                av_fast_malloc(&buffer, &buffer_size, tlen);

                if (!buffer) {

                    av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen);

                    goto seek;

                }

            }

            if (unsync || tunsync) {

                int64_t end = avio_tell(pb) + tlen;

                uint8_t *b;



                b = buffer;

                while (avio_tell(pb) < end && b - buffer < tlen && !pb->eof_reached) {

                    *b++ = avio_r8(pb);

                    if (*(b - 1) == 0xff && avio_tell(pb) < end - 1 &&

                        b - buffer < tlen &&

                        !pb->eof_reached ) {

                        uint8_t val = avio_r8(pb);

                        *b++ = val ? val : avio_r8(pb);

                    }

                }

                ffio_init_context(&pb_local, buffer, b - buffer, 0, NULL, NULL, NULL,

                                  NULL);

                tlen = b - buffer;

                pbx  = &pb_local; // read from sync buffer

            }



#if CONFIG_ZLIB

                if (tcomp) {

                    int err;



                    av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen);



                    av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);

                    if (!uncompressed_buffer) {

                        av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen);

                        goto seek;

                    }



                    if (!(unsync || tunsync)) {

                        err = avio_read(pb, buffer, tlen);

                        if (err < 0) {

                            av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n");

                            goto seek;

                        }

                        tlen = err;

                    }



                    err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);

                    if (err != Z_OK) {

                        av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err);

                        goto seek;

                    }

                    ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);

                    tlen = dlen;

                    pbx = &pb_local; // read from sync buffer

                }

#endif

            if (tag[0] == 'T')

                /* parse text tag */

                read_ttag(s, pbx, tlen, metadata, tag);

            else

                /* parse special meta tag */

                extra_func->read(s, pbx, tlen, tag, extra_meta, isv34);

        } else if (!tag[0]) {

            if (tag[1])

                av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n");

            avio_skip(pb, tlen);

            break;

        }

        /* Skip to end of tag */

seek:

        avio_seek(pb, next, SEEK_SET);

    }



    /* Footer preset, always 10 bytes, skip over it */

    if (version == 4 && flags & 0x10)

        end += 10;



error:

    if (reason)

        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n",

               version, reason);

    avio_seek(pb, end, SEEK_SET);

    av_free(buffer);

    av_free(uncompressed_buffer);

    return;

}

static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,

                        AVFormatContext *s, int len, uint8_t version,

                        uint8_t flags, ID3v2ExtraMeta **extra_meta)

{

    int isv34, unsync;

    unsigned tlen;

    char tag[5];

    int64_t next, end = avio_tell(pb) + len;

    int taghdrlen;

    const char *reason = NULL;

    AVIOContext pb_local;

    AVIOContext *pbx;

    unsigned char *buffer = NULL;

    int buffer_size       = 0;

    const ID3v2EMFunc *extra_func = NULL;

    unsigned char *uncompressed_buffer = NULL;

    av_unused int uncompressed_buffer_size = 0;



    av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len);



    switch (version) {

    case 2:

        if (flags & 0x40) {

            reason = "compression";

            goto error;

        }

        isv34     = 0;

        taghdrlen = 6;

        break;



    case 3:

    case 4:

        isv34     = 1;

        taghdrlen = 10;

        break;



    default:

        reason = "version";

        goto error;

    }



    unsync = flags & 0x80;



    if (isv34 && flags & 0x40) { 

        int extlen = get_size(pb, 4);

        if (version == 4)

            

            extlen -= 4;



        if (extlen < 0) {

            reason = "invalid extended header length";

            goto error;

        }

        avio_skip(pb, extlen);

        len -= extlen + 4;

        if (len < 0) {

            reason = "extended header too long.";

            goto error;

        }

    }



    while (len >= taghdrlen) {

        unsigned int tflags = 0;

        int tunsync         = 0;

        int tcomp           = 0;

        int tencr           = 0;

        unsigned long av_unused dlen;



        if (isv34) {

            if (avio_read(pb, tag, 4) < 4)

                break;

            tag[4] = 0;

            if (version == 3) {

                tlen = avio_rb32(pb);

            } else

                tlen = get_size(pb, 4);

            tflags  = avio_rb16(pb);

            tunsync = tflags & ID3v2_FLAG_UNSYNCH;

        } else {

            if (avio_read(pb, tag, 3) < 3)

                break;

            tag[3] = 0;

            tlen   = avio_rb24(pb);

        }

        if (tlen > (1<<28))

            break;

        len -= taghdrlen + tlen;



        if (len < 0)

            break;



        next = avio_tell(pb) + tlen;



        if (!tlen) {

            if (tag[0])

                av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n",

                       tag);

            continue;

        }



        if (tflags & ID3v2_FLAG_DATALEN) {

            if (tlen < 4)

                break;

            dlen = avio_rb32(pb);

            tlen -= 4;

        } else

            dlen = tlen;



        tcomp = tflags & ID3v2_FLAG_COMPRESSION;

        tencr = tflags & ID3v2_FLAG_ENCRYPTION;



        

        if (tencr || (!CONFIG_ZLIB && tcomp)) {

            const char *type;

            if (!tcomp)

                type = "encrypted";

            else if (!tencr)

                type = "compressed";

            else

                type = "encrypted and compressed";



            av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag);

            avio_skip(pb, tlen);

        

        } else if (tag[0] == 'T' ||

                   (extra_meta &&

                    (extra_func = get_extra_meta_func(tag, isv34)))) {

            pbx = pb;



            if (unsync || tunsync || tcomp) {

                av_fast_malloc(&buffer, &buffer_size, tlen);

                if (!buffer) {

                    av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen);

                    goto seek;

                }

            }

            if (unsync || tunsync) {

                int64_t end = avio_tell(pb) + tlen;

                uint8_t *b;



                b = buffer;

                while (avio_tell(pb) < end && b - buffer < tlen && !pb->eof_reached) {

                    *b++ = avio_r8(pb);

                    if (*(b - 1) == 0xff && avio_tell(pb) < end - 1 &&

                        b - buffer < tlen &&

                        !pb->eof_reached ) {

                        uint8_t val = avio_r8(pb);

                        *b++ = val ? val : avio_r8(pb);

                    }

                }

                ffio_init_context(&pb_local, buffer, b - buffer, 0, NULL, NULL, NULL,

                                  NULL);

                tlen = b - buffer;

                pbx  = &pb_local; 

            }



#if CONFIG_ZLIB

                if (tcomp) {

                    int err;



                    av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen);



                    av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen);

                    if (!uncompressed_buffer) {

                        av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen);

                        goto seek;

                    }



                    if (!(unsync || tunsync)) {

                        err = avio_read(pb, buffer, tlen);

                        if (err < 0) {

                            av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n");

                            goto seek;

                        }

                        tlen = err;

                    }



                    err = uncompress(uncompressed_buffer, &dlen, buffer, tlen);

                    if (err != Z_OK) {

                        av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err);

                        goto seek;

                    }

                    ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL);

                    tlen = dlen;

                    pbx = &pb_local; 

                }

#endif

            if (tag[0] == 'T')

                

                read_ttag(s, pbx, tlen, metadata, tag);

            else

                

                extra_func->read(s, pbx, tlen, tag, extra_meta, isv34);

        } else if (!tag[0]) {

            if (tag[1])

                av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n");

            avio_skip(pb, tlen);

            break;

        }

        

seek:

        avio_seek(pb, next, SEEK_SET);

    }



    

    if (version == 4 && flags & 0x10)

        end += 10;



error:

    if (reason)

        av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n",

               version, reason);

    avio_seek(pb, end, SEEK_SET);

    av_free(buffer);

    av_free(uncompressed_buffer);

    return;

}

static void FUNC_0(AVIOContext *VAR_0, AVDictionary **VAR_1,

                        AVFormatContext *VAR_2, int VAR_3, uint8_t VAR_4,

                        uint8_t VAR_5, ID3v2ExtraMeta **VAR_6)

{

    int VAR_7, VAR_8;

    unsigned VAR_9;

    char VAR_10[5];

    int64_t next, end = avio_tell(VAR_0) + VAR_3;

    int VAR_11;

    const char *VAR_12 = NULL;

    AVIOContext pb_local;

    AVIOContext *pbx;

    unsigned char *VAR_13 = NULL;

    int VAR_14       = 0;

    const ID3v2EMFunc *VAR_15 = NULL;

    unsigned char *VAR_16 = NULL;

    VAR_22 int uncompressed_buffer_size = 0;



    av_log(VAR_2, AV_LOG_DEBUG, "id3v2 ver:%d VAR_5:%02X VAR_3:%d\n", VAR_4, VAR_5, VAR_3);



    switch (VAR_4) {

    case 2:

        if (VAR_5 & 0x40) {

            VAR_12 = "compression";

            goto error;

        }

        VAR_7     = 0;

        VAR_11 = 6;

        break;



    case 3:

    case 4:

        VAR_7     = 1;

        VAR_11 = 10;

        break;



    default:

        VAR_12 = "VAR_4";

        goto error;

    }



    VAR_8 = VAR_5 & 0x80;



    if (VAR_7 && VAR_5 & 0x40) { 

        int VAR_17 = get_size(VAR_0, 4);

        if (VAR_4 == 4)

            

            VAR_17 -= 4;



        if (VAR_17 < 0) {

            VAR_12 = "invalid extended header length";

            goto error;

        }

        avio_skip(VAR_0, VAR_17);

        VAR_3 -= VAR_17 + 4;

        if (VAR_3 < 0) {

            VAR_12 = "extended header too long.";

            goto error;

        }

    }



    while (VAR_3 >= VAR_11) {

        unsigned int VAR_18 = 0;

        int VAR_19         = 0;

        int VAR_20           = 0;

        int VAR_21           = 0;

        unsigned long VAR_22 dlen;



        if (VAR_7) {

            if (avio_read(VAR_0, VAR_10, 4) < 4)

                break;

            VAR_10[4] = 0;

            if (VAR_4 == 3) {

                VAR_9 = avio_rb32(VAR_0);

            } else

                VAR_9 = get_size(VAR_0, 4);

            VAR_18  = avio_rb16(VAR_0);

            VAR_19 = VAR_18 & ID3v2_FLAG_UNSYNCH;

        } else {

            if (avio_read(VAR_0, VAR_10, 3) < 3)

                break;

            VAR_10[3] = 0;

            VAR_9   = avio_rb24(VAR_0);

        }

        if (VAR_9 > (1<<28))

            break;

        VAR_3 -= VAR_11 + VAR_9;



        if (VAR_3 < 0)

            break;



        next = avio_tell(VAR_0) + VAR_9;



        if (!VAR_9) {

            if (VAR_10[0])

                av_log(VAR_2, AV_LOG_DEBUG, "Invalid empty frame %VAR_2, skipping.\n",

                       VAR_10);

            continue;

        }



        if (VAR_18 & ID3v2_FLAG_DATALEN) {

            if (VAR_9 < 4)

                break;

            dlen = avio_rb32(VAR_0);

            VAR_9 -= 4;

        } else

            dlen = VAR_9;



        VAR_20 = VAR_18 & ID3v2_FLAG_COMPRESSION;

        VAR_21 = VAR_18 & ID3v2_FLAG_ENCRYPTION;



        

        if (VAR_21 || (!CONFIG_ZLIB && VAR_20)) {

            const char *VAR_23;

            if (!VAR_20)

                VAR_23 = "encrypted";

            else if (!VAR_21)

                VAR_23 = "compressed";

            else

                VAR_23 = "encrypted and compressed";



            av_log(VAR_2, AV_LOG_WARNING, "Skipping %VAR_2 ID3v2 frame %VAR_2.\n", VAR_23, VAR_10);

            avio_skip(VAR_0, VAR_9);

        

        } else if (VAR_10[0] == 'T' ||

                   (VAR_6 &&

                    (VAR_15 = get_extra_meta_func(VAR_10, VAR_7)))) {

            pbx = VAR_0;



            if (VAR_8 || VAR_19 || VAR_20) {

                av_fast_malloc(&VAR_13, &VAR_14, VAR_9);

                if (!VAR_13) {

                    av_log(VAR_2, AV_LOG_ERROR, "Failed to alloc %d bytes\n", VAR_9);

                    goto seek;

                }

            }

            if (VAR_8 || VAR_19) {

                int64_t end = avio_tell(VAR_0) + VAR_9;

                uint8_t *b;



                b = VAR_13;

                while (avio_tell(VAR_0) < end && b - VAR_13 < VAR_9 && !VAR_0->eof_reached) {

                    *b++ = avio_r8(VAR_0);

                    if (*(b - 1) == 0xff && avio_tell(VAR_0) < end - 1 &&

                        b - VAR_13 < VAR_9 &&

                        !VAR_0->eof_reached ) {

                        uint8_t val = avio_r8(VAR_0);

                        *b++ = val ? val : avio_r8(VAR_0);

                    }

                }

                ffio_init_context(&pb_local, VAR_13, b - VAR_13, 0, NULL, NULL, NULL,

                                  NULL);

                VAR_9 = b - VAR_13;

                pbx  = &pb_local; 

            }



#if CONFIG_ZLIB

                if (VAR_20) {

                    int err;



                    av_log(VAR_2, AV_LOG_DEBUG, "Compresssed frame %VAR_2 VAR_9=%d dlen=%ld\n", VAR_10, VAR_9, dlen);



                    av_fast_malloc(&VAR_16, &uncompressed_buffer_size, dlen);

                    if (!VAR_16) {

                        av_log(VAR_2, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen);

                        goto seek;

                    }



                    if (!(VAR_8 || VAR_19)) {

                        err = avio_read(VAR_0, VAR_13, VAR_9);

                        if (err < 0) {

                            av_log(VAR_2, AV_LOG_ERROR, "Failed to read compressed VAR_10\n");

                            goto seek;

                        }

                        VAR_9 = err;

                    }



                    err = uncompress(VAR_16, &dlen, VAR_13, VAR_9);

                    if (err != Z_OK) {

                        av_log(VAR_2, AV_LOG_ERROR, "Failed to uncompress VAR_10: %d\n", err);

                        goto seek;

                    }

                    ffio_init_context(&pb_local, VAR_16, dlen, 0, NULL, NULL, NULL, NULL);

                    VAR_9 = dlen;

                    pbx = &pb_local; 

                }

#endif

            if (VAR_10[0] == 'T')

                

                read_ttag(VAR_2, pbx, VAR_9, VAR_1, VAR_10);

            else

                

                VAR_15->read(VAR_2, pbx, VAR_9, VAR_10, VAR_6, VAR_7);

        } else if (!VAR_10[0]) {

            if (VAR_10[1])

                av_log(VAR_2, AV_LOG_WARNING, "invalid frame id, assuming padding\n");

            avio_skip(VAR_0, VAR_9);

            break;

        }

        

seek:

        avio_seek(VAR_0, next, SEEK_SET);

    }



    

    if (VAR_4 == 4 && VAR_5 & 0x10)

        end += 10;



error:

    if (VAR_12)

        av_log(VAR_2, AV_LOG_INFO, "ID3v2.%d VAR_10 skipped, cannot handle %VAR_2\n",

               VAR_4, VAR_12);

    avio_seek(VAR_0, end, SEEK_SET);

    av_free(VAR_13);

    av_free(VAR_16);

    return;

}

static void FUNC_0(AVIOContext *VAR_0, AVDictionary **VAR_1,
AVFormatContext *VAR_2, int VAR_3, uint8_t VAR_4,
uint8_t VAR_5, ID3v2ExtraMeta **VAR_6)
{ int VAR_7, VAR_8; unsigned VAR_9; char VAR_10[5]; int64_t next, end = avio_tell(VAR_0) + VAR_3; int VAR_11; const char *VAR_12 = NULL; AVIOContext pb_local; AVIOContext *pbx; unsigned char *VAR_13 = NULL; int VAR_14       = 0; const ID3v2EMFunc *VAR_15 = NULL; unsigned char *VAR_16 = NULL; VAR_22 int uncompressed_buffer_size = 0; av_log(VAR_2, AV_LOG_DEBUG, "id3v2 ver:%d VAR_5:%02X VAR_3:%d\n", VAR_4, VAR_5, VAR_3); switch (VAR_4) { case 2:
if (VAR_5 & 0x40) { VAR_12 = "compression"; goto error; } VAR_7     = 0; VAR_11 = 6; break; case 3:
case 4:
VAR_7     = 1; VAR_11 = 10; break; default:
VAR_12 = "VAR_4"; goto error; } VAR_8 = VAR_5 & 0x80; if (VAR_7 && VAR_5 & 0x40) { int VAR_17 = get_size(VAR_0, 4); if (VAR_4 == 4)
VAR_17 -= 4; if (VAR_17 < 0) { VAR_12 = "invalid extended header length"; goto error; } avio_skip(VAR_0, VAR_17); VAR_3 -= VAR_17 + 4; if (VAR_3 < 0) { VAR_12 = "extended header too long."; goto error; } } while (VAR_3 >= VAR_11) { unsigned int VAR_18 = 0; int VAR_19         = 0; int VAR_20           = 0; int VAR_21           = 0; unsigned long VAR_22 dlen; if (VAR_7) { if (avio_read(VAR_0, VAR_10, 4) < 4)
break; VAR_10[4] = 0; if (VAR_4 == 3) { VAR_9 = avio_rb32(VAR_0); } else VAR_9 = get_size(VAR_0, 4); VAR_18  = avio_rb16(VAR_0); VAR_19 = VAR_18 & ID3v2_FLAG_UNSYNCH; } else { if (avio_read(VAR_0, VAR_10, 3) < 3)
break; VAR_10[3] = 0; VAR_9   = avio_rb24(VAR_0); } if (VAR_9 > (1<<28))
break; VAR_3 -= VAR_11 + VAR_9; if (VAR_3 < 0)
break; next = avio_tell(VAR_0) + VAR_9; if (!VAR_9) { if (VAR_10[0])
av_log(VAR_2, AV_LOG_DEBUG, "Invalid empty frame %VAR_2, skipping.\n",
VAR_10); continue; } if (VAR_18 & ID3v2_FLAG_DATALEN) { if (VAR_9 < 4)
break; dlen = avio_rb32(VAR_0); VAR_9 -= 4; } else dlen = VAR_9; VAR_20 = VAR_18 & ID3v2_FLAG_COMPRESSION; VAR_21 = VAR_18 & ID3v2_FLAG_ENCRYPTION; if (VAR_21 || (!CONFIG_ZLIB && VAR_20)) { const char *VAR_23; if (!VAR_20)
VAR_23 = "encrypted"; else if (!VAR_21)
VAR_23 = "compressed"; else
VAR_23 = "encrypted and compressed"; av_log(VAR_2, AV_LOG_WARNING, "Skipping %VAR_2 ID3v2 frame %VAR_2.\n", VAR_23, VAR_10); avio_skip(VAR_0, VAR_9); } else if (VAR_10[0] == 'T' || (VAR_6 &&
(VAR_15 = get_extra_meta_func(VAR_10, VAR_7)))) { pbx = VAR_0; if (VAR_8 || VAR_19 || VAR_20) { av_fast_malloc(&VAR_13, &VAR_14, VAR_9); if (!VAR_13) { av_log(VAR_2, AV_LOG_ERROR, "Failed to alloc %d bytes\n", VAR_9); goto seek; } } if (VAR_8 || VAR_19) { int64_t end = avio_tell(VAR_0) + VAR_9; uint8_t *b; b = VAR_13; while (avio_tell(VAR_0) < end && b - VAR_13 < VAR_9 && !VAR_0->eof_reached) { *b++ = avio_r8(VAR_0); if (*(b - 1) == 0xff && avio_tell(VAR_0) < end - 1 &&
b - VAR_13 < VAR_9 &&
!VAR_0->eof_reached ) { uint8_t val = avio_r8(VAR_0); *b++ = val ? val : avio_r8(VAR_0); } } ffio_init_context(&pb_local, VAR_13, b - VAR_13, 0, NULL, NULL, NULL,
NULL); VAR_9 = b - VAR_13; pbx  = &pb_local; } #if CONFIG_ZLIB
if (VAR_20) { int err; av_log(VAR_2, AV_LOG_DEBUG, "Compresssed frame %VAR_2 VAR_9=%d dlen=%ld\n", VAR_10, VAR_9, dlen); av_fast_malloc(&VAR_16, &uncompressed_buffer_size, dlen); if (!VAR_16) { av_log(VAR_2, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen); goto seek; } if (!(VAR_8 || VAR_19)) { err = avio_read(VAR_0, VAR_13, VAR_9); if (err < 0) { av_log(VAR_2, AV_LOG_ERROR, "Failed to read compressed VAR_10\n"); goto seek; } VAR_9 = err; } err = uncompress(VAR_16, &dlen, VAR_13, VAR_9); if (err != Z_OK) { av_log(VAR_2, AV_LOG_ERROR, "Failed to uncompress VAR_10: %d\n", err); goto seek; } ffio_init_context(&pb_local, VAR_16, dlen, 0, NULL, NULL, NULL, NULL); VAR_9 = dlen; pbx = &pb_local; } #endif
if (VAR_10[0] == 'T')
read_ttag(VAR_2, pbx, VAR_9, VAR_1, VAR_10); else
VAR_15->read(VAR_2, pbx, VAR_9, VAR_10, VAR_6, VAR_7); } else if (!VAR_10[0]) { if (VAR_10[1])
av_log(VAR_2, AV_LOG_WARNING, "invalid frame id, assuming padding\n"); avio_skip(VAR_0, VAR_9); break; } seek:
avio_seek(VAR_0, next, SEEK_SET); } if (VAR_4 == 4 && VAR_5 & 0x10)
end += 10; error:
if (VAR_12)
av_log(VAR_2, AV_LOG_INFO, "ID3v2.%d VAR_10 skipped, cannot handle %VAR_2\n",
VAR_4, VAR_12); avio_seek(VAR_0, end, SEEK_SET); av_free(VAR_13); av_free(VAR_16); return; }