2014-03-27 19:10:15 +01:00
|
|
|
#include "videowidget.hpp"
|
|
|
|
|
2015-01-10 01:00:52 +01:00
|
|
|
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
|
|
|
|
|
2014-10-22 22:11:03 +02:00
|
|
|
#include "../mwsound/movieaudiofactory.hpp"
|
|
|
|
|
2014-03-27 19:10:15 +01:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
|
|
|
|
VideoWidget::VideoWidget()
|
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
mPlayer.reset(new Video::VideoPlayer());
|
2014-03-27 19:10:15 +01:00
|
|
|
setNeedKeyFocus(true);
|
|
|
|
}
|
|
|
|
|
2014-06-10 01:57:54 +02:00
|
|
|
void VideoWidget::playVideo(const std::string &video)
|
2014-03-27 19:10:15 +01:00
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
|
|
|
|
mPlayer->playVideo(video);
|
2014-03-27 19:10:15 +01:00
|
|
|
|
2015-01-10 01:00:52 +01:00
|
|
|
setImageTexture(mPlayer->getTextureName());
|
2014-03-27 19:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int VideoWidget::getVideoWidth()
|
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
return mPlayer->getVideoWidth();
|
2014-03-27 19:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int VideoWidget::getVideoHeight()
|
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
return mPlayer->getVideoHeight();
|
2014-03-27 19:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoWidget::update()
|
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
return mPlayer->update();
|
2014-03-27 19:10:15 +01:00
|
|
|
}
|
|
|
|
|
2014-06-10 01:57:54 +02:00
|
|
|
void VideoWidget::stop()
|
2014-06-05 15:39:08 +02:00
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
mPlayer->close();
|
2014-06-05 15:39:08 +02:00
|
|
|
}
|
|
|
|
|
2014-10-22 22:11:03 +02:00
|
|
|
bool VideoWidget::hasAudioStream()
|
|
|
|
{
|
2015-01-10 01:00:52 +01:00
|
|
|
return mPlayer->hasAudioStream();
|
2014-10-22 22:11:03 +02:00
|
|
|
}
|
|
|
|
|
2014-03-27 19:10:15 +01:00
|
|
|
}
|