+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) {
+ LOG_GENERAL ("Existing frame %1 has no info file", f);
+ return false;
+ }
+
+ libdcp::FrameInfo info (ifi);
+ fclose (ifi);
+ if (info.size == 0) {
+ LOG_GENERAL ("Existing frame %1 has no info file", f);
+ return false;
+ }
+
+ /* Read the data from the MXF and hash it */
+ dcpomatic_fseek (mxf, info.offset, SEEK_SET);
+ EncodedData data (info.size);
+ size_t const read = fread (data.data(), 1, data.size(), mxf);
+ if (read != static_cast<size_t> (data.size ())) {
+ LOG_GENERAL ("Existing frame %1 is incomplete", f);
+ return false;
+ }
+
+ MD5Digester digester;
+ digester.add (data.data(), data.size());
+ if (digester.get() != info.hash) {
+ LOG_GENERAL ("Existing frame %1 failed hash check", f);
+ return false;
+ }
+
+ return true;
+}