Revision bec994df

View differences:

libavformat/oggdec.c
193 193
    AVIOContext *bc = s->pb;
194 194
    struct ogg *ogg = s->priv_data;
195 195
    struct ogg_stream *os;
196
    int i = 0;
196
    int ret, i = 0;
197 197
    int flags, nsegs;
198 198
    uint64_t gp;
199 199
    uint32_t serial;
......
203 203
    uint8_t sync[4];
204 204
    int sp = 0;
205 205

  
206
    if (avio_read (bc, sync, 4) < 4)
207
        return -1;
206
    ret = avio_read (bc, sync, 4);
207
    if (ret < 4)
208
        return ret < 0 ? ret : AVERROR_EOF;
208 209

  
209 210
    do{
210 211
        int c;
......
216 217

  
217 218
        c = avio_r8(bc);
218 219
        if (url_feof(bc))
219
            return -1;
220
            return AVERROR_EOF;
220 221
        sync[sp++ & 3] = c;
221 222
    }while (i++ < MAX_PAGE_SIZE);
222 223

  
223 224
    if (i >= MAX_PAGE_SIZE){
224 225
        av_log (s, AV_LOG_INFO, "ogg, can't find sync word\n");
225
        return -1;
226
        return AVERROR_INVALIDDATA;
226 227
    }
227 228

  
228 229
    if (avio_r8(bc) != 0)      /* version */
229
        return -1;
230
        return AVERROR_INVALIDDATA;
230 231

  
231 232
    flags = avio_r8(bc);
232 233
    gp = avio_rl64 (bc);
......
251 252
            idx = ogg_new_stream(s, serial, 1);
252 253
        }
253 254
        if (idx < 0)
254
            return -1;
255
            return idx;
255 256
    }
256 257

  
257 258
    os = ogg->streams + idx;
......
260 261
    if(os->psize > 0)
261 262
        ogg_new_buf(ogg, idx);
262 263

  
263
    if (avio_read (bc, os->segments, nsegs) < nsegs)
264
        return -1;
264
    ret = avio_read (bc, os->segments, nsegs);
265
    if (ret < nsegs)
266
        return ret < 0 ? ret : AVERROR_EOF;
265 267

  
266 268
    os->nsegs = nsegs;
267 269
    os->segp = 0;
......
292 294
        os->buf = nb;
293 295
    }
294 296

  
295
    if (avio_read (bc, os->buf + os->bufpos, size) < size)
296
        return -1;
297
    ret = avio_read (bc, os->buf + os->bufpos, size);
298
    if (ret < size)
299
        return ret < 0 ? ret : AVERROR_EOF;
297 300

  
298 301
    os->bufpos += size;
299 302
    os->granule = gp;
......
309 312
                      int64_t *fpos)
310 313
{
311 314
    struct ogg *ogg = s->priv_data;
312
    int idx, i;
315
    int idx, i, ret;
313 316
    struct ogg_stream *os;
314 317
    int complete = 0;
315 318
    int segp = 0, psize = 0;
......
322 325
        idx = ogg->curidx;
323 326

  
324 327
        while (idx < 0){
325
            if (ogg_read_page (s, &idx) < 0)
326
                return -1;
328
            ret = ogg_read_page (s, &idx);
329
            if (ret < 0)
330
                return ret;
327 331
        }
328 332

  
329 333
        os = ogg->streams + idx;
......
338 342
            if (os->header < 0){
339 343
                os->codec = ogg_find_codec (os->buf, os->bufpos);
340 344
                if (!os->codec){
345
                    av_log(s, AV_LOG_WARNING, "Codec not found\n");
341 346
                    os->header = 0;
342 347
                    return 0;
343 348
                }
......
439 444
static int ogg_get_headers(AVFormatContext *s)
440 445
{
441 446
    struct ogg *ogg = s->priv_data;
447
    int ret;
442 448

  
443 449
    do{
444
        if (ogg_packet (s, NULL, NULL, NULL, NULL) < 0)
445
            return -1;
450
        ret = ogg_packet (s, NULL, NULL, NULL, NULL);
451
        if (ret < 0)
452
            return ret;
446 453
    }while (!ogg->headers);
447 454

  
448 455
#if 0
......
503 510
static int ogg_read_header(AVFormatContext *s, AVFormatParameters *ap)
504 511
{
505 512
    struct ogg *ogg = s->priv_data;
506
    int i;
513
    int ret, i;
507 514
    ogg->curidx = -1;
508 515
    //linear headers seek from start
509
    if (ogg_get_headers (s) < 0){
510
        return -1;
516
    ret = ogg_get_headers (s);
517
    if (ret < 0){
518
        return ret;
511 519
    }
512 520

  
513 521
    for (i = 0; i < ogg->nstreams; i++)

Also available in: Unified diff