2 Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
24 #include "subtitle_asset.h"
25 #include "reel_subtitle_asset.h"
26 #include "exceptions.h"
32 using boost::shared_ptr;
35 /** Load a DCP then re-write its subtitle XML or MXF in-place */
37 main (int argc, char* argv[])
41 cerr << "Syntax: " << argv[0] << " <dcp>\n";
45 DCP* dcp = new DCP (argv[1]);
48 list<shared_ptr<CPL> > cpls = dcp->cpls ();
49 for (list<boost::shared_ptr<CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
51 list<shared_ptr<Reel> > reels = (*i)->reels ();
52 for (list<shared_ptr<Reel> >::iterator j = reels.begin(); j != reels.end(); ++j) {
54 if ((*j)->main_subtitle()) {
55 (*j)->main_subtitle()->asset()->write ((*j)->main_subtitle()->asset()->file ());
63 cerr << e.what() << " (" << e.filename() << ") when reading " << argv[1] << "\n";
66 catch (DCPReadError& e)
68 cerr << e.what() << " when reading " << argv[1] << "\n";