Permalink
Browse files

Handle when no supported video stream is found

Fixes a segfault in environments where smacker support is disabled in ffmpg.
  • Loading branch information...
TheCycoONE committed Sep 20, 2018
1 parent ac53d63 commit 09c20856e8583d0780b26c97be7d55235346ec9b
Showing with 5 additions and 0 deletions.
  1. +5 −0 CorsixTH/Src/th_movie.cpp
@@ -462,6 +462,11 @@ bool movie_player::load(const char* szFilepath)
}
video_stream_index = av_find_best_stream(format_context, AVMEDIA_TYPE_VIDEO, -1, -1, &m_pVideoCodec, 0);
if (video_stream_index < 0) {
av_strerror(video_stream_index, error_buffer, movie_error_buffer_capacity);
last_error = std::string(error_buffer);
return false;
}
video_codec_context = get_codec_context_for_stream(m_pVideoCodec, format_context->streams[video_stream_index]);
avcodec_open2(video_codec_context, m_pVideoCodec, nullptr);

0 comments on commit 09c2085

Please sign in to comment.