3 #include <boost/filesystem.hpp>
6 #include "exceptions.h"
8 #include "sound_asset.h"
9 #include "picture_asset.h"
10 #include "subtitle_asset.h"
16 using boost::shared_ptr;
17 using namespace libdcp;
22 cerr << "Syntax: " << n << " [options] <DCP>\n"
23 << " -s, --subtitles list all subtitles\n";
27 main (int argc, char* argv[])
29 bool subtitles = false;
33 static struct option long_options[] = {
34 { "version", no_argument, 0, 'v'},
35 { "help", no_argument, 0, 'h'},
36 { "subtitles", no_argument, 0, 's'},
40 int c = getopt_long (argc, argv, "vhs", long_options, &option_index);
48 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
59 if (argc <= optind || argc > (optind + 1)) {
64 if (!boost::filesystem::exists (argv[optind])) {
65 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
71 dcp = new DCP (argv[optind]);
73 } catch (FileError& e) {
74 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
78 cout << "DCP: " << argv[optind] << "\n";
80 list<shared_ptr<const CPL> > cpls = dcp->cpls ();
82 for (list<shared_ptr<const CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
83 cout << " CPL: " << (*i)->name() << "\n"
84 << " Length: " << (*i)->length() << "\n"
85 << " Frames per second: " << (*i)->frames_per_second() << "\n";
87 list<shared_ptr<const Reel> > reels = (*i)->reels ();
90 for (list<shared_ptr<const Reel> >::const_iterator j = reels.begin(); j != reels.end(); ++j) {
91 cout << " Reel " << R << "\n";
93 if ((*j)->main_picture()) {
94 cout << " Picture: " << (*j)->main_picture()->size().width << "x" << (*j)->main_picture()->size().height << "\n";
96 if ((*j)->main_sound()) {
97 cout << " Sound: " << (*j)->main_sound()->channels() << " channels at " << (*j)->main_sound()->sampling_rate() << "Hz\n";
99 if ((*j)->main_subtitle()) {
100 list<shared_ptr<Subtitle> > subs = (*j)->main_subtitle()->subtitles ();
101 cout << " Subtitle: " << subs.size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";
103 for (list<shared_ptr<Subtitle> >::const_iterator k = subs.begin(); k != subs.end(); ++k) {
104 cout << " " << (*k)->text() << "\n";
106 << "font:" << (*k)->font() << "; "
107 << "italic:" << (*k)->italic() << "; "
108 << "color:" << (*k)->color() << "; "
109 << "in:" << (*k)->in() << "; "
110 << "out:" << (*k)->out() << "; "
111 << "v_position:" << (*k)->v_position() << "; "
112 << "v_align:" << (*k)->v_align() << "; "
113 << "effect:" << (*k)->effect() << "; "
114 << "effect_color:" << (*k)->effect_color() << "; "
115 << "fade_up_time:" << (*k)->fade_up_time() << "; "
116 << "fade_down_time:" << (*k)->fade_down_time() << "; "
117 << "size: " << (*k)->size() << "\n";