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.
22 #include <boost/filesystem.hpp>
25 #include "exceptions.h"
27 #include "sound_mxf.h"
28 #include "picture_mxf.h"
29 #include "subtitle_content.h"
30 #include "reel_picture_asset.h"
31 #include "reel_sound_asset.h"
32 #include "reel_subtitle_asset.h"
33 #include "subtitle_string.h"
40 using boost::shared_ptr;
46 cerr << "Syntax: " << n << " [options] <DCP>\n"
47 << " -s, --subtitles list all subtitles\n";
51 main (int argc, char* argv[])
53 bool subtitles = false;
57 static struct option long_options[] = {
58 { "version", no_argument, 0, 'v'},
59 { "help", no_argument, 0, 'h'},
60 { "subtitles", no_argument, 0, 's'},
64 int c = getopt_long (argc, argv, "vhs", long_options, &option_index);
72 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
83 if (argc <= optind || argc > (optind + 1)) {
88 if (!boost::filesystem::exists (argv[optind])) {
89 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
95 dcp = new DCP (argv[optind]);
97 } catch (FileError& e) {
98 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
102 cout << "DCP: " << argv[optind] << "\n";
104 list<shared_ptr<CPL> > cpls = dcp->cpls ();
106 for (list<shared_ptr<CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
107 cout << " CPL: " << (*i)->annotation_text() << "\n";
109 list<shared_ptr<Reel> > reels = (*i)->reels ();
112 for (list<shared_ptr<Reel> >::const_iterator j = reels.begin(); j != reels.end(); ++j) {
113 cout << " Reel " << R << "\n";
115 if ((*j)->main_picture()) {
117 << (*j)->main_picture()->mxf()->size().width
119 << (*j)->main_picture()->mxf()->size().height << "\n";
121 if ((*j)->main_sound()) {
123 << (*j)->main_sound()->mxf()->channels()
125 << (*j)->main_sound()->mxf()->sampling_rate() << "Hz\n";
127 if ((*j)->main_subtitle()) {
128 list<shared_ptr<SubtitleString> > subs = (*j)->main_subtitle()->subtitle_content()->subtitles ();
129 cout << " Subtitle: " << subs.size() << " subtitles in " << (*j)->main_subtitle()->subtitle_content()->language() << "\n";
131 for (list<shared_ptr<SubtitleString> >::const_iterator k = subs.begin(); k != subs.end(); ++k) {
132 cout << " " << (*k)->text() << "\n";
134 << "font:" << (*k)->font() << "; "
135 << "italic:" << (*k)->italic() << "; "
136 << "color:" << (*k)->color() << "; "
137 << "in:" << (*k)->in() << "; "
138 << "out:" << (*k)->out() << "; "
139 << "v_position:" << (*k)->v_position() << "; "
140 << "v_align:" << (*k)->v_align() << "; "
141 << "effect:" << (*k)->effect() << "; "
142 << "effect_color:" << (*k)->effect_color() << "; "
143 << "fade_up_time:" << (*k)->fade_up_time() << "; "
144 << "fade_down_time:" << (*k)->fade_down_time() << "; "
145 << "size: " << (*k)->size() << "\n";