Fix up some equals() prototype confusion.
authorCarl Hetherington <cth@carlh.net>
Mon, 21 Jul 2014 14:49:51 +0000 (15:49 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 21 Jul 2014 14:49:51 +0000 (15:49 +0100)
src/cpl.cc
src/cpl.h
src/mono_picture_mxf.cc
src/mono_picture_mxf.h
src/sound_mxf.cc
src/sound_mxf.h
src/stereo_picture_mxf.cc
src/stereo_picture_mxf.h
src/subtitle_content.h

index 35a305e5953a1fee3a8d73e8538e26add0a6bf72..9c8c865bcf1cdd5d15bbcc11a4a328db9410efb9 100644 (file)
@@ -44,6 +44,7 @@ using std::pair;
 using std::make_pair;
 using boost::shared_ptr;
 using boost::optional;
+using boost::dynamic_pointer_cast;
 using namespace dcp;
 
 CPL::CPL (string annotation_text, ContentKind content_kind)
@@ -174,27 +175,32 @@ CPL::reel_assets () const
 }
        
 bool
-CPL::equals (CPL const & other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
-       if (_annotation_text != other._annotation_text && !opt.cpl_annotation_texts_can_differ) {
+       shared_ptr<const CPL> other_cpl = dynamic_pointer_cast<const CPL> (other);
+       if (!other_cpl) {
+               return false;
+       }
+       
+       if (_annotation_text != other_cpl->_annotation_text && !opt.cpl_annotation_texts_can_differ) {
                stringstream s;
-               s << "annotation texts differ: " << _annotation_text << " vs " << other._annotation_text << "\n";
+               s << "annotation texts differ: " << _annotation_text << " vs " << other_cpl->_annotation_text << "\n";
                note (DCP_ERROR, s.str ());
                return false;
        }
 
-       if (_content_kind != other._content_kind) {
+       if (_content_kind != other_cpl->_content_kind) {
                note (DCP_ERROR, "content kinds differ");
                return false;
        }
 
-       if (_reels.size() != other._reels.size()) {
-               note (DCP_ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other._reels.size()));
+       if (_reels.size() != other_cpl->_reels.size()) {
+               note (DCP_ERROR, String::compose ("reel counts differ (%1 vs %2)", _reels.size(), other_cpl->_reels.size()));
                return false;
        }
        
        list<shared_ptr<Reel> >::const_iterator a = _reels.begin ();
-       list<shared_ptr<Reel> >::const_iterator b = other._reels.begin ();
+       list<shared_ptr<Reel> >::const_iterator b = other_cpl->_reels.begin ();
        
        while (a != _reels.end ()) {
                if (!(*a)->equals (*b, opt, note)) {
index 73ca45bf60bae809174c45714592116574aff849..b85b0395aa047c43acd10300a21c26716005f5e2 100644 (file)
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -55,7 +55,7 @@ public:
        CPL (boost::filesystem::path file);
 
        bool equals (
-               CPL const & other,
+               boost::shared_ptr<const Asset> other,
                EqualityOptions options,
                boost::function<void (NoteType, std::string)> note
                ) const;
index 815d88207c34022fa1f25460aef1cf23049e8963..b2042fa5d0d2c5d58bec3262299a8dba1c59909a 100644 (file)
@@ -68,7 +68,7 @@ MonoPictureMXF::get_frame (int n) const
 }
 
 bool
-MonoPictureMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+MonoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
        if (!MXF::equals (other, opt, note)) {
                return false;
index c02a63c108aa63989ed20accc60561b3ee2b5820..01a6de3fab9156a9cacccf6d47b3ef16eb79ef94 100644 (file)
@@ -46,7 +46,7 @@ public:
        boost::shared_ptr<PictureMXFWriter> start_write (boost::filesystem::path, Standard standard, bool);
 
        bool equals (
-               boost::shared_ptr<const Content> other,
+               boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
                boost::function<void (NoteType, std::string)> note
                ) const;
index 89f1ee60b0218244827557589eb7cfddfffedf66..05dac418e752613d80e01452c16823330fea62da 100644 (file)
@@ -82,7 +82,7 @@ SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels)
 }
 
 bool
-SoundMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+SoundMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
        if (!MXF::equals (other, opt, note)) {
                return false;
index d444ad28653fab8c0dcf08aa9c12bcb01f5aa689..d6978953f6ffaeb18e6fc6eea3ce39137498fe9f 100644 (file)
@@ -46,7 +46,7 @@ public:
        boost::shared_ptr<SoundMXFWriter> start_write (boost::filesystem::path file, Standard standard);
        
        bool equals (
-               boost::shared_ptr<const Content> other,
+               boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
                boost::function<void (NoteType, std::string)> note
                ) const;
index 0188e4e7876cb60fba975255a1043753150e6184..726b0feeea052365b33426ae2e40de5f43a5d328 100644 (file)
@@ -74,7 +74,7 @@ StereoPictureMXF::start_write (boost::filesystem::path file, Standard standard,
 }
 
 bool
-StereoPictureMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+StereoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
 {
        if (!MXF::equals (other, opt, note)) {
                return false;
index dc4605c752fddb1cfd57a6146a2110b7968db4de..9592653eb845ffc018193f5d402877e4a08cee98 100644 (file)
@@ -35,7 +35,7 @@ public:
        boost::shared_ptr<PictureMXFWriter> start_write (boost::filesystem::path file, Standard, bool);
 
        bool equals (
-               boost::shared_ptr<const Content> other,
+               boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
                boost::function<void (NoteType, std::string)> note
                ) const;
index b05fe59c51aeda5034a290fcd41d6b413d8687ef..945eb4d098bc99b179c3662053db32e2571a0ab3 100644 (file)
@@ -51,7 +51,7 @@ public:
        SubtitleContent (std::string movie_title, std::string language);
 
        bool equals (
-               boost::shared_ptr<const Content>,
+               boost::shared_ptr<const Asset>,
                EqualityOptions,
                boost::function<void (NoteType, std::string)> note
                ) const {