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], false);
62 } catch (FileError& e) {
63 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
67 cout << "DCP: " << argv[optind] << "\n"
68 << "\tLength: " << dcp->length() << "\n"
69 << "\tFrames per second: " << dcp->frames_per_second() << "\n";
71 list<shared_ptr<const Reel> > reels = dcp->reels ();
74 for (list<shared_ptr<const Reel> >::const_iterator i = reels.begin(); i != reels.end(); ++i) {
75 cout << "Reel " << R << "\n";
76 if ((*i)->main_picture()) {
77 cout << "\tPicture: " << (*i)->main_picture()->width() << "x" << (*i)->main_picture()->height() << "\n";
79 if ((*i)->main_sound()) {
80 cout << "\tSound: " << (*i)->main_sound()->channels() << " channels at " << (*i)->main_sound()->sampling_rate() << "Hz\n";
82 if ((*i)->main_subtitle()) {
83 cout << "\tSubtitle: " << (*i)->main_subtitle()->subtitles().size() << " subtitles in " << (*i)->main_subtitle()->language() << "\n";