2 Copyright (C) 2012 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.
20 /** @file src/make_dcp_job.cc
21 * @brief A job to create DCPs.
24 #include <boost/filesystem.hpp>
26 #include <libavutil/pixdesc.h>
28 #include "make_dcp_job.h"
29 #include "film_state.h"
30 #include "dcp_content_type.h"
31 #include "exceptions.h"
34 using namespace boost;
36 /** @param s FilmState of the Film we are making the DCP for.
40 MakeDCPJob::MakeDCPJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l)
47 MakeDCPJob::name () const
50 s << "Make DCP for " << _fs->name;
57 set_progress_unknown ();
59 string const dcp_path = _fs->dir (_fs->name);
61 /* Check that we have our prerequisites */
63 if (!filesystem::exists (filesystem::path (_fs->file ("video.mxf")))) {
64 throw EncodeError ("missing video.mxf");
67 bool const have_audio = filesystem::exists (filesystem::path (_fs->file ("audio.mxf")));
69 /* Remove any old DCP */
70 filesystem::remove_all (dcp_path);
72 DCP dcp (_fs->dir (_fs->name()));
74 shared_ptr<MainPictureAsset> (new MainPictureAsset ("video.mxf", rint (_fs->frames_per_second), _fs->length, _opt->out_size))
77 if (filesystem::exists (filesystem::path (_fs->file ("audio.mxf")))) {
79 shared_ptr<MainSoundAsset> (new MainSoundAsset ("audio.mxf", rint (_fs->frames_per_second), _fs->length))
89 add_reel (pkl[0].cpl[0]);