Skip to content
Snippets Groups Projects
Commit ea665a66 authored by Niklas Haas's avatar Niklas Haas Committed by Hugo Beauzée-Luyssen
Browse files

libplacebo: add support for video orientation

Requires videolan/libplacebo@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.
parent 53ec4c4d
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment