Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2009-03-08 · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | API changes, most recent first: | 14 | API changes, most recent first: |
| 15 | 15 | ||
| 16 | 2011-01-31 - X - lavfi 1.76.0 - vsrc_buffer | ||
| 17 | Add sample_aspect_ratio fields to vsrc_buffer arguments | ||
| 18 | |||
| 16 | 2011-01-31 - X - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio | 19 | 2011-01-31 - X - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio |
| 17 | Add sample_aspect_ratio field to AVFilterLink. | 20 | Add sample_aspect_ratio field to AVFilterLink. |
| 18 | 21 | ||
| @@ -1014,7 +1014,7 @@ This source is mainly intended for a programmatic use, in particular · 1013 unmodified lines | |||
| 1014 | through the interface defined in @file{libavfilter/vsrc_buffer.h}. | 1014 | through the interface defined in @file{libavfilter/vsrc_buffer.h}. |
| 1015 | 1015 | ||
| 1016 | It accepts the following parameters: | 1016 | It accepts the following parameters: |
| 1017 | @var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den} | 1017 | @var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den} |
| 1018 | 1018 | ||
| 1019 | All the parameters need to be explicitely defined. | 1019 | All the parameters need to be explicitely defined. |
| 1020 | 1020 | ||
| @@ -1033,15 +1033,20 @@ name. · 12 unmodified lines | |||
| 1033 | @item timebase_num, timebase_den | 1033 | @item timebase_num, timebase_den |
| 1034 | Specify numerator and denomitor of the timebase assumed by the | 1034 | Specify numerator and denomitor of the timebase assumed by the |
| 1035 | timestamps of the buffered frames. | 1035 | timestamps of the buffered frames. |
| 1036 | |||
| 1037 | @item sample_aspect_ratio.num, sample_aspect_ratio.den | ||
| 1038 | Specify numerator and denominator of the sample aspect ratio assumed | ||
| 1039 | by the video frames. | ||
| 1036 | @end table | 1040 | @end table |
| 1037 | 1041 | ||
| 1038 | For example: | 1042 | For example: |
| 1039 | @example | 1043 | @example |
| 1040 | buffer=320:240:yuv410p:1:24 | 1044 | buffer=320:240:yuv410p:1:24:1:1 |
| 1041 | @end example | 1045 | @end example |
| 1042 | 1046 | ||
| 1043 | will instruct the source to accept video frames with size 320x240 and | 1047 | will instruct the source to accept video frames with size 320x240 and |
| 1044 | with format "yuv410p" and assuming 1/24 as the timestamps timebase. | 1048 | with format "yuv410p", assuming 1/24 as the timestamps timebase and |
| 1049 | square pixels (1:1 sample aspect ratio). | ||
| 1045 | Since the pixel format with name "yuv410p" corresponds to the number 6 | 1050 | Since the pixel format with name "yuv410p" corresponds to the number 6 |
| 1046 | (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}), | 1051 | (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}), |
| 1047 | this example corresponds to: | 1052 | this example corresponds to: |
| @@ -355,13 +355,21 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost) · 354 unmodified lines | |||
| 355 | AVCodecContext *codec = ost->st->codec; | 355 | AVCodecContext *codec = ost->st->codec; |
| 356 | AVCodecContext *icodec = ist->st->codec; | 356 | AVCodecContext *icodec = ist->st->codec; |
| 357 | FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt }; | 357 | FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt }; |
| 358 | AVRational sample_aspect_ratio; | ||
| 358 | char args[255]; | 359 | char args[255]; |
| 359 | int ret; | 360 | int ret; |
| 360 | 361 | ||
| 361 | graph = avfilter_graph_alloc(); | 362 | graph = avfilter_graph_alloc(); |
| 362 | 363 | ||
| 363 | snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width, | 364 | if (ist->st->sample_aspect_ratio.num){ |
| 364 | ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE); | 365 | sample_aspect_ratio = ist->st->sample_aspect_ratio; |
| 366 | }else | ||
| 367 | sample_aspect_ratio = ist->st->codec->sample_aspect_ratio; | ||
| 368 | |||
| 369 | snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, | ||
| 370 | ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE, | ||
| 371 | sample_aspect_ratio.num, sample_aspect_ratio.den); | ||
| 372 | |||
| 365 | ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"), | 373 | ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"), |
| 366 | "src", args, NULL, graph); | 374 | "src", args, NULL, graph); |
| 367 | if (ret < 0) | 375 | if (ret < 0) |
| @@ -415,6 +423,8 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost) · 47 unmodified lines | |||
| 415 | 423 | ||
| 416 | codec->width = ist->output_video_filter->inputs[0]->w; | 424 | codec->width = ist->output_video_filter->inputs[0]->w; |
| 417 | codec->height = ist->output_video_filter->inputs[0]->h; | 425 | codec->height = ist->output_video_filter->inputs[0]->h; |
| 426 | codec->sample_aspect_ratio = ost->st->sample_aspect_ratio = | ||
| 427 | ist->output_video_filter->inputs[0]->sample_aspect_ratio; | ||
| 418 | 428 | ||
| 419 | return 0; | 429 | return 0; |
| 420 | } | 430 | } |
| @@ -2845,6 +2855,10 @@ static void opt_frame_aspect_ratio(const char *arg) · 2424 unmodified lines | |||
| 2845 | ffmpeg_exit(1); | 2855 | ffmpeg_exit(1); |
| 2846 | } | 2856 | } |
| 2847 | frame_aspect_ratio = ar; | 2857 | frame_aspect_ratio = ar; |
| 2858 | |||
| 2859 | x = vfilters ? strlen(vfilters) : 0; | ||
| 2860 | vfilters = av_realloc(vfilters, x+100); | ||
| 2861 | snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar); | ||
| 2848 | } | 2862 | } |
| 2849 | 2863 | ||
| 2850 | static int opt_metadata(const char *opt, const char *arg) | 2864 | static int opt_metadata(const char *opt, const char *arg) |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include "libavcore/samplefmt.h" | 27 | #include "libavcore/samplefmt.h" |
| 28 | 28 | ||
| 29 | #define LIBAVFILTER_VERSION_MAJOR 1 | 29 | #define LIBAVFILTER_VERSION_MAJOR 1 |
| 30 | #define LIBAVFILTER_VERSION_MINOR 75 | 30 | #define LIBAVFILTER_VERSION_MINOR 76 |
| 31 | #define LIBAVFILTER_VERSION_MICRO 0 | 31 | #define LIBAVFILTER_VERSION_MICRO 0 |
| 32 | 32 | ||
| 33 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | 33 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| @@ -68,8 +68,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) · 67 unmodified lines | |||
| 68 | int n = 0; | 68 | int n = 0; |
| 69 | 69 | ||
| 70 | if (!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) { | 71 | (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str, |
| 72 | av_log(ctx, AV_LOG_ERROR, "Expected 5 arguments, but only %d found in '%s'\n", n, args); | 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 | return AVERROR(EINVAL); | 75 | return AVERROR(EINVAL); |
| 74 | } | 76 | } |
| 75 | if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { | 77 | if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { |
| @@ -100,6 +102,7 @@ static int config_props(AVFilterLink *link) · 24 unmodified lines | |||
| 100 | 102 | ||
| 101 | link->w = c->w; | 103 | link->w = c->w; |
| 102 | link->h = c->h; | 104 | link->h = c->h; |
| 105 | link->sample_aspect_ratio = c->pixel_aspect; | ||
| 103 | link->time_base = c->time_base; | 106 | link->time_base = c->time_base; |
| 104 | 107 | ||
| 105 | return 0; | 108 | return 0; |