Remove unnecessary Content class.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Jun 2015 15:42:03 +0000 (16:42 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Jun 2015 15:42:03 +0000 (16:42 +0100)
17 files changed:
src/content.cc [deleted file]
src/content.h [deleted file]
src/interop_subtitle_content.cc
src/mxf.cc
src/mxf.h
src/reel.cc
src/reel_asset.cc
src/reel_asset.h
src/reel_mxf_asset.cc
src/reel_picture_asset.cc
src/reel_picture_asset.h
src/reel_sound_asset.h
src/reel_subtitle_asset.h
src/subtitle_content.cc
src/subtitle_content.h
src/wscript
test/test.h

diff --git a/src/content.cc b/src/content.cc
deleted file mode 100644 (file)
index 3842ec0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "content.h"
-#include "util.h"
-#include "metadata.h"
-#include "AS_DCP.h"
-#include "KM_util.h"
-#include <libxml++/nodes/element.h>
-#include <boost/filesystem.hpp>
-#include <boost/function.hpp>
-#include <iostream>
-
-using namespace std;
-using namespace boost;
-using namespace dcp;
-
-Content::Content (boost::filesystem::path file)
-       : Asset (file)
-{
-       
-}
diff --git a/src/content.h b/src/content.h
deleted file mode 100644 (file)
index fcbfc25..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/content.h
- *  @brief Content class.
- */
-
-#ifndef LIBDCP_CONTENT_H
-#define LIBDCP_CONTENT_H
-
-#include "types.h"
-#include "asset.h"
-#include <libxml++/libxml++.h>
-#include <boost/filesystem.hpp>
-#include <boost/function.hpp>
-#include <string>
-#include <list>
-
-namespace ASDCP {
-       struct WriterInfo;
-}
-
-namespace xmlpp {
-       class Element;
-}
-
-namespace dcp
-{
-
-/** @class Content
- *  @brief An asset that represents a piece of content, i.e. picture, sound or subtitle.
- *
- *  Such a piece of content will be contained in a file (either MXF or XML) within a DCP.
- */
-class Content : public Asset
-{
-public:
-       Content () {}
-       
-       /** Construct a Content object by reading a file.
-        *  @param file File to read.
-        */
-       Content (boost::filesystem::path file);
-
-protected:
-       virtual std::string asdcp_kind () const = 0;
-};
-
-}
-
-#endif
index 7b99e16ed38c1d1f71be1dcedc061ef73c2785f1..29da0b21f93e3ea93a21967175ff0563d3bcb45a 100644 (file)
@@ -22,6 +22,7 @@
 #include "xml.h"
 #include "raw_convert.h"
 #include "font_node.h"
+#include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
 #include <cmath>
 
index 5c99e01fcf8efdd4fecca15186807caf14bce1dc..ba614202aafb37797bd1aae6e02f4f3bc9d69f29 100644 (file)
@@ -52,7 +52,7 @@ MXF::MXF (Fraction edit_rate)
 }
 
 MXF::MXF (boost::filesystem::path file)
-       : Content (file)
+       : Asset (file)
        , _intrinsic_duration (0)
        , _encryption_context (0)
        , _decryption_context (0)
@@ -95,7 +95,7 @@ MXF::fill_writer_info (ASDCP::WriterInfo* writer_info, Standard standard)
 bool
 MXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
