Revision e63a3628 libavformat/siff.c

View differences:

libavformat/siff.c
89 89
    AVStream *st;
90 90
    int width, height;
91 91

  
92
    if (get_le32(pb) != TAG_VBHD){
92
    if (avio_rl32(pb) != TAG_VBHD){
93 93
        av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
94 94
        return -1;
95 95
    }
96
    if(get_be32(pb) != 32){
96
    if(avio_rb32(pb) != 32){
97 97
        av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
98 98
        return -1;
99 99
    }
100
    if(get_le16(pb) != 1){
100
    if(avio_rl16(pb) != 1){
101 101
        av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
102 102
        return -1;
103 103
    }
104
    width = get_le16(pb);
105
    height = get_le16(pb);
104
    width = avio_rl16(pb);
105
    height = avio_rl16(pb);
106 106
    url_fskip(pb, 4);
107
    c->frames = get_le16(pb);
107
    c->frames = avio_rl16(pb);
108 108
    if(!c->frames){
109 109
        av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
110 110
        return -1;
111 111
    }
112
    c->bits = get_le16(pb);
113
    c->rate = get_le16(pb);
112
    c->bits = avio_rl16(pb);
113
    c->rate = avio_rl16(pb);
114 114
    c->block_align = c->rate * (c->bits >> 3);
115 115

  
116 116
    url_fskip(pb, 16); //zeroes
......
137 137

  
138 138
static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
139 139
{
140
    if (get_le32(pb) != TAG_SHDR){
140
    if (avio_rl32(pb) != TAG_SHDR){
141 141
        av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
142 142
        return -1;
143 143
    }
144
    if(get_be32(pb) != 8){
144
    if(avio_rb32(pb) != 8){
145 145
        av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
146 146
        return -1;
147 147
    }
148 148
    url_fskip(pb, 4); //unknown value
149
    c->rate = get_le16(pb);
150
    c->bits = get_le16(pb);
149
    c->rate = avio_rl16(pb);
150
    c->bits = avio_rl16(pb);
151 151
    c->block_align = c->rate * (c->bits >> 3);
152 152
    return create_audio_stream(s, c);
153 153
}
......
158 158
    SIFFContext *c = s->priv_data;
159 159
    uint32_t tag;
160 160

  
161
    if (get_le32(pb) != TAG_SIFF)
161
    if (avio_rl32(pb) != TAG_SIFF)
162 162
        return -1;
163 163
    url_fskip(pb, 4); //ignore size
164
    tag = get_le32(pb);
164
    tag = avio_rl32(pb);
165 165

  
166 166
    if (tag != TAG_VBV1 && tag != TAG_SOUN){
167 167
        av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
......
172 172
        return -1;
173 173
    if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
174 174
        return -1;
175
    if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
175
    if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){
176 176
        av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
177 177
        return -1;
178 178
    }
......
190 190
        if (c->cur_frame >= c->frames)
191 191
            return AVERROR(EIO);
192 192
        if (c->curstrm == -1){
193
            c->pktsize = get_le32(s->pb) - 4;
194
            c->flags = get_le16(s->pb);
193
            c->pktsize = avio_rl32(s->pb) - 4;
194
            c->flags = avio_rl16(s->pb);
195 195
            c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
196 196
            if (c->gmcsize)
197
                get_buffer(s->pb, c->gmc, c->gmcsize);
198
            c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
197
                avio_read(s->pb, c->gmc, c->gmcsize);
198
            c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb): 0;
199 199
            c->curstrm = !!(c->flags & VB_HAS_AUDIO);
200 200
        }
201 201

  
......
206 206
            AV_WL16(pkt->data, c->flags);
207 207
            if (c->gmcsize)
208 208
                memcpy(pkt->data + 2, c->gmc, c->gmcsize);
209
            get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
209
            avio_read(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
210 210
            pkt->stream_index = 0;
211 211
            c->curstrm = -1;
212 212
        }else{

Also available in: Unified diff