X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcontent.h;h=c2841b64ee3f02ec28439312f93d4833b09aad52;hb=51cc8f575b55f2a21d8503965b628c0f59f1ed33;hp=fc3a531faf8293b69d484581810b0ea3fd351801;hpb=034feb503b0a38eb82c21ae8d9f83522fc63a25c;p=dcpomatic.git diff --git a/src/lib/content.h b/src/lib/content.h index fc3a531fa..c2841b64e 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 Carl Hetherington 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 @@ -17,6 +17,10 @@ */ +/** @file src/lib/content.h + * @brief Content class. + */ + #ifndef DCPOMATIC_CONTENT_H #define DCPOMATIC_CONTENT_H @@ -26,6 +30,7 @@ #include #include #include +#include #include "types.h" #include "dcpomatic_time.h" @@ -46,22 +51,36 @@ public: static int const TRIM_END; }; +/** @class Content + * @brief A piece of content represented by one or more files on disk. + */ class Content : public boost::enable_shared_from_this, public boost::noncopyable { public: Content (boost::shared_ptr); Content (boost::shared_ptr, DCPTime); Content (boost::shared_ptr, boost::filesystem::path); - Content (boost::shared_ptr, boost::shared_ptr); + Content (boost::shared_ptr, cxml::ConstNodePtr); Content (boost::shared_ptr, std::vector >); virtual ~Content () {} + + /** Examine the content to establish digest, frame rates and any other + * useful metadata. + * @param job Job to use to report progress, or 0. + * @param calculate_digest True to calculate a digest for the content's file(s). + */ + virtual void examine (boost::shared_ptr job, bool calculate_digest); - virtual void examine (boost::shared_ptr); + /** @return Quick one-line summary of the content, as will be presented in the + * film editor. + */ virtual std::string summary () const = 0; + /** @return Technical details of this content; these are written to logs to * help with debugging. */ virtual std::string technical_summary () const; + virtual std::string information () const = 0; virtual void as_xml (xmlpp::Node *) const; virtual DCPTime full_length () const = 0; @@ -91,7 +110,7 @@ public: bool paths_valid () const; /** @return MD5 digest of the content's file(s) */ - std::string digest () const { + boost::optional digest () const { boost::mutex::scoped_lock lm (_mutex); return _digest; } @@ -130,6 +149,10 @@ public: _change_signals_frequent = f; } + boost::shared_ptr film () const { + return _film.lock (); + } + boost::signals2::signal, int, bool)> Changed; protected: @@ -138,15 +161,15 @@ protected: boost::weak_ptr _film; /** _mutex which should be used to protect accesses, as examine - jobs can update content state in threads other than the main one. - */ + * jobs can update content state in threads other than the main one. + */ mutable boost::mutex _mutex; /** Paths of our data files */ std::vector _paths; private: - std::string _digest; + boost::optional _digest; DCPTime _position; DCPTime _trim_start; DCPTime _trim_end;