diff options
| author | jhurst <jhurst@cinecert.com> | 2018-10-13 21:49:53 +0000 |
|---|---|---|
| committer | jhurst <> | 2018-10-13 21:49:53 +0000 |
| commit | d0f88650a6395b4ee67c18e21a18ee341e7cd130 (patch) | |
| tree | 5b575d1839259df2cf1a5b0fddcc2ff00cb46352 | |
| parent | 2d8ed1812b98fe0af65fccf2e1565e724a93d701 (diff) | |
Fixed Atmos DataEssenceCoding UL
| -rw-r--r-- | src/AS_DCP_ATMOS.cpp | 9 | ||||
| -rwxr-xr-x | src/Dict.cpp | 47 |
2 files changed, 50 insertions, 6 deletions
diff --git a/src/AS_DCP_ATMOS.cpp b/src/AS_DCP_ATMOS.cpp index a016f27..2fc7d56 100644 --- a/src/AS_DCP_ATMOS.cpp +++ b/src/AS_DCP_ATMOS.cpp @@ -248,7 +248,7 @@ ASDCP::ATMOS::MXFReader::h__Reader::ReadFrame(ui32_t FrameNum, FrameBuffer& Fram ASDCP::ATMOS::MXFReader::MXFReader() { - m_Reader = new h__Reader(DefaultSMPTEDict()); + m_Reader = new h__Reader(AtmosSMPTEDict()); } @@ -427,8 +427,7 @@ ASDCP::ATMOS::MXFWriter::h__Writer::DCData_DDesc_to_MD(ASDCP::DCData::DCDataDesc DDescObj->SampleRate = DDesc.EditRate; DDescObj->ContainerDuration = DDesc.ContainerDuration; - DDescObj->DataEssenceCoding.Set(DDesc.DataEssenceCoding); - + DDescObj->DataEssenceCoding.Set(DDesc.DataEssenceCoding); return RESULT_OK; } @@ -554,7 +553,7 @@ ASDCP::ATMOS::MXFWriter::h__Writer::WriteFrame(const FrameBuffer& FrameBuf, ui64_t StreamOffset = m_StreamOffset; if ( ASDCP_SUCCESS(result) ) - result = WriteEKLVPacket(FrameBuf, m_EssenceUL, Ctx, HMAC); + result = WriteEKLVPacket(FrameBuf, m_EssenceUL, MXF_BER_LENGTH, Ctx, HMAC); if ( ASDCP_SUCCESS(result) ) { @@ -648,7 +647,7 @@ ASDCP::ATMOS::MXFWriter::OpenWrite(const std::string& filename, const WriterInfo return RESULT_FORMAT; } - m_Writer = new h__Writer(DefaultSMPTEDict()); + m_Writer = new h__Writer(AtmosSMPTEDict()); m_Writer->m_Info = Info; Result_t result = m_Writer->OpenWrite(filename, HeaderSize, ADesc); diff --git a/src/Dict.cpp b/src/Dict.cpp index fbf76b0..752b81a 100755 --- a/src/Dict.cpp +++ b/src/Dict.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2006-2016, John Hurst +Copyright (c) 2006-2018, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -136,6 +136,38 @@ ASDCP::SMPTE_390_OPAtom_Entry() { return s_MDD_Table[MDD_OPAtom]; } +// +// +static ASDCP::Dictionary s_AtmosSMPTEDict; +static Kumu::Mutex s_AtmosSMPTEDictLock; +static bool s_AtmosSMPTEDictInit = false; + +// +const ASDCP::Dictionary& +ASDCP::AtmosSMPTEDict() +{ + if ( ! s_AtmosSMPTEDictInit ) + { + Kumu::AutoMutex AL(s_AtmosSMPTEDictLock); + + if ( ! s_AtmosSMPTEDictInit ) + { + s_AtmosSMPTEDict.Init(); + + s_AtmosSMPTEDict.DeleteEntry(MDD_MXFInterop_OPAtom); + s_AtmosSMPTEDict.DeleteEntry(MDD_MXFInterop_CryptEssence); + s_AtmosSMPTEDict.DeleteEntry(MDD_MXFInterop_GenericDescriptor_SubDescriptors); + + // legacy Atmos files have the wrong version byte + assert(s_AtmosSMPTEDict.Type(MDD_GenericDataEssenceDescriptor_DataEssenceCoding).ul[7] == 0x03); + s_AtmosSMPTEDict.MutableType(MDD_GenericDataEssenceDescriptor_DataEssenceCoding).ul[7] = 0x05; + + s_AtmosSMPTEDictInit = true; + } + } + + return s_AtmosSMPTEDict; +} //------------------------------------------------------------------------------------------ // @@ -253,6 +285,19 @@ ASDCP::Dictionary::Type(MDD_t type_id) const } // +ASDCP::MDDEntry& +ASDCP::Dictionary::MutableType(MDD_t type_id) +{ + assert(m_MDD_Table[0].name[0]); + std::map<ui32_t, ASDCP::UL>::iterator rii = m_md_rev_lookup.find(type_id); + + if ( rii == m_md_rev_lookup.end() ) + Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL type_id: %d\n", type_id); + + return m_MDD_Table[type_id]; +} + +// const ASDCP::MDDEntry* ASDCP::Dictionary::FindULAnyVersion(const byte_t* ul_buf) const { |
