1 /***************************************************************** 2 | 3 | AP4 - hvcC Atoms 4 | 5 | Copyright 2002-2014 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_HVCC_ATOM_H_ 30 #define _AP4_HVCC_ATOM_H_ 31 32 /*---------------------------------------------------------------------- 33 | includes 34 +---------------------------------------------------------------------*/ 35 #include "Ap4Atom.h" 36 #include "Ap4Array.h" 37 38 /*---------------------------------------------------------------------- 39 | constants 40 +---------------------------------------------------------------------*/ 41 const AP4_UI08 AP4_HEVC_PROFILE_MAIN = 1; 42 const AP4_UI08 AP4_HEVC_PROFILE_MAIN_10 = 2; 43 const AP4_UI08 AP4_HEVC_PROFILE_MAIN_STILL_PICTURE = 3; 44 const AP4_UI08 AP4_HEVC_PROFILE_REXT = 4; 45 46 const AP4_UI08 AP4_HEVC_CHROMA_FORMAT_MONOCHROME = 0; 47 const AP4_UI08 AP4_HEVC_CHROMA_FORMAT_420 = 1; 48 const AP4_UI08 AP4_HEVC_CHROMA_FORMAT_422 = 2; 49 const AP4_UI08 AP4_HEVC_CHROMA_FORMAT_444 = 3; 50 51 /*---------------------------------------------------------------------- 52 | AP4_HvccAtom 53 +---------------------------------------------------------------------*/ 54 class AP4_HvccAtom : public AP4_Atom 55 { 56 public: AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_HvccAtom,AP4_Atom)57 AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_HvccAtom, AP4_Atom) 58 59 // types 60 class Sequence { 61 public: 62 AP4_UI08 m_ArrayCompleteness; 63 AP4_UI08 m_Reserved; 64 AP4_UI08 m_NaluType; 65 AP4_Array<AP4_DataBuffer> m_Nalus; 66 }; 67 68 // class methods 69 static AP4_HvccAtom* Create(AP4_Size size, AP4_ByteStream& stream); 70 static const char* GetProfileName(AP4_UI08 profile_space, AP4_UI08 profile); 71 static const char* GetChromaFormatName(AP4_UI08 chroma_format); 72 73 // constructors 74 AP4_HvccAtom(); 75 AP4_HvccAtom(const AP4_HvccAtom& other); // copy construtor 76 AP4_HvccAtom(AP4_UI08 general_profile_space, 77 AP4_UI08 general_tier_flag, 78 AP4_UI08 general_profile, 79 AP4_UI32 general_profile_compatibility_flags, 80 AP4_UI64 general_constraint_indicator_flags, 81 AP4_UI08 general_level, 82 AP4_UI32 min_spatial_segmentation, 83 AP4_UI08 parallelism_type, 84 AP4_UI08 chroma_format, 85 AP4_UI08 luma_bit_depth, 86 AP4_UI08 chroma_bit_depth, 87 AP4_UI16 average_frame_rate, 88 AP4_UI08 constant_frame_rate, 89 AP4_UI08 num_temporal_layers, 90 AP4_UI08 temporal_id_nested, 91 AP4_UI08 nalu_length_size, 92 const AP4_Array<AP4_DataBuffer>& video_parameters, 93 AP4_UI08 video_parameters_completeness, 94 const AP4_Array<AP4_DataBuffer>& sequence_parameters, 95 AP4_UI08 sequence_parameters_completeness, 96 const AP4_Array<AP4_DataBuffer>& picture_parameters, 97 AP4_UI08 picture_parameters_completeness); 98 99 // methods 100 virtual AP4_Result InspectFields(AP4_AtomInspector& inspector); 101 virtual AP4_Result WriteFields(AP4_ByteStream& stream); 102 103 // accessors GetConfigurationVersion()104 AP4_UI08 GetConfigurationVersion() const { return m_ConfigurationVersion; } GetGeneralProfileSpace()105 AP4_UI08 GetGeneralProfileSpace() const { return m_GeneralProfileSpace; } GetGeneralTierFlag()106 AP4_UI08 GetGeneralTierFlag() const { return m_GeneralTierFlag; } GetGeneralProfile()107 AP4_UI08 GetGeneralProfile() const { return m_GeneralProfile; } GetGeneralProfileCompatibilityFlags()108 AP4_UI32 GetGeneralProfileCompatibilityFlags() const { return m_GeneralProfileCompatibilityFlags; } GetGeneralConstraintIndicatorFlags()109 AP4_UI64 GetGeneralConstraintIndicatorFlags() const { return m_GeneralConstraintIndicatorFlags; } GetGeneralLevel()110 AP4_UI08 GetGeneralLevel() const { return m_GeneralLevel; } GetMinSpatialSegmentation()111 AP4_UI32 GetMinSpatialSegmentation() const { return m_MinSpatialSegmentation; } GetParallelismType()112 AP4_UI08 GetParallelismType() const { return m_ParallelismType; } GetChromaFormat()113 AP4_UI08 GetChromaFormat() const { return m_ChromaFormat; } GetLumaBitDepth()114 AP4_UI08 GetLumaBitDepth() const { return m_LumaBitDepth; } GetChromaBitDepth()115 AP4_UI08 GetChromaBitDepth() const { return m_ChromaBitDepth; } GetAverageFrameRate()116 AP4_UI16 GetAverageFrameRate() const { return m_AverageFrameRate; } GetConstantFrameRate()117 AP4_UI08 GetConstantFrameRate() const { return m_ConstantFrameRate; } GetNumTemporalLayers()118 AP4_UI08 GetNumTemporalLayers() const { return m_NumTemporalLayers; } GetTemporalIdNested()119 AP4_UI08 GetTemporalIdNested() const { return m_TemporalIdNested; } GetNaluLengthSize()120 AP4_UI08 GetNaluLengthSize() const { return m_NaluLengthSize; } GetSequences()121 const AP4_Array<Sequence>& GetSequences() const { return m_Sequences; } GetRawBytes()122 const AP4_DataBuffer& GetRawBytes() const { return m_RawBytes; } 123 124 private: 125 // methods 126 AP4_HvccAtom(AP4_UI32 size, const AP4_UI08* payload); 127 void UpdateRawBytes(); 128 129 // members 130 AP4_UI08 m_ConfigurationVersion; 131 AP4_UI08 m_GeneralProfileSpace; 132 AP4_UI08 m_GeneralTierFlag; 133 AP4_UI08 m_GeneralProfile; 134 AP4_UI32 m_GeneralProfileCompatibilityFlags; 135 AP4_UI64 m_GeneralConstraintIndicatorFlags; 136 AP4_UI08 m_GeneralLevel; 137 AP4_UI08 m_Reserved1; 138 AP4_UI32 m_MinSpatialSegmentation; 139 AP4_UI08 m_Reserved2; 140 AP4_UI08 m_ParallelismType; 141 AP4_UI08 m_Reserved3; 142 AP4_UI08 m_ChromaFormat; 143 AP4_UI08 m_Reserved4; 144 AP4_UI08 m_LumaBitDepth; 145 AP4_UI08 m_Reserved5; 146 AP4_UI08 m_ChromaBitDepth; 147 AP4_UI16 m_AverageFrameRate; 148 AP4_UI08 m_ConstantFrameRate; 149 AP4_UI08 m_NumTemporalLayers; 150 AP4_UI08 m_TemporalIdNested; 151 AP4_UI08 m_NaluLengthSize; 152 AP4_Array<Sequence> m_Sequences; 153 AP4_DataBuffer m_RawBytes; 154 }; 155 156 #endif // _AP4_HVCC_ATOM_H_ 157