summaryrefslogtreecommitdiff
path: root/src/h__Writer.cpp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-03-16 21:50:24 +0100
committerCarl Hetherington <cth@carlh.net>2024-03-21 20:29:50 +0100
commit4898f9d60bc621cb464faa00fb50146495d76928 (patch)
tree8d756384f4bd9cc866aa278eac8dd594082304d7 /src/h__Writer.cpp
parent8b59eda953e7fa37506e6cb6add7dcb7d5ae8dce (diff)
Support hashing while writing MXFs.
Diffstat (limited to 'src/h__Writer.cpp')
-rwxr-xr-xsrc/h__Writer.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/h__Writer.cpp b/src/h__Writer.cpp
index c7aa8ab..4eaf72f 100755
--- a/src/h__Writer.cpp
+++ b/src/h__Writer.cpp
@@ -319,12 +319,12 @@ ASDCP::h__ASDCPWriter::WriteASDCPHeader(const std::string& PackageLabel, const U
//
Result_t
ASDCP::h__ASDCPWriter::WriteEKLVPacket(const ASDCP::FrameBuffer& FrameBuf,const byte_t* EssenceUL,
- const ui32_t& MinEssenceElementBerLength,
- AESEncContext* Ctx, HMACContext* HMAC)
+ const ui32_t& MinEssenceElementBerLength,
+ AESEncContext* Ctx, HMACContext* HMAC, std::string* hash)
{
return Write_EKLV_Packet(m_File, *m_Dict, m_HeaderPart, m_Info, m_CtFrameBuf, m_FramesWritten,
m_StreamOffset, FrameBuf, EssenceUL, MinEssenceElementBerLength,
- Ctx, HMAC);
+ Ctx, HMAC, hash);
}
Result_t
@@ -393,11 +393,16 @@ ASDCP::Write_EKLV_Packet(Kumu::FileWriter& File, const ASDCP::Dictionary& Dict,
const ASDCP::WriterInfo& Info, ASDCP::FrameBuffer& CtFrameBuf, ui32_t& FramesWritten,
ui64_t & StreamOffset, const ASDCP::FrameBuffer& FrameBuf, const byte_t* EssenceUL,
const ui32_t& MinEssenceElementBerLength,
- AESEncContext* Ctx, HMACContext* HMAC)
+ AESEncContext* Ctx, HMACContext* HMAC, std::string* hash)
{
Result_t result = RESULT_OK;
IntegrityPack IntPack;
+ if (hash)
+ {
+ File.StartHashing();
+ }
+
byte_t overhead[128];
Kumu::MemIOWriter Overhead(overhead, 128);
// We declare HMACOverhead and its buffer in the outer scope, even though it is not used on
@@ -538,6 +543,11 @@ ASDCP::Write_EKLV_Packet(Kumu::FileWriter& File, const ASDCP::Dictionary& Dict,
if ( ASDCP_SUCCESS(result) )
result = File.Writev();
+ if (hash)
+ {
+ *hash = File.StopHashing();
+ }
+
return result;
}