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_DataEntryUrlAtom Class contains a table of data references which declare 20 the location of the media data used within the MPEG-4 presentation. 21 */ 22 23 #define IMPLEMENT_DataEntryUrlAtom_H__ 24 25 #include "dataentryurlatom.h" 26 #include "a_atomdefs.h" 27 #include "atomutils.h" 28 29 // Constructor PVA_FF_DataEntryUrlAtom(uint32 selfContained)30PVA_FF_DataEntryUrlAtom::PVA_FF_DataEntryUrlAtom(uint32 selfContained) 31 : PVA_FF_DataEntryAtom(DATA_ENTRY_URL_ATOM, (uint8)0, selfContained) 32 { 33 recomputeSize(); 34 } 35 36 // Destructor ~PVA_FF_DataEntryUrlAtom()37PVA_FF_DataEntryUrlAtom::~PVA_FF_DataEntryUrlAtom() 38 { 39 // Empty 40 } 41 42 43 // Rendering the PVA_FF_Atom in proper format (bitlengths, etc.) to an ostream 44 bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP * fp)45PVA_FF_DataEntryUrlAtom::renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp) 46 { 47 int32 rendered = 0; 48 49 if (!renderAtomBaseMembers(fp)) 50 { 51 return false; 52 } 53 rendered += getDefaultSize(); 54 55 if (getFlags() != 1) 56 { 57 // media NOT self contained 58 if (!PVA_FF_AtomUtils::renderNullTerminatedString(fp, getLocation())) 59 { 60 return false; 61 } 62 rendered += _location.get_size() + 1; // 1 for null termination 63 } 64 65 return true; 66 } 67 68 69 70 void recomputeSize()71PVA_FF_DataEntryUrlAtom::recomputeSize() 72 { 73 int32 size = getDefaultSize(); 74 75 if (getFlags() != 1) // media NOT self contained 76 { 77 size += _location.get_size() + 1; // 1 for null termination 78 } 79 80 _size = size; 81 82 } 83 84 85