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 /* ------------------------------------------------------------------- */ 20 /* MPEG-4 AudioSampleEntry Class */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 This AudioSampleEntry Class is used for visual streams. 25 */ 26 27 28 #ifndef AUDIOSAMPLEENTRY_H_INCLUDED 29 #define AUDIOSAMPLEENTRY_H_INCLUDED 30 31 #ifndef OSCL_FILE_IO_H_INCLUDED 32 #include "oscl_file_io.h" 33 #endif 34 #ifndef SAMPLEENTRY_H_INCLUDED 35 #include "sampleentry.h" 36 #endif 37 #ifndef ESDATOM_H_INCLUDED 38 #include "esdatom.h" 39 #endif 40 41 class AudioSampleEntry : public SampleEntry 42 { 43 44 public: 45 AudioSampleEntry(MP4_FF_FILE *fp, uint32 size, uint32 type); 46 virtual ~AudioSampleEntry(); 47 48 // Member gets and sets getESDAtom()49 const ESDAtom &getESDAtom() const 50 { 51 return *_pes; 52 } 53 getTimeScale()54 uint16 getTimeScale() 55 { 56 return _timeScale; 57 } 58 getSampleRate()59 uint16 getSampleRate() 60 { 61 return _sampleRateHi; 62 } 63 getChannelCount()64 uint16 getChannelCount() 65 { 66 return _channelCount; 67 } 68 getESID()69 virtual uint32 getESID() const 70 { 71 if (_pes != NULL) 72 { 73 if (_pes->getESDescriptorPtr() != NULL) 74 { 75 return _pes->getESDescriptorPtr()->getESID(); 76 } 77 else 78 { 79 return 0; 80 } 81 } 82 else 83 { 84 return 0; 85 } 86 } 87 getESDescriptor()88 virtual const ESDescriptor *getESDescriptor() const 89 { 90 if (_pes != NULL) 91 { 92 return _pes->getESDescriptorPtr(); 93 } 94 else 95 { 96 return NULL; 97 } 98 } 99 getObjectTypeIndication()100 virtual uint8 getObjectTypeIndication() const 101 { 102 if (_pes != NULL) 103 { 104 return _pes->getObjectTypeIndication(); 105 } 106 else 107 { 108 return 0xFF; 109 } 110 } 111 getDecoderSpecificInfo()112 virtual DecoderSpecificInfo *getDecoderSpecificInfo() const 113 { 114 if (_pes != NULL) 115 { 116 return _pes->getDecoderSpecificInfo(); 117 } 118 else 119 { 120 return NULL; 121 } 122 } 123 getAverageBitrate()124 virtual uint32 getAverageBitrate() const 125 { 126 if (_pes != NULL) 127 { 128 return _pes->getAverageBitrate(); 129 } 130 else 131 { 132 return 0; 133 } 134 } 135 getMaxBitrate()136 virtual uint32 getMaxBitrate() const 137 { 138 if (_pes != NULL) 139 { 140 return _pes->getMaxBitrate(); 141 } 142 else 143 { 144 return 0; 145 } 146 } 147 148 // Get the max size buffer needed to retrieve the media samples getMaxBufferSizeDB()149 uint32 getMaxBufferSizeDB() const 150 { 151 if (_pes != NULL) 152 { 153 return _pes->getMaxBufferSizeDB(); 154 } 155 else 156 { 157 return 0; 158 } 159 } 160 161 162 private: 163 // Reserved constants 164 uint32 _reserved1[2]; 165 uint16 _channelCount; 166 uint16 _sampleSize; 167 uint16 _preDefined; 168 uint16 _reserved; 169 uint16 _sampleRateLo; 170 uint16 _timeScale; //sampleRateHi = TimeScale of track 171 uint16 _sampleRateHi; //Either sampleRateHi or TimeScale will be read from the file 172 173 ESDAtom *_pes; 174 }; 175 176 177 #endif // AUDIOSAMPLEENTRY_H_INCLUDED 178 179 180