#include "audio_mapping.h"
#include "util.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "raw_convert.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
string
AudioMapping::digest () const
{
- MD5Digester digester;
+ Digester digester;
digester.add (_input_channels);
digester.add (_output_channels);
for (int i = 0; i < _input_channels; ++i) {
#include "config.h"
#include "colour_conversion.h"
#include "util.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "raw_convert.h"
#include <dcp/chromaticity.h>
#include <dcp/colour_matrix.h>
string
ColourConversion::identifier () const
{
- MD5Digester digester;
+ Digester digester;
if (dynamic_pointer_cast<const dcp::GammaTransferFunction> (_in)) {
shared_ptr<const dcp::GammaTransferFunction> tf = dynamic_pointer_cast<const dcp::GammaTransferFunction> (_in);
lm.unlock ();
/* Some content files are very big, so we use a poor man's
- digest here: a MD5 of the first and last 1e6 bytes with the
+ digest here: a digest of the first and last 1e6 bytes with the
size of the first file tacked on the end as a string.
*/
- string const d = md5_digest_head_tail (p, 1000000) + raw_convert<string> (boost::filesystem::file_size (p.front ()));
+ string const d = digest_head_tail (p, 1000000) + raw_convert<string> (boost::filesystem::file_size (p.front ()));
lm.lock ();
_digest = d;
--- /dev/null
+/*
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <iomanip>
+#include <openssl/md5.h>
+#include "digester.h"
+#include "safe_stringstream.h"
+
+using std::string;
+using std::hex;
+using std::setfill;
+using std::setw;
+
+Digester::Digester ()
+{
+ MD5_Init (&_context);
+}
+
+Digester::~Digester ()
+{
+ get ();
+}
+
+void
+Digester::add (void const * data, size_t size)
+{
+ MD5_Update (&_context, data, size);
+}
+
+void
+Digester::add (string const & s)
+{
+ add (s.c_str (), s.length ());
+}
+
+string
+Digester::get () const
+{
+ if (!_digest) {
+ unsigned char digest[MD5_DIGEST_LENGTH];
+ MD5_Final (digest, &_context);
+
+ SafeStringStream s;
+ for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
+ s << hex << setfill('0') << setw(2) << ((int) digest[i]);
+ }
+
+ _digest = s.str ();
+ }
+
+ return _digest.get ();
+}
--- /dev/null
+/*
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <openssl/md5.h>
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+#include <string>
+
+class Digester : public boost::noncopyable
+{
+public:
+ Digester ();
+ ~Digester ();
+
+ void add (void const * data, size_t size);
+
+ template <class T>
+ void add (T data) {
+ add (&data, sizeof (T));
+ }
+
+ void add (std::string const & s);
+
+ std::string get () const;
+
+private:
+ mutable MD5_CTX _context;
+ mutable boost::optional<std::string> _digest;
+};
#include "log.h"
#include "ffmpeg_subtitle_stream.h"
#include "ffmpeg_audio_stream.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "compose.hpp"
extern "C" {
#include <libavcodec/avcodec.h>
string
FFmpeg::subtitle_id (AVSubtitle const & sub)
{
- MD5Digester digester;
+ Digester digester;
digester.add (sub.pts);
for (unsigned int i = 0; i < sub.num_rects; ++i) {
AVSubtitleRect* rect = sub.rects[i];
#include "raw_image_proxy.h"
#include "video_decoder.h"
#include "film.h"
-#include "md5_digester.h"
#include "audio_decoder.h"
#include "compose.hpp"
#include "subtitle_content.h"
#include "environment_info.h"
#include "raw_convert.h"
#include "audio_processor.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "compose.hpp"
#include "screen.h"
#include "audio_content.h"
{
boost::filesystem::path p = dir ("analysis");
- MD5Digester digester;
+ Digester digester;
BOOST_FOREACH (shared_ptr<Content> i, playlist->content ()) {
if (!i->audio) {
continue;
#include "timer.h"
#include "rect.h"
#include "util.h"
-#include "md5_digester.h"
#include "dcpomatic_socket.h"
extern "C" {
#include <libswscale/swscale.h>
+++ /dev/null
-/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic 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.
-
- DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <iomanip>
-#include <openssl/md5.h>
-#include "md5_digester.h"
-#include "safe_stringstream.h"
-
-using std::string;
-using std::hex;
-using std::setfill;
-using std::setw;
-
-MD5Digester::MD5Digester ()
-{
- MD5_Init (&_context);
-}
-
-MD5Digester::~MD5Digester ()
-{
- get ();
-}
-
-void
-MD5Digester::add (void const * data, size_t size)
-{
- MD5_Update (&_context, data, size);
-}
-
-void
-MD5Digester::add (string const & s)
-{
- add (s.c_str (), s.length ());
-}
-
-string
-MD5Digester::get () const
-{
- if (!_digest) {
- unsigned char digest[MD5_DIGEST_LENGTH];
- MD5_Final (digest, &_context);
-
- SafeStringStream s;
- for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
- s << hex << setfill('0') << setw(2) << ((int) digest[i]);
- }
-
- _digest = s.str ();
- }
-
- return _digest.get ();
-}
+++ /dev/null
-/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic 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.
-
- DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <openssl/md5.h>
-#include <boost/noncopyable.hpp>
-#include <boost/optional.hpp>
-#include <string>
-
-class MD5Digester : public boost::noncopyable
-{
-public:
- MD5Digester ();
- ~MD5Digester ();
-
- void add (void const * data, size_t size);
-
- template <class T>
- void add (T data) {
- add (&data, sizeof (T));
- }
-
- void add (std::string const & s);
-
- std::string get () const;
-
-private:
- mutable MD5_CTX _context;
- mutable boost::optional<std::string> _digest;
-};
#include "job.h"
#include "config.h"
#include "util.h"
-#include "md5_digester.h"
+#include "digester.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/shared_ptr.hpp>
}
}
- MD5Digester digester;
+ Digester digester;
digester.add (t.c_str(), t.length());
return digester.get ();
}
#include "cross.h"
#include "job.h"
#include "log.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "font.h"
#include "compose.hpp"
#include "audio_buffers.h"
LOG_GENERAL ("Existing frame %1 is incomplete", _first_nonexistant_frame);
ok = false;
} else {
- MD5Digester digester;
+ Digester digester;
digester.add (data.data().get(), data.size());
LOG_GENERAL ("Hash %1 vs %2", digester.get(), info.hash);
if (digester.get() != info.hash) {
#include "cross.h"
#include "video_content.h"
#include "rect.h"
-#include "md5_digester.h"
+#include "digester.h"
#include "audio_processor.h"
#include "safe_stringstream.h"
#include "compose.hpp"
/** Compute a digest of the first and last `size' bytes of a set of files. */
string
-md5_digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
+digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
{
boost::scoped_array<char> buffer (new char[size]);
- MD5Digester digester;
+ Digester digester;
/* Head */
boost::uintmax_t to_do = size;
extern void dcpomatic_setup ();
extern void dcpomatic_setup_path_encoding ();
extern void dcpomatic_setup_gettext_i18n (std::string);
-extern std::string md5_digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
+extern std::string digest_head_tail (std::vector<boost::filesystem::path>, boost::uintmax_t size);
extern void ensure_ui_thread ();
extern std::string audio_channel_name (int);
extern bool valid_image_file (boost::filesystem::path);
#include "job.h"
#include "cross.h"
#include "audio_buffers.h"
-#include "md5_digester.h"
#include "version.h"
#include "font.h"
#include "util.h"
dcpomatic_socket.cc
dcpomatic_time.cc
decoder_factory.cc
+ digester.cc
dolby_cp750.cc
emailer.cc
encoder.cc
log.cc
log_entry.cc
magick_image_proxy.cc
- md5_digester.cc
mid_side_decoder.cc
overlaps.cc
player.cc
-Subproject commit 6d7ca26d1c1d7daa4e48b6fdc7ff6ff31911c4a4
+Subproject commit e0f35822bc59088e8107f2024ca7068d11f97b11
using std::vector;
using boost::shared_ptr;
-BOOST_AUTO_TEST_CASE (md5_digest_test)
+BOOST_AUTO_TEST_CASE (digest_test)
{
vector<boost::filesystem::path> p;
- p.push_back ("test/data/md5.test");
- BOOST_CHECK_EQUAL (md5_digest_head_tail (p, 1024), "57497ef84a0487f2bb0939a1f5703912");
+ p.push_back ("test/data/digest.test");
+ BOOST_CHECK_EQUAL (digest_head_tail (p, 1024), "57497ef84a0487f2bb0939a1f5703912");
- p.push_back ("test/data/md5.test2");
- BOOST_CHECK_EQUAL (md5_digest_head_tail (p, 1024), "5a3a89857b931755ae728a518224a05c");
+ p.push_back ("test/data/digest.test2");
+ BOOST_CHECK_EQUAL (digest_head_tail (p, 1024), "5a3a89857b931755ae728a518224a05c");
p.clear ();
- p.push_back ("test/data/md5.test3");
- p.push_back ("test/data/md5.test");
- p.push_back ("test/data/md5.test2");
- p.push_back ("test/data/md5.test4");
- BOOST_CHECK_EQUAL (md5_digest_head_tail (p, 1024), "52ccf111e4e72b58bb7b2aaa6bd45ea5");
+ p.push_back ("test/data/digest.test3");
+ p.push_back ("test/data/digest.test");
+ p.push_back ("test/data/digest.test2");
+ p.push_back ("test/data/digest.test4");
+ BOOST_CHECK_EQUAL (digest_head_tail (p, 1024), "52ccf111e4e72b58bb7b2aaa6bd45ea5");
p.clear ();
p.push_back ("foobar");
- BOOST_CHECK_THROW (md5_digest_head_tail (p, 1024), OpenFileError);
+ BOOST_CHECK_THROW (digest_head_tail (p, 1024), OpenFileError);
}
/* Straightforward test of DCPTime::round_up */