+bool
+Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes)
+{
+ /* Read the frame info as written */
+ FILE* ifi = fopen_boost (_film->info_path (f, eyes), "r");
+ if (!ifi) {
+ _film->log()->log (String::compose ("Existing frame %1 has no info file", f));
+ return false;
+ }
+
+ libdcp::FrameInfo info (ifi);
+ fclose (ifi);
+ if (info.size == 0) {
+ _film->log()->log (String::compose ("Existing frame %1 has no info file", f));
+ return false;
+ }
+
+ /* Read the data from the MXF and hash it */
+#ifdef DCPOMATIC_WINDOWS
+ _fseeki64 (mxf, info.offset, SEEK_SET);
+#else
+ fseek (mxf, info.offset, SEEK_SET);
+#endif
+ EncodedData data (info.size);
+ size_t const read = fread (data.data(), 1, data.size(), mxf);
+ if (read != static_cast<size_t> (data.size ())) {
+ _film->log()->log (String::compose ("Existing frame %1 is incomplete", f));
+ return false;
+ }
+
+ string const existing_hash = md5_digest (data.data(), data.size());
+ if (existing_hash != info.hash) {
+ _film->log()->log (String::compose ("Existing frame %1 failed hash check", f));
+ return false;
+ }
+
+ return true;
+}