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 << " <DCP>\n";
23 main (int argc, char* argv[])
27 static struct option long_options[] = {
28 { "version", no_argument, 0, 'v'},
29 { "help", no_argument, 0, 'h'},
33 int c = getopt_long (argc, argv, "vh", long_options, &option_index);
41 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
49 if (argc <= optind || argc > (optind + 1)) {
54 if (!filesystem::exists (argv[optind])) {
55 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
61 dcp = new DCP (argv[optind]);
63 } catch (FileError& e) {
64 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
68 cout << "DCP: " << argv[optind] << "\n";
70 list<shared_ptr<const CPL> > cpls = dcp->cpls ();
72 for (list<shared_ptr<const CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
73 cout << " CPL: " << (*i)->name() << "\n"
74 << " Length: " << (*i)->length() << "\n"
75 << " Frames per second: " << (*i)->frames_per_second() << "\n";
77 list<shared_ptr<const Reel> > reels = (*i)->reels ();
80 for (list<shared_ptr<const Reel> >::const_iterator j = reels.begin(); j != reels.end(); ++j) {
81 cout << " Reel " << R << "\n";
83 if ((*j)->main_picture()) {
84 cout << " Picture: " << (*j)->main_picture()->width() << "x" << (*j)->main_picture()->height() << "\n";
86 if ((*j)->main_sound()) {
87 cout << " Sound: " << (*j)->main_sound()->channels() << " channels at " << (*j)->main_sound()->sampling_rate() << "Hz\n";
89 if ((*j)->main_subtitle()) {
90 cout << " Subtitle: " << (*j)->main_subtitle()->subtitles().size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";