summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-12-22 23:29:50 +0000
committerCarl Hetherington <cth@carlh.net>2012-12-22 23:29:50 +0000
commitf5cc57f11946e1e269df25db434c5f8efe953a68 (patch)
tree47e7348bbf8d5077dec505c926af0d631c158b2b /test
parent4707ffd992e01a42e978b90b2cdcfc50d36e1513 (diff)
More various fixes to subtitle XML writing.
Diffstat (limited to 'test')
-rw-r--r--test/rewrite_subs.cc42
-rw-r--r--test/wscript8
2 files changed, 50 insertions, 0 deletions
diff --git a/test/rewrite_subs.cc b/test/rewrite_subs.cc
new file mode 100644
index 00000000..651b207a
--- /dev/null
+++ b/test/rewrite_subs.cc
@@ -0,0 +1,42 @@
+#include <iostream>
+#include "dcp.h"
+#include "reel.h"
+#include "subtitle_asset.h"
+
+using std::cout;
+using std::cerr;
+using std::list;
+using boost::shared_ptr;
+using namespace libdcp;
+
+int
+main (int argc, char* argv[])
+try
+{
+ if (argc < 2) {
+ cerr << "Syntax: " << argv[0] << " <dcp>\n";
+ exit (EXIT_FAILURE);
+ }
+
+ DCP* dcp = new DCP (argv[1]);
+ dcp->read (false);
+
+ list<shared_ptr<const CPL> > cpls = dcp->cpls ();
+ for (list<boost::shared_ptr<const CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
+
+ list<shared_ptr<const Reel> > reels = (*i)->reels ();
+ for (list<shared_ptr<const Reel> >::iterator j = reels.begin(); j != reels.end(); ++j) {
+
+ if ((*j)->main_subtitle()) {
+ (*j)->main_subtitle()->write_xml ();
+ }
+ }
+ }
+
+ return 0;
+}
+catch (FileError& e)
+{
+ cerr << e.what() << " (" << e.filename() << ")\n";
+ exit (EXIT_FAILURE);
+}
diff --git a/test/wscript b/test/wscript
index f24683b7..43ca7d73 100644
--- a/test/wscript
+++ b/test/wscript
@@ -31,3 +31,11 @@ def build(bld):
obj.source = 'subs_in_out.cc'
obj.target = 'subs_in_out'
obj.install_path = ''
+
+ obj = bld(features = 'cxx cxxprogram')
+ obj.name = 'rewrite_subs'
+ obj.uselib = 'BOOST_TEST OPENJPEG'
+ obj.use = 'libdcp'
+ obj.source = 'rewrite_subs.cc'
+ obj.target = 'rewrite_subs'
+ obj.install_path = ''