Revision 7a11c82f

View differences:

doc/APIchanges
13 13

  
14 14
API changes, most recent first:
15 15

  
16
2011-04-xx - xxxxxx - lavfi 2.2.0 - vsrc_buffer
17
  Add sample_aspect_ratio fields to vsrc_buffer arguments
18

  
16 19
2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
17 20
  Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
18 21

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

  
1192 1192
It accepts the following parameters:
1193
@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}
1193
@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}
1194 1194

  
1195 1195
All the parameters need to be explicitely defined.
1196 1196

  
......
1209 1209
@item timebase_num, timebase_den
1210 1210
Specify numerator and denomitor of the timebase assumed by the
1211 1211
timestamps of the buffered frames.
1212

  
1213
@item sample_aspect_ratio.num, sample_aspect_ratio.den
1214
Specify numerator and denominator of the sample aspect ratio assumed
1215
by the video frames.
1212 1216
@end table
1213 1217

  
1214 1218
For example:
1215 1219
@example
1216
buffer=320:240:yuv410p:1:24
1220
buffer=320:240:yuv410p:1:24:1:1
1217 1221
@end example
1218 1222

  
1219 1223
will instruct the source to accept video frames with size 320x240 and
1220
with format "yuv410p" and assuming 1/24 as the timestamps timebase.
1224
with format "yuv410p", assuming 1/24 as the timestamps timebase and
1225
square pixels (1:1 sample aspect ratio).
1221 1226
Since the pixel format with name "yuv410p" corresponds to the number 6
1222 1227
(check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
1223 1228
this example corresponds to:
ffmpeg.c
344 344
    AVCodecContext *codec = ost->st->codec;
345 345
    AVCodecContext *icodec = ist->st->codec;
346 346
    FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt };
347
    AVRational sample_aspect_ratio;
347 348
    char args[255];
348 349
    int ret;
349 350

  
350 351
    graph = avfilter_graph_alloc();
351 352

  
352
    snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width,
353
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE);
353
    if (ist->st->sample_aspect_ratio.num){
354
        sample_aspect_ratio = ist->st->sample_aspect_ratio;
355
    }else
356
        sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
357

  
358
    snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
359
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
360
             sample_aspect_ratio.num, sample_aspect_ratio.den);
361

  
354 362
    ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"),
355 363
                                       "src", args, NULL, graph);
356 364
    if (ret < 0)
......
404 412

  
405 413
    codec->width  = ist->output_video_filter->inputs[0]->w;
406 414
    codec->height = ist->output_video_filter->inputs[0]->h;
415
    codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
416
        ist->output_video_filter->inputs[0]->sample_aspect_ratio;
407 417

  
408 418
    return 0;
409 419
}
......
2784 2794
        ffmpeg_exit(1);
2785 2795
    }
2786 2796
    frame_aspect_ratio = ar;
2797

  
2798
    x = vfilters ? strlen(vfilters) : 0;
2799
    vfilters = av_realloc(vfilters, x+100);
2800
    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);
2787 2801
}
2788 2802

  
2789 2803
static int opt_metadata(const char *opt, const char *arg)
libavfilter/avfilter.h
26 26
#include "libavutil/samplefmt.h"
27 27

  
28 28
#define LIBAVFILTER_VERSION_MAJOR  2
29
#define LIBAVFILTER_VERSION_MINOR  1
29
#define LIBAVFILTER_VERSION_MINOR  2
30 30
#define LIBAVFILTER_VERSION_MICRO  0
31 31

  
32 32
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
libavfilter/vsrc_buffer.c
68 68
    int n = 0;
69 69

  
70 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
        (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
72
                    &c->time_base.num, &c->time_base.den,
73
                    &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
74
        av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but only %d found in '%s'\n", n, args);
73 75
        return AVERROR(EINVAL);
74 76
    }
75 77
    if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
......
100 102

  
101 103
    link->w = c->w;
102 104
    link->h = c->h;
105
    link->sample_aspect_ratio = c->pixel_aspect;
103 106
    link->time_base = c->time_base;
104 107

  
105 108
    return 0;

Also available in: Unified diff