--- /dev/null
+#!/usr/bin/python
+
+import os
+import sys
+import datetime
+import shutil
+
+def command(c):
+ os.system(c)
+ print c
+
+def release_version(s):
+ s = s[1:-1]
+ if s.endswith('pre'):
+ s = s[0:-3]
+ p = s.split('.')
+ return '0.%02d' % int(p[1])
+
+def new_pre_version(s):
+ s = s[1:-1]
+ p = s.split('.')
+ return '0.%02dpre' % (int(p[1]) + 1)
+
+def rewrite_wscript(version_maker):
+ f = open('wscript', 'rw')
+ o = open('wscript.tmp', 'w')
+ while 1:
+ l = f.readline()
+ if l == '':
+ break
+
+ s = l.split()
+ if len(s) == 3 and s[0] == "VERSION":
+ v = version_maker(s[2])
+ print "REWRITE %s -> %s" % (s[2], v)
+ print >>o,"VERSION = '%s'" % v
+ else:
+ print >>o,l,
+ f.close()
+ o.close()
+
+ os.rename('wscript.tmp', 'wscript')
+ return v
+
+def append_to_changelog(version):
+ f = open('ChangeLog', 'r')
+ c = f.read()
+ f.close()
+
+ f = open('ChangeLog', 'w')
+ now = datetime.datetime.now()
+ f.write('%d-%02d-%02d Carl Hetherington <cth@carlh.net>\n\n\t* Version %s released.\n\n' % (now.year, now.month, now.day, version))
+ f.write(c)
+
+release_version_string = rewrite_wscript(release_version)
+#append_to_changelog(release_version_string)
+
+command("git diff")
+if (raw_input() != "y"):
+ command("git reset --hard")
+ print 'Aborted'
+ sys.exit(1)
+
+command("git commit -a -m \"Bump version\"")
+command("git tag -m \"v%s\" v%s" % (release_version_string, release_version_string))
+command("./waf clean")
+command("./waf")
+command("./waf configure")
+command("./waf dist")
+
+rewrite_wscript(new_pre_version)
+
+command("git diff")
+if (raw_input() != "y"):
+ command("git reset --hard")
+ print 'Aborted'
+ sys.exit(1)
+
+command("git commit -a -m \"Bump version\"")
echo "FAIL: files differ"
exit 1
fi
-echo "PASS"
\ No newline at end of file
+
+if [ -e "../libdcp-test" ]; then
+ for d in `find ../libdcp-test -mindepth 1 -maxdepth 1 -type d`; do
+ LD_LIBRARY_PATH=build/src:build/asdcplib/src build/tools/dcpinfo $d
+ if [ "$?" != "0" ]; then
+ echo "FAIL: dcpinfo failed"
+ exit 1
+ fi
+ done
+else
+ echo "Test corpus not found"
+ exit 1
+fi
+
+echo "PASS"
+
--- /dev/null
+#!/bin/bash
+
+export LD_LIBRARY_PATH=build/src:build/asdcplib/src
+if [ "$1" == "--debug" ]; then
+ shift
+ gdb --args build/tools/dcpinfo "$@"
+elif [ "$1" == "--valgrind" ]; then
+ shift
+ valgrind --tool="memcheck" --leak-check=full --show-reachable=yes build/tools/dcpinfo "$@"
+else
+ build/tools/dcpinfo "$@"
+fi
}
-DCP::DCP (string directory)
+DCP::DCP (string directory, bool read_mxfs)
: _directory (directory)
{
Files files;
shared_ptr<SoundAsset> sound;
shared_ptr<SubtitleAsset> subtitle;
- if ((*i)->asset_list->main_picture) {
+ if (read_mxfs && (*i)->asset_list->main_picture) {
string n = pkl->asset_from_id (p->id)->original_file_name;
if (n.empty ()) {
)
);
- } else if ((*i)->asset_list->main_stereoscopic_picture) {
+ } else if (read_mxfs && (*i)->asset_list->main_stereoscopic_picture) {
string n = pkl->asset_from_id (p->id)->original_file_name;
if (n.empty ()) {
}
- if ((*i)->asset_list->main_sound) {
+ if (read_mxfs && (*i)->asset_list->main_sound) {
string n = pkl->asset_from_id ((*i)->asset_list->main_sound->id)->original_file_name;
if (n.empty ()) {
* of the DCP.
*
* @param directory Existing DCP's directory.
+ * @param read_mxfs true to read MXF files; setting to false can be useful for testing, but
+ * normally it should be set to true.
*/
- DCP (std::string directory);
+ DCP (std::string directory, bool read_mxfs = true);
void add_reel (boost::shared_ptr<const Reel> reel);
--- /dev/null
+#include <iostream>
+#include <cstdlib>
+#include <boost/filesystem.hpp>
+#include <getopt.h>
+#include "dcp.h"
+#include "exceptions.h"
+#include "reel.h"
+
+using namespace std;
+using namespace boost;
+using namespace libdcp;
+
+static void
+help (string n)
+{
+ cerr << "Syntax: " << n << " <DCP>\n";
+}
+
+int
+main (int argc, char* argv[])
+{
+ int option_index = 0;
+ while (1) {
+ static struct option long_options[] = {
+ { "version", no_argument, 0, 'v'},
+ { "help", no_argument, 0, 'h'},
+ { 0, 0, 0, 0 }
+ };
+
+ int c = getopt_long (argc, argv, "vh", long_options, &option_index);
+
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'v':
+ cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
+ exit (EXIT_SUCCESS);
+ case 'h':
+ help (argv[0]);
+ exit (EXIT_SUCCESS);
+ }
+ }
+
+ if (argc <= optind || argc > (optind + 1)) {
+ help (argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (!filesystem::exists (argv[optind])) {
+ cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ list<string> missing_mxfs;
+
+ DCP* dcp = 0;
+ try {
+ dcp = new DCP (argv[optind], false);
+ } catch (FileError& e) {
+ cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
+ exit (EXIT_FAILURE);
+ }
+
+ cout << "DCP: " << argv[optind] << "\n"
+ << "\tLength: " << dcp->length() << "\n"
+ << "\tFrames per second: " << dcp->frames_per_second() << "\n";
+
+ if (!missing_mxfs.empty ()) {
+ cout << "\tmissing MXFs: ";
+ for (list<string>::const_iterator i = missing_mxfs.begin(); i != missing_mxfs.end(); ++i) {
+ cout << *i << " " ;
+ }
+ cout << "\n";
+ }
+
+ list<shared_ptr<const Reel> > reels = dcp->reels ();
+
+ int R = 1;
+ for (list<shared_ptr<const Reel> >::const_iterator i = reels.begin(); i != reels.end(); ++i) {
+ cout << "Reel " << R << "\n";
+ cout << "\tContains: ";
+ if ((*i)->main_picture()) {
+ cout << "picture ";
+ }
+ if ((*i)->main_sound()) {
+ cout << "sound ";
+ }
+ if ((*i)->main_subtitle()) {
+ cout << "subtitle ";
+ }
+ cout << "\n";
+ ++R;
+ }
+
+ return 0;
+}
obj.use = ['libdcp']
obj.source = 'dcpdiff.cc'
obj.target = 'dcpdiff'
+
+ obj = bld(features = 'cxx cxxprogram')
+ obj.use = ['libdcp']
+ obj.source = 'dcpinfo.cc'
+ obj.target = 'dcpinfo'
+