Use enum class for VideoRange.
[dcpomatic.git] / src / lib / dcp_video.cc
index 7b06f8cfca3cd6975b3a63c63d00598b4004fb12..67baa121570c0f95016bb89449e44618d11f4910 100644 (file)
 #include "cross.h"
 #include "player_video.h"
 #include "compose.hpp"
+#include "warnings.h"
 #include <libcxml/cxml.h>
 #include <dcp/raw_convert.h>
 #include <dcp/openjpeg_image.h>
 #include <dcp/rgb_xyz.h>
 #include <dcp/j2k.h>
+DCPOMATIC_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
+DCPOMATIC_ENABLE_WARNINGS
 #include <boost/asio.hpp>
 #include <boost/thread.hpp>
 #include <stdint.h>
 
 using std::string;
 using std::cout;
-using boost::shared_ptr;
+using std::shared_ptr;
 using dcp::Size;
-using dcp::Data;
+using dcp::ArrayData;
 using dcp::raw_convert;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 #define DCI_COEFFICENT (48.0 / 52.37)
 
@@ -93,7 +99,7 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
 {
        shared_ptr<dcp::OpenJPEGImage> xyz;
 
-       shared_ptr<Image> image = frame->image (bind (&PlayerVideo::keep_xyz_or_rgb, _1), true, false);
+       shared_ptr<Image> image = frame->image (bind (&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, true, false);
        if (frame->colour_conversion()) {
                xyz = dcp::rgb_to_xyz (
                        image->data()[0],
@@ -112,12 +118,12 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
 /** J2K-encode this frame on the local host.
  *  @return Encoded data.
  */
-Data
+ArrayData
 DCPVideo::encode_locally ()
 {
        string const comment = Config::instance()->dcp_j2k_comment();
 
-       Data enc = compress_j2k (
+       ArrayData enc = dcp::compress_j2k (
                convert_to_xyz (_frame, boost::bind(&Log::dcp_log, dcpomatic_log.get(), _1, _2)),
                _j2k_bandwidth,
                _frames_per_second,
@@ -148,7 +154,7 @@ DCPVideo::encode_locally ()
  *  @param timeout timeout in seconds.
  *  @return Encoded data.
  */
-Data
+ArrayData
 DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
 {
        boost::asio::io_service io_service;
@@ -186,9 +192,9 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout)
        */
        Socket::ReadDigestScope ds (socket);
        LOG_TIMING("start-remote-encode thread=%1", thread_id ());
-       Data e (socket->read_uint32 ());
+       ArrayData e (socket->read_uint32 ());
        LOG_TIMING("start-remote-receive thread=%1", thread_id ());
-       socket->read (e.data().get(), e.size());
+       socket->read (e.data(), e.size());
        LOG_TIMING("finish-remote-receive thread=%1", thread_id ());
        if (!ds.check()) {
                throw NetworkError ("Checksums do not match");