X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_image_proxy.cc;h=46c9836e060d781b1a5083184f052b053812ae08;hb=refs%2Ftags%2Fv2.13.95;hp=e38b80be1942085d9160891a29edff428fd3425a;hpb=e5b744922fb6aed65ec13f22a9de0c86dd1bd561;p=dcpomatic.git diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index e38b80be1..46c9836e0 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -84,6 +84,9 @@ int FFmpegImageProxy::avio_read (uint8_t* buffer, int const amount) { int const to_do = min(int64_t(amount), _data.size() - _pos); + if (to_do == 0) { + return AVERROR_EOF; + } memcpy (buffer, _data.data().get() + _pos, to_do); _pos += to_do; return to_do; @@ -167,7 +170,9 @@ FFmpegImageProxy::image (optional) const _image.reset (new Image (frame)); + av_packet_unref (&packet); av_frame_free (&frame); + avcodec_close (codec_context); avformat_close_input (&format_context); av_free (avio_context->buffer); av_free (avio_context);