X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fcontent.cc;h=b6f7ebbaafa1284bbce648ebe7e58829d0b2fbbe;hp=11a4b21cca3026706911cb0c51ea9230eabc8797;hb=3c9b646e2ea130e9ab737bb3e751f1705fc7331c;hpb=0b6c6de07f9a3aa28c2e8ca8ef30340e3fa1bfc6 diff --git a/src/lib/content.cc b/src/lib/content.cc index 11a4b21cc..b6f7ebbaa 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -1,250 +1,352 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2021 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic 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, + DCP-o-matic 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. + along with DCP-o-matic. If not, see . */ -#include -#include -#include -#include + +/** @file src/lib/content.cc + * @brief Content class. + */ + + #include "content.h" +#include "change_signaller.h" #include "util.h" #include "content_factory.h" -#include "ui_signaller.h" +#include "video_content.h" +#include "audio_content.h" +#include "text_content.h" #include "exceptions.h" #include "film.h" -#include "safe_stringstream.h" +#include "job.h" +#include "compose.hpp" +#include +#include +#include +#include +#include +#include #include "i18n.h" -using std::string; -using std::set; -using std::list; + using std::cout; -using std::vector; +using std::list; +using std::make_shared; using std::max; -using boost::shared_ptr; -using libdcp::raw_convert; +using std::pair; +using std::shared_ptr; +using std::string; +using std::vector; +using boost::optional; +using dcp::locale_convert; +using dcp::raw_convert; +using namespace dcpomatic; + int const ContentProperty::PATH = 400; int const ContentProperty::POSITION = 401; int const ContentProperty::LENGTH = 402; int const ContentProperty::TRIM_START = 403; int const ContentProperty::TRIM_END = 404; +int const ContentProperty::VIDEO_FRAME_RATE = 405; -Content::Content (shared_ptr f) - : _film (f) - , _position (0) - , _trim_start (0) - , _trim_end (0) - , _change_signals_frequent (false) + +Content::Content () + : _change_signals_frequent (false) { } -Content::Content (shared_ptr f, Time p) - : _film (f) - , _position (p) - , _trim_start (0) - , _trim_end (0) + +Content::Content (DCPTime p) + : _position (p) , _change_signals_frequent (false) { } -Content::Content (shared_ptr f, boost::filesystem::path p) - : _film (f) - , _position (0) - , _trim_start (0) - , _trim_end (0) - , _change_signals_frequent (false) + +Content::Content (boost::filesystem::path p) + : _change_signals_frequent (false) { - _paths.push_back (p); + add_path (p); } -Content::Content (shared_ptr f, shared_ptr node) - : _film (f) - , _change_signals_frequent (false) + +Content::Content (cxml::ConstNodePtr node) + : _change_signals_frequent (false) { - list path_children = node->node_children ("Path"); - for (list::const_iterator i = path_children.begin(); i != path_children.end(); ++i) { - _paths.push_back ((*i)->content ()); + for (auto i: node->node_children("Path")) { + _paths.push_back (i->content()); + auto const mod = i->optional_number_attribute("mtime"); + if (mod) { + _last_write_times.push_back (*mod); + } else { + boost::system::error_code ec; + auto last_write = boost::filesystem::last_write_time(i->content(), ec); + _last_write_times.push_back (ec ? 0 : last_write); + } } - _digest = node->string_child ("Digest"); - _position = node->number_child