Player log file -> player activity log file.
[dcpomatic.git] / src / lib / ffmpeg_image_proxy.cc
index c83bebcb54b63a1ec17e842f83c23841c2deb7ec..46c9836e060d781b1a5083184f052b053812ae08 100644 (file)
@@ -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;
@@ -110,7 +113,7 @@ FFmpegImageProxy::avio_seek (int64_t const pos, int whence)
 }
 
 pair<shared_ptr<Image>, int>
-FFmpegImageProxy::image (optional<dcp::NoteHandler>, optional<dcp::Size>) const
+FFmpegImageProxy::image (optional<dcp::Size>) const
 {
        boost::mutex::scoped_lock lm (_mutex);
 
@@ -167,7 +170,9 @@ FFmpegImageProxy::image (optional<dcp::NoteHandler>, 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);