1 /***************************************************************** 2 | 3 | AP4 - ohdr Atom 4 | 5 | Copyright 2002-2008 Axiomatic Systems, LLC 6 | 7 | 8 | This file is part of Bento4/AP4 (MP4 Atom Processing Library). 9 | 10 | Unless you have obtained Bento4 under a difference license, 11 | this version of Bento4 is Bento4|GPL. 12 | Bento4|GPL is free software; you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; either version 2, or (at your option) 15 | any later version. 16 | 17 | Bento4|GPL is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with Bento4|GPL; see the file COPYING. If not, write to the 24 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 25 | 02111-1307, USA. 26 | 27 ****************************************************************/ 28 29 #ifndef _AP4_OHDR_ATOM_H_ 30 #define _AP4_OHDR_ATOM_H_ 31 32 /*---------------------------------------------------------------------- 33 | includes 34 +---------------------------------------------------------------------*/ 35 #include "Ap4Types.h" 36 #include "Ap4Atom.h" 37 #include "Ap4ContainerAtom.h" 38 #include "Ap4String.h" 39 #include "Ap4OmaDcf.h" 40 41 /*---------------------------------------------------------------------- 42 | constants 43 +---------------------------------------------------------------------*/ 44 const AP4_UI08 AP4_OMA_DCF_ENCRYPTION_METHOD_NULL = 0; 45 const AP4_UI08 AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CBC = 1; 46 const AP4_UI08 AP4_OMA_DCF_ENCRYPTION_METHOD_AES_CTR = 2; 47 48 const AP4_UI08 AP4_OMA_DCF_PADDING_SCHEME_NONE = 0; 49 const AP4_UI08 AP4_OMA_DCF_PADDING_SCHEME_RFC_2630 = 1; 50 51 /*---------------------------------------------------------------------- 52 | AP4_OhdrAtom 53 +---------------------------------------------------------------------*/ 54 class AP4_OhdrAtom : public AP4_ContainerAtom, public AP4_OmaDrmInfo 55 { 56 public: 57 AP4_IMPLEMENT_DYNAMIC_CAST_D2(AP4_OhdrAtom, AP4_ContainerAtom, AP4_OmaDrmInfo) 58 59 // class methods 60 static AP4_OhdrAtom* Create(AP4_Size size, 61 AP4_ByteStream& stream, 62 AP4_AtomFactory& atom_factory); 63 64 // constructor 65 AP4_OhdrAtom(AP4_UI08 encryption_method, 66 AP4_UI08 padding_scheme, 67 AP4_UI64 plaintext_length, 68 const char* content_id, 69 const char* rights_issuer_url, 70 const AP4_Byte* textual_headers, 71 AP4_Size textual_headers_size); 72 73 // methods 74 virtual AP4_Result InspectFields(AP4_AtomInspector& inspector); 75 virtual AP4_Result WriteFields(AP4_ByteStream& stream); 76 virtual AP4_Atom* Clone(); 77 78 // accessors GetEncryptionMethod()79 AP4_UI08 GetEncryptionMethod() const { return m_EncryptionMethod; } SetEncryptionMethod(AP4_UI08 encryption_method)80 void SetEncryptionMethod(AP4_UI08 encryption_method) { m_EncryptionMethod = encryption_method; } GetPaddingScheme()81 AP4_UI08 GetPaddingScheme() const { return m_PaddingScheme; } SetPaddingScheme(AP4_UI08 padding_scheme)82 void SetPaddingScheme(AP4_UI08 padding_scheme) { m_PaddingScheme = padding_scheme; } GetPlaintextLength()83 AP4_UI64 GetPlaintextLength() const { return m_PlaintextLength; } 84 85 // AP4_OmaDrmInfo implementation GetContentId()86 const AP4_String& GetContentId() const { return m_ContentId; } GetRightsIssuerUrl()87 const AP4_String& GetRightsIssuerUrl() const { return m_RightsIssuerUrl; } GetTextualHeaders()88 const AP4_DataBuffer& GetTextualHeaders() const { return m_TextualHeaders; } 89 90 private: 91 // methods 92 AP4_OhdrAtom(AP4_UI32 size, 93 AP4_UI08 version, 94 AP4_UI32 flags, 95 AP4_ByteStream& stream, 96 AP4_AtomFactory& atom_factory); 97 98 // members 99 AP4_UI08 m_EncryptionMethod; 100 AP4_UI08 m_PaddingScheme; 101 AP4_UI64 m_PlaintextLength; 102 AP4_String m_ContentId; 103 AP4_String m_RightsIssuerUrl; 104 AP4_DataBuffer m_TextualHeaders; 105 }; 106 107 #endif // _AP4_OHDR_ATOM_H_ 108