diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-16 01:58:57 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-12-26 17:20:25 +0100 |
| commit | 24728b74693bb84d79474e014cdb952abc8a79f2 (patch) | |
| tree | b18a95441b7fcf53232958b364c84bcee67f1695 /src/lib/frame_info.cc | |
| parent | d7f6ab91208cb4a562ccd668ca2cc8135f124053 (diff) | |
Give ownership of info files to ReelWriters (#2912).v2.18.2
The motivation here is to stop a pattern where we create a file, close
it, and then re-open it (many times) as I think there are problems on
Windows when a virus scanner sees the new file, opens it for checking,
and then we can't re-open it.
This also makes things a fair bit simpler, as a lock is removed and we
don't try to differentiate read/write cases by opening the file in
different ways; it's now always writeable.
Diffstat (limited to 'src/lib/frame_info.cc')
| -rw-r--r-- | src/lib/frame_info.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/frame_info.cc b/src/lib/frame_info.cc index f348bca6a..e2382376c 100644 --- a/src/lib/frame_info.cc +++ b/src/lib/frame_info.cc @@ -41,14 +41,14 @@ J2KFrameInfo::J2KFrameInfo(dcp::J2KFrameInfo const& info) } -J2KFrameInfo::J2KFrameInfo(shared_ptr<InfoFileHandle> info_file, Frame frame, Eyes eyes) +J2KFrameInfo::J2KFrameInfo(dcp::File& info_file, Frame frame, Eyes eyes) { - info_file->get().seek(position(frame, eyes), SEEK_SET); - info_file->get().checked_read(&offset, sizeof(offset)); - info_file->get().checked_read(&size, sizeof(size)); + info_file.seek(position(frame, eyes), SEEK_SET); + info_file.checked_read(&offset, sizeof(offset)); + info_file.checked_read(&size, sizeof(size)); char hash_buffer[33]; - info_file->get().checked_read(hash_buffer, 32); + info_file.checked_read(hash_buffer, 32); hash_buffer[32] = '\0'; hash = hash_buffer; } @@ -74,11 +74,11 @@ J2KFrameInfo::position(Frame frame, Eyes eyes) const /** @param frame reel-relative frame */ void -J2KFrameInfo::write(shared_ptr<InfoFileHandle> info_file, Frame frame, Eyes eyes) const +J2KFrameInfo::write(dcp::File& info_file, Frame frame, Eyes eyes) const { - info_file->get().seek(position(frame, eyes), SEEK_SET); - info_file->get().checked_write(&offset, sizeof(offset)); - info_file->get().checked_write(&size, sizeof(size)); - info_file->get().checked_write(hash.c_str(), hash.size()); + info_file.seek(position(frame, eyes), SEEK_SET); + info_file.checked_write(&offset, sizeof(offset)); + info_file.checked_write(&size, sizeof(size)); + info_file.checked_write(hash.c_str(), hash.size()); } |
