summaryrefslogtreecommitdiff
path: root/src/lib/dcp_video_frame.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-25 01:20:58 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-25 01:20:58 +0100
commit82af50304f55a961cba6afefbfa7edd5440bfcc4 (patch)
tree7f637d5f9218a8a72752505d1467b75bdc934574 /src/lib/dcp_video_frame.cc
parent8b3f7c38278952dc97feba7d51ef39775608689b (diff)
Basic J2K hash checking.
Diffstat (limited to 'src/lib/dcp_video_frame.cc')
-rw-r--r--src/lib/dcp_video_frame.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc
index 96c40358a..da7133c4b 100644
--- a/src/lib/dcp_video_frame.cc
+++ b/src/lib/dcp_video_frame.cc
@@ -36,6 +36,7 @@
#include <iomanip>
#include <sstream>
#include <iostream>
+#include <fstream>
#include <unistd.h>
#include <errno.h>
#include <boost/array.hpp>
@@ -344,8 +345,16 @@ EncodedData::write (shared_ptr<const Options> opt, int frame)
fwrite (_data, 1, _size, f);
fclose (f);
+ string const real_j2k = opt->frame_out_path (frame, false);
+
/* Rename the file from foo.j2c.tmp to foo.j2c now that it is complete */
- filesystem::rename (tmp_j2k, opt->frame_out_path (frame, false));
+ filesystem::rename (tmp_j2k, real_j2k);
+
+ /* Write a file containing the hash */
+ string const hash = real_j2k + ".md5";
+ ofstream h (hash.c_str());
+ h << md5_digest (_data, _size) << "\n";
+ h.close ();
}
/** Send this data to a socket.