Revision 0c41d554 libavformat/id3v2.c

View differences:

libavformat/id3v2.c
53 53
{
54 54
    int len, ret;
55 55
    uint8_t buf[ID3v2_HEADER_SIZE];
56
    int     found_header;
57
    int64_t off;
56 58

  
59
    do {
60
        /* save the current offset in case there's nothing to read/skip */
61
        off = url_ftell(s->pb);
57 62
    ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
58 63
    if (ret != ID3v2_HEADER_SIZE)
59 64
        return;
60
    if (ff_id3v2_match(buf, magic)) {
65
        found_header = ff_id3v2_match(buf, magic);
66
        if (found_header) {
61 67
        /* parse ID3v2 header */
62 68
        len = ((buf[6] & 0x7f) << 21) |
63 69
            ((buf[7] & 0x7f) << 14) |
......
65 71
            (buf[9] & 0x7f);
66 72
        ff_id3v2_parse(s, len, buf[3], buf[5]);
67 73
    } else {
68
        url_fseek(s->pb, 0, SEEK_SET);
74
        url_fseek(s->pb, off, SEEK_SET);
69 75
    }
76
    } while (found_header);
70 77
}
71 78

  
72 79
static unsigned int get_size(ByteIOContext *s, int len)

Also available in: Unified diff