diff options
author | wm4 <wm4@nowhere> | 2016-08-19 09:37:52 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-19 09:37:52 +0200 |
commit | 4e3663a2da5da33231ced7ae513c2a9017cd4298 (patch) | |
tree | e71fa5481cb4df5d364c3ba9c74cd442ced3ebd2 /video | |
parent | e6952c70532bbc491cbe1ec484030b101fc71b7d (diff) | |
download | mpv-4e3663a2da5da33231ced7ae513c2a9017cd4298.tar.bz2 mpv-4e3663a2da5da33231ced7ae513c2a9017cd4298.tar.xz |
vf_rotate: allow arbitrary rotation
vf_rotate selects the correct filter for 90° rotation, but it can be
extended to use lavfi's vf_rotate as fallback.
See #3434.
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/vf_rotate.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c index 60e52a00bd..dcaba53c6a 100644 --- a/video/filter/vf_rotate.c +++ b/video/filter/vf_rotate.c @@ -18,6 +18,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include <inttypes.h> #include "common/msg.h" @@ -46,11 +47,17 @@ static int lavfi_reconfig(struct vf_instance *vf, struct vf_priv_s *p = vf_lw_old_priv(vf); if (p->angle == 4) { // "auto" int r = in->rotate; - if (r < 0 || r >= 360 || (r % 90) != 0) { + if (r < 0 || r >= 360) { MP_ERR(vf, "Can't apply rotation of %d degrees.\n", r); return -1; } - vf_lw_update_graph(vf, NULL, "%s", rot[(r / 90) % 360]); + if (r % 90) { + double a = r / 180.0 * M_PI; + vf_lw_update_graph(vf, NULL, "rotate=%f:ow=rotw(%f):oh=roth(%f)", + a, a, a); + } else { + vf_lw_update_graph(vf, NULL, "%s", rot[(r / 90) % 360]); + } out->rotate = 0; } return 0; |