diff options
| author | John Hurst <jhurst@cinecert.com> | 2021-08-26 20:49:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-26 20:49:41 -0700 |
| commit | 3e71fd643d02342ffd7b5fd3b561233b3bb31acc (patch) | |
| tree | 5eb2aa3b254edf3f0c448cd890aadb827ee32fae /src/h__02_Writer.cpp | |
| parent | 623b3ae0a41e6c27f331e2a3347ec07cf1337b05 (diff) | |
| parent | 301b00b133eccd88e86a4536266ec258bb3b82de (diff) | |
Merge pull request #15 from DolbyLaboratories/dolby/atmos_storage/asdcplib_integration/templatize_h02writerclip_depends_on_pluggable_filereader
Templatize h__AS02WriteClip, move functions definition to header. Note that this depends on filereader pluggable at runtime commit as the reader is called as a pointer here.
Diffstat (limited to 'src/h__02_Writer.cpp')
| -rw-r--r-- | src/h__02_Writer.cpp | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/h__02_Writer.cpp b/src/h__02_Writer.cpp index e35727e..8043ebd 100644 --- a/src/h__02_Writer.cpp +++ b/src/h__02_Writer.cpp @@ -309,89 +309,3 @@ AS_02::MXF::AS02IndexWriterCBR::SetEditRate(const ASDCP::Rational& edit_rate, co //------------------------------------------------------------------------------------------ // - -// -AS_02::h__AS02WriterClip::h__AS02WriterClip(const ASDCP::Dictionary* d) : - h__AS02Writer<AS_02::MXF::AS02IndexWriterCBR>(d), - m_ECStart(0), m_ClipStart(0), m_IndexStrategy(AS_02::IS_FOLLOW) {} - -AS_02::h__AS02WriterClip::~h__AS02WriterClip() {} - -// -bool -AS_02::h__AS02WriterClip::HasOpenClip() const -{ - return m_ClipStart != 0; -} - -// -Result_t -AS_02::h__AS02WriterClip::StartClip(const byte_t* EssenceUL, AESEncContext* Ctx, HMACContext*) -{ - if ( Ctx != 0 ) - { - DefaultLogSink().Error("Encryption not yet supported for PCM clip-wrap.\n"); - return RESULT_STATE; - } - - if ( m_ClipStart != 0 ) - { - DefaultLogSink().Error("Cannot open clip, clip already open.\n"); - return RESULT_STATE; - } - - m_ClipStart = m_File.Tell(); - byte_t clip_buffer[24] = {0}; - memcpy(clip_buffer, EssenceUL, 16); - bool check = Kumu::write_BER(clip_buffer+16, 0, 8); - assert(check); - return m_File.Write(clip_buffer, 24); -} - -// -Result_t -AS_02::h__AS02WriterClip::WriteClipBlock(const ASDCP::FrameBuffer& FrameBuf) -{ - if ( m_ClipStart == 0 ) - { - DefaultLogSink().Error("Cannot write clip block, no clip open.\n"); - return RESULT_STATE; - } - - return m_File.Write(FrameBuf.RoData(), FrameBuf.Size()); -} - -// -Result_t -AS_02::h__AS02WriterClip::FinalizeClip(ui32_t bytes_per_frame) -{ - if ( m_ClipStart == 0 ) - { - DefaultLogSink().Error("Cannot close clip, clip not open.\n"); - return RESULT_STATE; - } - - ui64_t current_position = m_File.Tell(); - Result_t result = m_File.Seek(m_ClipStart+16); - - if ( KM_SUCCESS(result) ) - { - byte_t clip_buffer[8] = {0}; - ui64_t size = static_cast<ui64_t>(m_FramesWritten) * bytes_per_frame; - bool check = Kumu::write_BER(clip_buffer, size, 8); - assert(check); - result = m_File.Write(clip_buffer, 8); - } - - if ( KM_SUCCESS(result) ) - { - result = m_File.Seek(current_position); - m_ClipStart = 0; - } - - return result; -} - -// -// end h__02_Writer.cpp -// |
