#include "MPEG4LATMAudioRTPSource.hh"Include dependency graph for MPEG4LATMAudioRTPSource.cpp:

Go to the source code of this file.
Data Structures | |
| class | LATMBufferedPacket |
| class | LATMBufferedPacketFactory |
Functions | |
| static Boolean | getNibble (char const *&configStr, unsigned char &resultNibble) |
| static Boolean | getByte (char const *&configStr, unsigned char &resultByte) |
| Boolean | parseStreamMuxConfigStr (char const *configStr, Boolean &audioMuxVersion, Boolean &allStreamsSameTimeFraming, unsigned char &numSubFrames, unsigned char &numProgram, unsigned char &numLayer, unsigned char *&audioSpecificConfig, unsigned &audioSpecificConfigSize) |
| unsigned char * | parseStreamMuxConfigStr (char const *configStr, unsigned &audioSpecificConfigSize) |
| unsigned char * | parseGeneralConfigStr (char const *configStr, unsigned &configSize) |
| static Boolean getByte | ( | char const *& | configStr, | |
| unsigned char & | resultByte | |||
| ) | [static] |
Definition at line 147 of file MPEG4LATMAudioRTPSource.cpp.
References False, getNibble(), and True.
Referenced by parseGeneralConfigStr(), and parseStreamMuxConfigStr().
00147 { 00148 resultByte = 0; // by default, in case parsing fails 00149 00150 unsigned char firstNibble; 00151 if (!getNibble(configStr, firstNibble)) return False; 00152 resultByte = firstNibble<<4; 00153 00154 unsigned char secondNibble = 0; 00155 if (!getNibble(configStr, secondNibble) && configStr[0] != '\0') { 00156 // There's a second nibble, but it's malformed 00157 return False; 00158 } 00159 resultByte |= secondNibble; 00160 00161 return True; 00162 }
| static Boolean getNibble | ( | char const *& | configStr, | |
| unsigned char & | resultNibble | |||
| ) | [static] |
Definition at line 128 of file MPEG4LATMAudioRTPSource.cpp.
Referenced by getByte().
00129 { 00130 char c = configStr[0]; 00131 if (c == '\0') return False; // we've reached the end 00132 00133 if (c >= '0' && c <= '9') { 00134 resultNibble = c - '0'; 00135 } else if (c >= 'A' && c <= 'F') { 00136 resultNibble = 10 + c - 'A'; 00137 } else if (c >= 'a' && c <= 'f') { 00138 resultNibble = 10 + c - 'a'; 00139 } else { 00140 return False; 00141 } 00142 00143 ++configStr; // move to the next nibble 00144 return True; 00145 }
| unsigned char* parseGeneralConfigStr | ( | char const * | configStr, | |
| unsigned & | configSize | |||
| ) |
Definition at line 241 of file MPEG4LATMAudioRTPSource.cpp.
References getByte(), and NULL.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), MPEG4ESVideoRTPSink::MPEG4ESVideoRTPSink(), samplingFrequencyFromAudioSpecificConfig(), MPEG4VideoStreamFramer::setConfigInfo(), and setupStreams().
00242 : 00243 unsigned& configSize) { 00244 unsigned char* config = NULL; 00245 do { 00246 if (configStr == NULL) break; 00247 configSize = (strlen(configStr)+1)/2; 00248 00249 config = new unsigned char[configSize]; 00250 if (config == NULL) break; 00251 00252 unsigned i; 00253 for (i = 0; i < configSize; ++i) { 00254 if (!getByte(configStr, config[i])) break; 00255 } 00256 if (i != configSize) break; // part of the string was bad 00257 00258 return config; 00259 } while (0); 00260 00261 configSize = 0; 00262 delete[] config; 00263 return NULL; 00264 } }
| unsigned char* parseStreamMuxConfigStr | ( | char const * | configStr, | |
| unsigned & | audioSpecificConfigSize | |||
| ) |
Definition at line 223 of file MPEG4LATMAudioRTPSource.cpp.
References NULL, and parseStreamMuxConfigStr().
00224 : 00225 unsigned& audioSpecificConfigSize) { 00226 Boolean audioMuxVersion, allStreamsSameTimeFraming; 00227 unsigned char numSubFrames, numProgram, numLayer; 00228 unsigned char* audioSpecificConfig; 00229 00230 if (!parseStreamMuxConfigStr(configStr, 00231 audioMuxVersion, allStreamsSameTimeFraming, 00232 numSubFrames, numProgram, numLayer, 00233 audioSpecificConfig, audioSpecificConfigSize)) { 00234 audioSpecificConfigSize = 0; 00235 return NULL; 00236 } 00237 00238 return audioSpecificConfig; 00239 }
| Boolean parseStreamMuxConfigStr | ( | char const * | configStr, | |
| Boolean & | audioMuxVersion, | |||
| Boolean & | allStreamsSameTimeFraming, | |||
| unsigned char & | numSubFrames, | |||
| unsigned char & | numProgram, | |||
| unsigned char & | numLayer, | |||
| unsigned char *& | audioSpecificConfig, | |||
| unsigned & | audioSpecificConfigSize | |||
| ) |
Definition at line 165 of file MPEG4LATMAudioRTPSource.cpp.
References False, getByte(), NULL, and True.
00166 : 00167 Boolean& audioMuxVersion, 00168 Boolean& allStreamsSameTimeFraming, 00169 unsigned char& numSubFrames, 00170 unsigned char& numProgram, 00171 unsigned char& numLayer, 00172 unsigned char*& audioSpecificConfig, 00173 unsigned& audioSpecificConfigSize) { 00174 // Set default versions of the result parameters: 00175 audioMuxVersion = 0; 00176 allStreamsSameTimeFraming = 1; 00177 numSubFrames = numProgram = numLayer = 0; 00178 audioSpecificConfig = NULL; 00179 audioSpecificConfigSize = 0; 00180 00181 do { 00182 if (configStr == NULL) break; 00183 00184 unsigned char nextByte; 00185 00186 if (!getByte(configStr, nextByte)) break; 00187 audioMuxVersion = (nextByte&0x80)>>7; 00188 if (audioMuxVersion != 0) break; 00189 00190 allStreamsSameTimeFraming = (nextByte&0x40)>>6; 00191 numSubFrames = (nextByte&0x3F); 00192 00193 if (!getByte(configStr, nextByte)) break; 00194 numProgram = (nextByte&0xF0)>>4; 00195 00196 numLayer = (nextByte&0x0E)>>1; 00197 00198 // The one remaining bit, and the rest of the string, 00199 // are used for "audioSpecificConfig": 00200 unsigned char remainingBit = nextByte&1; 00201 00202 unsigned ascSize = (strlen(configStr)+1)/2 + 1; 00203 audioSpecificConfig = new unsigned char[ascSize]; 00204 00205 Boolean parseSuccess; 00206 unsigned i = 0; 00207 do { 00208 nextByte = 0; 00209 parseSuccess = getByte(configStr, nextByte); 00210 audioSpecificConfig[i++] = (remainingBit<<7)|((nextByte&0xFE)>>1); 00211 remainingBit = nextByte&1; 00212 } while (parseSuccess); 00213 if (i != ascSize) break; // part of the remaining string was bad 00214 00215 audioSpecificConfigSize = ascSize; 00216 return True; // parsing succeeded 00217 } while (0); 00218 00219 delete[] audioSpecificConfig; 00220 return False; // parsing failed 00221 }
1.5.2