Changeset 30
- Timestamp:
- 10/16/06 00:21:58 (2 years ago)
- Files:
-
- trunk/AC3MovieImport/AC3MovieImport.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/AC3MovieImport/AC3MovieImport.c
r14 r30 251 251 { 252 252 #pragma unused(globals) 253 253 #define SEARCH_SIZE 2048 254 254 OSErr err = noErr; 255 255 DataHandler dataHandler = 0; 256 unsigned char header[ 107];256 unsigned char header[SEARCH_SIZE+7]; 257 257 258 258 *valid = 0; … … 276 276 int bit_rate; 277 277 int i; 278 for(i=0;i< 100;i++)278 for(i=0;i<SEARCH_SIZE;i++) 279 279 { 280 280 int frame_size = a52_syncinfo(header+i, &flags, &sample_rate, &bit_rate); … … 346 346 ComponentInstance dataHandler = 0; 347 347 unsigned char header[7]; 348 longfileOffset = 0, fileSize;348 UInt64 fileOffset = 0, fileSize; 349 349 350 350 *outFlags = 0; … … 374 374 // Get the size, in bytes, of the current data reference, this is 375 375 // functionally equivalent to the File Manager's GetEOF function. 376 err = DataHGetFileSize(dataHandler, &fileSize); 376 wide fileSizeInWide; 377 err = DataHGetFileSize64(dataHandler, &fileSizeInWide); 378 fileSize = WideToSInt64(fileSizeInWide); 377 379 if (err) goto bail; 378 380 … … 485 487 // than one sample--all the samples described by a reference must be the same size. This function does not update the movie data 486 488 // as part of the add operation therefore you do not have to call BeginMediaEdits before calling AddMediaSampleReference. 487 err = AddMediaSampleReference(audioMedia, // Specifies the media for this operation 488 fileOffset, // Specifies the offset into the data file 489 frame_size, // Specifies the number of bytes of sample data to be identified by the reference 490 6 * 256, // Specifies the duration of each sample in the reference 491 (SampleDescriptionHandle)globals->audioDesc, // Handle to a sample description 492 1, // Specifies the number of samples contained in the reference 493 0, // Contains flags that control the operation 494 NULL); // Returns the time where the reference was inserted, NULL to ignore 489 SampleReference64Record sampleRec; 490 sampleRec.dataOffset = SInt64ToWide(fileOffset); 491 sampleRec.dataSize = frame_size; 492 sampleRec.durationPerSample = 6 * 256; 493 sampleRec.numberOfSamples = 1; 494 TimeValue mediaTime; 495 496 // Increment to the next frame 497 fileOffset += frame_size; 498 if(fileOffset > fileSize) 499 break; //frame is incomplete, drop it. 500 err = AddMediaSampleReferences64(audioMedia, // Specifies the media for this operation 501 (SampleDescriptionHandle)globals->audioDesc, // The sampleRecord to add 502 1, // 1 sample to add 503 &sampleRec, // the sample to add 504 &mediaTime); // The time of the sample 495 505 if (err) goto bail; 496 506 497 // Increment to the next frame498 fileOffset += frame_size;499 507 } 500 508
