X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fraw_image_proxy.cc;h=a7c77ce6c6406e9168503384b92535fafd4c305b;hb=79af506328e80ad84cbe0dddaf2e1a21d4df1fe8;hp=8e8bf88248be5bf2b70e2a2f1055283850e6b9b5;hpb=87da92b45a9a0cf4ce809ea580a78c4dd5d96021;p=dcpomatic.git diff --git a/src/lib/raw_image_proxy.cc b/src/lib/raw_image_proxy.cc index 8e8bf8824..a7c77ce6c 100644 --- a/src/lib/raw_image_proxy.cc +++ b/src/lib/raw_image_proxy.cc @@ -17,19 +17,22 @@ */ +#include "raw_image_proxy.h" +#include "image.h" +#include "raw_convert.h" +#include +#include extern "C" { #include } -#include -#include -#include -#include "raw_image_proxy.h" -#include "image.h" +#include #include "i18n.h" using std::string; using boost::shared_ptr; +using boost::dynamic_pointer_cast; +using boost::optional; RawImageProxy::RawImageProxy (shared_ptr image) : _image (image) @@ -48,7 +51,7 @@ RawImageProxy::RawImageProxy (shared_ptr xml, shared_ptr soc } shared_ptr -RawImageProxy::image () const +RawImageProxy::image (optional) const { return _image; } @@ -57,9 +60,9 @@ void RawImageProxy::add_metadata (xmlpp::Node* node) const { node->add_child("Type")->add_child_text (N_("Raw")); - node->add_child("Width")->add_child_text (dcp::raw_convert (_image->size().width)); - node->add_child("Height")->add_child_text (dcp::raw_convert (_image->size().height)); - node->add_child("PixelFormat")->add_child_text (dcp::raw_convert (_image->pixel_format ())); + node->add_child("Width")->add_child_text (raw_convert (_image->size().width)); + node->add_child("Height")->add_child_text (raw_convert (_image->size().height)); + node->add_child("PixelFormat")->add_child_text (raw_convert (_image->pixel_format ())); } void @@ -67,3 +70,14 @@ RawImageProxy::send_binary (shared_ptr socket) const { _image->write_to_socket (socket); } + +bool +RawImageProxy::same (shared_ptr other) const +{ + shared_ptr rp = dynamic_pointer_cast (other); + if (!rp) { + return false; + } + + return (*_image.get()) == (*rp->image().get()); +}