Revision 67d44b84

View differences:

libavformat/dv.c
31 31
#include <time.h>
32 32
#include "avformat.h"
33 33
#include "libavcodec/dvdata.h"
34
#include "libavutil/intreadwrite.h"
34 35
#include "dv.h"
35 36

  
36 37
struct DVDemuxContext {
......
399 400
static int dv_read_header(AVFormatContext *s,
400 401
                          AVFormatParameters *ap)
401 402
{
403
    unsigned state;
402 404
    RawDVContext *c = s->priv_data;
403 405

  
404 406
    c->dv_demux = dv_init_demux(s);
405 407
    if (!c->dv_demux)
406 408
        return -1;
407 409

  
408
    if (get_buffer(s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
410
    state = get_be32(s->pb);
411
    while ((state & 0xffffff7f) != 0x1f07003f) {
412
        if (url_feof(s->pb)) {
413
            av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
414
            return -1;
415
        }
416
        state = (state << 8) | get_byte(s->pb);
417
    }
418
    AV_WB32(c->buf, state);
419

  
420
    if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
409 421
        url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
410 422
        return AVERROR(EIO);
411 423

  

Also available in: Unified diff