mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 23:51:09 -04:00
Fix for trying to play videos when not supported
This commit is contained in:
parent
26660110e5
commit
9e842a0bbb
@ -896,8 +896,6 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
|
||||
|
||||
void VideoState::init(const std::string& resourceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
int video_index = -1;
|
||||
int audio_index = -1;
|
||||
unsigned int i;
|
||||
@ -950,12 +948,6 @@ void VideoState::init(const std::string& resourceName)
|
||||
this->stream_open(video_index, this->format_ctx);
|
||||
|
||||
this->parse_thread = boost::thread(decode_thread_loop, this);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->quit = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void VideoState::deinit()
|
||||
@ -997,7 +989,7 @@ public:
|
||||
|
||||
void init(const std::string& resourceName)
|
||||
{
|
||||
throw std::runtime_error("FFmpeg not supported, cannot play video \""+resourceName+"\"");
|
||||
throw std::runtime_error("FFmpeg not supported, cannot play \""+resourceName+"\"");
|
||||
}
|
||||
void deinit() { }
|
||||
|
||||
@ -1100,8 +1092,14 @@ void VideoPlayer::playVideo(const std::string &resourceName)
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->pauseAllSounds();
|
||||
|
||||
try {
|
||||
mState = new VideoState;
|
||||
mState->init(resourceName);
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
std::cerr<< "Failed to play video: "<<e.what() <<std::endl;
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
void VideoPlayer::update ()
|
||||
@ -1115,10 +1113,13 @@ void VideoPlayer::update ()
|
||||
|
||||
void VideoPlayer::close()
|
||||
{
|
||||
if(mState)
|
||||
{
|
||||
mState->deinit();
|
||||
|
||||
delete mState;
|
||||
mState = NULL;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->resumeAllSounds();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user