diff options
| author | John Hurst <jhurst@cinecert.com> | 2021-08-27 07:44:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-27 07:44:04 -0700 |
| commit | b8dea7232f134cc54f516e1f0f914d626594eaa4 (patch) | |
| tree | ab1fcf6f04c89caecb086e2c8964e346425fe6ff /src/AS_DCP_internal.h | |
| parent | 9b1a901aef79dfe022c54dfdb1e0c1c1b4a451a8 (diff) | |
| parent | 404ae7e7645525b0ac846ab1c4f08a2867cfc680 (diff) | |
Merge pull request #2 from DolbyLaboratories/dolby/atmos_storage/asdcplib_integration/as02info_as02unwrap_iab
Merge dolby/atmos_storage/asdcplib_integration/as02info_as02unwrap_iab (contains also FileReader pluggable at runtime) to master
Diffstat (limited to 'src/AS_DCP_internal.h')
| -rwxr-xr-x | src/AS_DCP_internal.h | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/AS_DCP_internal.h b/src/AS_DCP_internal.h index f3616b7..6d8688f 100755 --- a/src/AS_DCP_internal.h +++ b/src/AS_DCP_internal.h @@ -174,7 +174,7 @@ extern MXF::RIP *g_RIP; Result_t WriteGenericStreamPartition(Kumu::FileWriter&, ASDCP::MXF::OP1aHeader&, ASDCP::MXF::RIP&, const Dictionary*, const ASDCP::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0); - Result_t Read_EKLV_Packet(Kumu::FileReader& File, const ASDCP::Dictionary& Dict, + Result_t Read_EKLV_Packet(Kumu::IFileReader& File, const ASDCP::Dictionary& Dict, const ASDCP::WriterInfo& Info, Kumu::fpos_t& LastPosition, ASDCP::FrameBuffer& CtFrameBuf, ui32_t FrameNum, ui32_t SequenceNum, ASDCP::FrameBuffer& FrameBuf, const byte_t* EssenceUL, AESDecContext* Ctx, HMACContext* HMAC); @@ -199,7 +199,7 @@ extern MXF::RIP *g_RIP; inline ui64_t Length() { return m_ValueLength; } inline ui64_t KLLength() { return m_KLLength; } - Result_t ReadKLFromFile(Kumu::FileReader& Reader); + Result_t ReadKLFromFile(Kumu::IFileReader& Reader); }; namespace MXF @@ -217,7 +217,7 @@ extern MXF::RIP *g_RIP; public: const Dictionary *m_Dict; - Kumu::FileReader m_File; + Kumu::IFileReader* m_File; HeaderType m_HeaderPart; IndexAccessType m_IndexAccess; RIP m_RIP; @@ -225,14 +225,16 @@ extern MXF::RIP *g_RIP; ASDCP::FrameBuffer m_CtFrameBuf; Kumu::fpos_t m_LastPosition; - TrackFileReader(const Dictionary *d) : - m_HeaderPart(d), m_IndexAccess(d), m_RIP(d), m_Dict(d) + TrackFileReader(const Dictionary* d, const Kumu::IFileReaderFactory& fileReaderFactory) : + m_HeaderPart(m_Dict), m_IndexAccess(m_Dict), m_RIP(m_Dict), m_Dict(d) { default_md_object_init(); + m_File = fileReaderFactory.CreateFileReader(); } virtual ~TrackFileReader() { Close(); + delete m_File; } const MXF::RIP& GetRIP() const { return m_RIP; } @@ -241,14 +243,14 @@ extern MXF::RIP *g_RIP; Result_t OpenMXFRead(const std::string& filename) { m_LastPosition = 0; - Result_t result = m_File.OpenRead(filename); + Result_t result = m_File->OpenRead(filename); if ( ASDCP_SUCCESS(result) ) - result = SeekToRIP(m_File); + result = SeekToRIP(*m_File); if ( ASDCP_SUCCESS(result) ) { - result = m_RIP.InitFromFile(m_File); + result = m_RIP.InitFromFile(*m_File); if ( ASDCP_FAILURE(result) ) { @@ -264,8 +266,8 @@ extern MXF::RIP *g_RIP; DefaultLogSink().Error("TrackFileReader::OpenMXFRead, SeekToRIP failed\n"); } - m_File.Seek(0); - result = m_HeaderPart.InitFromFile(m_File); + m_File->Seek(0); + result = m_HeaderPart.InitFromFile(*m_File); if ( KM_FAILURE(result) ) { @@ -331,7 +333,7 @@ extern MXF::RIP *g_RIP; if ( FilePosition != m_LastPosition ) { m_LastPosition = FilePosition; - result = m_File.Seek(FilePosition); + result = m_File->Seek(FilePosition); } if ( KM_SUCCESS(result) ) @@ -360,7 +362,7 @@ extern MXF::RIP *g_RIP; if ( static_cast<Kumu::fpos_t>(TmpEntry.StreamOffset) != m_LastPosition ) { m_LastPosition = TmpEntry.StreamOffset; - result = m_File.Seek(TmpEntry.StreamOffset); + result = m_File->Seek(TmpEntry.StreamOffset); } if ( KM_SUCCESS(result) ) @@ -374,7 +376,7 @@ extern MXF::RIP *g_RIP; const byte_t* EssenceUL, AESDecContext* Ctx, HMACContext* HMAC) { assert(m_Dict); - return Read_EKLV_Packet(m_File, *m_Dict, m_Info, m_LastPosition, m_CtFrameBuf, + return Read_EKLV_Packet(*m_File, *m_Dict, m_Info, m_LastPosition, m_CtFrameBuf, FrameNum, SequenceNum, FrameBuf, EssenceUL, Ctx, HMAC); } @@ -383,7 +385,7 @@ extern MXF::RIP *g_RIP; Result_t CalcFrameBufferSize(ui64_t &PacketLength) { KLReader Reader; - Result_t result = Reader.ReadKLFromFile(m_File); + Result_t result = Reader.ReadKLFromFile(*m_File); if ( KM_FAILURE(result) ) return result; @@ -454,7 +456,7 @@ extern MXF::RIP *g_RIP; } // Read the Partition header and then read the payload. - Result_t result = m_File.Seek(start_offset); + Result_t result = m_File->Seek(start_offset); if ( KM_SUCCESS(result) ) { @@ -465,7 +467,7 @@ extern MXF::RIP *g_RIP; { // read the partition header ASDCP::MXF::Partition GSPart(m_Dict); - result = GSPart.InitFromFile(m_File); + result = GSPart.InitFromFile(*m_File); if ( KM_SUCCESS(result) ) { @@ -488,7 +490,7 @@ extern MXF::RIP *g_RIP; // void Close() { - m_File.Close(); + m_File->Close(); } }; @@ -869,7 +871,7 @@ extern MXF::RIP *g_RIP; { // m_RIP now contains an entry (at the back) for the new generic stream // (this entry was created during the call to AddDmsTrackGenericPartUtf8Text()) - if ( m_File.Tell() != m_RIP.PairArray.back().ByteOffset ) + if ( m_File.TellPosition() != m_RIP.PairArray.back().ByteOffset ) { DefaultLogSink().Error("File offset has moved since RIP modification. Unrecoverable error.\n"); return RESULT_FAIL; @@ -931,7 +933,7 @@ extern MXF::RIP *g_RIP; public: Partition m_BodyPart; - h__ASDCPReader(const Dictionary*); + h__ASDCPReader(const Dictionary*, const Kumu::IFileReaderFactory& fileReaderFactory); virtual ~h__ASDCPReader(); Result_t OpenMXFRead(const std::string& filename); |
