Added display rotation support to mmal decoder

This commit is contained in:
Tom 2020-04-17 10:59:15 -06:00
parent 4bfeee690a
commit ceacef6329
2 changed files with 13 additions and 1 deletions

View File

@ -191,7 +191,7 @@ static void help() {
printf("\t-4k\t\t\tUse 3840x2160 resolution\n"); printf("\t-4k\t\t\tUse 3840x2160 resolution\n");
printf("\t-width <width>\t\tHorizontal resolution (default 1280)\n"); printf("\t-width <width>\t\tHorizontal resolution (default 1280)\n");
printf("\t-height <height>\tVertical resolution (default 720)\n"); printf("\t-height <height>\tVertical resolution (default 720)\n");
#if defined(HAVE_PI) #if defined(HAVE_PI) | defined(HAVE_MMAL)
printf("\t-rotate <height>\tRotate display: 0/90/180/270 (default 0)\n"); printf("\t-rotate <height>\tRotate display: 0/90/180/270 (default 0)\n");
#endif #endif
printf("\t-fps <fps>\t\tSpecify the fps to use (default -1)\n"); printf("\t-fps <fps>\t\tSpecify the fps to use (default -1)\n");

View File

@ -158,6 +158,18 @@ static int decoder_renderer_setup(int videoFormat, int width, int height, int re
param.layer = 128; param.layer = 128;
param.display_num = 0; param.display_num = 0;
param.fullscreen = true; param.fullscreen = true;
int displayRotation = drFlags & DISPLAY_ROTATE_MASK;
switch (displayRotation) {
case DISPLAY_ROTATE_90:
param.transform = MMAL_DISPLAY_ROT90;
break;
case DISPLAY_ROTATE_180:
param.transform = MMAL_DISPLAY_ROT180;
break;
case DISPLAY_ROTATE_270:
param.transform = MMAL_DISPLAY_ROT270;
break;
}
if (mmal_port_parameter_set(renderer->input[0], &param.hdr) != MMAL_SUCCESS) { if (mmal_port_parameter_set(renderer->input[0], &param.hdr) != MMAL_SUCCESS) {
fprintf(stderr, "Can't set parameters\n"); fprintf(stderr, "Can't set parameters\n");