summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-09 16:43:46 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-09 16:43:46 +0100
commit4f6142b7d4c6d4c9db3f54e4893bff1dc9c5085f (patch)
treef842bab4d98c34421c883a4b39880fcf3282d9e9 /tools
parenta5418c87482e43b8654cfbceccd5fe774af74f03 (diff)
List subtitles in test output.
Diffstat (limited to 'tools')
-rw-r--r--tools/dcpinfo.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/dcpinfo.cc b/tools/dcpinfo.cc
index 7d49d699..cdbb8688 100644
--- a/tools/dcpinfo.cc
+++ b/tools/dcpinfo.cc
@@ -16,21 +16,25 @@ using namespace libdcp;
static void
help (string n)
{
- cerr << "Syntax: " << n << " <DCP>\n";
+ cerr << "Syntax: " << n << " [options] <DCP>\n"
+ << " -s, --subtitles list all subtitles\n";
}
int
main (int argc, char* argv[])
{
+ bool subtitles = false;
+
int option_index = 0;
while (1) {
static struct option long_options[] = {
{ "version", no_argument, 0, 'v'},
{ "help", no_argument, 0, 'h'},
+ { "subtitles", no_argument, 0, 's'},
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "vh", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhs", long_options, &option_index);
if (c == -1) {
break;
@@ -43,6 +47,9 @@ main (int argc, char* argv[])
case 'h':
help (argv[0]);
exit (EXIT_SUCCESS);
+ case 's':
+ subtitles = true;
+ break;
}
}
@@ -87,7 +94,13 @@ main (int argc, char* argv[])
cout << " Sound: " << (*j)->main_sound()->channels() << " channels at " << (*j)->main_sound()->sampling_rate() << "Hz\n";
}
if ((*j)->main_subtitle()) {
- cout << " Subtitle: " << (*j)->main_subtitle()->subtitles().size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";
+ list<shared_ptr<Subtitle> > subs = (*j)->main_subtitle()->subtitles ();
+ cout << " Subtitle: " << subs.size() << " subtitles in " << (*j)->main_subtitle()->language() << "\n";
+ if (subtitles) {
+ for (list<shared_ptr<Subtitle> >::const_iterator k = subs.begin(); k != subs.end(); ++k) {
+ cout << " " << (*k)->text() << "\n";
+ }
+ }
}
++R;
}