1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 10:53:54 +00:00

Better handle some ffmpeg errors

This commit is contained in:
Chris Robinson 2012-03-21 12:20:36 -07:00
parent 7b22ee6fd1
commit fd8326e958

View file

@ -243,12 +243,16 @@ void FFmpeg_Decoder::open(const std::string &fname)
if((mFormatCtx=avformat_alloc_context()) == NULL)
fail("Failed to allocate context");
try
{
mFormatCtx->pb = avio_alloc_context(NULL, 0, 0, this, readPacket, writePacket, seek);
if(!mFormatCtx->pb || avformat_open_input(&mFormatCtx, fname.c_str(), NULL, NULL) != 0)
fail("Failed to open input stream for "+fname);
{
avformat_free_context(mFormatCtx);
mFormatCtx = NULL;
fail("Failed to allocate input stream");
}
try
{
if(avformat_find_stream_info(mFormatCtx, NULL) < 0)
fail("Failed to find stream info in "+fname);