1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 19:29:09 +00:00

Fix video size

Scale plate using pixels and limit it to viewport size
This commit is contained in:
Florian Meißner
2014-10-28 22:22:46 +01:00
parent ca79d8d33a
commit 589d59fc4c

View File

@ -328,10 +328,16 @@ bool plMoviePlayer::Start()
// Need to figure out scaling based on pipe size. // Need to figure out scaling based on pipe size.
plPlateManager& plateMgr = plPlateManager::Instance(); plPlateManager& plateMgr = plPlateManager::Instance();
const mkvparser::VideoTrack* video = static_cast<const mkvparser::VideoTrack*>(fVideoTrack->GetTrack()); const mkvparser::VideoTrack* video = static_cast<const mkvparser::VideoTrack*>(fVideoTrack->GetTrack());
float width = (static_cast<float>(video->GetWidth()) / static_cast<float>(plateMgr.GetPipeWidth())) * fScale.fX; float plateWidth = video->GetWidth() * fScale.fX;
float height = (static_cast<float>(video->GetHeight()) / static_cast<float>(plateMgr.GetPipeHeight())) * fScale.fY; float plateHeight = video->GetHeight() * fScale.fY;
if (plateWidth > plateMgr.GetPipeWidth() || plateHeight > plateMgr.GetPipeHeight())
plateMgr.CreatePlate(&fPlate, fPosition.fX, fPosition.fY, width, height); {
float scale = std::min(plateMgr.GetPipeWidth() / plateWidth, plateMgr.GetPipeHeight() / plateHeight);
plateWidth *= scale;
plateHeight *= scale;
}
plateMgr.CreatePlate(&fPlate, fPosition.fX, fPosition.fY, 0, 0);
plateMgr.SetPlatePixelSize(fPlate, plateWidth, plateHeight);
fTexture = fPlate->CreateMaterial(static_cast<uint32_t>(video->GetWidth()), static_cast<uint32_t>(video->GetHeight()), false); fTexture = fPlate->CreateMaterial(static_cast<uint32_t>(video->GetWidth()), static_cast<uint32_t>(video->GetHeight()), false);
//initialize opus //initialize opus