diff options
author | Max Kellermann <max@duempel.org> | 2016-07-29 19:25:02 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-07-29 19:32:21 +0200 |
commit | 7456dccd3ad1fcf18bcf13c26bac8fd014b4b009 (patch) | |
tree | d929b7dc7c02d255c9543543c076f96d4376879c /src/decoder/plugins/FfmpegDecoderPlugin.cxx | |
parent | 245f41bb7e29170635726aeda1920cdd911958a8 (diff) |
decoder/ffmpeg: FfmpegOpenInput() returns Error
Diffstat (limited to 'src/decoder/plugins/FfmpegDecoderPlugin.cxx')
-rw-r--r-- | src/decoder/plugins/FfmpegDecoderPlugin.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index dd411a4e0..533799548 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -58,11 +58,14 @@ extern "C" { static AVFormatContext * FfmpegOpenInput(AVIOContext *pb, const char *filename, - AVInputFormat *fmt) + AVInputFormat *fmt, + Error &error) { AVFormatContext *context = avformat_alloc_context(); - if (context == nullptr) + if (context == nullptr) { + error.Set(ffmpeg_domain, "Out of memory"); return nullptr; + } context->pb = pb; @@ -666,10 +669,11 @@ ffmpeg_decode(Decoder &decoder, InputStream &input) return; } + Error error; AVFormatContext *format_context = - FfmpegOpenInput(stream.io, input.GetURI(), input_format); + FfmpegOpenInput(stream.io, input.GetURI(), input_format, error); if (format_context == nullptr) { - LogError(ffmpeg_domain, "Open failed"); + LogError(error); return; } @@ -718,7 +722,8 @@ ffmpeg_scan_stream(InputStream &is, return false; AVFormatContext *f = - FfmpegOpenInput(stream.io, is.GetURI(), input_format); + FfmpegOpenInput(stream.io, is.GetURI(), input_format, + IgnoreError()); if (f == nullptr) return false; |