summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_image_proxy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ffmpeg_image_proxy.cc')
-rw-r--r--src/lib/ffmpeg_image_proxy.cc5
1 files changed, 5 insertions, 0 deletions
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<dcp::Size>) 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);