3 #include <boost/filesystem.hpp>
6 #include "exceptions.h"
8 #include "sound_asset.h"
9 #include "picture_asset.h"
10 #include "subtitle_asset.h"
13 using namespace boost;
14 using namespace libdcp;
19 cerr << "Syntax: " << n << " [options] <DCP>\n"
20 << " -s, --subtitles list all subtitles\n";
24 main (int argc, char* argv[])
26 bool subtitles = false;
30 static struct option long_options[] = {
31 { "version", no_argument, 0, 'v'},
32 { "help", no_argument, 0, 'h'},
33 { "subtitles", no_argument, 0, 's'},
37 int c = getopt_long (argc, argv, "vhs", long_options, &option_index);
45 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
56 if (argc <= optind || argc > (optind + 1)) {
61 if (!filesystem::exists (argv[optind])) {
62 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
68 dcp = new DCP (argv[optind]);
70 } catch (FileError& e) {
71 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
75 cout << "DCP: " << argv[optind] << "\n";
77 list<shared_ptr<const CPL> > cpls = dcp->cpls ();
79 for (list<shared_ptr<const CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
80 cout << " CPL: " << (*i)->name() << "\n"
81 << " Length: " << (*i)->length() << "\n"
82 << " Frames per second: " << (*i)->frames_per_second() << "\n";
84 list<shared_ptr<const Reel> > reels = (*i)->reels ();
87 for (list<shared_ptr<const Reel> >::const_iterator j = reels.begin(); j != reels.end(); ++j) {
88 cout << " Reel " << R << "\n";
90 if ((*j)->main_picture()) {
91 cout << " Picture: " << (*j)->main_picture()->width() << "x" << (*j)->main_picture()->height() << "\n";
93 if ((*j)->main_sound()) {
94 cout << " Sound: " << (*j)->main_sound()->channels() << " channels at " << (*j)->main_sound()->sampling_rate() << "Hz\n";
96 if ((*j)->main_subtitle()) {
97 list<shared_ptr<Subtitle> > subs = (*j)->main_subtitle()->subtitles ();
98 cout << " Subtitle: " << subs.size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";
100 for (list<shared_ptr<Subtitle> >::const_iterator k = subs.begin(); k != subs.end(); ++k) {
101 cout << " " << (*k)->text() << "\n";