diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-25 00:13:55 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-15 23:18:58 +0200 |
| commit | b786ec52435a697f7bcc2ef1870f22e27e446315 (patch) | |
| tree | 0a2a2ad040e5a73350b853d190acd3277fecd1cd /src | |
| parent | 7cb07bcec10bfdfed3e82a2dc138114dc6a5ac68 (diff) | |
FIXME: Hash to a vector rather than a string.2758-safe-write
Needs asdcplib version bump.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame_info.h | 11 | ||||
| -rw-r--r-- | src/mono_j2k_picture_asset_writer.cc | 5 | ||||
| -rw-r--r-- | src/mono_mpeg2_picture_asset_writer.cc | 3 | ||||
| -rw-r--r-- | src/stereo_j2k_picture_asset_writer.cc | 7 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/frame_info.h b/src/frame_info.h index 325350c4..ea57885c 100644 --- a/src/frame_info.h +++ b/src/frame_info.h @@ -42,6 +42,7 @@ LIBDCP_DISABLE_WARNINGS LIBDCP_ENABLE_WARNINGS #include <stdint.h> #include <string> +#include <vector> namespace dcp { @@ -54,15 +55,15 @@ struct FrameInfo { FrameInfo () = default; - FrameInfo(uint64_t o, uint64_t s, std::string h) + FrameInfo(uint64_t o, uint64_t s, std::vector<uint8_t> h) : offset(o) , size(s) - , hash(h) + , hash(std::move(h)) {} uint64_t offset = 0; uint64_t size = 0; - std::string hash; + std::vector<uint8_t> hash; }; @@ -70,7 +71,7 @@ struct J2KFrameInfo : public FrameInfo { J2KFrameInfo() = default; - J2KFrameInfo(uint64_t offset_, uint64_t size_, std::string hash_) + J2KFrameInfo(uint64_t offset_, uint64_t size_, std::vector<uint8_t> hash_) : FrameInfo(offset_, size_, hash_) {} }; @@ -83,7 +84,7 @@ struct MPEG2FrameInfo : public FrameInfo MPEG2FrameInfo( uint64_t offset_, uint64_t size_, - std::string hash_, + std::vector<uint8_t> hash_, ASDCP::MPEG2::FrameType_t type_, bool gop_start_, bool closed_gop_, diff --git a/src/mono_j2k_picture_asset_writer.cc b/src/mono_j2k_picture_asset_writer.cc index 644cfd3a..394040ac 100644 --- a/src/mono_j2k_picture_asset_writer.cc +++ b/src/mono_j2k_picture_asset_writer.cc @@ -52,8 +52,9 @@ LIBDCP_ENABLE_WARNINGS #include "j2k_picture_asset_writer_common.cc" -using std::string; using std::shared_ptr; +using std::string; +using std::vector; using namespace dcp; @@ -110,7 +111,7 @@ MonoJ2KPictureAssetWriter::write (uint8_t const * data, int size) uint64_t const before_offset = _state->mxf_writer.Tell (); - string hash; + vector<uint8_t> hash; auto const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac(), &hash); if (ASDCP_FAILURE(r)) { throw_from_asdcplib(r, _file, MXFFileError("error in writing video MXF", _file.string(), r)); diff --git a/src/mono_mpeg2_picture_asset_writer.cc b/src/mono_mpeg2_picture_asset_writer.cc index a8e05ce9..5b841c4d 100644 --- a/src/mono_mpeg2_picture_asset_writer.cc +++ b/src/mono_mpeg2_picture_asset_writer.cc @@ -38,6 +38,7 @@ using std::string; +using std::vector; using namespace dcp; @@ -92,7 +93,7 @@ MonoMPEG2PictureAssetWriter::write(uint8_t const * data, int size) auto const before_offset = _state->mxf_writer.Tell(); - string hash; + vector<uint8_t> hash; auto const r = _state->mxf_writer.WriteFrame(buffer, _crypto_context->context(), _crypto_context->hmac(), &hash); if (ASDCP_FAILURE(r)) { throw_from_asdcplib(r, _file, MXFFileError("error in writing video MXF", _file.string(), r)); diff --git a/src/stereo_j2k_picture_asset_writer.cc b/src/stereo_j2k_picture_asset_writer.cc index 02ccdca1..6874bf7c 100644 --- a/src/stereo_j2k_picture_asset_writer.cc +++ b/src/stereo_j2k_picture_asset_writer.cc @@ -49,8 +49,9 @@ #include "j2k_picture_asset_writer_common.cc" -using std::string; using std::shared_ptr; +using std::string; +using std::vector; using namespace dcp; @@ -104,7 +105,7 @@ StereoJ2KPictureAssetWriter::write (uint8_t const * data, int size) uint64_t const before_offset = _state->mxf_writer.Tell (); - string hash; + vector<uint8_t> hash; auto r = _state->mxf_writer.WriteFrame ( _state->frame_buffer, _next_eye == Eye::LEFT ? ASDCP::JP2K::SP_LEFT : ASDCP::JP2K::SP_RIGHT, @@ -123,7 +124,7 @@ StereoJ2KPictureAssetWriter::write (uint8_t const * data, int size) ++_frames_written; } - return J2KFrameInfo(before_offset, _state->mxf_writer.Tell() - before_offset, hash); + return J2KFrameInfo(before_offset, _state->mxf_writer.Tell() - before_offset, std::move(hash)); } |
