2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "dcp_content.h"
22 #include "dcp_examiner.h"
25 #include "compose.hpp"
30 using boost::shared_ptr;
32 DCPContent::DCPContent (shared_ptr<const Film> f, boost::filesystem::path p)
35 , SingleStreamAudioContent (f)
43 DCPContent::read_directory (boost::filesystem::path p)
45 for (boost::filesystem::directory_iterator i(p); i != boost::filesystem::directory_iterator(); ++i) {
46 if (boost::filesystem::is_regular_file (i->path ())) {
47 _paths.push_back (i->path ());
48 } else if (boost::filesystem::is_directory (i->path ())) {
49 read_directory (i->path ());
55 DCPContent::examine (shared_ptr<Job> job)
57 job->set_progress_unknown ();
58 Content::examine (job);
59 shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
60 take_from_video_examiner (examiner);
62 boost::mutex::scoped_lock lm (_mutex);
63 _name = examiner->name ();
67 DCPContent::summary () const
69 boost::mutex::scoped_lock lm (_mutex);
70 return String::compose (_("%1 [DCP]"), _name);
74 DCPContent::technical_summary () const
76 return Content::technical_summary() + " - "
77 + VideoContent::technical_summary() + " - "
78 + AudioContent::technical_summary() + " - ";
82 DCPContent::as_xml (xmlpp::Node* node) const
84 node->add_child("Type")->add_child_text ("DCP");
85 Content::as_xml (node);
86 VideoContent::as_xml (node);
87 SingleStreamAudioContent::as_xml (node);
91 DCPContent::full_length () const
93 shared_ptr<const Film> film = _film.lock ();
95 return DCPTime (video_length (), FrameRateChange (video_frame_rate (), film->video_frame_rate ()));