Changeset 544


Ignore:
Timestamp:
06/15/09 23:02:41 (10 years ago)
Author:
Nicholas Riley
Message:

Don't keep QTMovies around (and corresponding files open) for pending alarms; we could run out of file handles this way.

Location:
trunk/Cocoa/Pester/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSMediaAlert.h

    r133 r544  
    99#import "PSAlert.h"
    1010
     11extern const float PSMediaAlertNoVolume;
    1112
    1213@interface PSMediaAlert : PSAlert {
  • trunk/Cocoa/Pester/Source/PSMediaAlert.m

    r543 r544  
    1515static NSString * const PLAlertOutputVolume = @"volume"; // NSNumber
    1616
    17 static const float PSMediaAlertNoVolume = 0;
     17const float PSMediaAlertNoVolume = 0;
    1818
    1919@implementation PSMediaAlert
  • trunk/Cocoa/Pester/Source/PSMovieAlert.h

    r543 r544  
    88
    99#import <AppKit/AppKit.h>
    10 #import <QTKit/QTKit.h>
    1110#import "PSMediaAlert.h"
    1211
    1312@class BDAlias;
     13@class QTMovie;
    1414
    1515@interface PSMovieAlert : PSMediaAlert {
    1616    BDAlias *alias;
    17     QTMovie *movie;
    1817    BOOL hasAudio;
    1918    BOOL hasVideo;
  • trunk/Cocoa/Pester/Source/PSMovieAlert.m

    r543 r544  
    77//
    88
     9#import <QTKit/QTKit.h>
    910#import <QuickTime/Movies.h>
    1011#import "PSMovieAlert.h"
     
    3536        alias = [anAlias retain];
    3637        repetitions = numReps;
    37         // 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 = [[QTMovie alloc] initWithFile: path error: NULL];
     38        QTMovie *movie = [[QTMovie alloc] initWithFile: path error: NULL];
    3939        if (movie == nil) {
    4040            [self release];
     
    4848            }
    4949        }
     50        [movie release];
    5051    }
    5152   
     
    6566- (QTMovie *)movie;
    6667{
    67     return movie;
     68    NSString *path = [alias fullPath];
     69    if (path == nil)
     70        return nil;
     71   
     72    return [[[QTMovie alloc] initWithFile: path error: NULL] autorelease];
    6873}
    6974
     
    8186{
    8287    [alias release];
    83     [movie release];
     88
     89    NSLog(@"PSMovieAlert dealloc: %@", self);
    8490    [super dealloc];
    8591}
     
    8793- (NSString *)description;
    8894{
    89     return [NSString stringWithFormat: @"PSMovieAlert (%@%@): %@, repeats %hu times%@", hasAudio ? @"A" : @"", hasVideo ? @"V" : @"", [alias fullPath], repetitions, hasAudio && outputVolume != kNoVolume ? [NSString stringWithFormat: @" at %.0f%% volume", outputVolume * 100] : @""];
     95    return [NSString stringWithFormat: @"PSMovieAlert (%@%@): %@, repeats %hu times%@", hasAudio ? @"A" : @"", hasVideo ? @"V" : @"", [alias fullPath], repetitions, hasAudio && outputVolume != PSMediaAlertNoVolume ? [NSString stringWithFormat: @" at %.0f%% volume", outputVolume * 100] : @""];
    9096}
    9197
     
    97103- (NSAttributedString *)actionDescription;
    98104{
    99     BOOL isStatic = [movie NJR_isStatic];
     105    BOOL isStatic = [[self movie] NJR_isStatic];
    100106    NSMutableAttributedString *string = [[(isStatic ? @"Show " : @"Play ") small] mutableCopy];
    101107    NSString *kindString = nil, *name = [alias displayNameWithKindString: &kindString];
Note: See TracChangeset for help on using the changeset viewer.