-bool
-Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes)
-{
- /* Read the frame info as written */
- FILE* file = fopen_boost (_film->info_file (), "rb");
- if (!file) {
- LOG_GENERAL ("Existing frame %1 has no info file", f);
- return false;
- }
-
- dcp::FrameInfo info = read_frame_info (file, f, eyes);
- fclose (file);
- 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;