Revision 94498ec9

View differences:

doc/filters.texi
611 611
through the interface defined in @file{libavfilter/vsrc_buffer.h}.
612 612

  
613 613
It accepts the following parameters:
614
@var{width}:@var{height}:@var{pix_fmt_string}
614
@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}
615 615

  
616 616
All the parameters need to be explicitely defined.
617 617

  
......
628 628
It may be a number corresponding to a pixel format, or a pixel format
629 629
name.
630 630

  
631
@item timebase_num, timebase_den
632
Specify numerator and denomitor of the timebase assumed by the
633
timestamps of the buffered frames.
631 634
@end table
632 635

  
633 636
For example:
634 637
@example
635
buffer=320:240:yuv410p
638
buffer=320:240:yuv410p:1:24
636 639
@end example
637 640

  
638 641
will instruct the source to accept video frames with size 320x240 and
639
with format "yuv410p". Since the pixel format with name "yuv410p"
640
corresponds to the number 6 (check the enum PixelFormat definition in
641
@file{libavutil/pixfmt.h}), this example corresponds to:
642
with format "yuv410p" and assuming 1/24 as the timestamps timebase.
643
Since the pixel format with name "yuv410p" corresponds to the number 6
644
(check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
645
this example corresponds to:
642 646
@example
643
buffer=320:240:6
647
buffer=320:240:6:1:24
644 648
@end example
645 649

  
646 650
@section color
ffmpeg.c
424 424
    if ((ret = avfilter_open(&ist->output_video_filter, &output_filter, "out")) < 0)
425 425
        return ret;
426 426

  
427
    snprintf(args, 255, "%d:%d:%d", ist->st->codec->width,
428
             ist->st->codec->height, ist->st->codec->pix_fmt);
427
    snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width,
428
             ist->st->codec->height, ist->st->codec->pix_fmt,
429
             ist->st->time_base.num, ist->st->time_base.den);
429 430
    if ((ret = avfilter_init_filter(ist->input_video_filter, args, NULL)) < 0)
430 431
        return ret;
431 432
    if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &codec->pix_fmt)) < 0)
libavfilter/avfilter.h
26 26

  
27 27
#define LIBAVFILTER_VERSION_MAJOR  1
28 28
#define LIBAVFILTER_VERSION_MINOR 51
29
#define LIBAVFILTER_VERSION_MICRO  0
29
#define LIBAVFILTER_VERSION_MICRO  1
30 30

  
31 31
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
32 32
                                               LIBAVFILTER_VERSION_MINOR, \
libavfilter/vsrc_buffer.c
33 33
    int               has_frame;
34 34
    int               h, w;
35 35
    enum PixelFormat  pix_fmt;
36
    AVRational        time_base;     ///< time_base to set in the output link
36 37
    AVRational        pixel_aspect;
37 38
} BufferSourceContext;
38 39

  
......
66 67
    char pix_fmt_str[128];
67 68
    int n = 0;
68 69

  
69
    if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) {
70
        av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");
70
    if (!args ||
71
        (n = sscanf(args, "%d:%d:%127[^:]:%d:%d", &c->w, &c->h, pix_fmt_str, &c->time_base.num, &c->time_base.den)) != 5) {
72
        av_log(ctx, AV_LOG_ERROR, "Expected 5 arguments, but only %d found in '%s'\n", n, args);
71 73
        return AVERROR(EINVAL);
72 74
    }
73 75
    if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
......
98 100

  
99 101
    link->w = c->w;
100 102
    link->h = c->h;
103
    link->time_base = c->time_base;
101 104

  
102 105
    return 0;
103 106
}

Also available in: Unified diff