summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-20 13:59:07 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-20 13:59:07 +0100
commit7aaf59faf8bb0ff85a2f76f6569076790a124813 (patch)
treef35c23fe5cbe709ffeea4584c9420795ef89ca5b /src
parentd92919284b25526581f5a3f461f1e06106b91a09 (diff)
Give access to git revision, and make test mode accessible.
Diffstat (limited to 'src')
-rw-r--r--src/git_commit.h6
-rw-r--r--src/test_mode.cc40
-rw-r--r--src/test_mode.h29
-rw-r--r--src/wscript2
4 files changed, 77 insertions, 0 deletions
diff --git a/src/git_commit.h b/src/git_commit.h
new file mode 100644
index 00000000..377fefbb
--- /dev/null
+++ b/src/git_commit.h
@@ -0,0 +1,6 @@
+
+namespace libdcp {
+
+extern char const * git_commit;
+
+}
diff --git a/src/test_mode.cc b/src/test_mode.cc
new file mode 100644
index 00000000..2ff806fa
--- /dev/null
+++ b/src/test_mode.cc
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file src/test_mode.cc
+ * @brief A method to enable test mode for libdcp.
+ */
+
+#include "KM_prng.h"
+#include "test_mode.h"
+#include "metadata.h"
+
+/** Calling this will seed the random number generator used to
+ * generate UUIDs with a known value, and set the DCP issue
+ * date to 1st January 2012 at midnight. This means that
+ * two runs of libdcp with the same inputs will produce
+ * the same output.
+ */
+
+void
+libdcp::enable_test_mode ()
+{
+ Kumu::libdcp_test = true;
+ Metadata::instance()->issue_date = "2012-01-01T00:00:00+00:00";
+}
diff --git a/src/test_mode.h b/src/test_mode.h
new file mode 100644
index 00000000..b2e671d5
--- /dev/null
+++ b/src/test_mode.h
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file src/test_mode.h
+ * @brief A method to enable test mode for libdcp.
+ */
+
+namespace libdcp
+{
+
+extern void enable_test_mode ();
+
+}
diff --git a/src/wscript b/src/wscript
index a57bb75b..b0e7f8be 100644
--- a/src/wscript
+++ b/src/wscript
@@ -12,6 +12,8 @@ def build(bld):
picture_asset.cc
util.cc
metadata.cc
+ git_commit.cc
+ test_mode.cc
"""
headers = """