forked from mirror/openmw-tes3mp
eb1c24ffe6
- Split video player to separate source files. - Move video player engine sources to extern/ (repository will be set up on github soon). - Audio is handled in a MovieAudioFactory, implemented by the user (here in MWSound subsystem). - Handle conversion of unsupported channel layouts via ffmpeg's swresample.
47 lines
717 B
C++
47 lines
717 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()
|
|
{
|
|
mPlayer.update();
|
|
return mPlayer.isPlaying();
|
|
}
|
|
|
|
void VideoWidget::stop()
|
|
{
|
|
mPlayer.close();
|
|
}
|
|
|
|
bool VideoWidget::hasAudioStream()
|
|
{
|
|
return mPlayer.hasAudioStream();
|
|
}
|
|
|
|
}
|