Merge master.
[dcpomatic.git] / src / lib / dcp_video.cc
index 9b1c8c33eae12cf36d214cbd81b84af99e9e7ae8..f6c671fd14774b655acb67708b75084c6a49eaf8 100644 (file)
@@ -34,7 +34,6 @@
 #include <stdexcept>
 #include <cstdio>
 #include <iomanip>
-#include <sstream>
 #include <iostream>
 #include <fstream>
 #include <unistd.h>
@@ -67,7 +66,6 @@
 #include "i18n.h"
 
 using std::string;
-using std::stringstream;
 using std::cout;
 using boost::shared_ptr;
 using boost::lexical_cast;
@@ -127,7 +125,7 @@ DCPVideo::encode_locally ()
        }
 
        shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz (
-               _frame->image (_burn_subtitles),
+               _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles),
                in_lut,
                dcp::GammaLUT::cache.get (16, 1 / _frame->colour_conversion().output_gamma, false),
                matrix
@@ -282,10 +280,9 @@ DCPVideo::encode_remotely (ServerDescription serv)
        LOG_GENERAL (N_("Sending frame %1 to remote"), _index);
        
        /* Send XML metadata */
-       stringstream xml;
-       doc.write_to_stream (xml, "UTF-8");
-       socket->write (xml.str().length() + 1);
-       socket->write ((uint8_t *) xml.str().c_str(), xml.str().length() + 1);
+       string xml = doc.write_to_string ("UTF-8");
+       socket->write (xml.length() + 1);
+       socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
 
        /* Send binary data */
        _frame->send_binary (socket, _burn_subtitles);
@@ -318,3 +315,18 @@ DCPVideo::eyes () const
        return _frame->eyes ();
 }
 
+/** @return true if this DCPVideo is definitely the same as another;
+ *  (apart from the frame index), false if it is probably not.
+ */
+bool
+DCPVideo::same (shared_ptr<const DCPVideo> other) const
+{
+       if (_frames_per_second != other->_frames_per_second ||
+           _j2k_bandwidth != other->_j2k_bandwidth ||
+           _resolution != other->_resolution ||
+           _burn_subtitles != other->_burn_subtitles) {
+               return false;
+       }
+
+       return _frame->same (other->_frame);
+}