Added command line option to control omx rotation

This commit is contained in:
Tom
2020-04-17 10:44:16 -06:00
parent a205edc1c7
commit 4bfeee690a
5 changed files with 40 additions and 1 deletions

View File

@@ -143,10 +143,22 @@ static int decoder_renderer_setup(int videoFormat, int width, int height, int re
}
OMX_CONFIG_ROTATIONTYPE rotationType;
memset(&rotationType, 0, sizeof(OMX_CONFIG_ROTATIONTYPE));
rotationType.nSize = sizeof(OMX_CONFIG_ROTATIONTYPE);
rotationType.nVersion.nVersion = OMX_VERSION;
rotationType.nPortIndex = 90;
rotationType.nRotation = 90;
int displayRotation = drFlags & DISPLAY_ROTATE_MASK;
switch (displayRotation) {
case DISPLAY_ROTATE_90:
rotationType.nRotation = 90;
break;
case DISPLAY_ROTATE_180:
rotationType.nRotation = 180;
break;
case DISPLAY_ROTATE_270:
rotationType.nRotation = 270;
break;
}
if(OMX_SetParameter(ILC_GET_HANDLE(video_render), OMX_IndexConfigCommonRotate, &rotationType) != OMX_ErrorNone) {
fprintf(stderr, "Failed to set video rotation\n");

View File

@@ -24,6 +24,10 @@
#define DISPLAY_FULLSCREEN 1
#define ENABLE_HARDWARE_ACCELERATION_1 2
#define ENABLE_HARDWARE_ACCELERATION_2 4
#define DISPLAY_ROTATE_MASK 24
#define DISPLAY_ROTATE_90 8
#define DISPLAY_ROTATE_180 16
#define DISPLAY_ROTATE_270 24
#define INIT_EGL 1
#define INIT_VDPAU 2