From cdb25d5a21e2502fef51c2ae7ae387bf990ab73d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 27 Sep 2014 18:13:14 +0200 Subject: video: change automatic rotation and 3D filter insertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We inserted these filters with fixed parameters, which was ok. But this also didn't change image parameters for the filters down the filter chain and the VO. For example, if rotation by 90° was requested by the file, we would insert a filter and rotate the video, but the VO would still receive image parameters that direct rotation by 90°. This wasn't a problem, but it could become one. Fix this by letting the filters automatically pick up the image params. The image params are reset on application. (We could probably also always try to apply and reset image params in a filter, instead of having special "auto" parameters. This would probably work, and video.c would insert a "rotate=0" filter. But I'm afraid this would be confusing and the current solution is cosmetically slightly nicer.) Unfortunately, the vf_stereo3d.c change turned out a big mess, but once the "internal" filter is fully replaced with libavfilter, most of this can be radically simplified. --- player/video.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index 61c7914920..3d308ae955 100644 --- a/player/video.c +++ b/player/video.c @@ -147,9 +147,7 @@ static void filter_reconfig(struct MPContext *mpctx, if (params.rotate && (params.rotate % 90 == 0)) { if (!(mpctx->video_out->driver->caps & VO_CAP_ROTATE90)) { // Try to insert a rotation filter. - char deg[10]; - snprintf(deg, sizeof(deg), "%d", params.rotate); - char *args[] = {"angle", deg, NULL, NULL}; + char *args[] = {"angle", "auto", NULL}; if (try_filter(mpctx, params, "rotate", "autorotate", args) >= 0) { params.rotate = 0; } else { @@ -161,10 +159,9 @@ static void filter_reconfig(struct MPContext *mpctx, if (params.stereo_in != params.stereo_out && params.stereo_in > 0 && params.stereo_out >= 0) { - char *from = MP_STEREO3D_NAME(params.stereo_in); char *to = MP_STEREO3D_NAME(params.stereo_out); - if (from && to) { - char *args[] = {"in", from, "out", to, NULL, NULL}; + if (to) { + char *args[] = {"in", "auto", "out", to, NULL, NULL}; if (try_filter(mpctx, params, "stereo3d", "stereo3d", args) < 0) MP_ERR(mpctx, "Can't insert 3D conversion filter.\n"); } -- cgit v1.2.3