X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg.cc;h=4b8d7b8ab1d89ab7b14b67dbd8da739a52abc144;hb=458517981bbb6d8a76b2769ac824daa29c691d35;hp=6ec368ef64f49b7fabf3788ac95a8f655ebdfd34;hpb=c2f74bf15f6f2a88138119a42a44f4241169f6e5;p=dcpomatic.git diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 6ec368ef6..4b8d7b8ab 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -96,30 +96,9 @@ avio_seek_wrapper (void* data, int64_t offset, int whence) } -void -FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl) -{ - if (level > AV_LOG_WARNING) { - return; - } - - char line[1024]; - static int prefix = 0; - av_log_format_line (ptr, level, fmt, vl, line, sizeof (line), &prefix); - string str (line); - boost::algorithm::trim (str); - dcpomatic_log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL); -} - - void FFmpeg::setup_general () { - /* This might not work too well in some cases of multiple FFmpeg decoders, - but it's probably good enough. - */ - av_log_set_callback (FFmpeg::ffmpeg_log_callback); - _file_group.set_paths (_ffmpeg_content->paths ()); _avio_buffer = static_cast (wrapped_av_malloc(_avio_buffer_size)); _avio_context = avio_alloc_context (_avio_buffer, _avio_buffer_size, 0, this, avio_read_wrapper, 0, avio_seek_wrapper); @@ -273,7 +252,11 @@ FFmpeg::subtitle_codec_context () const int FFmpeg::avio_read (uint8_t* buffer, int const amount) { - return _file_group.read (buffer, amount); + auto result = _file_group.read(buffer, amount); + if (result.eof && result.bytes_read == 0) { + return AVERROR_EOF; + } + return result.bytes_read; }