mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
use sample_aspect_ratio if available
This commit is contained in:
parent
5ed04ae53e
commit
63e86555b6
1 changed files with 8 additions and 7 deletions
|
@ -1045,15 +1045,16 @@ void VideoPlayer::update ()
|
||||||
mVideoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("VideoTexture");
|
mVideoMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("VideoTexture");
|
||||||
|
|
||||||
// Correct aspect ratio by adding black bars
|
// Correct aspect ratio by adding black bars
|
||||||
int width = (mState->video_st->codec->width);
|
double videoaspect = static_cast<double>(mState->video_st->codec->width) / mState->video_st->codec->height;
|
||||||
int height = (mState->video_st->codec->height);
|
|
||||||
|
|
||||||
float screenaspect = static_cast<float>(mWidth) / mHeight;
|
if (av_q2d(mState->video_st->codec->sample_aspect_ratio) != 0)
|
||||||
float videoaspect = static_cast<float>(width) / height;
|
videoaspect *= av_q2d(mState->video_st->codec->sample_aspect_ratio);
|
||||||
float aspect_correction = videoaspect / screenaspect;
|
|
||||||
|
|
||||||
mRectangle->setCorners (std::max(-1.f, -1.f * aspect_correction), std::min(1.f, 1.f / aspect_correction),
|
double screenaspect = static_cast<double>(mWidth) / mHeight;
|
||||||
std::min(1.f, 1.f * aspect_correction), std::max(-1.f, -1.f / aspect_correction));
|
double aspect_correction = videoaspect / screenaspect;
|
||||||
|
|
||||||
|
mRectangle->setCorners (std::max(-1.0, -1.0 * aspect_correction), std::min(1.0, 1.0 / aspect_correction),
|
||||||
|
std::min(1.0, 1.0 * aspect_correction), std::max(-1.0, -1.0 / aspect_correction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue