openmw-tes3coop/apps/openmw/mwgui/videowidget.cpp

50 lines
804 B
C++
Raw Normal View History

#include "videowidget.hpp"
2015-01-10 00:00:52 +00:00
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
#include "../mwsound/movieaudiofactory.hpp"
namespace MWGui
{
VideoWidget::VideoWidget()
{
2015-01-10 00:00:52 +00:00
mPlayer.reset(new Video::VideoPlayer());
setNeedKeyFocus(true);
}
void VideoWidget::playVideo(const std::string &video)
{
2015-01-10 00:00:52 +00:00
mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
mPlayer->playVideo(video);
2015-01-10 00:00:52 +00:00
setImageTexture(mPlayer->getTextureName());
}
int VideoWidget::getVideoWidth()
{
2015-01-10 00:00:52 +00:00
return mPlayer->getVideoWidth();
}
int VideoWidget::getVideoHeight()
{
2015-01-10 00:00:52 +00:00
return mPlayer->getVideoHeight();
}
bool VideoWidget::update()
{
2015-01-10 00:00:52 +00:00
return mPlayer->update();
}
void VideoWidget::stop()
{
2015-01-10 00:00:52 +00:00
mPlayer->close();
}
bool VideoWidget::hasAudioStream()
{
2015-01-10 00:00:52 +00:00
return mPlayer->hasAudioStream();
}
}