Skip to content

Commit

Permalink
Merge pull request #1473 from TheCycoONE/movie_no_decoder
Browse files Browse the repository at this point in the history
Handle when no supported video stream is found
  • Loading branch information
Alberth289346 committed Sep 28, 2018
2 parents 309460a + 09c2085 commit 02896f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CorsixTH/Src/th_movie.cpp
Expand Up @@ -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);

Expand Down

0 comments on commit 02896f9

Please sign in to comment.