Various improvements to the content properties dialogue (including #791).
[dcpomatic.git] / src / lib / content.h
index b7f7987ef4fa0d79783df8a56d869f52fedfabf8..d87ae13d7fee53739f8a5d8ecb1173d177654929 100644 (file)
 #include "types.h"
 #include "signaller.h"
 #include "dcpomatic_time.h"
-#include <libxml++/libxml++.h>
+#include "raw_convert.h"
 #include <libcxml/cxml.h>
 #include <boost/filesystem.hpp>
 #include <boost/signals2.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
+namespace xmlpp {
+       class Node;
+}
+
 namespace cxml {
        class Node;
 }
@@ -83,8 +87,10 @@ public:
        virtual void as_xml (xmlpp::Node *) const;
        virtual DCPTime full_length () const = 0;
        virtual std::string identifier () const;
-
-       std::list<std::pair<std::string, std::string> > properties () const;
+       /** @return points at which to split this content when
+        *  REELTYPE_BY_VIDEO_CONTENT is in use.
+        */
+       virtual std::list<DCPTime> reel_split_points () const;
 
        boost::shared_ptr<Content> clone () const;
 
@@ -109,10 +115,10 @@ public:
 
        bool paths_valid () const;
 
-       /** @return Digest of the content's file(s).  Note: this is
-        *  not a complete MD5-or-whatever hash, but a sort of poor
-        *  man's version (see comments in ::examine).
-        */
+       /** @return Digest of the content's file(s).  Note: this is
+        *  not a complete MD5-or-whatever hash, but a sort of poor
+        *  man's version (see comments in ::examine).
+        */
        std::string digest () const {
                boost::mutex::scoped_lock lm (_mutex);
                return _digest;
@@ -153,15 +159,33 @@ public:
                _change_signals_frequent = f;
        }
 
-       boost::shared_ptr<const Film> film () const {
-               return _film.lock ();
-       }
+       boost::shared_ptr<const Film> film () const;
+
+       class UserProperty
+       {
+       public:
+               template <class T>
+               UserProperty (std::string category_, std::string key_, T value_, std::string unit_ = "")
+                       : category (category_)
+                       , key (key_)
+                       , value (raw_convert<std::string> (value_))
+                       , unit (unit_)
+               {}
+
+               std::string category;
+               std::string key;
+               std::string value;
+               std::string unit;
+       };
+
+       std::list<UserProperty> user_properties () const;
 
        boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed;
 
 protected:
        void signal_changed (int);
-       virtual void add_properties (std::list<std::pair<std::string, std::string> > &) const {}
+
+       virtual void add_properties (std::list<UserProperty> &) const {}
 
        boost::weak_ptr<const Film> _film;