Changeset 523

Show
Ignore:
Timestamp:
04/26/08 02:51:19 (9 months ago)
Author:
gbooker
Message:

Apparently, making a QTMovie out of a Movie which already exists in the player triggers some sneak code that screws up things. Re-adapted all this code to Movie instead of QTMovie to avoid this mess. Also, increased the padding just in case.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SapphireFrappliance/SapphireVideoPlayer.h

    r498 r523  
    3939 */ 
    4040@interface SapphireVideoPlayer : BRQTKitVideoPlayer { 
    41         int                                             padding[4];   /*!< @brief The classes are of different sizes.  This padding prevents a class compiled with one size to overlap when used with a class of a different size*/ 
     41        int                                             padding[16];  /*!< @brief The classes are of different sizes.  This padding prevents a class compiled with one size to overlap when used with a class of a different size*/ 
    4242        double                                  skipTime;               /*!< @brief Time by which next skip should advance/reverse*/ 
    4343        SkipState                               state;                  /*!< @brief Current state we are in*/ 
    4444        BOOL                                    enabled;                /*!< @brief YES if we are enabled, NO if we behave the same as the super class*/ 
    4545        NSTimer                                 *resetTimer;    /*!< @brief Timer to reset our state machine to default (not retained)*/ 
    46         NSTimeInterval                        duration;               /*!< @brief Total length of the movie*/ 
     46        double                                duration;               /*!< @brief Total length of the movie*/ 
    4747} 
    4848 
  • trunk/SapphireFrappliance/SapphireVideoPlayer.m

    r508 r523  
    3535 
    3636@interface BRVideo (privateFunctions) 
    37 - (QTMovie *)gimmieMovie; 
     37- (Movie)gimmieMovie; 
    3838@end 
    3939 
     
    4949 
    5050@implementation BRVideo (privateFunctions) 
    51 - (QTMovie *)gimmieMovie 
     51- (Movie)gimmieMovie 
    5252{ 
    5353        Class myClass = [self class]; 
    5454        Ivar ret = class_getInstanceVariable(myClass, "_movie"); 
    5555         
    56         if(![SapphireFrontRowCompat usingTakeTwo]) 
    57                 return *(QTMovie * *)(((char *)self)+ret->ivar_offset); 
    58         Movie mov = *(Movie *)(((char *)self)+ret->ivar_offset); 
    59         return [QTMovie movieWithQuickTimeMovie:mov disposeWhenDone:NO error:nil]; 
     56        if([SapphireFrontRowCompat usingTakeTwo]) 
     57                return *(Movie *)(((char *)self)+ret->ivar_offset); 
     58        QTMovie *qtmov = *(QTMovie * *)(((char *)self)+ret->ivar_offset); 
     59        return [qtmov quickTimeMovie]; 
    6060} 
    6161@end 
     
    8686- (void)dealloc 
    8787{ 
    88       [resetTimer invalidate]; 
     88//    [resetTimer invalidate]; 
    8989        [super dealloc]; 
     90} 
     91 
     92- (BOOL)movieHasChapters:(Movie)mov 
     93{ 
     94        int tkCount = GetMovieTrackCount(mov); 
     95        int i; 
     96        for(i=0; i<tkCount; i++) 
     97        { 
     98                Track track = GetMovieIndTrack(mov, i); 
     99                if(!GetTrackEnabled(track)) 
     100                        continue; 
     101                 
     102                if(GetTrackReference(track, 'chap', 1) != NULL) 
     103                        return YES; 
     104        } 
     105         
     106        return NO; 
    90107} 
    91108 
     
    98115         
    99116        /*Check to see if the movie has any chapters by default*/ 
    100         QTMovie *myMovie = [[self gimmieVideo] gimmieMovie]; 
    101         if(![myMovie hasChapters]) 
     117        Movie myMovie = [[self gimmieVideo] gimmieMovie]; 
     118         
     119        BOOL hasChapters = [self movieHasChapters:myMovie]; 
     120        duration = ((double)GetMovieDuration(myMovie)) / ((double)GetMovieTimeScale(myMovie)); 
     121         
     122        if(!hasChapters) 
    102123                enabled = TRUE; 
    103          
    104         QTGetTimeInterval([myMovie duration], &duration); 
    105          
     124 
    106125        return ret; 
    107126}