[vlc-commits] [Git][videolan/vlc][master] libplacebo: add support for video orientation

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon Oct 25 09:09:50 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
ea665a66 by Niklas Haas at 2021-10-25T08:43:14+00:00
libplacebo: add support for video orientation

Requires videolan/libplacebo at 957ad294

Note: We could technically support mirroring (and 180° rotation) on
older libplacebo as well if needed, but I decided to go for the simpler
implementation since those cases are comparatively rare anyways. 90°
rotation is the most important case to support properly.

- - - - -


1 changed file:

- modules/video_output/libplacebo/display.c


Changes:

=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -281,6 +281,36 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         place.height = -place.height;
     }
 
+#if PL_API_VER >= 162
+#define SWAP(a, b) { float _tmp = (a); (a) = (b); (b) = _tmp; }
+    switch (vd->fmt->orientation) {
+    case ORIENT_HFLIPPED:
+        SWAP(img.crop.x0, img.crop.x1);
+        break;
+    case ORIENT_VFLIPPED:
+        SWAP(img.crop.y0, img.crop.y1);
+        break;
+    case ORIENT_ROTATED_90:
+        img.rotation = PL_ROTATION_90;
+        break;
+    case ORIENT_ROTATED_180:
+        img.rotation = PL_ROTATION_180;
+        break;
+    case ORIENT_ROTATED_270:
+        img.rotation = PL_ROTATION_270;
+        break;
+    case ORIENT_TRANSPOSED:
+        img.rotation = PL_ROTATION_90;
+        SWAP(img.crop.y0, img.crop.y1);
+        break;
+    case ORIENT_ANTI_TRANSPOSED:
+        img.rotation = PL_ROTATION_90;
+        SWAP(img.crop.x0, img.crop.x1);
+    default:
+        break;
+    }
+#endif
+
 #if PL_API_VER >= 101
     target.crop = (struct pl_rect2df) {
         place.x, place.y, place.x + place.width, place.y + place.height,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ea665a66852c73ac65b92d31864d9fd03fdb3905

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ea665a66852c73ac65b92d31864d9fd03fdb3905
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list