2 Copyright (C) 2012-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.
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";