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_SampleDescriptionAtom Class gives detailed information about the codeing 20 type used, and any initialization information needed for coding. 21*/ 22 23 24#ifndef __SampleDescriptionAtom_H__ 25#define __SampleDescriptionAtom_H__ 26 27#include "a_atomdefs.h" 28#include "fullatom.h" 29#include "sampleentry.h" 30#include "esdescriptor.h" 31#include "decoderspecificinfo.h" 32 33 34class PVA_FF_SampleDescriptionAtom : public PVA_FF_FullAtom 35{ 36 37 public: 38 PVA_FF_SampleDescriptionAtom(uint32 mediaType, 39 int32 codecType, 40 uint32 protocol = 0, 41 uint8 profile = 1, 42 uint8 profileComp = 0xFF, 43 uint8 level = 0xFF); // Constructor 44 45 virtual ~PVA_FF_SampleDescriptionAtom(); 46 47 void init(int32 mediaType, 48 uint32 protocol, 49 uint8 profile, 50 uint8 profileComp, 51 uint8 level); 52 53 int32 nextSample(uint32 size, uint8 flags); 54 int32 nextTextSample(uint32 size, uint8 flags, int32 index); 55 56 // Member gets and sets 57 uint32 getEntryCount() const 58 { 59 return _entryCount; 60 } 61 uint32 getHandlerType() const 62 { 63 return _handlerType; 64 } 65 66 // Stream properties 67 void setTargetBitrate(uint32 avgBitRate, uint32 maxBitRate, uint32 bufferSizeDB); 68 69 void addSampleEntry(PVA_FF_SampleEntry *entry); 70 void insertSampleEntryAt(int32 index, PVA_FF_SampleEntry *entry); 71 void replaceSampleEntryAt(int32 index, PVA_FF_SampleEntry *entry); 72 Oscl_Vector<PVA_FF_SampleEntry*, OsclMemAllocator>& getSampleEntries() const 73 { 74 return *_psampleEntryVec; 75 } 76 const PVA_FF_SampleEntry* getSampleEntryAt(int32 index) const; 77 PVA_FF_SampleEntry* getMutableSampleEntryAt(int32 index); 78 79 // Getting and setting the Mpeg4 VOL header 80 void addDecoderSpecificInfo(PVA_FF_DecoderSpecificInfo *pinfo); 81 82 // Getting and setting the Mpeg4 VOL header for Timed text 83 void addTextDecoderSpecificInfo(PVA_FF_TextSampleDescInfo *pinfo); 84 85 void setMaxBufferSizeDB(uint32 max); 86 87 // Rendering the PVA_FF_Atom in proper format (bitlengths, etc.) to an ostream 88 virtual bool renderToFileStream(MP4_AUTHOR_FF_FILE_IO_WRAP *fp); 89 90 void setTimeScale(uint32 ts) 91 { 92 _mediaTimeScale = ts; 93 } 94 95 void setVideoParams(uint32 frame_width, uint32 frame_height) 96 { 97 _frame_width = (uint16)frame_width; 98 _frame_height = (uint16)frame_height; 99 } 100 101 void setAudioEncodeParams(PVMP4FFComposerAudioEncodeParams &audioParams); 102 103 void setH263ProfileLevel(uint8 profile, uint8 level) 104 { 105 _h263Profile = profile; 106 _h263Level = level; 107 } 108 109 void setESID(uint16 esid) 110 { 111 for (uint32 i = 0; i < _psampleEntryVec->size(); i++) 112 { 113 (*_psampleEntryVec)[i]->setESID(esid); 114 } 115 } 116 117 void SetMaxSampleSize(uint32); 118 void writeMaxSampleSize(MP4_AUTHOR_FF_FILE_IO_WRAP*); 119 120 protected: 121 virtual void recomputeSize(); 122 123 private: 124 uint32 _entryCount; 125 uint32 _handlerType; // Do NOT render this member or use it in a size calc 126 Oscl_Vector<PVA_FF_SampleEntry*, OsclMemAllocator> *_psampleEntryVec; // Careful with vector access and cleanup! 127 128 int32 _mediaType; 129 int32 _currAudioBitrate; 130 int32 _codecType; 131 132 uint32 _mediaTimeScale; 133 134 uint16 _frame_width; 135 uint16 _frame_height; 136 uint8 _h263Profile; 137 uint8 _h263Level; 138 139 bool _textflag; 140 uint32 _text_sample_num; 141 //vectors stores the information specific to the timed text file format. 142 Oscl_Vector<int32, OsclMemAllocator> _SDIndex; 143 144 Oscl_Vector<uint32, OsclMemAllocator> *_psampleEntryTypeVec; // Careful with vector access and cleanup! 145}; 146 147 148#endif 149 150