Revision e7b987dc libavdevice/v4l2.c

View differences:

libavdevice/v4l2.c
57 57
    int frame_format; /* V4L2_PIX_FMT_* */
58 58
    enum io_method io_method;
59 59
    int width, height;
60
    int frame_rate;
61
    int frame_rate_base;
62 60
    int frame_size;
63 61
    int top_field_first;
64 62

  
......
509 507
    struct video_data *s = s1->priv_data;
510 508
    AVStream *st;
511 509
    int width, height;
512
    int res, frame_rate, frame_rate_base;
510
    int res;
513 511
    uint32_t desired_format, capabilities;
514 512

  
515 513
    if (ap->width <= 0 || ap->height <= 0) {
516 514
        av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
517 515
        return -1;
518 516
    }
519
    if (ap->time_base.den <= 0) {
520
        av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
521
        return -1;
522
    }
523 517

  
524 518
    width = ap->width;
525 519
    height = ap->height;
526
    frame_rate = ap->time_base.den;
527
    frame_rate_base = ap->time_base.num;
528 520

  
529 521
    if(avcodec_check_dimensions(s1, ap->width, ap->height) < 0)
530 522
        return -1;
......
537 529

  
538 530
    s->width = width;
539 531
    s->height = height;
540
    s->frame_rate      = frame_rate;
541
    s->frame_rate_base = frame_rate_base;
542 532

  
543 533
    capabilities = 0;
544 534
    s->fd = device_open(s1, &capabilities);
......
599 589
    st->codec->codec_id = CODEC_ID_RAWVIDEO;
600 590
    st->codec->width = width;
601 591
    st->codec->height = height;
602
    st->codec->time_base.den = frame_rate;
603
    st->codec->time_base.num = frame_rate_base;
592
    st->codec->time_base.den = ap->time_base.den;
593
    st->codec->time_base.num = ap->time_base.num;
604 594
    st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
605 595

  
606 596
    return 0;

Also available in: Unified diff