3 #include <boost/filesystem.hpp>
6 #include "exceptions.h"
8 #include "sound_asset.h"
9 #include "picture_asset.h"
10 #include "subtitle_asset.h"
17 using boost::shared_ptr;
18 using namespace libdcp;
23 cerr << "Syntax: " << n << " [options] <DCP>\n"
24 << " -s, --subtitles list all subtitles\n";
28 main (int argc, char* argv[])
30 bool subtitles = false;
34 static struct option long_options[] = {
35 { "version", no_argument, 0, 'v'},
36 { "help", no_argument, 0, 'h'},
37 { "subtitles", no_argument, 0, 's'},
41 int c = getopt_long (argc, argv, "vhs", long_options, &option_index);
49 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
60 if (argc <= optind || argc > (optind + 1)) {
65 if (!boost::filesystem::exists (argv[optind])) {
66 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
72 dcp = new DCP (argv[optind]);
74 } catch (FileError& e) {
75 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
79 cout << "DCP: " << argv[optind] << "\n";
81 list<shared_ptr<const CPL> > cpls = dcp->cpls ();
83 for (list<shared_ptr<const CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
84 cout << " CPL: " << (*i)->name() << "\n"
85 << " Length: " << (*i)->length() << "\n"
86 << " Frames per second: " << (*i)->frames_per_second() << "\n";
88 list<shared_ptr<const Reel> > reels = (*i)->reels ();
91 for (list<shared_ptr<const Reel> >::const_iterator j = reels.begin(); j != reels.end(); ++j) {
92 cout << " Reel " << R << "\n";
94 if ((*j)->main_picture()) {
95 cout << " Picture: " << (*j)->main_picture()->size().width << "x" << (*j)->main_picture()->size().height << "\n";
97 if ((*j)->main_sound()) {
98 cout << " Sound: " << (*j)->main_sound()->channels() << " channels at " << (*j)->main_sound()->sampling_rate() << "Hz\n";
100 if ((*j)->main_subtitle()) {
101 list<shared_ptr<Subtitle> > subs = (*j)->main_subtitle()->subtitles ();
102 cout << " Subtitle: " << subs.size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";
104 for (list<shared_ptr<Subtitle> >::const_iterator k = subs.begin(); k != subs.end(); ++k) {
105 cout << " " << (*k)->text() << "\n";
107 << "font:" << (*k)->font() << "; "
108 << "italic:" << (*k)->italic() << "; "
109 << "color:" << (*k)->color() << "; "
110 << "in:" << (*k)->in() << "; "
111 << "out:" << (*k)->out() << "; "
112 << "v_position:" << (*k)->v_position() << "; "
113 << "v_align:" << (*k)->v_align() << "; "
114 << "effect:" << (*k)->effect() << "; "
115 << "effect_color:" << (*k)->effect_color() << "; "
116 << "fade_up_time:" << (*k)->fade_up_time() << "; "
117 << "fade_down_time:" << (*k)->fade_down_time() << "; "
118 << "size: " << (*k)->size() << "\n";