AVCSampleDependencyType::AVCSampleDependencyType(MP4_FF_FILE *fp, uint32 size, uint32 type, uint32 sample_count) : FullAtom(fp, size, type) { OSCL_UNUSED_ARG(type); if (_success) { if (getVersion() == 0) { PV_MP4_FF_ARRAY_NEW(NULL, uint8, (sample_count), _reserved); if (_reserved == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint8, (sample_count), _sample_depends_on); if (_sample_depends_on == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint8, (sample_count), _sample_is_depended_on); if (_sample_is_depended_on == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } for (uint32 idx = 0; idx < sample_count; idx++) { if (!AtomUtils::read8(fp, _reserved[idx])) { _success = false; } _sample_depends_on[idx] = (uint8)(_reserved[idx] & ~0xF3); _sample_is_depended_on[idx] = (uint8)(_reserved[idx] & ~0xFC); } } } if (!_success) { _mp4ErrorCode = READ_AVC_SAMPLE_DEPENDENCY_TYPE_BOX_FAILED; } }
// Stream-in constructor SyncSampleAtom::SyncSampleAtom(MP4_FF_FILE *fp, uint32 size, uint32 type) : FullAtom(fp, size, type) { _psampleNumbers = NULL; if (_success) { _nextSampleNumber = 0; if (!AtomUtils::read32(fp, _entryCount)) { _success = false; } uint32 dataSize = _size - (DEFAULT_FULL_ATOM_SIZE + 4); uint32 entrySize = (4); if ((_entryCount*entrySize) > dataSize) { _success = false; } if (_success) { PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleNumbers); uint32 sync; for (uint32 i = 0; i < _entryCount; i++) { if (!AtomUtils::read32(fp, sync)) { _success = false; break; } _psampleNumbers[i] = (sync); } } if (!_success) _mp4ErrorCode = READ_SYNC_SAMPLE_ATOM_FAILED; } else { if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED) _mp4ErrorCode = READ_SYNC_SAMPLE_ATOM_FAILED; } }
// responsible for creation of data sturcture inside the table. PVMFStatus CompositionOffsetAtom::CreateMarkerTable() { MT_Table_Size = (_iTotalNumSamplesInTrack / MT_SAMPLECOUNT_INCREMENT); PV_MP4_FF_ARRAY_NEW(NULL, uint32, (MT_Table_Size), MT_SampleCount); if (MT_SampleCount == NULL) { PV_MP4_ARRAY_DELETE(NULL, MT_SampleCount); MT_SampleCount = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return PVMFFailure; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (MT_Table_Size), MT_EntryCount); if (MT_EntryCount == NULL) { PV_MP4_ARRAY_DELETE(NULL, MT_EntryCount); MT_EntryCount = NULL; PV_MP4_ARRAY_DELETE(NULL, MT_SampleCount); MT_SampleCount = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return PVMFFailure; } for (uint32 idx = 0; idx < MT_Table_Size; idx++) //initialization { MT_EntryCount[idx] = 0; MT_SampleCount[idx] = 0; } return PVMFSuccess; }
AVCConfigurationBox::ParameterSet::ParameterSet(uint16 length, MP4_FF_FILE *fp) { _parameterSetLength = 0; _pParameterSet = NULL; _success = false; if ((int16)(length) > 0) { _parameterSetLength = length; PV_MP4_FF_ARRAY_NEW(NULL, uint8, _parameterSetLength, _pParameterSet); if (!AtomUtils::readByteData(fp, _parameterSetLength, _pParameterSet)) { return ; } _success = true; } }
// Stream-in ctor CompositionOffsetAtom::CompositionOffsetAtom(MP4_FF_FILE *fp, uint32 mediaType, uint32 size, uint32 type, OSCL_wString& filename, uint32 parsingMode): FullAtom(fp, size, type), OsclTimerObject(OsclActiveObject::EPriorityNominal, "CompositionOffsetAtom") { _psampleCountVec = NULL; _psampleOffsetVec = NULL; MT_SampleCount = NULL; MT_EntryCount = NULL; iMarkerTableCreation = false; MT_Table_Size = 0; _currGetSampleCount = 0; _currGetIndex = -1; _currGetTimeOffset = 0; _currPeekSampleCount = 0; _currPeekIndex = -1; _currPeekTimeOffset = 0; MT_Counter = 1; addSampleCount = 0; prevSampleCount = 0; entrycountTraversed = 0; refSample = MT_SAMPLECOUNT_INCREMENT; MT_j = 1; _mediaType = mediaType; _parsed_entry_cnt = 0; _fileptr = NULL; _parsing_mode = 0; _parsing_mode = parsingMode; _stbl_buff_size = CTTS_MIN_SAMPLE_TABLE_SIZE; _next_buff_number = 0; _curr_buff_number = 0; _curr_entry_point = 0; _stbl_fptr_vec = NULL; iLogger = PVLogger::GetLoggerObject("mp4ffparser"); iStateVarLogger = PVLogger::GetLoggerObject("mp4ffparser_mediasamplestats"); iParsedDataLogger = PVLogger::GetLoggerObject("mp4ffparser_parseddata"); iMarkerTableCreation = false; /* Add this AO to the scheduler */ if (OsclExecScheduler::Current() != NULL) { if (!IsAdded()) { AddToScheduler(); } } if (_success) { if (!AtomUtils::read32(fp, _entryCount)) { _success = false; } PVMF_MP4FFPARSER_LOGPARSEDINFO((0, "CompositionOffsetAtom::CompositionOffsetAtom- _entryCount =%d", _entryCount)); uint32 dataSize = _size - (DEFAULT_FULL_ATOM_SIZE + 4); uint32 entrySize = (4 + 4); if ((_entryCount*entrySize) > dataSize) { _success = false; } if (_success) { if (_entryCount > 0) { if (parsingMode == 1) { // cache size is 4K so that optimization // should work if entry_count is greater than 4K if (_entryCount > _stbl_buff_size) { uint32 fptrBuffSize = (_entryCount / _stbl_buff_size) + 1; PV_MP4_FF_ARRAY_NEW(NULL, uint32, (fptrBuffSize), _stbl_fptr_vec); if (_stbl_fptr_vec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psampleCountVec); if (_psampleCountVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psampleOffsetVec); if (_psampleOffsetVec == NULL) { PV_MP4_ARRAY_DELETE(NULL, _psampleOffsetVec); _psampleOffsetVec = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } for (uint32 idx = 0; idx < _stbl_buff_size; idx++) //initialization { _psampleCountVec[idx] = 0; _psampleOffsetVec[idx] = 0; } OsclAny* ptr = (MP4_FF_FILE *)(oscl_malloc(sizeof(MP4_FF_FILE))); if (ptr == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } _fileptr = OSCL_PLACEMENT_NEW(ptr, MP4_FF_FILE()); _fileptr->_fileServSession = fp->_fileServSession; _fileptr->_pvfile.SetCPM(fp->_pvfile.GetCPM()); _fileptr->_pvfile.SetFileHandle(fp->_pvfile.iFileHandle); if (AtomUtils::OpenMP4File(filename, Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, _fileptr) != 0) { _success = false; _mp4ErrorCode = FILE_OPEN_FAILED; } _fileptr->_fileSize = fp->_fileSize; int32 _head_offset = AtomUtils::getCurrentFilePosition(fp); AtomUtils::seekFromCurrPos(fp, dataSize); AtomUtils::seekFromStart(_fileptr, _head_offset); return; } else { _parsing_mode = 0; _stbl_buff_size = _entryCount; } } else { _stbl_buff_size = _entryCount; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleCountVec); if (_psampleCountVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleOffsetVec); if (_psampleOffsetVec == NULL) { PV_MP4_ARRAY_DELETE(NULL, _psampleOffsetVec); _psampleOffsetVec = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } for (uint32 idx = 0; idx < _entryCount; idx++) //initialization { _psampleCountVec[idx] = 0; _psampleOffsetVec[idx] = 0; } uint32 number = 0; uint32 offset = 0; for (_parsed_entry_cnt = 0; _parsed_entry_cnt < _entryCount; _parsed_entry_cnt++) { if (!AtomUtils::read32(fp, number)) { _success = false; break; } if (!AtomUtils::read32(fp, offset)) { _success = false; break; } _psampleCountVec[_parsed_entry_cnt] = (number); _psampleOffsetVec[_parsed_entry_cnt] = (offset); } } } if (!_success) { _mp4ErrorCode = READ_TIME_TO_SAMPLE_ATOM_FAILED; } } else { if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED) _mp4ErrorCode = READ_TIME_TO_SAMPLE_ATOM_FAILED; } }
// Stream-in ctor // Create and return a new SampleToChunkAtom by reading in from an ifstream SampleToChunkAtom::SampleToChunkAtom(MP4_FF_FILE *fp, uint32 size, uint32 type, OSCL_wString& filename, uint32 parsingMode) : FullAtom(fp, size, type) { _pfirstChunkVec = NULL; _psamplesPerChunkVec = NULL; _psampleDescriptionIndexVec = NULL; _Index = 0; _numChunksInRun = 0; _majorGetIndex = 0; _currGetChunk = -1; _numGetChunksInRun = 0; _currGetSampleCount = 0; _firstGetSampleInCurrChunk = 0; _numGetSamplesPerChunk = 0; _currGetSDI = 0; _majorPeekIndex = 0; _currPeekChunk = -1; _numPeekChunksInRun = 0; _currPeekSampleCount = 0; _firstPeekSampleInCurrChunk = 0; _numPeekSamplesPerChunk = 0; _currPeekSDI = 0; _parsed_entry_cnt = 0; _fileptr = NULL; _stbl_buff_size = MAX_CACHED_TABLE_ENTRIES_FILE; _next_buff_number = 0; _curr_buff_number = 0; _curr_entry_point = 0; _stbl_fptr_vec = NULL; _parsing_mode = parsingMode; iLogger = PVLogger::GetLoggerObject("mp4ffparser"); iStateVarLogger = PVLogger::GetLoggerObject("mp4ffparser_mediasamplestats"); iParsedDataLogger = PVLogger::GetLoggerObject("mp4ffparser_parseddata"); if (_success) { _currentChunkNumber = 0; _maxNumSamplesPerChunk = DEFAULT_MAX_NUM_SAMPLES_PER_CHUNK; _maxChunkDataSize = DEFAULT_MAX_CHUNK_DATA_SIZE; if (!AtomUtils::read32(fp, _entryCount)) { _success = false; } PVMF_MP4FFPARSER_LOGPARSEDINFO((0, "SampleToChunkAtom::SampleToChunkAtom- _entryCount =%d", _entryCount)); TOsclFileOffset dataSize = _size - (DEFAULT_FULL_ATOM_SIZE + 4); uint32 entrySize = (4 + 4 + 4); if ((TOsclFileOffset)(_entryCount*entrySize) > dataSize) { _success = false; } if (_success) { if (_entryCount > 0) { if (_parsing_mode) { if ((_entryCount > _stbl_buff_size)) // cahce size is 4K so that optimization should work if entry_count is greater than 4K { uint32 fptrBuffSize = (_entryCount / _stbl_buff_size) + 1; PV_MP4_FF_ARRAY_NEW(NULL, TOsclFileOffset, (fptrBuffSize), _stbl_fptr_vec); if (_stbl_fptr_vec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _pfirstChunkVec); if (_pfirstChunkVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psamplesPerChunkVec); if (_psamplesPerChunkVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psampleDescriptionIndexVec); if (_psampleDescriptionIndexVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } { OsclAny* ptr = (MP4_FF_FILE *)(oscl_malloc(sizeof(MP4_FF_FILE))); if (ptr == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } _fileptr = OSCL_PLACEMENT_NEW(ptr, MP4_FF_FILE()); _fileptr->_fileServSession = fp->_fileServSession; _fileptr->_pvfile.SetCPM(fp->_pvfile.GetCPM()); _fileptr->_pvfile.SetFileHandle(fp->_pvfile.iFileHandle); if (AtomUtils::OpenMP4File(filename, Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, _fileptr) != 0) { _success = false; _mp4ErrorCode = FILE_OPEN_FAILED; } _fileptr->_fileSize = fp->_fileSize; } TOsclFileOffset _head_offset = AtomUtils::getCurrentFilePosition(fp); AtomUtils::seekFromCurrPos(fp, dataSize); AtomUtils::seekFromStart(_fileptr, _head_offset); ParseEntryUnit(0); uint32 firstsamplenum = 0; resetStateVariables(firstsamplenum); return; } else { _parsing_mode = 0; _stbl_buff_size = _entryCount; } } else { _parsing_mode = 0; _stbl_buff_size = _entryCount; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _pfirstChunkVec); PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psamplesPerChunkVec); PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleDescriptionIndexVec); uint32 firstChunk; uint32 samplesPerChunk; uint32 sampleDescrIndex; uint32 offSet = 0; uint32 prevFirstChunk = 0; uint32 j = 0; for (uint32 i = 0; i < _entryCount; i++) { if (!AtomUtils::read32(fp, firstChunk)) { _success = false; break; } if (i == 0) offSet = firstChunk; if (!AtomUtils::read32(fp, samplesPerChunk)) { _success = false; break; } if (!AtomUtils::read32(fp, sampleDescrIndex)) { _success = false; break; } if (firstChunk > prevFirstChunk) { _pfirstChunkVec[j] = (firstChunk - offSet); _psamplesPerChunkVec[j] = (samplesPerChunk); _psampleDescriptionIndexVec[j] = (sampleDescrIndex); prevFirstChunk = firstChunk; j++; } } _entryCount = j; uint32 firstsamplenum = 0; resetStateVariables(firstsamplenum); } else { _pfirstChunkVec = NULL; _psamplesPerChunkVec = NULL; _psampleDescriptionIndexVec = NULL; } } if (!_success) { _mp4ErrorCode = READ_SAMPLE_TO_CHUNK_ATOM_FAILED; PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>SampleToChunkAtom::SampleToChunkAtom- Read SampleToChunk Atom failed %d", _mp4ErrorCode)); } } else { if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED) { _mp4ErrorCode = READ_SAMPLE_TO_CHUNK_ATOM_FAILED; PVMF_MP4FFPARSER_LOGERROR((0, "ERROR =>SampleToChunkAtom::SampleToChunkAtom- Read SampleToChunk Atom failed %d", _mp4ErrorCode)); } } }
// Ctor to create a new ChunkOffsetAtom by reading in from an ifstream ChunkOffsetAtom::ChunkOffsetAtom(MP4_FF_FILE *fp, uint32 size, uint32 type, OSCL_wString& filename, uint32 parsingMode) : FullAtom(fp, size, type) { _pchunkOffsets = NULL; _stbl_buff_size = MAX_CACHED_TABLE_ENTRIES_FILE; _next_buff_number = 0; _curr_buff_number = 0; _curr_entry_point = 0; _stbl_fptr_vec = NULL; _parsed_entry_cnt = 0; _parsingMode = parsingMode; _fileptr = NULL; if (_success) { _currentDataOffset = 0; if (!AtomUtils::read32(fp, _entryCount)) { _success = false; } uint32 dataSize = _size - (DEFAULT_FULL_ATOM_SIZE + 4); uint32 entrySize = 4; if ((_entryCount*entrySize) > dataSize) { _success = false; } if (_success) { if (_entryCount > 0) { if (_parsingMode == 1) { // cache size is 4K so that optimization should work if entry_count is greater than 4K if ((_entryCount > _stbl_buff_size)) { uint32 fptrBuffSize = (_entryCount / _stbl_buff_size) + 1; PV_MP4_FF_ARRAY_NEW(NULL, uint32, (fptrBuffSize), _stbl_fptr_vec); if (_stbl_fptr_vec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _pchunkOffsets); if (_pchunkOffsets == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } { OsclAny* ptr = (MP4_FF_FILE *)(oscl_malloc(sizeof(MP4_FF_FILE))); if (ptr == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } _fileptr = OSCL_PLACEMENT_NEW(ptr, MP4_FF_FILE()); _fileptr->_fileServSession = fp->_fileServSession; _fileptr->_pvfile.SetCPM(fp->_pvfile.GetCPM()); if (AtomUtils::OpenMP4File(filename, Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, _fileptr) != 0) { _success = false; _mp4ErrorCode = FILE_OPEN_FAILED; } _fileptr->_fileSize = fp->_fileSize; } int32 _head_offset = AtomUtils::getCurrentFilePosition(fp); AtomUtils::seekFromCurrPos(fp, dataSize); AtomUtils::seekFromStart(_fileptr, _head_offset); return; } else { _parsingMode = 0; _stbl_buff_size = _entryCount; } } else { _stbl_buff_size = _entryCount; } _parsingMode = 0; PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _pchunkOffsets); uint32 offset = 0; for (uint32 i = 0; i < _entryCount; i++) { if (!AtomUtils::read32(fp, offset)) { _success = false; break; } _pchunkOffsets[i] = offset; } _parsed_entry_cnt = _entryCount; } else { _pchunkOffsets = NULL; } } if (!_success) { _mp4ErrorCode = READ_CHUNK_OFFSET_ATOM_FAILED; } } else { if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED) _mp4ErrorCode = READ_CHUNK_OFFSET_ATOM_FAILED; } }
// Stream-in ctor TimeToSampleAtom::TimeToSampleAtom(MP4_FF_FILE *fp, uint32 mediaType, uint32 size, uint32 type, OSCL_wString& filename, uint32 parsingMode) : FullAtom(fp, size, type) { _psampleCountVec = NULL; _psampleDeltaVec = NULL; _currGetSampleCount = 0; _currGetIndex = -1; _currGetTimeDelta = 0; _currPeekSampleCount = 0; _currPeekIndex = -1; _currPeekTimeDelta = 0; _mediaType = mediaType; _parsed_entry_cnt = 0; _fileptr = NULL; _parsing_mode = 0; _parsing_mode = parsingMode; _stbl_buff_size = MAX_CACHED_TABLE_ENTRIES_FILE; _next_buff_number = 0; _curr_buff_number = 0; _curr_entry_point = 0; _stbl_fptr_vec = NULL; iLogger = PVLogger::GetLoggerObject("mp4ffparser"); iStateVarLogger = PVLogger::GetLoggerObject("mp4ffparser_mediasamplestats"); iParsedDataLogger = PVLogger::GetLoggerObject("mp4ffparser_parseddata"); if (_success) { if (!AtomUtils::read32(fp, _entryCount)) { _success = false; } PVMF_MP4FFPARSER_LOGPARSEDINFO((0, "TimeToSampleAtom::TimeToSampleAtom- _entryCount =%d", _entryCount)); uint32 dataSize = _size - (DEFAULT_FULL_ATOM_SIZE + 4); uint32 entrySize = (4 + 4); if ((_entryCount*entrySize) > dataSize) { _success = false; } if (_success) { if (_entryCount > 0) { if (parsingMode == 1) { // cache size is 4K so that optimization should work if entry_count is greater than 4K if ((_entryCount > _stbl_buff_size)) { uint32 fptrBuffSize = (_entryCount / _stbl_buff_size) + 1; PV_MP4_FF_ARRAY_NEW(NULL, uint32, (fptrBuffSize), _stbl_fptr_vec); if (_stbl_fptr_vec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psampleCountVec); if (_psampleCountVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_stbl_buff_size), _psampleDeltaVec); if (_psampleDeltaVec == NULL) { PV_MP4_ARRAY_DELETE(NULL, _psampleDeltaVec); _psampleDeltaVec = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } for (uint32 idx = 0; idx < _stbl_buff_size; idx++) //initialization { _psampleCountVec[idx] = 0; _psampleDeltaVec[idx] = 0; } OsclAny* ptr = (MP4_FF_FILE *)(oscl_malloc(sizeof(MP4_FF_FILE))); if (ptr == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } _fileptr = OSCL_PLACEMENT_NEW(ptr, MP4_FF_FILE()); _fileptr->_fileServSession = fp->_fileServSession; _fileptr->_pvfile.SetCPM(fp->_pvfile.GetCPM()); _fileptr->_pvfile.SetFileHandle(fp->_pvfile.iFileHandle); if (AtomUtils::OpenMP4File(filename, Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, _fileptr) != 0) { _success = false; _mp4ErrorCode = FILE_OPEN_FAILED; } _fileptr->_fileSize = fp->_fileSize; int32 _head_offset = AtomUtils::getCurrentFilePosition(fp); AtomUtils::seekFromCurrPos(fp, dataSize); AtomUtils::seekFromStart(_fileptr, _head_offset); return; } else { _parsing_mode = 0; _stbl_buff_size = _entryCount; } } else { _stbl_buff_size = _entryCount; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleCountVec); if (_psampleCountVec == NULL) { _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } PV_MP4_FF_ARRAY_NEW(NULL, uint32, (_entryCount), _psampleDeltaVec); if (_psampleDeltaVec == NULL) { PV_MP4_ARRAY_DELETE(NULL, _psampleDeltaVec); _psampleDeltaVec = NULL; _success = false; _mp4ErrorCode = MEMORY_ALLOCATION_FAILED; return; } for (uint32 idx = 0; idx < _entryCount; idx++) //initialization { _psampleCountVec[idx] = 0; _psampleDeltaVec[idx] = 0; } uint32 number = 0; uint32 delta = 0; for (_parsed_entry_cnt = 0; _parsed_entry_cnt < _entryCount; _parsed_entry_cnt++) { if (!AtomUtils::read32(fp, number)) { _success = false; break; } if (!AtomUtils::read32(fp, delta)) { _success = false; break; } _psampleCountVec[_parsed_entry_cnt] = (number); _psampleDeltaVec[_parsed_entry_cnt] = (delta); } } } if (!_success) { _mp4ErrorCode = READ_TIME_TO_SAMPLE_ATOM_FAILED; } } else { if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED) _mp4ErrorCode = READ_TIME_TO_SAMPLE_ATOM_FAILED; } }