Changeset 1163

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

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

Location:
branches/PlayerFramework/CommonMediaPlayer
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/PlayerFramework/CommonMediaPlayer/Classes/CMPPlayerManager.m

    r1159 r1163  
    131131                [players addObjectsFromArray:genericPlayers]; 
    132132 
    133         NSLog(@"List of players is %@", players); 
     133        //NSLog(@"List of players is %@", players); 
    134134        NSEnumerator *playerEnum = [players objectEnumerator]; 
    135135        Class playerClass; 
     
    139139                player = [[playerClass alloc] init]; 
    140140                 
    141                 NSLog(@"Testing %@", player); 
     141                //NSLog(@"Testing %@", player); 
    142142                BOOL canPlay = [player canPlay:path withError:nil]; 
    143                 NSLog(@"can play is %d", canPlay); 
     143                //NSLog(@"can play is %d", canPlay); 
    144144                if(canPlay) 
    145145                { 
    146146                        CMPBaseMediaAsset *asset = [[CMPBaseMediaAsset alloc] initWithMediaURL:[NSURL fileURLWithPath:path]]; 
    147147                        canPlay &= [player setMedia:asset error:nil]; 
    148                         NSLog(@"Set asset is %d", canPlay); 
     148                        //NSLog(@"Set asset is %d", canPlay); 
    149149                        [asset release]; 
    150150                } 
    151151                if(canPlay) 
    152152                { 
    153                         NSLog(@"Using Player"); 
     153                        //NSLog(@"Using Player"); 
    154154                        [player retain]; 
    155155                        break; 
     
    180180        } 
    181181         
    182         NSLog(@"Controllers is %@", goodControllers); 
     182        //NSLog(@"Controllers is %@", goodControllers); 
    183183         
    184184        //XXX Prefs 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDFrameworkLoadAction.m

    r1095 r1163  
    182182                                                                                                                                                                  BRLocalizedString(@"Failed to load DVD Framework", @"Failure to load error message"), NSLocalizedDescriptionKey, 
    183183                                                                                                                                                                  nil]]; 
    184                         else 
    185                                 NSLog(@"Loaded framework"); 
     184                        //else 
     185                                //NSLog(@"Loaded framework"); 
    186186                } 
    187187        } 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDImageAction.m

    r1121 r1163  
    124124        { 
    125125                 
    126                 NSLog(error); 
     126                NSLog(@"%@", error); 
    127127                 
    128128                [error release]; 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDPlayer.h

    r1136 r1163  
    5555        UInt32                                          titleDuration; 
    5656        UInt32                                          currentElapsedTime; 
     57        NSTimer                                         *stopTimer; 
    5758} 
    5859 
  • 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        { 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDPlayerController.m

    r1151 r1163  
    8383        { 
    8484//              [layer setOpaque:NO]; 
    85                 NSLog(@"Layer is %@ with %d children", layer, [[layer sublayers] count]); 
     85                //NSLog(@"Layer is %@ with %d children", layer, [[layer sublayers] count]); 
    8686                id superlayer = [layer superlayer]; 
    8787                //              if(count < 6) 
    8888//              [layer setOpacity:opacity]; 
    8989                [layer setBackgroundColor:clear]; 
    90                 NSLog(@"Set opacity of %d layer", count); 
     90                //NSLog(@"Set opacity of %d layer", count); 
    9191                layer = superlayer; 
    9292                count++; 
     
    243243                return; 
    244244        CGSGetWindowBounds(cid, dvdWindow, &bounds); 
    245         NSLog(@"Bounds is %fx%f - %fx%f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); 
     245        //NSLog(@"Bounds is %fx%f - %fx%f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); 
    246246//      CGLGetCurrentContext() 
    247247        char *bitmap = malloc(bounds.size.width *bounds.size.height * 4); 
     
    485485- (BOOL)brEventAction:(BREvent *)event 
    486486{ 
    487         NSLog(@"Got event %@", event); 
     487        //NSLog(@"Got event %@", event); 
    488488        BREventRemoteAction action = [CMPATVVersion remoteActionForEvent:event]; 
    489489        if(![player playing]) 
     
    495495        BOOL inMenu = [player inMenu]; 
    496496        CMPDVDState state = [player state]; 
    497         NSLog(@"State is %d and doing %d", state, action); 
     497        //NSLog(@"State is %d and doing %d", state, action); 
    498498        BOOL playingInSomeForm = (state == CMPDVDStatePlaying || state == CMPDVDStateScanningForward || state == CMPDVDStateScanningBackward || state == CMPDVDStatePlayingSlowForward || state == CMPDVDStatePlayingSlowBackward); 
    499499        BOOL supressStateDisplay = inMenu; 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDWindowCreationAction.m

    r1142 r1163  
    162162        NSRect frameRect; 
    163163        frameRect.size = [textField frame].size; 
    164         NSLog(@"Size is %fx%f", frameRect.size.width, frameRect.size.height); 
     164        //NSLog(@"Size is %fx%f", frameRect.size.width, frameRect.size.height); 
    165165        float distanceFromEdge = screenRect.size.height / 15; 
    166166        if(position == CMPDVDOverlayUpperLeft || position == CMPDVDOverlayUpperRight) 
     
    519519        //NSLog(@"Bounds is %fx%f - %fx%f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); 
    520520        //      CGLGetCurrentContext() 
    521         NSLog(@"bounds is %fx%f-%fx%f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); 
     521        //NSLog(@"bounds is %fx%f-%fx%f", bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); 
    522522        CGRect imageBounds = bounds; 
    523523        if(bounds.size.height > 480 || bounds.size.width > 720) 
  • branches/PlayerFramework/CommonMediaPlayer/Media Players/DVD Framework/CMPISODVDPlayer.m

    r1124 r1163  
    5858//      } 
    5959        imageMount = [[CMPDVDImageAction alloc] initWithPath:path]; 
    60         NSLog(@"imagePath: %@", path); 
     60        //NSLog(@"imagePath: %@", path); 
    6161        if (![imageMount openWithError:nil] == YES) 
    6262        { 
    63                 NSLog(@"fail"); 
     63                NSLog(@"failed to mount image"); 
    6464                return; 
    6565        } 
    6666         
    67         NSLog(@"mountedPath = %@", [imageMount mountedPath]); 
     67        //NSLog(@"mountedPath = %@", [imageMount mountedPath]); 
    6868        NSString *mountedPath = [imageMount mountedPath]; 
    6969