Changeset 461
- Timestamp:
- 04/25/07 17:48:20 (1 year ago)
- Files:
-
- trunk/Perian.xcodeproj/project.pbxproj (modified) (2 diffs)
- trunk/ff_MovieImport.c (modified) (3 diffs)
- trunk/ff_private.c (modified) (6 diffs)
- trunk/ff_private.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Perian.xcodeproj/project.pbxproj
r459 r461 1162 1162 F5CFD2D60B5012A100616865 /* A52Codec.component */, 1163 1163 F5CFD2D80B5012A100616865 /* AC3MovieImport.component */, 1164 F5CFD2DA0B5012A100616865 /* Preferences.app */,1164 F5CFD2DA0B5012A100616865 /* A52Preferences.app */, 1165 1165 ); 1166 1166 name = Products; … … 1430 1430 sourceTree = BUILT_PRODUCTS_DIR; 1431 1431 }; 1432 F5CFD2DA0B5012A100616865 /* Preferences.app */ = {1432 F5CFD2DA0B5012A100616865 /* A52Preferences.app */ = { 1433 1433 isa = PBXReferenceProxy; 1434 1434 fileType = wrapper.application; 1435 path = Preferences.app;1435 path = A52Preferences.app; 1436 1436 remoteRef = F5CFD2D90B5012A100616865 /* PBXContainerItemProxy */; 1437 1437 sourceTree = BUILT_PRODUCTS_DIR; trunk/ff_MovieImport.c
r424 r461 398 398 memset(&byteContext, 0, sizeof(byteContext)); 399 399 result = url_open_dataref(&byteContext, dataRef, dataRefType, &storage->dataHandler, &storage->dataHandlerSupportsWideOffsets, &storage->dataSize); 400 storage->isStreamed = dataRefType == URLDataHandlerSubType; 400 401 require_noerr(result, bail); 401 402 … … 497 498 498 499 //import with idle. Decode a little bit of data now. 499 import_with_idle(storage, inFlags, outFlags, 10, 300 );500 import_with_idle(storage, inFlags, outFlags, 10, 300, true); 500 501 } else { 501 502 //QuickTime didn't request import with idle, so do it all now. 502 import_with_idle(storage, inFlags, outFlags, 0, 0 );503 import_with_idle(storage, inFlags, outFlags, 0, 0, true); 503 504 } 504 505 … … 518 519 519 520 ComponentResult FFAvi_MovieImportIdle(ff_global_ptr storage, long inFlags, long *outFlags) { 520 return(import_with_idle(storage, inFlags | movieImportWithIdle, outFlags, 0, 1000)); 521 ComponentResult err = noErr; 522 TimeValue currentIdleTime = GetMovieTime(storage->movie, NULL); 523 TimeScale movieTimeScale = GetMovieTimeScale(storage->movie); 524 int addSamples = false; 525 526 storage->idlesSinceLastAdd++; 527 528 if (currentIdleTime == storage->lastIdleTime && storage->idlesSinceLastAdd > 5 || 529 storage->loadedTime < currentIdleTime + 5*movieTimeScale) 530 { 531 storage->idlesSinceLastAdd = 0; 532 addSamples = true; 533 } 534 535 err = import_with_idle(storage, inFlags | movieImportWithIdle, outFlags, 0, 1000, addSamples); 536 537 storage->lastIdleTime = currentIdleTime; 538 return err; 521 539 } 522 540 trunk/ff_private.c
r459 r461 522 522 map[j].index = st->index; 523 523 map[j].str = st; 524 map[j].duration = -1; 524 525 525 526 if(st->codec->codec_type == CODEC_TYPE_VIDEO) { … … 780 781 * Supports progressive importing, but will not idle if maxFrames == 0. 781 782 */ 782 ComponentResult import_with_idle(ff_global_ptr storage, long inFlags, long *outFlags, int minFrames, int maxFrames ) {783 ComponentResult import_with_idle(ff_global_ptr storage, long inFlags, long *outFlags, int minFrames, int maxFrames, bool addSamples) { 783 784 SampleReference64Record sampleRec; 784 785 DataHandler dataHandler; … … 826 827 Media media = ncstream->media; 827 828 828 if(media )829 if(media && ncstream->duration == -1) 829 830 ncstream->duration = GetMediaDuration(media); 830 831 } … … 914 915 Media media = ncstream->media; 915 916 916 if(media ) {917 if(media && (addSamples || readResult != 0)) { 917 918 Track track = GetMediaTrack(media); 918 919 TimeScale mediaTimeScale = GetMediaTimeScale(media); … … 928 929 result = InsertMediaIntoTrack(track, -1, prevDuration, addedDuration, fixed1); 929 930 } 931 ncstream->duration = -1; 930 932 } 931 933 } … … 969 971 970 972 //tell the idle manager to idle us again in 500ms. 971 if(idling && storage->idleManager )973 if(idling && storage->idleManager && storage->isStreamed) 972 974 QTIdleManagerSetNextIdleTimeDelta(storage->idleManager, 1, 2); 973 975 trunk/ff_private.h
r402 r461 60 60 Track placeholderTrack; 61 61 DataHandler dataHandler; 62 bool isStreamed; 62 63 Boolean dataHandlerSupportsWideOffsets; 63 64 int64_t dataSize; … … 67 68 long movieLoadState; 68 69 TimeValue loadedTime; 70 TimeValue lastIdleTime; 71 int idlesSinceLastAdd; 69 72 70 73 //the "atTime" parameter to the initial import. … … 100 103 int determine_header_offset(ff_global_ptr storage); 101 104 int import_using_index(ff_global_ptr storage, int *hadIndex, TimeValue *addedDuration); 102 ComponentResult import_with_idle(ff_global_ptr storage, long inFlags, long *outFlags, int minFrames, int maxFrames );105 ComponentResult import_with_idle(ff_global_ptr storage, long inFlags, long *outFlags, int minFrames, int maxFrames, bool addSamples); 103 106 ComponentResult create_placeholder_track(Movie movie, Track *placeholderTrack, TimeValue duration, Handle dataRef, OSType dataRefType); 104 107 void send_movie_changed_notification(Movie movie);
