summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-01-20 23:11:18 +0000
committerCarl Hetherington <cth@carlh.net>2013-01-20 23:11:18 +0000
commit5e7de85ce53a42b90023a2160d3450a7af4a4b61 (patch)
tree7020eb41d9a5e319b794f6cd587e7835631902e2 /src/lib
parenta9911ae2e5d5ea1ca63e96eb0dd0290f97fefe47 (diff)
Write hashes of encoded frames.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_video_frame.cc10
-rw-r--r--src/lib/dcp_video_frame.h1
-rw-r--r--src/lib/writer.cc2
3 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc
index 89db5761a..c3f0fed03 100644
--- a/src/lib/dcp_video_frame.cc
+++ b/src/lib/dcp_video_frame.cc
@@ -401,8 +401,8 @@ EncodedData::~EncodedData ()
}
/** Write this data to a J2K file.
- * @param opt Options.
- * @param frame DCP Frame index.
+ * @param Film Film.
+ * @param frame DCP frame index.
*/
void
EncodedData::write (shared_ptr<const Film> film, int frame) const
@@ -422,12 +422,14 @@ EncodedData::write (shared_ptr<const Film> film, int frame) const
/* Rename the file from foo.j2c.tmp to foo.j2c now that it is complete */
boost::filesystem::rename (tmp_j2k, real_j2k);
+}
- /* Write a file containing the hash */
+void
+EncodedData::write_hash (shared_ptr<const Film> film, int frame) const
+{
string const hash = film->hash_out_path (frame, false);
ofstream h (hash.c_str());
h << md5_digest (_data, _size) << "\n";
- h.close ();
}
/** Send this data to a socket.
diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h
index 2ad2b0d44..1d434505a 100644
--- a/src/lib/dcp_video_frame.h
+++ b/src/lib/dcp_video_frame.h
@@ -49,6 +49,7 @@ public:
void send (boost::shared_ptr<Socket> socket);
void write (boost::shared_ptr<const Film>, int) const;
+ void write_hash (boost::shared_ptr<const Film>, int) const;
/** @return data */
uint8_t* data () const {
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 2cefd32fb..b94ff3c24 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -124,9 +124,11 @@ Writer::thread ()
_film->log()->log (String::compose ("Writer writes %1 to MXF", encoded.second));
if (encoded.first) {
_picture_asset_writer->write (encoded.first->data(), encoded.first->size());
+ encoded.first->write_hash (_film, encoded.second);
_last_written = encoded.first;
} else {
_picture_asset_writer->write (_last_written->data(), _last_written->size());
+ _last_written->write_hash (_film, encoded.second);
}
lock.lock ();