Show
Ignore:
Timestamp:
02/23/10 16:48:16 (2 years ago)
Author:
gbooker
Message:

Made DVD Player stop if it's not playing for 5 minutes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDPlayer.m

    r1151 r1163  
    7474        [asset release]; 
    7575        [frameworkLoad release]; 
     76        [stopTimer invalidate]; 
    7677        [super dealloc]; 
    7778} 
     
    9596- (BOOL)canPlay:(NSString *)path withError:(NSError **)error 
    9697{ 
    97         NSLog(@"Testing can play"); 
     98        //NSLog(@"Testing can play"); 
    9899        BOOL usable = [frameworkLoad openWithError:error]; 
    99100        if(!usable) 
    100101                return NO; 
    101102         
    102         NSLog(@"Usable from %@ says %d", frameworkLoad, usable); 
     103        //NSLog(@"Usable from %@ says %d", frameworkLoad, usable); 
    103104         
    104105        usable = [self initializeFrameworkWithError:error]; 
     
    137138                         
    138139                case 2: //is volume 
    139                         NSLog(@"%@, is a volume!", [theVolume lastPathComponent]); 
     140                        //NSLog(@"%@, is a volume!", [theVolume lastPathComponent]); 
    140141                        isVolume = YES; 
    141142                        break; 
    142143                default: 
    143                         NSLog(@"not a volume: %i, %@", fsType,[theVolume lastPathComponent]); 
     144                        //NSLog(@"not a volume: %i, %@", fsType,[theVolume lastPathComponent]); 
    144145                        isVolume = NO; 
    145146                        break; 
     
    197198                        if ([[mountPath lastPathComponent] isEqualToString:[theVolume lastPathComponent]]) 
    198199                        { 
    199                                 NSLog(@"%@ is a disc image", [theVolume lastPathComponent]); 
     200                                //NSLog(@"%@ is a disc image", [theVolume lastPathComponent]); 
    200201                                return YES; 
    201202                        } 
     
    251252        NSURL *url = [NSURL URLWithString:[asset mediaURL]]; 
    252253        NSString *path = [[url path] stringByAppendingPathComponent:@"VIDEO_TS"]; 
    253         NSLog(@"Going to play %@", path); 
     254        //NSLog(@"Going to play %@", path); 
    254255         
    255256        BOOL ret = [frameworkLoad openWithError:error]; 
    256         NSLog(@"Framework usable is %d", ret); 
     257        //NSLog(@"Framework usable is %d", ret); 
    257258        if(!ret) 
    258259                return NO; 
    259260        ret = [self initializeFrameworkWithError:error]; 
    260         NSLog(@"Initialize is %d", ret); 
     261        //NSLog(@"Initialize is %d", ret); 
    261262        if(!ret) 
    262263                return NO; 
     
    265266        OSStatus resultz=[CMPDVDPlayer getFSRefAtPath:path ref:&fsRef]; 
    266267        //OSStatus resultz = FSPathMakeRef((UInt8*)cPath, &fsRef, NULL); 
    267         NSLog(@"make path is %d", resultz); 
     268        //NSLog(@"make path is %d", resultz); 
    268269        OSStatus openError = resultz; 
    269270        if(resultz == noErr) 
    270271                openError = DVDOpenMediaFile(&fsRef); 
    271272         
    272         NSLog(@"open error is %d", openError); 
     273        //NSLog(@"open error is %d", openError); 
    273274        return openError == noErr; 
    274275} 
     
    388389- (void)goToMenu 
    389390{ 
    390         NSLog(@"Going to Menu"); 
     391        //NSLog(@"Going to Menu"); 
    391392        if(DVDGoToMenu(kDVDMenuRoot) != noErr) 
    392393        { 
     
    399400- (void)play 
    400401{ 
    401         NSLog(@"Playing"); 
     402        //NSLog(@"Playing"); 
    402403        DVDPlay(); 
    403404} 
     
    405406- (void)pause 
    406407{ 
    407         NSLog(@"Pausing"); 
     408        //NSLog(@"Pausing"); 
    408409        DVDPause(); 
    409410} 
     
    470471- (void)incrementScanRate 
    471472{ 
    472         NSLog(@"Incrementing scan rate"); 
     473        //NSLog(@"Incrementing scan rate"); 
    473474        //Really increment in terms of forward direction 
    474475        DVDScanRate outRate; 
     
    476477         
    477478        DVDGetScanRate(&outRate, &outDirection); 
    478         NSLog(@"Scan rate in currently %d:%d", outDirection, outRate); 
     479        //NSLog(@"Scan rate in currently %d:%d", outDirection, outRate); 
    479480        DVDScanRate newRate; 
    480481        if(outDirection == kDVDScanDirectionForward) 
     
    488489                newRate = outRate; 
    489490        } 
    490         NSLog(@"Scan rate in now %d:%d", outDirection, newRate); 
     491        //NSLog(@"Scan rate in now %d:%d", outDirection, newRate); 
    491492        DVDScan(newRate, outDirection); 
    492493} 
     
    494495- (void)decrementScanRate 
    495496{ 
    496         NSLog(@"Decrementing scan rate"); 
     497        //NSLog(@"Decrementing scan rate"); 
    497498        //Really decrement in terms of forward direction 
    498499        DVDScanRate outRate; 
     
    500501         
    501502        DVDGetScanRate(&outRate, &outDirection); 
    502         NSLog(@"Scan rate in currently %d:%d", outDirection, outRate); 
     503        //NSLog(@"Scan rate in currently %d:%d", outDirection, outRate); 
    503504        DVDScanRate newRate; 
    504505        if(outDirection == kDVDScanDirectionForward) 
     
    512513                newRate = outRate; 
    513514        } 
    514         NSLog(@"Scan rate in now %d:%d", outDirection, newRate); 
     515        //NSLog(@"Scan rate in now %d:%d", outDirection, newRate); 
    515516        DVDScan(newRate, outDirection); 
    516517} 
     
    625626- (void)nextChapter 
    626627{ 
    627         NSLog(@"Going to next chapter"); 
     628        //NSLog(@"Going to next chapter"); 
    628629        DVDNextChapter(); 
    629630} 
     
    631632- (void)previousChapter 
    632633{ 
    633         NSLog(@"Going to previous chapter"); 
     634        //NSLog(@"Going to previous chapter"); 
    634635        DVDPreviousChapter(); 
    635636} 
     
    689690        //See if we can go SPDIF 
    690691        OSStatus SPDIFresult = DVDGetAudioOutputModeCapabilities(&audioMode); 
    691         NSLog(@"SPDIF get is %d with mode %d", SPDIFresult, audioMode); 
     692        //NSLog(@"SPDIF get is %d with mode %d", SPDIFresult, audioMode); 
    692693        if(audioMode & kDVDAudioModeSPDIF) 
    693694        { 
    694695                //Engage the SPDIF interface 
    695696                SPDIFresult = DVDSetAudioOutputMode(kDVDAudioModeSPDIF); 
    696                 NSLog(@"Set to SPDIF with result %d", SPDIFresult); 
     697                //NSLog(@"Set to SPDIF with result %d", SPDIFresult); 
    697698                SPDIFresult = DVDSetSPDIFDataOutDevice(0); 
    698                 NSLog(@"Set SPDIF device with result %d", SPDIFresult); 
     699                //NSLog(@"Set SPDIF device with result %d", SPDIFresult); 
    699700        }        
    700701         
     
    727728- (void)stopPlayback 
    728729{ 
    729         NSLog(@"Stopping"); 
     730        //NSLog(@"Stopping"); 
    730731        DVDUnregisterEventCallBack(eventCallbackID); 
    731732        eventCallbackID = 0; 
     
    839840} 
    840841 
     842- (void)stopTimerFire 
     843{ 
     844        stopTimer = nil; 
     845        [controller playbackStopped]; 
     846} 
     847 
     848- (void)resetStopTimer 
     849{ 
     850        [stopTimer invalidate]; 
     851        stopTimer = [NSTimer scheduledTimerWithTimeInterval:5*60 target:self selector:@selector(stopTimerFire) userInfo:nil repeats:NO]; 
     852} 
     853 
    841854- (void)titleChanged 
    842855{ 
     
    847860- (void)titleTimeChanged 
    848861{ 
     862        [self performSelectorOnMainThread:@selector(resetStopTimer) withObject:nil waitUntilDone:NO]; 
    849863        UInt16 frames; 
    850864        UInt32 time = 0; 
     
    10221036{ 
    10231037        OSStatus result = DVDInitialize(); 
    1024         NSLog(@"DVDInitialize: %d", result); 
     1038        //NSLog(@"DVDInitialize: %d", result); 
    10251039        DVDEventCode eventCodes[] = { 
    10261040                kDVDEventDisplayMode,  
     
    10431057                                                                           (UInt32)self,  
    10441058                                                                           &eventCallbackID); 
    1045         NSLog(@"DVD Register Callbacks: %d", result); 
     1059        //NSLog(@"DVD Register Callbacks: %d", result); 
    10461060        switch(result) 
    10471061        {