Revision b7effd4e libavformat/sauce.c

View differences:

libavformat/sauce.c
36 36
    uint64_t start_pos = url_fsize(pb) - 128;
37 37

  
38 38
    url_fseek(pb, start_pos, SEEK_SET);
39
    if (get_buffer(pb, buf, 7) != 7)
39
    if (avio_read(pb, buf, 7) != 7)
40 40
        return -1;
41 41
    if (memcmp(buf, "SAUCE00", 7))
42 42
        return -1;
43 43

  
44 44
#define GET_SAUCE_META(name,size) \
45
    if (get_buffer(pb, buf, size) == size && buf[0]) { \
45
    if (avio_read(pb, buf, size) == size && buf[0]) { \
46 46
        buf[size] = 0; \
47 47
        av_metadata_set2(&avctx->metadata, name, buf, 0); \
48 48
    }
......
52 52
    GET_SAUCE_META("publisher", 20)
53 53
    GET_SAUCE_META("date",      8)
54 54
    url_fskip(pb, 4);
55
    datatype    = get_byte(pb);
56
    filetype    = get_byte(pb);
57
    t1          = get_le16(pb);
58
    t2          = get_le16(pb);
59
    nb_comments = get_byte(pb);
60
    flags       = get_byte(pb);
55
    datatype    = avio_r8(pb);
56
    filetype    = avio_r8(pb);
57
    t1          = avio_rl16(pb);
58
    t2          = avio_rl16(pb);
59
    nb_comments = avio_r8(pb);
60
    flags       = avio_r8(pb);
61 61
    url_fskip(pb, 4);
62 62
    GET_SAUCE_META("encoder",   22);
63 63

  
......
83 83

  
84 84
    if (nb_comments > 0) {
85 85
        url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
86
        if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
86
        if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
87 87
            int i;
88 88
            char *str = av_malloc(65*nb_comments + 1);
89 89
            *fsize -= 64*nb_comments + 5;
90 90
            if (!str)
91 91
                return 0;
92 92
            for (i = 0; i < nb_comments; i++) {
93
                if (get_buffer(pb, str + 65*i, 64) != 64)
93
                if (avio_read(pb, str + 65*i, 64) != 64)
94 94
                    break;
95 95
                str[65*i + 64] = '\n';
96 96
            }

Also available in: Unified diff