mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fix omxplayer when using --screensize, --screenoffset and --screenrotate
This commit is contained in:
parent
ec8ebf07f3
commit
4428ddaa6d
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
|
#include "Renderer.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <wait.h>
|
#include <wait.h>
|
||||||
|
@ -93,14 +94,68 @@ void VideoPlayerComponent::startVideo()
|
||||||
|
|
||||||
// Find out the pixel position of the video view and build a command line for
|
// Find out the pixel position of the video view and build a command line for
|
||||||
// omxplayer to position it in the right place
|
// omxplayer to position it in the right place
|
||||||
char buf[32];
|
char buf1[32];
|
||||||
|
char buf2[32];
|
||||||
float x = mPosition.x() - (mOrigin.x() * mSize.x());
|
float x = mPosition.x() - (mOrigin.x() * mSize.x());
|
||||||
float y = mPosition.y() - (mOrigin.y() * mSize.y());
|
float y = mPosition.y() - (mOrigin.y() * mSize.y());
|
||||||
sprintf(buf, "%d,%d,%d,%d", (int)x, (int)y, (int)(x + mSize.x()), (int)(y + mSize.y()));
|
|
||||||
|
// fix x and y
|
||||||
|
switch(Renderer::getScreenRotate())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
const int x1 = (int)(Renderer::getScreenOffsetX() + x);
|
||||||
|
const int y1 = (int)(Renderer::getScreenOffsetY() + y);
|
||||||
|
const int x2 = (int)(x1 + mSize.x());
|
||||||
|
const int y2 = (int)(y1 + mSize.y());
|
||||||
|
sprintf(buf1, "%d,%d,%d,%d", x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
const int x1 = (int)(Renderer::getScreenOffsetY() + Renderer::getScreenHeight() - y - mSize.y());
|
||||||
|
const int y1 = (int)(Renderer::getScreenOffsetX() + x);
|
||||||
|
const int x2 = (int)(x1 + mSize.y());
|
||||||
|
const int y2 = (int)(y1 + mSize.x());
|
||||||
|
sprintf(buf1, "%d,%d,%d,%d", x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
const int x1 = (int)(Renderer::getScreenOffsetX() + Renderer::getScreenWidth() - x - mSize.x());
|
||||||
|
const int y1 = (int)(Renderer::getScreenOffsetY() + Renderer::getScreenHeight() - y - mSize.y());
|
||||||
|
const int x2 = (int)(x1 + mSize.x());
|
||||||
|
const int y2 = (int)(y1 + mSize.y());
|
||||||
|
sprintf(buf1, "%d,%d,%d,%d", x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
const int x1 = (int)(Renderer::getScreenOffsetY() + y);
|
||||||
|
const int y1 = (int)(Renderer::getScreenOffsetX() + Renderer::getScreenWidth() - x - mSize.x());
|
||||||
|
const int x2 = (int)(x1 + mSize.y());
|
||||||
|
const int y2 = (int)(y1 + mSize.x());
|
||||||
|
sprintf(buf1, "%d,%d,%d,%d", x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rotate the video
|
||||||
|
switch(Renderer::getScreenRotate())
|
||||||
|
{
|
||||||
|
case 0: { sprintf(buf2, "%d", (int) 0); } break;
|
||||||
|
case 1: { sprintf(buf2, "%d", (int) 90); } break;
|
||||||
|
case 2: { sprintf(buf2, "%d", (int)180); } break;
|
||||||
|
case 3: { sprintf(buf2, "%d", (int)270); } break;
|
||||||
|
}
|
||||||
|
|
||||||
// We need to specify the layer of 10000 or above to ensure the video is displayed on top
|
// We need to specify the layer of 10000 or above to ensure the video is displayed on top
|
||||||
// of our SDL display
|
// of our SDL display
|
||||||
|
|
||||||
const char* argv[] = { "", "--layer", "10010", "--loop", "--no-osd", "--aspect-mode", "letterbox", "--vol", "0", "-o", "both","--win", buf, "--no-ghost-box", "", "", "", "", NULL };
|
const char* argv[] = { "", "--layer", "10010", "--loop", "--no-osd", "--aspect-mode", "letterbox", "--vol", "0", "-o", "both","--win", buf1, "--orientation", buf2, "", "", "", "", NULL };
|
||||||
|
|
||||||
// check if we want to mute the audio
|
// check if we want to mute the audio
|
||||||
if (!Settings::getInstance()->getBool("VideoAudio") || (float)VolumeControl::getInstance()->getVolume() == 0)
|
if (!Settings::getInstance()->getBool("VideoAudio") || (float)VolumeControl::getInstance()->getVolume() == 0)
|
||||||
|
@ -128,14 +183,14 @@ void VideoPlayerComponent::startVideo()
|
||||||
if (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never")
|
if (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never")
|
||||||
{
|
{
|
||||||
// if we have chosen to render subtitles
|
// if we have chosen to render subtitles
|
||||||
argv[13] = "--subtitles";
|
argv[15] = "--subtitles";
|
||||||
argv[14] = subtitlePath.c_str();
|
argv[16] = subtitlePath.c_str();
|
||||||
argv[15] = mPlayingVideoPath.c_str();
|
argv[17] = mPlayingVideoPath.c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we have chosen NOT to render subtitles in the screensaver
|
// if we have chosen NOT to render subtitles in the screensaver
|
||||||
argv[13] = mPlayingVideoPath.c_str();
|
argv[15] = mPlayingVideoPath.c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -145,7 +200,7 @@ void VideoPlayerComponent::startVideo()
|
||||||
{
|
{
|
||||||
argv[6] = "stretch";
|
argv[6] = "stretch";
|
||||||
}
|
}
|
||||||
argv[13] = mPlayingVideoPath.c_str();
|
argv[15] = mPlayingVideoPath.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
argv[10] = Settings::getInstance()->getString("OMXAudioDev").c_str();
|
argv[10] = Settings::getInstance()->getString("OMXAudioDev").c_str();
|
||||||
|
|
Loading…
Reference in a new issue