From f85cad799b52eb15f3dda40f4a400ee1a6e059a1 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 13 Jun 2017 15:07:36 +0200 Subject: [PATCH] avfilter: properly set SAR for A->V filters Signed-off-by: Paul B Mahol --- libavfilter/avf_abitscope.c | 2 ++ libavfilter/avf_avectorscope.c | 1 + libavfilter/avf_showfreqs.c | 1 + libavfilter/avf_showspectrum.c | 3 ++- libavfilter/f_ebur128.c | 3 ++- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavfilter/avf_abitscope.c b/libavfilter/avf_abitscope.c index 0f3e3594c1..0e3eaa422e 100644 --- a/libavfilter/avf_abitscope.c +++ b/libavfilter/avf_abitscope.c @@ -166,6 +166,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) memset(outpicref->data[0] + i * outpicref->linesize[0], 0, outlink->w * 4); outpicref->pts = insamples->pts; + outpicref->sample_aspect_ratio = (AVRational){1,1}; + switch (insamples->format) { case AV_SAMPLE_FMT_S16P: for (ch = 0; ch < inlink->channels; ch++) { diff --git a/libavfilter/avf_avectorscope.c b/libavfilter/avf_avectorscope.c index c6e278d30d..7cb5efb402 100644 --- a/libavfilter/avf_avectorscope.c +++ b/libavfilter/avf_avectorscope.c @@ -246,6 +246,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return AVERROR(ENOMEM); } + s->outpicref->sample_aspect_ratio = (AVRational){1,1}; for (i = 0; i < outlink->h; i++) memset(s->outpicref->data[0] + i * s->outpicref->linesize[0], 0, outlink->w * 4); } diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c index 21735ed075..068ff1fb88 100644 --- a/libavfilter/avf_showfreqs.c +++ b/libavfilter/avf_showfreqs.c @@ -434,6 +434,7 @@ static int plot_freqs(AVFilterLink *inlink, AVFrame *in) av_free(colors); out->pts = in->pts; + out->sample_aspect_ratio = (AVRational){1,1}; return ff_filter_frame(outlink, out); } diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index ff66740a3a..4317161d79 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -306,6 +306,7 @@ static int config_output(AVFilterLink *outlink) outlink->w = s->w; outlink->h = s->h; + outlink->sample_aspect_ratio = (AVRational){1,1}; if (s->legend) { s->start_x = log10(inlink->sample_rate) * 25; @@ -422,7 +423,7 @@ static int config_output(AVFilterLink *outlink) ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!outpicref) return AVERROR(ENOMEM); - outlink->sample_aspect_ratio = (AVRational){1,1}; + outpicref->sample_aspect_ratio = (AVRational){1,1}; for (i = 0; i < outlink->h; i++) { memset(outpicref->data[0] + i * outpicref->linesize[0], 0, outlink->w); memset(outpicref->data[1] + i * outpicref->linesize[1], 128, outlink->w); diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index daeb9f9b58..1e8b90fa2f 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -269,6 +269,7 @@ static int config_video_output(AVFilterLink *outlink) } outlink->w = ebur128->w; outlink->h = ebur128->h; + outlink->sample_aspect_ratio = (AVRational){1,1}; #define PAD 8 @@ -299,7 +300,7 @@ static int config_video_output(AVFilterLink *outlink) ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!outpicref) return AVERROR(ENOMEM); - outlink->sample_aspect_ratio = (AVRational){1,1}; + outpicref->sample_aspect_ratio = (AVRational){1,1}; /* init y references values (to draw LU lines) */ ebur128->y_line_ref = av_calloc(ebur128->graph.h + 1, sizeof(*ebur128->y_line_ref));