summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-07-28 16:43:28 +0100
committerCarl Hetherington <cth@carlh.net>2016-07-28 16:43:28 +0100
commite4d5298e7a179d4103581cba05cbc516f94acf60 (patch)
tree0b9c8cb6ad65917f6a3bf76f5a55ec648bdb0e42
parent5eb63969c5b6f26ea820cfab116d4aecb6bd3390 (diff)
parentdc52dfc8e5a5e89005098bbec56331f9f0c6d3aa (diff)
Merge branch '1.0' of git.carlh.net:git/libdcp into 1.0
-rw-r--r--cscript6
-rw-r--r--src/certificate.cc3
-rw-r--r--src/certificate_chain.cc12
-rw-r--r--src/compose.hpp32
-rw-r--r--src/cpl.cc7
-rw-r--r--src/dcp.cc2
-rw-r--r--src/dcp_time.cc2
-rw-r--r--src/decrypted_kdm.cc7
-rw-r--r--src/key.cc5
-rw-r--r--src/metadata.cc1
-rw-r--r--src/mono_picture_asset_writer.cc2
-rw-r--r--src/mono_picture_asset_writer.h1
-rw-r--r--src/picture_asset.cc6
-rw-r--r--src/picture_asset_writer.cc2
-rw-r--r--src/picture_asset_writer.h1
-rw-r--r--src/raw_convert.h4
-rw-r--r--src/reel_asset.cc9
-rw-r--r--src/reel_picture_asset.cc1
-rw-r--r--src/smpte_subtitle_asset.cc6
-rw-r--r--src/sound_asset.cc3
-rw-r--r--src/stereo_picture_asset_writer.cc2
-rw-r--r--src/subtitle_asset.cc4
-rw-r--r--src/types.cc2
-rw-r--r--src/util.cc2
-rw-r--r--test/colour_test.cc5
-rw-r--r--test/frame_info_hash_test.cc57
-rw-r--r--test/kdm_test.cc9
-rw-r--r--test/recovery_test.cc1
-rw-r--r--test/test.cc4
-rw-r--r--test/wscript1
30 files changed, 106 insertions, 93 deletions
diff --git a/cscript b/cscript
index d2375c40..7a09f0a0 100644
--- a/cscript
+++ b/cscript
@@ -35,9 +35,9 @@ import os
def dependencies(target):
if target.platform == 'windows' and target.version == 'xp':
- return (('libcxml', 'v0.15.1'), ('openjpeg-cdist', '5d8bffd'), ('asdcplib-cth', 'v0.1.2'))
+ return (('libcxml', 'c1348c5'), ('openjpeg-cdist', '5d8bffd'), ('asdcplib-cth', '4c8a027'))
else:
- return (('libcxml', 'v0.15.1'), ('openjpeg2-cdist', '94bdab1'), ('asdcplib-cth', 'v0.1.2'))
+ return (('libcxml', 'c1348c5'), ('openjpeg2-cdist', '94bdab1'), ('asdcplib-cth', '4c8a027'))
def build(target, options):
cmd = './waf configure --disable-examples --prefix=%s' % target.directory
@@ -48,7 +48,7 @@ def build(target, options):
if (target.distro == 'debian' and target.version == 'unstable' or target.distro == 'fedora' and target.version == '23'):
target.append_with_space('CXXFLAGS', '-std=c++11')
elif target.platform == 'windows':
- cmd += ' --target-windows --disable-gcov'
+ cmd += ' --target-windows --disable-gcov --disable-tests'
if target.version == 'xp':
# OpenJPEG 1.x is inexplicably faster on Windows XP; see DCP-o-matic bug #771
cmd += ' --jpeg=oj1'
diff --git a/src/certificate.cc b/src/certificate.cc
index 18249a58..34f79754 100644
--- a/src/certificate.cc
+++ b/src/certificate.cc
@@ -55,7 +55,6 @@ using std::list;
using std::string;
using std::ostream;
using std::min;
-using std::stringstream;
using namespace dcp;
static string const begin_certificate = "-----BEGIN CERTIFICATE-----";
@@ -104,7 +103,7 @@ Certificate::read_string (string cert)
See http://comments.gmane.org/gmane.comp.encryption.openssl.user/55593
*/
- stringstream s (cert);
+ locked_stringstream s (cert);
string line;
/* BEGIN */
diff --git a/src/certificate_chain.cc b/src/certificate_chain.cc
index 0046fe75..2ba70183 100644
--- a/src/certificate_chain.cc
+++ b/src/certificate_chain.cc
@@ -55,13 +55,11 @@
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include <fstream>
-#include <sstream>
using std::string;
using std::ofstream;
using std::ifstream;
using std::runtime_error;
-using std::stringstream;
using namespace dcp;
/** Run a shell command.
@@ -108,7 +106,7 @@ command (string cmd)
int const code = WEXITSTATUS (r);
#endif
if (code) {
- stringstream s;
+ locked_stringstream s;
s << "error " << code << " in " << cmd << " within " << boost::filesystem::current_path();
throw dcp::MiscError (s.str());
}
@@ -125,7 +123,7 @@ public_key_digest (boost::filesystem::path private_key, boost::filesystem::path
boost::filesystem::path public_name = private_key.string() + ".public";
/* Create the public key from the private key */
- stringstream s;
+ locked_stringstream s;
s << "\"" << openssl.string() << "\" rsa -outform PEM -pubout -in " << private_key.string() << " -out " << public_name.string ();
command (s.str().c_str ());
@@ -222,7 +220,7 @@ CertificateChain::CertificateChain (
"/dnQualifier=" + public_key_digest ("ca.key", openssl);
{
- stringstream c;
+ locked_stringstream c;
c << quoted_openssl
<< " req -new -x509 -sha256 -config ca.cnf -days 3650 -set_serial 5"
<< " -subj \"" << ca_subject << "\" -key ca.key -outform PEM -out ca.self-signed.pem";
@@ -253,7 +251,7 @@ CertificateChain::CertificateChain (
"/dnQualifier=" + public_key_digest ("intermediate.key", openssl);
{
- stringstream s;
+ locked_stringstream s;
s << quoted_openssl
<< " req -new -config intermediate.cnf -days 3649 -subj \"" << inter_subject << "\" -key intermediate.key -out intermediate.csr";
command (s.str().c_str());
@@ -290,7 +288,7 @@ CertificateChain::CertificateChain (
"/dnQualifier=" + public_key_digest ("leaf.key", openssl);
{
- stringstream s;
+ locked_stringstream s;
s << quoted_openssl << " req -new -config leaf.cnf -days 3648 -subj \"" << leaf_subject << "\" -key leaf.key -outform PEM -out leaf.csr";
command (s.str().c_str());
}
diff --git a/src/compose.hpp b/src/compose.hpp
index f7bd4282..185e00a4 100644
--- a/src/compose.hpp
+++ b/src/compose.hpp
@@ -33,7 +33,7 @@
#ifndef STRING_COMPOSE_H
#define STRING_COMPOSE_H
-#include <sstream>
+#include <locked_sstream.h>
#include <string>
#include <list>
#include <map> // for multimap
@@ -58,7 +58,7 @@ namespace StringPrivate
std::string str() const;
private:
- std::ostringstream os;
+ locked_stringstream os;
int arg_no;
// we store the output as a list - when the output string is requested, the
@@ -106,7 +106,7 @@ namespace StringPrivate
case '8':
case '9':
return true;
-
+
default:
return false;
}
@@ -120,21 +120,21 @@ namespace StringPrivate
os << obj;
std::string rep = os.str();
-
+
if (!rep.empty()) { // manipulators don't produce output
for (specification_map::const_iterator i = specs.lower_bound(arg_no),
end = specs.upper_bound(arg_no); i != end; ++i) {
output_list::iterator pos = i->second;
++pos;
-
+
output.insert(pos, rep);
}
-
+
os.str(std::string());
//os.clear();
++arg_no;
}
-
+
return *this;
}
@@ -142,7 +142,7 @@ namespace StringPrivate
: arg_no(1)
{
std::string::size_type b = 0, i = 0;
-
+
// fill in output with the strings between the %1 %2 %3 etc. and
// fill in specs with the positions
while (i < fmt.length()) {
@@ -154,7 +154,7 @@ namespace StringPrivate
else if (is_number(fmt[i + 1])) { // aha! a spec!
// save string
output.push_back(fmt.substr(b, i - b));
-
+
int n = 1; // number of digits
int spec_no = 0;
@@ -167,9 +167,9 @@ namespace StringPrivate
spec_no /= 10;
output_list::iterator pos = output.end();
--pos; // safe since we have just inserted a string>
-
+
specs.insert(specification_map::value_type(spec_no, pos));
-
+
// jump over spec string
i += n;
b = i;
@@ -180,7 +180,7 @@ namespace StringPrivate
else
++i;
}
-
+
if (i - b > 0) // add the rest of the string
output.push_back(fmt.substr(b, i - b));
}
@@ -189,17 +189,17 @@ namespace StringPrivate
{
// assemble string
std::string str;
-
+
for (output_list::const_iterator i = output.begin(), end = output.end();
i != end; ++i)
str += *i;
-
+
return str;
}
}
// now for the real thing(s)
-namespace String
+namespace String
{
// a series of functions which accept a format string on the form "text %1
// more %2 less %3" and a number of templated parameters and spits out the
@@ -310,7 +310,7 @@ namespace String
.arg(o10);
return c.str();
}
-
+
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11>
diff --git a/src/cpl.cc b/src/cpl.cc
index 33ef647e..0abf864a 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -49,8 +49,6 @@
#include <boost/foreach.hpp>
using std::string;
-using std::stringstream;
-using std::ostream;
using std::list;
using std::pair;
using std::make_pair;
@@ -207,9 +205,8 @@ CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler not
}
if (_annotation_text != other_cpl->_annotation_text && !opt.cpl_annotation_texts_can_differ) {
- stringstream s;
- s << "CPL: annotation texts differ: " << _annotation_text << " vs " << other_cpl->_annotation_text << "\n";
- note (DCP_ERROR, s.str ());
+ string const s = "CPL: annotation texts differ: " + _annotation_text + " vs " + other_cpl->_annotation_text + "\n";
+ note (DCP_ERROR, s);
return false;
}
diff --git a/src/dcp.cc b/src/dcp.cc
index 215c6002..d2fc9745 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -62,12 +62,10 @@
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
-#include <iostream>
using std::string;
using std::list;
using std::cout;
-using std::ostream;
using std::make_pair;
using std::map;
using std::cout;
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index 401abb3c..526c784c 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -330,7 +330,7 @@ dcp::operator/ (Time a, Time const & b)
string
Time::as_string (Standard standard) const
{
- stringstream str;
+ locked_stringstream str;
str << setw(2) << setfill('0') << h << ":"
<< setw(2) << setfill('0') << m << ":"
<< setw(2) << setfill('0') << s << ":";
diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc
index abe12a32..4ffad923 100644
--- a/src/decrypted_kdm.cc
+++ b/src/decrypted_kdm.cc
@@ -52,7 +52,6 @@
using std::list;
using std::vector;
using std::string;
-using std::stringstream;
using std::setw;
using std::setfill;
using std::hex;
@@ -79,7 +78,7 @@ put_uuid (uint8_t ** d, string id)
{
id.erase (std::remove (id.begin(), id.end(), '-'));
for (int i = 0; i < 32; i += 2) {
- stringstream s;
+ locked_stringstream s;
s << id[i] << id[i + 1];
int h;
s >> hex >> h;
@@ -91,7 +90,7 @@ put_uuid (uint8_t ** d, string id)
static string
get_uuid (unsigned char ** p)
{
- stringstream g;
+ locked_stringstream g;
for (int i = 0; i < 16; ++i) {
g << setw(2) << setfill('0') << hex << static_cast<int> (**p);
@@ -301,7 +300,7 @@ DecryptedKDM::encrypt (shared_ptr<const CertificateChain> signer, Certificate re
char out[encrypted_len * 2];
Kumu::base64encode (encrypted, encrypted_len, out, encrypted_len * 2);
int const N = strlen (out);
- stringstream lines;
+ locked_stringstream lines;
for (int i = 0; i < N; ++i) {
if (i > 0 && (i % 64) == 0) {
lines << "\n";
diff --git a/src/key.cc b/src/key.cc
index d2417a09..cf7b4d6d 100644
--- a/src/key.cc
+++ b/src/key.cc
@@ -36,15 +36,14 @@
*/
#include "key.h"
+#include <locked_sstream.h>
#include <asdcp/AS_DCP.h>
#include <asdcp/KM_prng.h>
#include <asdcp/KM_util.h>
-#include <sstream>
#include <string>
#include <iomanip>
using std::string;
-using std::stringstream;
using std::setw;
using std::setfill;
using namespace dcp;
@@ -94,7 +93,7 @@ Key::operator= (Key const & other)
string
Key::hex () const
{
- stringstream g;
+ locked_stringstream g;
for (unsigned int i = 0; i < ASDCP::KeyLen; ++i) {
g << setw(2) << setfill('0') << std::hex << static_cast<int> (_value[i]);
diff --git a/src/metadata.cc b/src/metadata.cc
index 0e3d7c76..dbe80919 100644
--- a/src/metadata.cc
+++ b/src/metadata.cc
@@ -39,7 +39,6 @@
#include "util.h"
#include "local_time.h"
#include <asdcp/AS_DCP.h>
-#include <sstream>
#include <iomanip>
#include <time.h>
diff --git a/src/mono_picture_asset_writer.cc b/src/mono_picture_asset_writer.cc
index 7c955c1d..1ef079dc 100644
--- a/src/mono_picture_asset_writer.cc
+++ b/src/mono_picture_asset_writer.cc
@@ -44,8 +44,6 @@
#include "picture_asset_writer_common.cc"
-using std::istream;
-using std::ostream;
using std::string;
using boost::shared_ptr;
using namespace dcp;
diff --git a/src/mono_picture_asset_writer.h b/src/mono_picture_asset_writer.h
index e694e085..532f7ad7 100644
--- a/src/mono_picture_asset_writer.h
+++ b/src/mono_picture_asset_writer.h
@@ -43,7 +43,6 @@
#include <boost/utility.hpp>
#include <stdint.h>
#include <string>
-#include <fstream>
namespace dcp {
diff --git a/src/picture_asset.cc b/src/picture_asset.cc
index 674180c3..a0a7d7d7 100644
--- a/src/picture_asset.cc
+++ b/src/picture_asset.cc
@@ -45,19 +45,13 @@
#include <boost/filesystem.hpp>
#include <list>
#include <stdexcept>
-#include <iostream>
-#include <sstream>
using std::string;
-using std::ostream;
using std::list;
using std::vector;
using std::max;
-using std::stringstream;
using std::pair;
using std::make_pair;
-using std::istream;
-using std::cout;
using boost::shared_ptr;
using namespace dcp;
diff --git a/src/picture_asset_writer.cc b/src/picture_asset_writer.cc
index baa98a4f..e3d7b70e 100644
--- a/src/picture_asset_writer.cc
+++ b/src/picture_asset_writer.cc
@@ -39,8 +39,6 @@
#include <inttypes.h>
#include <stdint.h>
-using std::istream;
-using std::ostream;
using std::string;
using boost::shared_ptr;
using namespace dcp;
diff --git a/src/picture_asset_writer.h b/src/picture_asset_writer.h
index 5527537d..1ef519ba 100644
--- a/src/picture_asset_writer.h
+++ b/src/picture_asset_writer.h
@@ -45,7 +45,6 @@
#include <boost/utility.hpp>
#include <stdint.h>
#include <string>
-#include <fstream>
namespace dcp {
diff --git a/src/raw_convert.h b/src/raw_convert.h
index 36d578b4..5fc05c12 100644
--- a/src/raw_convert.h
+++ b/src/raw_convert.h
@@ -34,7 +34,7 @@
#ifndef LIBDCP_RAW_CONVERT_H
#define LIBDCP_RAW_CONVERT_H
-#include <sstream>
+#include <locked_sstream.h>
#include <iomanip>
namespace dcp {
@@ -46,7 +46,7 @@ template <typename P, typename Q>
P
raw_convert (Q v, int precision = 16, bool fixed = false)
{
- std::stringstream s;
+ locked_stringstream s;
s.imbue (std::locale::classic ());
s << std::setprecision (precision);
if (fixed) {
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index c4432f21..6e1b024e 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -41,12 +41,10 @@
#include "compose.hpp"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
-#include <iostream>
using std::pair;
using std::cout;
using std::string;
-using std::stringstream;
using std::make_pair;
using boost::shared_ptr;
using namespace dcp;
@@ -122,13 +120,12 @@ bool
ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
{
if (_annotation_text != other->_annotation_text) {
- stringstream s;
- s << "Reel: annotation texts differ (" << _annotation_text << " vs " << other->_annotation_text << ")\n";
+ string const s = "Reel: annotation texts differ (" + _annotation_text + " vs " + other->_annotation_text + ")\n";
if (!opt.reel_annotation_texts_can_differ) {
- note (DCP_ERROR, s.str ());
+ note (DCP_ERROR, s);
return false;
} else {
- note (DCP_NOTE, s.str ());
+ note (DCP_NOTE, s);
}
}
diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc
index 1c745e4a..de106c79 100644
--- a/src/reel_picture_asset.cc
+++ b/src/reel_picture_asset.cc
@@ -47,7 +47,6 @@
using std::bad_cast;
using std::string;
-using std::stringstream;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc
index 5bb88621..0c0181f4 100644
--- a/src/smpte_subtitle_asset.cc
+++ b/src/smpte_subtitle_asset.cc
@@ -52,8 +52,6 @@
using std::string;
using std::list;
-using std::stringstream;
-using std::cout;
using std::vector;
using std::map;
using boost::shared_ptr;
@@ -85,9 +83,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file)
if (!ASDCP_FAILURE (r)) {
string s;
reader->ReadTimedTextResource (s, 0, 0);
- stringstream t;
- t << s;
- xml->read_stream (t);
+ xml->read_string (s);
ASDCP::WriterInfo info;
reader->FillWriterInfo (info);
_id = read_writer_info (info);
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index 613fa576..e3adff45 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -47,12 +47,9 @@
#include <asdcp/AS_DCP.h>
#include <libxml++/nodes/element.h>
#include <boost/filesystem.hpp>
-#include <iostream>
#include <stdexcept>
using std::string;
-using std::stringstream;
-using std::ostream;
using std::vector;
using std::list;
using boost::shared_ptr;
diff --git a/src/stereo_picture_asset_writer.cc b/src/stereo_picture_asset_writer.cc
index d98df6ae..6e43de10 100644
--- a/src/stereo_picture_asset_writer.cc
+++ b/src/stereo_picture_asset_writer.cc
@@ -40,8 +40,6 @@
#include "picture_asset_writer_common.cc"
-using std::istream;
-using std::ostream;
using std::string;
using boost::shared_ptr;
using namespace dcp;
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index cb757673..b9f6336c 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -45,13 +45,9 @@
#include <boost/algorithm/string.hpp>
#include <boost/shared_array.hpp>
#include <boost/foreach.hpp>
-#include <fstream>
using std::string;
using std::list;
-using std::ostream;
-using std::ofstream;
-using std::stringstream;
using std::cout;
using std::cerr;
using std::map;
diff --git a/src/types.cc b/src/types.cc
index cbb56e7f..cf3229df 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -121,7 +121,7 @@ Colour::Colour (string argb_hex)
string
Colour::to_argb_string () const
{
- stringstream s;
+ locked_stringstream s;
s << "FF";
s << hex
<< setw(2) << setfill('0') << r
diff --git a/src/util.cc b/src/util.cc
index 359ac317..0c3cea08 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -55,14 +55,12 @@
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <stdexcept>
-#include <sstream>
#include <iostream>
#include <iomanip>
using std::string;
using std::wstring;
using std::cout;
-using std::stringstream;
using std::min;
using std::max;
using std::list;
diff --git a/test/colour_test.cc b/test/colour_test.cc
index a99b5b7e..d39c888d 100644
--- a/test/colour_test.cc
+++ b/test/colour_test.cc
@@ -19,10 +19,9 @@
#include "util.h"
#include "exceptions.h"
+#include <locked_sstream.h>
#include <boost/test/unit_test.hpp>
-using std::stringstream;
-
/** Check that dcp::Colour works */
BOOST_AUTO_TEST_CASE (colour)
{
@@ -58,7 +57,7 @@ BOOST_AUTO_TEST_CASE (colour)
BOOST_CHECK_THROW (dcp::Colour ("001234"), dcp::XMLError);
- stringstream s;
+ locked_stringstream s;
s << c;
BOOST_CHECK_EQUAL (s.str(), "(255, 0, 0)");
}
diff --git a/test/frame_info_hash_test.cc b/test/frame_info_hash_test.cc
new file mode 100644
index 00000000..1713963b
--- /dev/null
+++ b/test/frame_info_hash_test.cc
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp 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.
+
+ libdcp 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 libdcp. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "mono_picture_asset.h"
+#include "mono_picture_asset_writer.h"
+#include "j2k.h"
+#include "openjpeg_image.h"
+#include <boost/test/unit_test.hpp>
+
+using std::string;
+using boost::shared_ptr;
+
+static void
+check (unsigned int* seed, shared_ptr<dcp::PictureAssetWriter> writer, string hash)
+{
+ shared_ptr<dcp::OpenJPEGImage> xyz (new dcp::OpenJPEGImage (dcp::Size (1998, 1080)));
+ for (int c = 0; c < 3; ++c) {
+ for (int p = 0; p < (1998 * 1080); ++p) {
+ xyz->data(c)[p] = rand_r (seed);
+ }
+ }
+
+ dcp::Data data = dcp::compress_j2k (xyz, 100000000, 24, false, false);
+
+ dcp::FrameInfo info = writer->write (data.data().get(), data.size());
+ BOOST_CHECK_EQUAL (info.hash, hash);
+}
+
+/** Test the hashing of data written to JPEG2000 MXFs with some random inputs */
+BOOST_AUTO_TEST_CASE (frame_info_hash_test)
+{
+ shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1)));
+ shared_ptr<dcp::PictureAssetWriter> writer = mp->start_write ("build/test/frame_info_hash_test.mxf", dcp::SMPTE, false);
+
+ unsigned int seed = 42;
+
+ /* Check a few random frames */
+ check (&seed, writer, "7ddfb4f5cec76f95138c4377a829dd6f");
+ check (&seed, writer, "d6a91028bab60995b4fc49fbccd5c2ba");
+ check (&seed, writer, "9d8653644f49f692e4bbac34106a4897");
+}
diff --git a/test/kdm_test.cc b/test/kdm_test.cc
index ee52ad8e..82701d96 100644
--- a/test/kdm_test.cc
+++ b/test/kdm_test.cc
@@ -17,14 +17,13 @@
along with libdcp. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <boost/test/unit_test.hpp>
-#include <libxml++/libxml++.h>
#include "encrypted_kdm.h"
#include "decrypted_kdm.h"
#include "util.h"
+#include <libxml++/libxml++.h>
+#include <boost/test/unit_test.hpp>
using std::list;
-using std::stringstream;
using boost::shared_ptr;
/** Check reading and decryption of a KDM */
@@ -58,9 +57,7 @@ BOOST_AUTO_TEST_CASE (kdm_passthrough_test)
);
shared_ptr<xmlpp::DomParser> parser (new xmlpp::DomParser ());
- stringstream s;
- s << kdm.as_xml ();
- parser->parse_stream (s);
+ parser->parse_memory (kdm.as_xml ());
parser->get_document()->write_to_file_formatted ("build/kdm.xml", "UTF-8");
int const r = system (
"xmldiff -c test/data/kdm_TONEPLATES-SMPTE-ENC_.smpte-430-2.ROOT.NOT_FOR_PRODUCTION_20130706_20230702_CAR_OV_t1_8971c838.xml build/kdm.xml"
diff --git a/test/recovery_test.cc b/test/recovery_test.cc
index 7482b8cc..6c4f6ac9 100644
--- a/test/recovery_test.cc
+++ b/test/recovery_test.cc
@@ -54,6 +54,7 @@ BOOST_AUTO_TEST_CASE (recovery)
int written_size = 0;
for (int i = 0; i < 24; ++i) {
dcp::FrameInfo info = writer->write (data, size);
+ BOOST_CHECK_EQUAL (info.hash, "cb90485a97ea5f7555cedc8a7afd473b");
written_size = info.size;
}
diff --git a/test/test.cc b/test/test.cc
index 0e7ad511..c17f1506 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -21,13 +21,13 @@
#define BOOST_TEST_MODULE libdcp_test
#include "util.h"
#include "test.h"
+#include <locked_sstream.h>
#include <libxml++/libxml++.h>
#include <boost/test/unit_test.hpp>
#include <cstdio>
using std::string;
using std::min;
-using std::stringstream;
using std::list;
boost::filesystem::path private_test;
@@ -123,7 +123,7 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
uint8_t* ref_buffer = new uint8_t[buffer_size];
uint8_t* check_buffer = new uint8_t[buffer_size];
- stringstream error;
+ locked_stringstream error;
error << "File " << check.string() << " differs from reference " << ref.string();
while (N) {
diff --git a/test/wscript b/test/wscript
index 653ab09d..b56de9cb 100644
--- a/test/wscript
+++ b/test/wscript
@@ -75,6 +75,7 @@ def build(bld):
encryption_test.cc
exception_test.cc
fraction_test.cc
+ frame_info_hash_test.cc
gamma_transfer_function_test.cc
interop_load_font_test.cc
local_time_test.cc