Ignore:
Timestamp:
06/15/09 06:16:52 (10 years ago)
Author:
Nicholas Riley
Message:

Minimally convert media playback to QTKit. Some direct QuickTime? access still needs migrating.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSMovieAlertController.m

    r133 r543  
    1010#import "PSMovieAlertController.h"
    1111#import "PSMovieAlert.h"
    12 #import "NSMovie-NJRExtensions.h"
     12#import "QTMovie-NJRExtensions.h"
    1313#import "NJRSoundManager.h"
    1414#import <QuickTime/Movies.h>
     
    3838        repetitionsRemaining--;
    3939        [movieView gotoBeginning: self];
    40         [movieView start: self];
     40        [movieView play: self];
    4141    }
    4242    delay = (GetMovieDuration((Movie)theMovie) - GetMovieTime((Movie)theMovie, NULL)) / (double)GetMovieTimeScale((Movie)theMovie);
     
    4848{
    4949    if ([self initWithWindowNibName: @"Movie alert"]) {
    50         NSMovie *movie = [anAlert movie];
     50        QTMovie *movie = [anAlert movie];
    5151        NSWindow *window = [self window]; // connect outlets
    5252        alarm = anAlarm;
    5353        alert = anAlert;
     54        theMovie = [movie quickTimeMovie];
    5455        [movieView setMovie: movie];
    55         theMovie = [movie QTMovie];
    5656        if ([alert hasVideo]) {
    5757            NSRect screenRect = [[window screen] visibleFrame];
    58             float magnification = 1.0;
    59             NSSize movieSize;
     58            NSSize movieSize = [[movie attributeForKey: QTMovieNaturalSizeAttribute] sizeValue];
    6059            NSSize minSize = [window minSize];
    6160            float windowFrameHeight = [window frame].size.height - [[window contentView] frame].size.height;
     
    6362            screenRect.size.height -= windowFrameHeight;
    6463            minSize.height -= windowFrameHeight;
    65             while (1) {
    66                 movieSize = [movieView sizeForMagnification: magnification];
    67                 movieSize.height -= 16; // controller is hidden, but its size is included (documented, ergh)
    68                 if (movieSize.width > screenRect.size.width || movieSize.height > screenRect.size.height)
    69                     magnification /= 2;
    70                 else
    71                     break;
     64            while (movieSize.width > screenRect.size.width || movieSize.height > screenRect.size.height) {
     65                movieSize.width /= 2;
     66                movieSize.height /= 2;
    7267            }
    7368            if (movieSize.width < minSize.width) movieSize.width = minSize.width;
     
    9489        repetitions = [alert repetitions];
    9590        repetitionsRemaining = repetitions;
    96         if ([movie hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) {
     91        if ([movie NJR_hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) {
    9792            [NJRSoundManager setDefaultOutputVolume: [alert outputVolume]];
    9893        }
    99         if (![movie isStatic]) [self play]; // if it's an image, don't close the window automatically
     94        if (![movie NJR_isStatic]) [self play]; // if it's an image, don't close the window automatically
    10095    }
    10196    return self;
     
    115110{
    116111    repetitions = 0;
    117     [movieView stop: self];
     112    [movieView pause: self];
    118113    [alert completedForAlarm: alarm];
    119114    [self autorelease];
Note: See TracChangeset for help on using the changeset viewer.