diff options
| author | jhurst <jhurst@cinecert.com> | 2013-06-17 17:55:54 +0000 |
|---|---|---|
| committer | jhurst <> | 2013-06-17 17:55:54 +0000 |
| commit | ba6e57635ce6482fa9dcd6a824b579edb459b834 (patch) | |
| tree | f354c0297a4233f9cb89396b2fa9fac893ba8140 /src/AS_02_internal.h | |
| parent | e54f387729bacc2d3e8c93aeb59ee45181d6f714 (diff) | |
tweezes
Diffstat (limited to 'src/AS_02_internal.h')
| -rw-r--r-- | src/AS_02_internal.h | 131 |
1 files changed, 73 insertions, 58 deletions
diff --git a/src/AS_02_internal.h b/src/AS_02_internal.h index cf9c368..748e795 100644 --- a/src/AS_02_internal.h +++ b/src/AS_02_internal.h @@ -1,28 +1,30 @@ /* - Copyright (c) 2011-2013, Robert Scheler, Heiko Sparenberg Fraunhofer IIS, John Hurst - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Copyright (c) 2011-2013, Robert Scheler, Heiko Sparenberg Fraunhofer IIS, +John Hurst + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*! \file AS_02_internal.h \version $Id: AS_02_internal.h *** @@ -50,34 +52,35 @@ namespace AS_02 void default_md_object_init(); - - // - class AS02IndexWriter : public ASDCP::MXF::Partition - { - ASDCP::MXF::IndexTableSegment* m_CurrentSegment; - ui32_t m_BytesPerEditUnit; - ASDCP::MXF::Rational m_EditRate; - - KM_NO_COPY_CONSTRUCT(AS02IndexWriter); - AS02IndexWriter(); - - public: - const ASDCP::Dictionary*& m_Dict; - Kumu::fpos_t m_ECOffset; - ASDCP::IPrimerLookup* m_Lookup; + namespace MXF + { + // + class AS02IndexWriter : public ASDCP::MXF::Partition + { + ASDCP::MXF::IndexTableSegment* m_CurrentSegment; + ui32_t m_BytesPerEditUnit; + ASDCP::MXF::Rational m_EditRate; + + KM_NO_COPY_CONSTRUCT(AS02IndexWriter); + AS02IndexWriter(); + + public: + const ASDCP::Dictionary*& m_Dict; + ASDCP::IPrimerLookup* m_Lookup; - AS02IndexWriter(const ASDCP::Dictionary*&); - virtual ~AS02IndexWriter(); + AS02IndexWriter(const ASDCP::Dictionary*&); + virtual ~AS02IndexWriter(); - Result_t WriteToFile(Kumu::FileWriter& Writer); - void ResetCBR(Kumu::fpos_t offset); - void Dump(FILE* = 0); + Result_t WriteToFile(Kumu::FileWriter& Writer); + void ResetCBR(Kumu::fpos_t offset); + void Dump(FILE* = 0); - ui32_t GetDuration() const; - void PushIndexEntry(const ASDCP::MXF::IndexTableSegment::IndexEntry&); - void SetIndexParamsCBR(ASDCP::IPrimerLookup* lookup, ui32_t size, const ASDCP::Rational& Rate); - void SetIndexParamsVBR(ASDCP::IPrimerLookup* lookup, const ASDCP::Rational& Rate, Kumu::fpos_t offset); - }; + ui32_t GetDuration() const; + void PushIndexEntry(const ASDCP::MXF::IndexTableSegment::IndexEntry&); + void SetIndexParamsCBR(ASDCP::IPrimerLookup* lookup, ui32_t size, const ASDCP::Rational& Rate); + void SetIndexParamsVBR(ASDCP::IPrimerLookup* lookup, const ASDCP::Rational& Rate, Kumu::fpos_t offset); + }; + } // class h__AS02Reader : public ASDCP::MXF::TrackFileReader<ASDCP::MXF::OP1aHeader, AS_02::MXF::AS02IndexReader> @@ -86,20 +89,21 @@ namespace AS_02 h__AS02Reader(); public: - // Partition *m_pCurrentBodyPartition; - // ui64_t m_EssenceStart; - // std::vector<Partition*> m_BodyPartList; - // ui32_t m_start_pos; - h__AS02Reader(const ASDCP::Dictionary&); virtual ~h__AS02Reader(); Result_t OpenMXFRead(const char* filename); + // USE FRAME WRAPPING... Result_t ReadEKLVFrame(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf, const byte_t* EssenceUL, ASDCP::AESDecContext* Ctx, ASDCP::HMACContext* HMAC); - Result_t LocateFrame(ui32_t FrameNum, Kumu::fpos_t& streamOffset, i8_t& temporalOffset, i8_t& keyFrameOffset); + // OR CLIP WRAPPING... + // clip wrapping is handled directly by the essence-specific classes + // Result_t ReadyClip(const ui32_t& FrameNum, const byte_t* EssenceUL, ASDCP::AESDecContext* Ctx, ASDCP::HMACContext* HMAC, ui64_t& position); + /// Result_t ReadClipBlock(ASDCP::FrameBuffer& FrameBuf, const ui32_t& read_size); + + // NOT BOTH! }; // @@ -109,9 +113,11 @@ namespace AS_02 h__AS02Writer(); public: - AS02IndexWriter m_IndexWriter; - ui32_t m_PartitionSpace; // edit units per partition - IndexStrategy_t m_IndexStrategy; //Shim parameter index_strategy_frame/clip + ui64_t m_ECStart; // offset of the first essence element + ui64_t m_ClipStart; // state variable for clip-wrap-in-progress + ui32_t m_PartitionSpace; // edit units per partition + AS_02::MXF::AS02IndexWriter m_IndexWriter; + IndexStrategy_t m_IndexStrategy; // per SMPTE ST 2067-5 h__AS02Writer(const Dictionary&); virtual ~h__AS02Writer(); @@ -122,9 +128,18 @@ namespace AS_02 const ASDCP::UL& DataDefinition, const ASDCP::Rational& EditRate, ui32_t TCFrameRate, ui32_t BytesPerEditUnit = 0); + // USE FRAME WRAPPING... Result_t WriteEKLVPacket(const ASDCP::FrameBuffer& FrameBuf,const byte_t* EssenceUL, AESEncContext* Ctx, HMACContext* HMAC); + // OR CLIP WRAPPING... + bool HasOpenClip() const; + Result_t StartClip(const byte_t* EssenceUL, AESEncContext* Ctx, HMACContext* HMAC); + Result_t WriteClipBlock(const ASDCP::FrameBuffer& FrameBuf); + Result_t FinalizeClip(ui32_t bytes_per_frame); + + // NOT BOTH! + Result_t WriteAS02Footer(); }; |
