2014-03-27 18:10:15 +00:00
|
|
|
#include "videowidget.hpp"
|
|
|
|
|
2015-04-01 15:02:15 +00:00
|
|
|
//#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
|
2015-01-10 00:00:52 +00:00
|
|
|
|
2015-01-27 23:02:05 +00:00
|
|
|
#include <MyGUI_RenderManager.h>
|
|
|
|
|
2015-04-01 15:02:15 +00:00
|
|
|
//#include "../mwsound/movieaudiofactory.hpp"
|
2014-10-22 20:11:03 +00:00
|
|
|
|
2014-03-27 18:10:15 +00:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
|
|
|
|
VideoWidget::VideoWidget()
|
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
//mPlayer.reset(new Video::VideoPlayer());
|
2014-03-27 18:10:15 +00:00
|
|
|
setNeedKeyFocus(true);
|
|
|
|
}
|
|
|
|
|
2014-06-09 23:57:54 +00:00
|
|
|
void VideoWidget::playVideo(const std::string &video)
|
2014-03-27 18:10:15 +00:00
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
//mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
|
|
|
|
//mPlayer->playVideo(video);
|
2014-03-27 18:10:15 +00:00
|
|
|
|
2015-04-01 15:02:15 +00:00
|
|
|
//setImageTexture(mPlayer->getTextureName());
|
2014-03-27 18:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int VideoWidget::getVideoWidth()
|
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
return 0;//mPlayer->getVideoWidth();
|
2014-03-27 18:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int VideoWidget::getVideoHeight()
|
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
return 0;//mPlayer->getVideoHeight();
|
2014-03-27 18:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VideoWidget::update()
|
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
return 0;//mPlayer->update();
|
2014-03-27 18:10:15 +00:00
|
|
|
}
|
|
|
|
|
2014-06-09 23:57:54 +00:00
|
|
|
void VideoWidget::stop()
|
2014-06-05 13:39:08 +00:00
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
//mPlayer->close();
|
2014-06-05 13:39:08 +00:00
|
|
|
}
|
|
|
|
|
2014-10-22 20:11:03 +00:00
|
|
|
bool VideoWidget::hasAudioStream()
|
|
|
|
{
|
2015-04-01 15:02:15 +00:00
|
|
|
return 0;//mPlayer->hasAudioStream();
|
2014-10-22 20:11:03 +00:00
|
|
|
}
|
|
|
|
|
2015-01-27 23:02:05 +00:00
|
|
|
void VideoWidget::autoResize(bool stretch)
|
|
|
|
{
|
|
|
|
MyGUI::IntSize screenSize = MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
if (getParent())
|
|
|
|
screenSize = getParent()->getSize();
|
|
|
|
|
|
|
|
if (getVideoHeight() > 0 && !stretch)
|
|
|
|
{
|
|
|
|
double imageaspect = static_cast<double>(getVideoWidth())/getVideoHeight();
|
|
|
|
|
2015-03-08 00:07:29 +00:00
|
|
|
int leftPadding = std::max(0, static_cast<int>(screenSize.width - screenSize.height * imageaspect) / 2);
|
|
|
|
int topPadding = std::max(0, static_cast<int>(screenSize.height - screenSize.width / imageaspect) / 2);
|
2015-01-27 23:02:05 +00:00
|
|
|
|
|
|
|
setCoord(leftPadding, topPadding,
|
|
|
|
screenSize.width - leftPadding*2, screenSize.height - topPadding*2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
setCoord(0,0,screenSize.width,screenSize.height);
|
|
|
|
}
|
|
|
|
|
2014-03-27 18:10:15 +00:00
|
|
|
}
|