最近應用工作原因在看Android多媒體架構的源碼!看到了AwesomePlayer.cpp源碼!發現有很多 bool findInt32(uint32_t key, int32_t *value);類似的代碼!看不懂什麼意思!現在豁然開朗!也是個人理解!假設!猜測!做個筆記!
AwesomePlayer.cpp裡面有如下函數: int32_t displayWidth, displayHeight; bool success = meta->findInt32(kKeyDisplayWidth, &displayWidth/*輸出參數*/); if (success) { success = meta->findInt32(kKeyDisplayHeight, &displayHeight/*輸出參數*/); } if (success) { mDisplayWidth = displayWidth; mDisplayHeight = displayHeight; }
1)有以上得出個人理解:kKeyDisplayWidth、kKeyDisplayHeight是個"鍵",它對應的有個值!findInt32就是找到對應的值賦值給displayWidth, displayHeight;
2)在源碼搜尋kKeyDisplayWidth、kKeyDisplayHeight果然搜到索引值對應enum在MetaData.h源碼裡:
// The following keys map to int32_t data unless indicated otherwise.enum { kKeyMIMEType = 'mime', // cstring kKeyWidth = 'widt', // int32_t, image pixel kKeyHeight = 'heig', // int32_t, image pixel kKeyDisplayWidth = 'dWid', // int32_t, display/presentation kKeyDisplayHeight = 'dHgt', // int32_t, display/presentation // a rectangle, if absent assumed to be (0, 0, width - 1, height - 1) kKeyCropRect = 'crop', kKeyRotation = 'rotA', // int32_t (angle in degrees) kKeyIFramesInterval = 'ifiv', // int32_t kKeyStride = 'strd', // int32_t kKeySliceHeight = 'slht', // int32_t kKeyChannelCount = '#chn', // int32_t kKeySampleRate = 'srte', // int32_t (audio sampling rate Hz) kKeyFrameRate = 'frmR', // int32_t (video frame rate fps) kKeyBitRate = 'brte', // int32_t (bps) kKeyESDS = 'esds', // raw data kKeyAVCC = 'avcc', // raw data#ifdef OMAP_ENHANCEMENT kKeyHdr = 'hdrd', // raw data kKeySARIdc = 'sari', // Sample aspect ratio of the luma samples (int32_t) kKeySARWidth = 'sarw', // Sample aspect ratio width (int32_t) kKeySARHeight = 'sarh', // Sample aspect ratio height (int32_t)#endif kKeyD263 = 'd263', // raw data kKeyVorbisInfo = 'vinf', // raw data kKeyVorbisBooks = 'vboo', // raw data kKeyWantsNALFragments = 'NALf', kKeyIsSyncFrame = 'sync', // int32_t (bool) kKeyIsCodecConfig = 'conf', // int32_t (bool) kKeyTime = 'time', // int64_t (usecs) kKeyDecodingTime = 'decT', // int64_t (decoding timestamp in usecs) kKeyNTPTime = 'ntpT', // uint64_t (ntp-timestamp) kKeyTargetTime = 'tarT', // int64_t (usecs) kKeyDriftTime = 'dftT', // int64_t (usecs) kKeyAnchorTime = 'ancT', // int64_t (usecs) kKeyDuration = 'dura', // int64_t (usecs) kKeyColorFormat = 'colf', kKeyPlatformPrivate = 'priv', // pointer kKeyDecoderComponent = 'decC', // cstring kKeyBufferID = 'bfID', kKeyMaxInputSize = 'inpS', kKeyThumbnailTime = 'thbT', // int64_t (usecs) kKeyTrackID = 'trID', kKeyIsDRM = 'idrm', // int32_t (bool) kKeyAlbum = 'albu', // cstring kKeyArtist = 'arti', // cstring kKeyAlbumArtist = 'aart', // cstring kKeyComposer = 'comp', // cstring kKeyGenre = 'genr', // cstring kKeyTitle = 'titl', // cstring kKeyYear = 'year', // cstring kKeyAlbumArt = 'albA', // compressed image data kKeyAlbumArtMIME = 'alAM', // cstring kKeyAuthor = 'auth', // cstring kKeyCDTrackNumber = 'cdtr', // cstring kKeyDiscNumber = 'dnum', // cstring kKeyDate = 'date', // cstring kKeyWriter = 'writ', // cstring kKeyCompilation = 'cpil', // cstring kKeyLocation = 'loc ', // cstring kKeyTimeScale = 'tmsl', // int32_t // video profile and level kKeyVideoProfile = 'vprf', // int32_t kKeyVideoLevel = 'vlev', // int32_t // Set this key to enable authoring files in 64-bit offset kKey64BitFileOffset = 'fobt', // int32_t (bool) kKey2ByteNalLength = '2NAL', // int32_t (bool) // Identify the file output format for authoring // Please see <media/mediarecorder.h> for the supported // file output formats. kKeyFileType = 'ftyp', // int32_t // Track authoring progress status // kKeyTrackTimeStatus is used to track progress in elapsed time kKeyTrackTimeStatus = 'tktm', // int64_t kKeyNotRealTime = 'ntrt', // bool (int32_t) // Ogg files can be tagged to be automatically looping... kKeyAutoLoop = 'autL', // bool (int32_t) kKeyValidSamples = 'valD', // int32_t kKeyIsUnreadable = 'unre', // bool (int32_t) // An indication that a video buffer has been rendered. kKeyRendered = 'rend', // bool (int32_t) // The language code for this media kKeyMediaLanguage = 'lang', // cstring // To store the timed text format data kKeyTextFormatData = 'text', // raw data kKeyRequiresSecureBuffers = 'secu', // bool (int32_t)#ifdef OMAP_ENHANCEMENT_S3D kKeyS3DLayout = 's3dl',#endif#ifdef OMAP_ENHANCEMENT kKeyBufferLayout = 'lout', kKeyVideoFPS = 'vfps', // int32_t#endif};enum { kTypeESDS = 'esds', kTypeAVCC = 'avcc',#ifdef OMAP_ENHANCEMENT kTypeHdr = 'hdrd',#endif kTypeD263 = 'd263',};
具體這些索引值什麼意思有待進一步分析!