/*--------------------------------------------------------------------------------*/ bool ADMRIFFFile::CreateExtraChunks() { bool success = true; if (adm) { RIFFChunk *chunk; uint64_t chnalen; uint8_t *chna; uint_t i, nchannels = GetChannels(); success = true; for (i = 0; i < nchannels; i++) { ADMAudioTrack *track; // create chna track data if ((track = adm->CreateTrack(i)) != NULL) { track->SetSampleRate(GetSampleRate()); track->SetBitDepth(GetBitsPerSample()); } } if (!admfile.empty()) { // create ADM structure (content and objects from file) if (adm->CreateFromFile(admfile.c_str())) { // can prepare cursors now since all objects have been created PrepareCursors(); } else { BBCERROR("Unable to create ADM structure from '%s'", admfile.c_str()); success = false; } } // get ADM object to create chna chunk if ((chna = adm->GetChna(chnalen)) != NULL) { // and add it to the RIFF file if ((chunk = AddChunk(chna_ID)) != NULL) { success &= chunk->CreateChunkData(chna, chnalen); } else BBCERROR("Failed to add chna chunk"); // don't need the raw data any more delete[] chna; } else BBCERROR("No chna data available"); success &= (AddChunk(axml_ID) != NULL); } return success; }
void* operator new (unsigned int size, const char* fileName, int lineNo) { void* p = malloc(size); AddChunk(fileName, lineNo, size, p); return p; }
void ASolarsystemManager::Init() { UWorld* world = GetWorld(); if (world) { FConstPawnIterator it = world->GetPawnIterator(); player = *it; AddChunk(player->GetActorLocation()); } }
// General chunk storage, starting with the header at 'start_offset', allowing // the user to request the payload via a fourcc string. 'size' includes the // header and the unpadded payload size. // Returns true on success, false otherwise. static int StoreChunk(WebPDemuxer* const dmux, size_t start_offset, uint32_t size) { Chunk* const chunk = (Chunk*)calloc(1, sizeof(*chunk)); if (chunk == NULL) return 0; chunk->data_.offset_ = start_offset; chunk->data_.size_ = size; AddChunk(dmux, chunk); return 1; }
TInt DMemModelProcess::NewChunk(DChunk*& aChunk, SChunkCreateInfo& aInfo, TLinAddr& aRunAddr) { aChunk=NULL; DMemModelChunk* pC=new DMemModelChunk; if (!pC) return KErrNoMemory; TChunkType type = aInfo.iType; pC->iChunkType=type; TInt r=pC->SetAttributes(aInfo); if (r!=KErrNone) { pC->Close(NULL); return r; } pC->iOwningProcess=(pC->iAttributes&DMemModelChunk::EPublic)?NULL:this; r=pC->Create(aInfo); if (r==KErrNone && (aInfo.iOperations & SChunkCreateInfo::EAdjust)) { if (aInfo.iRunAddress!=0) pC->SetFixedAddress(aInfo.iRunAddress,aInfo.iPreallocated); if (aInfo.iPreallocated==0 && aInfo.iInitialTop!=0) { if (pC->iAttributes & DChunk::EDisconnected) { r=pC->Commit(aInfo.iInitialBottom,aInfo.iInitialTop-aInfo.iInitialBottom); } else if (pC->iAttributes & DChunk::EDoubleEnded) { r=pC->AdjustDoubleEnded(aInfo.iInitialBottom,aInfo.iInitialTop); } else { r=pC->Adjust(aInfo.iInitialTop); } } } if (r==KErrNone && (aInfo.iOperations & SChunkCreateInfo::EAdd)) { r = AddChunk(pC, EFalse); } if (r==KErrNone) { if(pC->iKernelMapping) aRunAddr = (TLinAddr)MM::MappingBase(pC->iKernelMapping); pC->iDestroyedDfc = aInfo.iDestroyedDfc; aChunk=(DChunk*)pC; } else pC->Close(NULL); // NULL since chunk can't have been added to process return r; }
TInt DMemModelProcess::AddChunk(DChunk* aChunk,TBool isReadOnly) { DMemModelChunk* pC=(DMemModelChunk*)aChunk; TInt r=WaitProcessLock(); if (r==KErrNone) { TInt pos=0; r=ChunkIndex(pC,pos); TLinAddr dataSectionBase=0; if (r==0) // Found the chunk in this process, just up its count { iChunks[pos].iAccessCount++; __KTRACE_OPT(KPROC,Kern::Printf("DMemModelProcess::AddChunk %08x to %08x (Access count incremented to %d)",aChunk,this,iChunks[pos].iAccessCount)); SignalProcessLock(); return KErrNone; } r=AddChunk(pC,dataSectionBase,isReadOnly); SignalProcessLock(); } __KTRACE_OPT(KPROC,Kern::Printf("DMemModelProcess::AddChunk returns %d",r)); return r; }
void VDAVIReadIndex::Append(const VDAVIReadIndex& src, sint64 bytePosOffset) { if (mbFinalized) { mSectors.pop_back(); mSectors.pop_back(); mbFinalized = false; } const SectorEntry *sec = &src.mSectors[0]; uint32 next = sec[1].mChunkOffset; for(uint32 i=0; i<src.mChunkCount; ++i) { if (i >= next) { ++sec; next = sec[1].mChunkOffset; } const IndexEntry& ient = src.mIndex[i >> kBlockSizeBits][i & kBlockMask]; sint64 bytePos = sec->mByteOffset + bytePosOffset + ient.mByteOffset; AddChunk(bytePos, ient.mSizeAndKeyFrameFlag); } Finalize(); }
TInt DMemModelProcess::NewChunk(DChunk*& aChunk, SChunkCreateInfo& aInfo, TLinAddr& aRunAddr) { aChunk=NULL; DMemModelChunk* pC=NULL; TInt r=GetNewChunk(pC,aInfo); if (r!=KErrNone) { if (pC) pC->Close(NULL); return r; } if (aInfo.iForceFixed || iAttributes & DMemModelProcess::EFixedAddress) pC->iAttributes |= DMemModelChunk::EFixedAddress; if (!aInfo.iGlobal && (iAttributes & DMemModelProcess::EPrivate)!=0) pC->iAttributes |= DMemModelChunk::EPrivate; if (pC->iChunkType==EDll || pC->iChunkType==EUserCode || pC->iChunkType==EUserSelfModCode || pC->iChunkType==EKernelCode) pC->iAttributes |= (DMemModelChunk::EFixedAddress|DMemModelChunk::ECode); pC->iOwningProcess=(aInfo.iGlobal)?NULL:this; r=pC->Create(aInfo); if (r==KErrNone && (aInfo.iOperations & SChunkCreateInfo::EAdjust)) { if (aInfo.iRunAddress!=0) pC->SetFixedAddress(aInfo.iRunAddress,aInfo.iPreallocated); if (aInfo.iPreallocated==0) { if (pC->iAttributes & DChunk::EDisconnected) { r=pC->Commit(aInfo.iInitialBottom,aInfo.iInitialTop-aInfo.iInitialBottom); } else if (pC->iAttributes & DChunk::EDoubleEnded) { r=pC->AdjustDoubleEnded(aInfo.iInitialBottom,aInfo.iInitialTop); } else { r=pC->Adjust(aInfo.iInitialTop); } } if (r==KErrNone && pC->iHomeRegionBase==0 && (pC->iAttributes&DMemModelChunk::EFixedAddress)!=0) { r=pC->Reserve(0); aRunAddr=(TLinAddr)pC->Base(); } } if (r==KErrNone && (aInfo.iOperations & SChunkCreateInfo::EAdd)) { if (pC->iAttributes & DMemModelChunk::ECode) Mmu::Get().SyncCodeMappings(); if (pC->iChunkType!=EUserCode) { r=WaitProcessLock(); if (r==KErrNone) { r=AddChunk(pC,aRunAddr,EFalse); SignalProcessLock(); } } else aRunAddr=(TLinAddr)pC->Base(); // code chunks always fixed address } if (r==KErrNone) { pC->iDestroyedDfc = aInfo.iDestroyedDfc; aChunk=(DChunk*)pC; } else pC->Close(NULL); // NULL since chunk can't have been added to process return r; }