-       if (!Content::equals (other, opt, note)) {
+       if (!Asset::equals (other, opt, note)) {
                return false;
        }
        
index f0ad4bd837cf2671312a6194a9467f195ae271b7..1b5b03d6868779a0f517e182642df41bcf2701ad 100644 (file)
--- a/src/mxf.h
+++ b/src/mxf.h
 #ifndef LIBDCP_MXF_H
 #define LIBDCP_MXF_H
 
-#include "content.h"
+#include "asset.h"
 #include "key.h"
 #include "metadata.h"
+
 #include <boost/signals2.hpp>
 
 namespace ASDCP {
        class AESEncContext;
        class AESDecContext;
+       class WriterInfo;
 }
 
 /* Undefine some stuff that the OS X 10.5 SDK defines */
@@ -42,7 +44,7 @@ class MXFMetadata;
 /** @class MXF
  *  @brief Parent class for classes which represent MXF files.
  */
-class MXF : public Content
+class MXF : public Asset
 {
 public:
        MXF (Fraction edit_rate);
@@ -116,6 +118,7 @@ public:
 protected:
        friend class MXFWriter;
 
+       virtual std::string asdcp_kind () const = 0;
        std::string pkl_type (Standard standard) const;
        void read_writer_info (ASDCP::WriterInfo const &);
        
index 9e6e0ca73a20320615808dd649be059148f17763..eb682aeaf983aabd22bc483f7eff9f2338c90a51 100644 (file)
@@ -167,14 +167,14 @@ void
 Reel::resolve_refs (list<shared_ptr<Object> > objects)
 {
        if (_main_picture) {
-               _main_picture->content().resolve (objects);
+               _main_picture->asset().resolve (objects);
        }
 
        if (_main_sound) {
-               _main_sound->content().resolve (objects);
+               _main_sound->asset().resolve (objects);
        }
 
        if (_main_subtitle) {
-               _main_subtitle->content().resolve (objects);
+               _main_subtitle->asset().resolve (objects);
        }
 }
index 57b709a78613a03a34e32adbfe940e73f2b28043..7f129f906afc0488ecfa45af68e62424f6a348d0 100644 (file)
 
 #include "raw_convert.h"
 #include "reel_asset.h"
-#include "content.h"
+#include "asset.h"
 #include "compose.hpp"
 #include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
 
 using std::pair;
 using std::string;
@@ -32,7 +33,7 @@ using namespace dcp;
 
 ReelAsset::ReelAsset ()
        : Object (make_uuid ())
-       , _content (_id)
+       , _asset (_id)
        , _edit_rate (Fraction (24, 1))
        , _intrinsic_duration (0)
        , _entry_point (0)
@@ -42,27 +43,27 @@ ReelAsset::ReelAsset ()
 }
 
 /** Construct a ReelAsset.
- *  @param content Content that this asset refers to.
- *  @param edit_rate Edit rate for the content.
- *  @param intrinsic_duration Intrinsic duration of this content.
- *  @param entry_point Entry point to use in that content.
+ *  @param asset Asset that this ReelAsset refers to.
+ *  @param edit_rate Edit rate for the asset.
+ *  @param intrinsic_duration Intrinsic duration of this asset.
+ *  @param entry_point Entry point to use in that asset.
  */
-ReelAsset::ReelAsset (shared_ptr<Content> content, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
-       : Object (content->id ())
-       , _content (content)
+ReelAsset::ReelAsset (shared_ptr<Asset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+       : Object (asset->id ())
+       , _asset (asset)
        , _edit_rate (edit_rate)
        , _intrinsic_duration (intrinsic_duration)
        , _entry_point (entry_point)
        , _duration (intrinsic_duration - entry_point)
-       , _hash (make_digest (content->file (), 0))
+       , _hash (make_digest (asset->file (), 0))
 {
        /* default _annotation_text to the leaf name of our file */
-        _annotation_text = content->file().leaf().string ();
+        _annotation_text = asset->file().leaf().string ();
 }
 
 ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
        : Object (node->string_child ("Id"))
-       , _content (_id)
+       , _asset (_id)
        , _annotation_text (node->optional_string_child ("AnnotationText").get_value_or (""))
        , _edit_rate (Fraction (node->string_child ("EditRate")))
        , _intrinsic_duration (node->number_child<int64_t> ("IntrinsicDuration"))
@@ -72,7 +73,7 @@ ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
 {
        if (_id.length() > 9) {
                _id = _id.substr (9);
-               _content.set_id (_id);
+               _asset.set_id (_id);
        }
 }
 
@@ -90,7 +91,7 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
         a->add_child("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
         a->add_child("EntryPoint")->add_child_text (raw_convert<string> (_entry_point));
         a->add_child("Duration")->add_child_text (raw_convert<string> (_duration));
-       a->add_child("Hash")->add_child_text (_content.object()->hash ());
+       a->add_child("Hash")->add_child_text (_asset.object()->hash ());
 }
 
 pair<string, string>
@@ -142,8 +143,8 @@ ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteH
                }
        }
 
-       if (_content.resolved () && other->_content.resolved ()) {
-               return _content->equals (other->_content.object (), opt, note);
+       if (_asset.resolved () && other->_asset.resolved ()) {
+               return _asset->equals (other->_asset.object (), opt, note);
        }
 
        return true;
index 6db621ccf0b90c073dbfb6a6423eae2f49dfec2d..7588c063f349256da6d3c2a22a9e244442e4e285 100644 (file)
@@ -35,7 +35,7 @@ namespace xmlpp {
 
 namespace dcp {
 
-class Content;
+class Asset;
 
 /** @class ReelAsset
  *  @brief An entry in a &lt;Reel&gt; which refers to a use of a piece of content.
@@ -48,15 +48,15 @@ class ReelAsset : public Object
 {
 public:
        ReelAsset ();
-       ReelAsset (boost::shared_ptr<Content> content, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+       ReelAsset (boost::shared_ptr<Asset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
        ReelAsset (boost::shared_ptr<const cxml::Node>);
 
        virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
        virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
 
-       /** @return a Ref to our actual content */
-       Ref<Content>& content () {
-               return _content;
+       /** @return a Ref to our actual asset */
+       Ref<Asset>& asset () {
+               return _asset;
        }
 
        int64_t entry_point () const {
@@ -78,10 +78,10 @@ protected:
         */
        virtual std::pair<std::string, std::string> cpl_node_attribute (Standard) const;
 
-       /** Reference to the content (MXF or XML file) that this reel entry
+       /** Reference to the asset (MXF or XML file) that this reel entry
         *  applies to.
         */
-       Ref<Content> _content;
+       Ref<Asset> _asset;
 
 private:
        
index 9d7c1fada363d66737cbf9fe1de6677d96d057c1..6e62f9bc3f7313ba047a340e8297a8804c72259e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 #include "mxf.h"
 #include "dcp_assert.h"
 #include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
 
 using boost::shared_ptr;
 using namespace dcp;
index 6bac3bce5f47d21fe3563f8cd72a2d460f28a608..b363c89bc741bbaf7ac60058ecf6270b54b1914d 100644 (file)
  *  @brief ReelPictureAsset class.
  */
 
-#include "content.h"
 #include "reel_picture_asset.h"
 #include "picture_mxf.h"
 #include "dcp_assert.h"
 #include "compose.hpp"
 #include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
 #include <iomanip>
 
 using std::bad_cast;
@@ -43,10 +43,10 @@ ReelPictureAsset::ReelPictureAsset ()
 
 }
 
-ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureMXF> content, int64_t entry_point)
-       : ReelMXFAsset (content, content->edit_rate(), content->intrinsic_duration(), entry_point)
-       , _frame_rate (content->frame_rate ())
-       , _screen_aspect_ratio (content->screen_aspect_ratio ())
+ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureMXF> asset, int64_t entry_point)
+       : ReelMXFAsset (asset, asset->edit_rate(), asset->intrinsic_duration(), entry_point)
+       , _frame_rate (asset->frame_rate ())
+       , _screen_aspect_ratio (asset->screen_aspect_ratio ())
 {
        
 }
index 1607379a0993630b0ade428a9588b9643b85bfb6..fd4d11fce33a2e1b047ca398d67707d57b97e3a6 100644 (file)
@@ -36,7 +36,7 @@ class ReelPictureAsset : public ReelMXFAsset
 {
 public:
        ReelPictureAsset ();
-       ReelPictureAsset (boost::shared_ptr<PictureMXF> content, int64_t entry_point);
+       ReelPictureAsset (boost::shared_ptr<PictureMXF> asset, int64_t entry_point);
        ReelPictureAsset (boost::shared_ptr<const cxml::Node>);
 
        virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
@@ -44,7 +44,7 @@ public:
 
        /** @return the PictureMXF that this object refers to */
        boost::shared_ptr<PictureMXF> mxf () {
-               return boost::dynamic_pointer_cast<PictureMXF> (_content.object ());
+               return boost::dynamic_pointer_cast<PictureMXF> (_asset.object ());
        }
 
        /** @return picture frame rate */
index b5dc819a07f843f7ce2868763063a8b1a1b6a66e..c8eb2cca9f13be4fd3d2f3e8a4322677b188845f 100644 (file)
@@ -39,12 +39,12 @@ public:
 
        /** @return the SoundMXF that this object refers to */
        boost::shared_ptr<SoundMXF> mxf () {
-               return boost::dynamic_pointer_cast<SoundMXF> (_content.object ());
+               return boost::dynamic_pointer_cast<SoundMXF> (_asset.object ());
        }
 
        /** @return the SoundMXF that this object refers to */
        boost::shared_ptr<const SoundMXF> mxf () const {
-               return boost::dynamic_pointer_cast<const SoundMXF> (_content.object ());
+               return boost::dynamic_pointer_cast<const SoundMXF> (_asset.object ());
        }
        
 private:
index f0537cb5d38b42ca00c4e99d54983d0dde165e9b..bc00b4c3566885dba9c470f6007d4606fff2950c 100644 (file)
@@ -41,7 +41,7 @@ public:
        ReelSubtitleAsset (boost::shared_ptr<const cxml::Node>);
 
        boost::shared_ptr<SubtitleContent> subtitle_content () const {
-               return boost::dynamic_pointer_cast<SubtitleContent> (_content.object ());
+               return boost::dynamic_pointer_cast<SubtitleContent> (_asset.object ());
        }
 
 private:       
index fb01502d58632ac5b1e13e1f7d430d3fc883f9c3..d2be6fe02d52d55225c7ee5fab3556e0c9207190 100644 (file)
@@ -49,7 +49,7 @@ SubtitleContent::SubtitleContent ()
 }
 
 SubtitleContent::SubtitleContent (boost::filesystem::path file)
-       : Content (file)
+       : Asset (file)
        , _reel_number ("1")
 {
 
index ee4249160b0a75ad3f5eac055d2962df0c416eb5..d80d631c2249f01b876f87aecfeb408f142b8065 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef LIBDCP_SUBTITLE_CONTENT_H
 #define LIBDCP_SUBTITLE_CONTENT_H
 
-#include "content.h"
+#include "asset.h"
 #include "dcp_time.h"
 #include "subtitle_string.h"
 #include <libcxml/cxml.h>
@@ -37,7 +37,7 @@ class LoadFontNode;
 /** @class SubtitleContent
  *  @brief A parent for classes representing a file containing subtitles.
  */
-class SubtitleContent : public Content
+class SubtitleContent : public Asset
 {
 public:
        SubtitleContent ();
index fac20fb78e8a48a6b003543b398226f14f75dff7..7328178b927c867ead69124b9dbdf719bcecfd85 100644 (file)
@@ -7,7 +7,6 @@ def build(bld):
              certificates.cc
              colour_conversion.cc
              colour_matrix.cc
-             content.cc
              cpl.cc
              dcp.cc        
              dcp_time.cc
@@ -70,7 +69,6 @@ def build(bld):
               colour_conversion.h
               colour_matrix.h
               cpl.h
-              content.h
               dcp.h
               dcp_time.h
               decrypted_kdm.h
index 433dad224643e063ec8754fd998c6b8f1520fbb2..4c941023b1ca2d6071a3d71c29d2dfdfaeddc93e 100644 (file)
 
 */
 
+namespace xmlpp {
+       class Element;
+}
+
 extern boost::filesystem::path private_test;
 extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std::string> ignore);
 extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore);