mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 17:19:56 +00:00
b39d69e98c
- Fix rindex overflow - Fix audio sample size bugs (was using sample_fmt and channel count of the decoder, instead of the resampled settings). We didn't notice this bug before, because the OpenAL MovieAudioFactory tries to resample to a format of the same byte size. - Add support for play/pause and seeking controls (not used by cutscenes in OpenMW) - Closing the video when arriving at the stream end is now handled by the user (we may also want to keep the video open and seek back) The video player now has a standalone demo, at https://github.com/scrawl/ogre-ffmpeg-videoplayer
46 lines
692 B
C++
46 lines
692 B
C++
#include "videowidget.hpp"
|
|
|
|
#include "../mwsound/movieaudiofactory.hpp"
|
|
|
|
namespace MWGui
|
|
{
|
|
|
|
VideoWidget::VideoWidget()
|
|
{
|
|
setNeedKeyFocus(true);
|
|
}
|
|
|
|
void VideoWidget::playVideo(const std::string &video)
|
|
{
|
|
mPlayer.setAudioFactory(new MWSound::MovieAudioFactory());
|
|
mPlayer.playVideo(video);
|
|
|
|
setImageTexture(mPlayer.getTextureName());
|
|
}
|
|
|
|
int VideoWidget::getVideoWidth()
|
|
{
|
|
return mPlayer.getVideoWidth();
|
|
}
|
|
|
|
int VideoWidget::getVideoHeight()
|
|
{
|
|
return mPlayer.getVideoHeight();
|
|
}
|
|
|
|
bool VideoWidget::update()
|
|
{
|
|
return mPlayer.update();
|
|
}
|
|
|
|
void VideoWidget::stop()
|
|
{
|
|
mPlayer.close();
|
|
}
|
|
|
|
bool VideoWidget::hasAudioStream()
|
|
{
|
|
return mPlayer.hasAudioStream();
|
|
}
|
|
|
|
}
|