summaryrefslogtreecommitdiffstats
path: root/video/out/aspect.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-08-25 19:21:21 +0200
committerDudemanguy <random342@airmail.cc>2023-08-31 17:37:42 +0000
commitf3f1a79fe3ad9bdae344559ec5802c184af41112 (patch)
tree8ad67cec885e18f6d0618dc9b220288574e1e98f /video/out/aspect.c
parentf3211db7911c89883dc392ddeef8ffe53aeb49b0 (diff)
downloadmpv-f3f1a79fe3ad9bdae344559ec5802c184af41112.tar.bz2
mpv-f3f1a79fe3ad9bdae344559ec5802c184af41112.tar.xz
vo: add --video-crop
Just cropping by VO that works with hwdec. Fixes: #12222
Diffstat (limited to 'video/out/aspect.c')
-rw-r--r--video/out/aspect.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/video/out/aspect.c b/video/out/aspect.c
index a295f8d3da..84fdb13b69 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -136,10 +136,6 @@ void mp_get_src_dst_rects(struct mp_log *log, struct mp_vo_opts *opts,
int src_dw, src_dh;
mp_image_params_get_dsize(video, &src_dw, &src_dh);
- if (video->rotate % 180 == 90 && (vo_caps & VO_CAP_ROTATE90)) {
- MPSWAP(int, src_w, src_h);
- MPSWAP(int, src_dw, src_dh);
- }
window_w = MPMAX(1, window_w);
window_h = MPMAX(1, window_h);
@@ -155,6 +151,17 @@ void mp_get_src_dst_rects(struct mp_log *log, struct mp_vo_opts *opts,
struct mp_rect dst = {0, 0, window_w, window_h};
struct mp_rect src = {0, 0, src_w, src_h};
+ if (mp_image_crop_valid(video))
+ src = video->crop;
+
+ if (vo_caps & VO_CAP_ROTATE90) {
+ if (video->rotate % 180 == 90) {
+ MPSWAP(int, src_w, src_h);
+ MPSWAP(int, src_dw, src_dh);
+ }
+ mp_rect_rotate(&src, src_w, src_h, video->rotate);
+ }
+
struct mp_osd_res osd = {
.w = window_w,
.h = window_h,