Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / lib / raw_image_proxy.cc
index ac8ff0763d103556b20b649574bad94515171f04..c606ddd9906520b128c1009517d2c706dd180659 100644 (file)
 
 #include "raw_image_proxy.h"
 #include "image.h"
-#include "warnings.h"
 #include <dcp/raw_convert.h>
 #include <dcp/util.h>
+#include <dcp/warnings.h>
 #include <libcxml/cxml.h>
 extern "C" {
 #include <libavutil/pixfmt.h>
 }
-DCPOMATIC_DISABLE_WARNINGS
+LIBDCP_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
-DCPOMATIC_ENABLE_WARNINGS
+LIBDCP_ENABLE_WARNINGS
 
 #include "i18n.h"
 
@@ -45,7 +45,7 @@ using boost::optional;
 using dcp::raw_convert;
 
 
-RawImageProxy::RawImageProxy (shared_ptr<Image> image)
+RawImageProxy::RawImageProxy(shared_ptr<const Image> image)
        : _image (image)
 {
 
@@ -58,16 +58,17 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
                xml->number_child<int>("Width"), xml->number_child<int>("Height")
                );
 
-       _image = make_shared<Image>(static_cast<AVPixelFormat>(xml->number_child<int>("PixelFormat")), size, true);
-       _image->read_from_socket (socket);
+       auto image = make_shared<Image>(static_cast<AVPixelFormat>(xml->number_child<int>("PixelFormat")), size, Image::Alignment::PADDED);
+       image->read_from_socket (socket);
+       _image = image;
 }
 
 
 ImageProxy::Result
-RawImageProxy::image (bool aligned, optional<dcp::Size>) const
+RawImageProxy::image (Image::Alignment alignment, optional<dcp::Size>) const
 {
-       /* This ensure_aligned could be wasteful */
-       return Result (Image::ensure_aligned(_image, aligned), 0);
+       /* This ensure_alignment could be wasteful */
+       return Result (Image::ensure_alignment(_image, alignment), 0);
 }
 
 
@@ -96,7 +97,7 @@ RawImageProxy::same (shared_ptr<const ImageProxy> other) const
                return false;
        }
 
-       return (*_image.get()) == (*rp->image(_image->aligned()).image.get());
+       return (*_image.get()) == (*rp->image(_image->alignment()).image.get());
 }