summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-12-10 01:16:16 +0000
committerCarl Hetherington <cth@carlh.net>2018-12-10 01:16:16 +0000
commitdceecebd37d5e1b5c098ad1358310d3f276c703c (patch)
tree116c8ed3b879122ff37fa61ecfa4c8cc04141f14 /src
parent6e16dcc7f8e13a9b96bd251f113588914db1b296 (diff)
Add a couple of missing deallocation calls and fix a warning
with current FFmpeg (returning AVERROR_EOF rather than 0 when a AVIO source is finished).
Diffstat (limited to 'src')
-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);