Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding movieAttributes later on is (apparently?) not kosher on Lion #1

Open
briangibson opened this issue Aug 14, 2011 · 1 comment

Comments

@briangibson
Copy link

Allo again. I'm poking around with Quicktime X. If I left it the way it was, my app would crash.

For quicktime X support, I had to comment the following:

// frameCount = movieDuration.timeValue / frameStep;
// NSLog(@" movie has %d frames ", frameCount);

and

// self.volume = 1.0;
// self.loops = YES;

to get Quicktime X to load my movie files properly.
this is probably because (i'm assuming, anyway...) quicktime X wants you to perform these tasks in a callback once the movie is sufficiently loaded. I am working on a fix for those at the moment which involves NSNotifications that call movieLoadStateChanged. Also, to get quicktime X to load properly on Lion with the QTMovieOpenForPlaybackAttribute attribute, i had to declare it in the movieAttributes dictionary as soon as it is created. I'm not sure why this is. My current hacky workaround for Quicktime X support is as follows:

#ifdef MAC_OS_X_VERSION_10_6 || MAC_OS_X_VERSION_10_7

    if(self.useTexture && !self.usePixels){
        NSLog(@"osx 10.6 or 10.7 texture only, so loading quicktime X");
        NSMutableDictionary* movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                                [NSURL fileURLWithPath:[moviePath stringByStandardizingPath]], QTMovieURLAttribute,
                                                [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
                                                //[NSNumber numberWithBool:NO], QTMovieOpenAsyncRequiredAttribute,
                                                [NSNumber numberWithBool:YES], QTMovieOpenForPlaybackAttribute,
                                                nil];
        _movie = [[QTMovie alloc] initWithAttributes:movieAttributes 
                                               error: &error];
    }
    else{

        NSLog(@"osx 10.6 or 10.7, pixel buffer requested so no quicktime X");
         NSMutableDictionary* movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                                [NSURL fileURLWithPath:[moviePath stringByStandardizingPath]], QTMovieURLAttribute,
                                                [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
                                               // [NSNumber numberWithBool:NO], QTMovieOpenAsyncRequiredAttribute,
                                                [NSNumber numberWithBool:NO], QTMovieOpenForPlaybackAttribute,
                                                nil];
        _movie = [[QTMovie alloc] initWithAttributes:movieAttributes 
                                               error: &error];
    }
#endif

    #ifndef MAC_OS_X_VERSION_10_7
        #ifndef MAC_OS_X_VERSION_10_6
        NSLog(@"osx 10.x, no quicktime X");
        NSMutableDictionary* movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                                [NSURL fileURLWithPath:[moviePath stringByStandardizingPath]], QTMovieURLAttribute,
                                                [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
                                                //[NSNumber numberWithBool:NO], QTMovieOpenAsyncRequiredAttribute,
                                                [NSNumber numberWithBool:NO], QTMovieOpenForPlaybackAttribute,
                                                nil];
        _movie = [[QTMovie alloc] initWithAttributes:movieAttributes 
                                             error: &error];
        #endif
    #endif

I should also mention that #ifdef MAC_OS_X_VERSION_10_7 does not get called on my Lion system.
EDIT: i had to change my OF deployment target in Xcode, now it does.
My next step includes asynchronous loading support.

@briangibson
Copy link
Author

I poked around with this for a bit longer, got async loading working with simple NSNotification callbacks, and quicktime X support (which was kind of awful, actually), but couldn't find any good method for multithreaded movie loading in the qtkit API. I went back to my modified version of gameoverhack's pthread-based (ofThread) GWorld -(old school,deprecated) quicktime movie loader for the time being until i can do more research on threaded movie loading with QTKit.

EDIT: after changing my loading method so that all my movies that i will ever use are pre-cached on app load and paused, performance seems reasonable using the quicktime 7.0 qtkit methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant