1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /* 19 This PVA_FF_FullAtom Class fp the base class for some Atoms in the MPEG-4 File 20 Format. 21 */ 22 23 24 #define IMPLEMENT_FullAtom 25 26 #include "fullatom.h" 27 #include "atomutils.h" 28 29 const uint32 DEFAULT_FULL_ATOM_SIZE = 12; // (8 bytes from PVA_FF_Atom + 1 for 30 // version and 3 for flags) 31 32 // Constructor 33 PVA_FF_FullAtom::PVA_FF_FullAtom(uint32 type, uint8 version, uint32 flags) 34 : PVA_FF_Atom(type) 35 { 36 _version = version; 37 _flags = flags; 38 } 39 40 // Desctuctor 41 PVA_FF_FullAtom::~PVA_FF_FullAtom() 42 { 43 // Empty 44 } 45 46 inline uint32 47 PVA_FF_FullAtom::getDefaultSize() const 48 { 49 return DEFAULT_FULL_ATOM_SIZE; 50 } 51 52 bool 53 PVA_FF_FullAtom::renderAtomBaseMembers(MP4_AUTHOR_FF_FILE_IO_WRAP *fp) const 54 { 55 // Render PVA_FF_Atom size 56 if (!PVA_FF_AtomUtils::render32(fp, getSize())) 57 { 58 return false; 59 } 60 61 // Render PVA_FF_Atom type (MOVIE_ATOM) 62 if (!PVA_FF_AtomUtils::render32(fp, getType())) 63 { 64 return false; 65 } 66 67 // Render Version 68 if (!PVA_FF_AtomUtils::render8(fp, getVersion())) 69 { 70 return false; 71 } 72 73 // Render flags 74 if (!PVA_FF_AtomUtils::render24(fp, getFlags())) 75 { 76 return false; 77 } 78 79 return true; 80 } 81 82 83