Changeset 543


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

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

Location:
trunk/Cocoa/Pester
Files:
1 added
3 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/English.lproj/Movie alert.nib/classes.nib

    r59 r543  
    1 {
    2     IBClasses = (
    3         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
    4         {CLASS = NJRCenteringMovieView; LANGUAGE = ObjC; SUPERCLASS = NSMovieView; },
    5         {
    6             ACTIONS = {close = id; };
    7             CLASS = PSMovieAlertController;
    8             LANGUAGE = ObjC;
    9             OUTLETS = {movieView = NSMovieView; };
    10             SUPERCLASS = NSWindowController;
    11         },
    12         {CLASS = "java.lang.Object"; LANGUAGE = Java; }
    13     );
    14     IBVersion = 1;
    15 }
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     3<plist version="1.0">
     4<dict>
     5        <key>IBClasses</key>
     6        <array>
     7                <dict>
     8                        <key>CLASS</key>
     9                        <string>NSObject</string>
     10                        <key>LANGUAGE</key>
     11                        <string>ObjC</string>
     12                </dict>
     13                <dict>
     14                        <key>CLASS</key>
     15                        <string>FirstResponder</string>
     16                        <key>LANGUAGE</key>
     17                        <string>ObjC</string>
     18                        <key>SUPERCLASS</key>
     19                        <string>NSObject</string>
     20                </dict>
     21                <dict>
     22                        <key>ACTIONS</key>
     23                        <dict>
     24                                <key>close</key>
     25                                <string>id</string>
     26                        </dict>
     27                        <key>CLASS</key>
     28                        <string>PSMovieAlertController</string>
     29                        <key>LANGUAGE</key>
     30                        <string>ObjC</string>
     31                        <key>OUTLETS</key>
     32                        <dict>
     33                                <key>movieView</key>
     34                                <string>QTMovieView</string>
     35                        </dict>
     36                        <key>SUPERCLASS</key>
     37                        <string>NSWindowController</string>
     38                </dict>
     39                <dict>
     40                        <key>CLASS</key>
     41                        <string>NSWindow</string>
     42                        <key>LANGUAGE</key>
     43                        <string>ObjC</string>
     44                        <key>SUPERCLASS</key>
     45                        <string>NSResponder</string>
     46                </dict>
     47        </array>
     48        <key>IBVersion</key>
     49        <string>1</string>
     50</dict>
     51</plist>
  • trunk/Cocoa/Pester/Source/English.lproj/Movie alert.nib/info.nib

    r59 r543  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    33<plist version="1.0">
    44<dict>
    5         <key>IBDocumentLocation</key>
    6         <string>36 16 356 240 0 0 1280 832 </string>
    75        <key>IBFramework Version</key>
    8         <string>291.0</string>
     6        <string>677</string>
     7        <key>IBLastKnownRelativeProjectPath</key>
     8        <string>../Pester.xcodeproj</string>
     9        <key>IBOldestOS</key>
     10        <integer>4</integer>
    911        <key>IBOpenObjects</key>
    1012        <array>
    11                 <integer>10</integer>
     13                <integer>51</integer>
    1214        </array>
    1315        <key>IBSystem Version</key>
    14         <string>6G30</string>
     16        <string>9J61</string>
     17        <key>targetFramework</key>
     18        <string>IBCocoaFramework</string>
    1519</dict>
    1620</plist>
  • trunk/Cocoa/Pester/Source/PSMediaAlert.m

    r364 r543  
    1010#import "NSDictionary-NJRExtensions.h"
    1111#import "NJRSoundManager.h"
    12 #import <QuickTime/Movies.h>
    1312
    1413// property list keys
    1514static NSString * const PLAlertRepetitions = @"times"; // NSString
    1615static NSString * const PLAlertOutputVolume = @"volume"; // NSNumber
     16
     17static const float PSMediaAlertNoVolume = 0;
    1718
    1819@implementation PSMediaAlert
     
    5051        outputVolume = volume;
    5152    else
    52         outputVolume = kNoVolume;
     53        outputVolume = PSMediaAlertNoVolume;
    5354}
    5455
     
    5960    NSMutableDictionary *plAlert = [[super propertyListRepresentation] mutableCopy];
    6061    [plAlert setObject: [NSNumber numberWithUnsignedShort: repetitions] forKey: PLAlertRepetitions];
    61     if (outputVolume != kNoVolume) {
     62    if (outputVolume != PSMediaAlertNoVolume) {
    6263        [plAlert setObject: [NSNumber numberWithFloat: outputVolume] forKey: PLAlertOutputVolume];
    6364    }
  • trunk/Cocoa/Pester/Source/PSMovieAlert.h

    r133 r543  
    88
    99#import <AppKit/AppKit.h>
     10#import <QTKit/QTKit.h>
    1011#import "PSMediaAlert.h"
    1112
     
    1415@interface PSMovieAlert : PSMediaAlert {
    1516    BDAlias *alias;
    16     NSMovie *movie;
     17    QTMovie *movie;
    1718    BOOL hasAudio;
    1819    BOOL hasVideo;
     
    2425
    2526- (BOOL)hasVideo;
    26 - (NSMovie *)movie;
     27- (QTMovie *)movie;
    2728- (BDAlias *)movieFileAlias;
    2829
  • trunk/Cocoa/Pester/Source/PSMovieAlert.m

    r133 r543  
    1111#import "PSMovieAlertController.h"
    1212#import "NSDictionary-NJRExtensions.h"
    13 #import "NSMovie-NJRExtensions.h"
     13#import "QTMovie-NJRExtensions.h"
    1414#import "BDAlias.h"
    1515
     
    3636        repetitions = numReps;
    3737        // XXX if we support remote movie URLs, need to call EnterMovies() ourselves at least in Jaguar (_MacTech_ December 2002, p. 64); also should do async movie loading (p. 73Ð74).
    38         movie = [[NSMovie alloc] initWithURL: [NSURL fileURLWithPath: path] byReference: YES];
     38        movie = [[QTMovie alloc] initWithFile: path error: NULL];
    3939        if (movie == nil) {
    4040            [self release];
    4141            self = nil;
    4242        } else {
    43             hasAudio = [movie hasAudio];
    44             hasVideo = [movie hasVideo];
     43            hasAudio = [movie NJR_hasAudio];
     44            hasVideo = [movie NJR_hasVideo];
    4545           
    4646            if (!hasAudio && !hasVideo) {
     
    6363}
    6464
    65 - (NSMovie *)movie;
     65- (QTMovie *)movie;
    6666{
    6767    return movie;
     
    9797- (NSAttributedString *)actionDescription;
    9898{
    99     BOOL isStatic = [movie isStatic];
     99    BOOL isStatic = [movie NJR_isStatic];
    100100    NSMutableAttributedString *string = [[(isStatic ? @"Show " : @"Play ") small] mutableCopy];
    101101    NSString *kindString = nil, *name = [alias displayNameWithKindString: &kindString];
  • trunk/Cocoa/Pester/Source/PSMovieAlertController.h

    r133 r543  
    1111@class PSAlarm;
    1212@class PSMovieAlert;
     13@class QTMovieView;
    1314
    1415@interface PSMovieAlertController : NSWindowController {
    1516    PSAlarm *alarm;
    1617    PSMovieAlert *alert;
    17     IBOutlet NSMovieView *movieView;
     18    IBOutlet QTMovieView *movieView;
    1819    void *theMovie; /* Movie */
    1920    unsigned short repetitions;
  • 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];
  • trunk/Cocoa/Pester/Source/Pester.xcodeproj/project.pbxproj

    r541 r543  
    8282                E1B11F650CF5F30F004975AA /* NJRIntervalField.m in Sources */ = {isa = PBXBuildFile; fileRef = E13919E303B9E4E100000028 /* NJRIntervalField.m */; };
    8383                E1B11F660CF5F30F004975AA /* PSError.m in Sources */ = {isa = PBXBuildFile; fileRef = E1ECA00703C002B300F54C66 /* PSError.m */; };
    84                 E1B11F670CF5F30F004975AA /* NJRCenteringMovieView.m in Sources */ = {isa = PBXBuildFile; fileRef = E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */; };
    8584                E1B11F690CF5F30F004975AA /* PSTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = E1BF6E9103C928D200050002 /* PSTimer.m */; };
    8685                E1B11F6A0CF5F30F004975AA /* PSWakeAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = E19FD39F03C98645001509F3 /* PSWakeAlert.m */; };
     
    242241                E1CDEC3D0444053F00AEEDB1 /* NJRNonCenteringWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJRNonCenteringWindow.h; sourceTree = "<group>"; };
    243242                E1CDEC3E0444053F00AEEDB1 /* NJRNonCenteringWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJRNonCenteringWindow.m; sourceTree = "<group>"; };
    244                 E1D358B903C60CE900C8A18E /* NJRCenteringMovieView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJRCenteringMovieView.h; sourceTree = "<group>"; };
    245                 E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJRCenteringMovieView.m; sourceTree = "<group>"; };
    246243                E1DEF0EA03FE1BF100050002 /* OARightArrowPressed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = OARightArrowPressed.tiff; sourceTree = "<group>"; };
    247244                E1DEF0EB03FE1BF100050002 /* OALeftArrow.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = OALeftArrow.tiff; sourceTree = "<group>"; };
     
    655652                        children = (
    656653                                E17F2F4C03FDF67D00050002 /* OACalendarView */,
    657                                 E1D358B903C60CE900C8A18E /* NJRCenteringMovieView.h */,
    658                                 E1D358BA03C60CE900C8A18E /* NJRCenteringMovieView.m */,
    659654                                E1F0B14A03AD8CEF00AEFBE0 /* NJRUnfocusableMovieView.h */,
    660655                                E1F0B14B03AD8CEF00AEFBE0 /* NJRUnfocusableMovieView.m */,
     
    892887                                E1B11F650CF5F30F004975AA /* NJRIntervalField.m in Sources */,
    893888                                E1B11F660CF5F30F004975AA /* PSError.m in Sources */,
    894                                 E1B11F670CF5F30F004975AA /* NJRCenteringMovieView.m in Sources */,
    895889                                E1B11F690CF5F30F004975AA /* PSTimer.m in Sources */,
    896890                                E1B11F6A0CF5F30F004975AA /* PSWakeAlert.m in Sources */,
Note: See TracChangeset for help on using the changeset viewer.