Hi! Attached patch fixes ticket #6672.
Please comment, Carl Eugen
From c4d3ba1d69e7dd7a60ea7150eb1fc545a86697fe Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffm...@gmail.com> Date: Mon, 18 Sep 2017 23:10:06 +0200 Subject: [PATCH] lavfi/stereo3d: Set SAR for every output frame. Fixes ticket #6672. --- libavfilter/vf_stereo3d.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index 3e23890..8b22f88 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -150,6 +150,7 @@ typedef struct Stereo3DContext { AVFrame *prev; int blanks; int in_off_left[4], in_off_right[4]; + AVRational aspect; Stereo3DDSPContext dsp; } Stereo3DContext; @@ -359,11 +360,11 @@ static int config_output(AVFilterLink *outlink) AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = ctx->inputs[0]; Stereo3DContext *s = ctx->priv; - AVRational aspect = inlink->sample_aspect_ratio; AVRational fps = inlink->frame_rate; AVRational tb = inlink->time_base; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); int ret; + s->aspect = inlink->sample_aspect_ratio; switch (s->in.format) { case INTERLEAVE_COLS_LR: @@ -404,25 +405,25 @@ static int config_output(AVFilterLink *outlink) switch (s->in.format) { case SIDE_BY_SIDE_2_LR: - aspect.num *= 2; + s->aspect.num *= 2; case SIDE_BY_SIDE_LR: s->width = inlink->w / 2; s->in.off_right = s->width; break; case SIDE_BY_SIDE_2_RL: - aspect.num *= 2; + s->aspect.num *= 2; case SIDE_BY_SIDE_RL: s->width = inlink->w / 2; s->in.off_left = s->width; break; case ABOVE_BELOW_2_LR: - aspect.den *= 2; + s->aspect.den *= 2; case ABOVE_BELOW_LR: s->in.row_right = s->height = inlink->h / 2; break; case ABOVE_BELOW_2_RL: - aspect.den *= 2; + s->aspect.den *= 2; case ABOVE_BELOW_RL: s->in.row_left = s->height = inlink->h / 2; @@ -486,19 +487,19 @@ static int config_output(AVFilterLink *outlink) break; } case SIDE_BY_SIDE_2_LR: - aspect.den *= 2; + s->aspect.den *= 2; case SIDE_BY_SIDE_LR: s->out.width = s->width * 2; s->out.off_right = s->width; break; case SIDE_BY_SIDE_2_RL: - aspect.den *= 2; + s->aspect.den *= 2; case SIDE_BY_SIDE_RL: s->out.width = s->width * 2; s->out.off_left = s->width; break; case ABOVE_BELOW_2_LR: - aspect.num *= 2; + s->aspect.num *= 2; case ABOVE_BELOW_LR: s->out.height = s->height * 2; s->out.row_right = s->height; @@ -514,7 +515,7 @@ static int config_output(AVFilterLink *outlink) s->out.row_right = s->height + s->blanks; break; case ABOVE_BELOW_2_RL: - aspect.num *= 2; + s->aspect.num *= 2; case ABOVE_BELOW_RL: s->out.height = s->height * 2; s->out.row_left = s->height; @@ -576,7 +577,7 @@ static int config_output(AVFilterLink *outlink) outlink->h = s->out.height; outlink->frame_rate = fps; outlink->time_base = tb; - outlink->sample_aspect_ratio = aspect; + outlink->sample_aspect_ratio = s->aspect; if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, s->width)) < 0) return ret; @@ -1075,6 +1076,7 @@ copy: av_frame_free(&s->prev); av_frame_free(&inpicref); } + out->sample_aspect_ratio = s->aspect; return ff_filter_frame(outlink, out); } -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel