// ------------------------------------- // Constructors and destructors // QTRTPFile::QTRTPFile(Bool16 debugFlag, Bool16 deepDebugFlag) : fDebug(debugFlag) , fDeepDebug(deepDebugFlag) , fFile(NULL) , fFCB(NULL) , fNumHintTracks(0) , fFirstTrack(NULL) , fLastTrack(NULL) , fCurSeekTrack(NULL) , fSDPFile(NULL) , fSDPFileLength(0) , fNumSkippedSamples(0) , fRequestedSeekTime(0.0) , fSeekTime(0.0) , fLastPacketTrack(NULL) , fBytesPerSecond(0) , fHasRTPMetaInfoFieldArray(false) , fWasLastSeekASeekToPacketNumber(false) , fDropRepeatPackets(false) , fErr(errNoError) { fFCB = NEW QTFile_FileControlBlock(); }
// ------------------------------------- // Initialization functions // Bool16 QTAtom_dref::Initialize(void) { // Temporary vars UInt32 tempInt32; // General vars UInt64 refPos; // // Parse this atom's fields. ReadInt32(drefPos_VersionFlags, &tempInt32); fVersion = (UInt8)((tempInt32 >> 24) & 0x000000ff); fFlags = tempInt32 & 0x00ffffff; ReadInt32(drefPos_NumRefs, &fNumRefs); // // Read in all of the refs. if( fNumRefs > 0 ) { // // Allocate our ref table. fRefs = NEW DataRefEntry[fNumRefs]; if( fRefs == NULL ) return false; // // Read them all in.. refPos = drefPos_RefTable; for( UInt32 CurRef = 0; CurRef < fNumRefs; CurRef++ ) { // // Set up the entry. fRefs[CurRef].Flags = 0x0; fRefs[CurRef].ReferenceType = FOUR_CHARS_TO_INT('N', 'U', 'L', 'L'); // NULL fRefs[CurRef].DataLength = 0; fRefs[CurRef].Data = NULL; fRefs[CurRef].IsEntryInitialized = false; fRefs[CurRef].IsFileOpen = false; fRefs[CurRef].FCB = NULL; // // Get the flags and type. ReadInt32(refPos + drefRefPos_VersionFlags, &tempInt32); fRefs[CurRef].Flags = tempInt32 & 0x00ffffff; ReadInt32(refPos + drefRefPos_Type, &tempInt32); fRefs[CurRef].ReferenceType = tempInt32; // // We're done if this is a self-referencing atom. if( fRefs[CurRef].Flags & flagSelfRef ) { fRefs[CurRef].IsEntryInitialized = true; continue; } // // Get all of the data. ReadInt32(refPos + drefRefPos_Size, &tempInt32); fRefs[CurRef].DataLength = tempInt32 - 12 /* skip the header */; fRefs[CurRef].Data = NEW char[fRefs[CurRef].DataLength]; if( fRefs[CurRef].Data == NULL ) { // // De-initialize this entry. fRefs[CurRef].DataLength = 0; fRefs[CurRef].IsEntryInitialized = false; } else { // // Read the entry data. ReadBytes(refPos + drefRefPos_Data, fRefs[CurRef].Data, fRefs[CurRef].DataLength); // // Configure the rest of the entry. fRefs[CurRef].FCB = NEW QTFile_FileControlBlock(); if( fRefs[CurRef].FCB == NULL ) fRefs[CurRef].IsEntryInitialized = false; else fRefs[CurRef].IsEntryInitialized = true; fRefs[CurRef].IsFileOpen = false; } // // Skip over this mini-atom. refPos += fRefs[CurRef].DataLength + 12 /* account for the header */; } }