Change MagickImageProxy to FFmpegImageProxy and make it use FFmpeg
[dcpomatic.git] / src / lib / image.cc
index 792bf3ab469c2ffd363b81de850a0bedb8fe98c6..0590a4e78901e3a0adceb2a2a3238cd56fb9ca36 100644 (file)
@@ -36,6 +36,9 @@ extern "C" {
 #include <libavutil/pixdesc.h>
 #include <libavutil/frame.h>
 }
+#if HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
 #include <iostream>
 
 #include "i18n.h"
@@ -821,11 +824,18 @@ Image::allocate ()
                   testing suggests that it works.
                */
                _data[i] = (uint8_t *) wrapped_av_malloc (_stride[i] * sample_size(i).height + _extra_pixels * bytes_per_pixel(i) + 32);
+#if HAVE_VALGRIND_MEMCHECK_H
+               /* The data between the end of the line size and the stride is undefined but processed by
+                  libswscale, causing lots of valgrind errors.  Mark it all defined to quell these errors.
+               */
+               VALGRIND_MAKE_MEM_DEFINED (_data[i], _stride[i] * sample_size(i).height + _extra_pixels * bytes_per_pixel(i) + 32);
+#endif
        }
 }
 
 Image::Image (Image const & other)
-       : _size (other._size)
+       : boost::enable_shared_from_this<Image>(other)
+       , _size (other._size)
        , _pixel_format (other._pixel_format)
        , _aligned (other._aligned)
        , _extra_pixels (other._extra_pixels)
@@ -1125,8 +1135,8 @@ Image::fade (float f)
        }
 }
 
-shared_ptr<Image>
-Image::ensure_aligned (shared_ptr<Image> image)
+shared_ptr<const Image>
+Image::ensure_aligned (shared_ptr<const Image> image)
 {
        if (image->aligned()) {
                return image;
@@ -1144,3 +1154,10 @@ Image::memory_used () const
        }
        return m;
 }
+
+dcp::Data
+Image::as_png () const
+{
+       /* XXX */
+       return dcp::Data();
+}