mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:23:53 +00:00
Improve ffmpeg failure messages
This commit is contained in:
parent
26a441f29a
commit
2989a1e06e
1 changed files with 13 additions and 8 deletions
|
@ -247,10 +247,10 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
{
|
||||
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");
|
||||
fail("Failed to open input stream for "+fname);
|
||||
|
||||
if(avformat_find_stream_info(mFormatCtx, NULL) < 0)
|
||||
fail("Failed to find stream info");
|
||||
fail("Failed to find stream info in "+fname);
|
||||
|
||||
for(size_t j = 0;j < mFormatCtx->nb_streams;j++)
|
||||
{
|
||||
|
@ -261,10 +261,15 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
stream->mStreamIdx = j;
|
||||
stream->mPackets = NULL;
|
||||
|
||||
AVCodec *codec;
|
||||
codec = avcodec_find_decoder(stream->mCodecCtx->codec_id);
|
||||
if(!codec || avcodec_open(stream->mCodecCtx, codec) < 0)
|
||||
fail("Could not open audio codec");
|
||||
AVCodec *codec = avcodec_find_decoder(stream->mCodecCtx->codec_id);
|
||||
if(!codec)
|
||||
{
|
||||
std::stringstream ss("No codec found for id ");
|
||||
ss << stream->mCodecCtx->codec_id;
|
||||
fail(ss.str());
|
||||
}
|
||||
if(avcodec_open(stream->mCodecCtx, codec) < 0)
|
||||
fail("Failed to open audio codec " + std::string(codec->long_name));
|
||||
|
||||
stream->mDecodedData = (char*)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
stream->mDecodedDataSize = 0;
|
||||
|
@ -275,7 +280,7 @@ void FFmpeg_Decoder::open(const std::string &fname)
|
|||
}
|
||||
}
|
||||
if(mStreams.empty())
|
||||
fail("No audio streams");
|
||||
fail("No audio streams in "+fname);
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue