PDA

View Full Version : flattening NSMovies


hyperzoanoid
2002.07.03, 06:40 PM
hi i have a simple question, (i think) on flattening NSMovies. heres the code

NSURL *whereat;
NSMovie *sound;
NSOpenPanel *panelz=[NSOpenPanel openPanel];
int answer=[panelz runModalForTypes:[NSArray arrayWithObject:@"mp3"]];

if(answer==NSOKButton){
whereat=[[NSURL alloc]initFileURLWithPath:[panelz filename]];
sound=[[NSMovie alloc]initWithURL:whereat byReference:NO];

[pack setObject:[[sound QTMovie]FlattenMovieData] forKey:@"sound"];}



first i get the movie, but i want to save the whole movie, so i use the QTMovie call to get it and then FlattenMovieData to return the data. After that NSArchiver archives 'pack' the dictionary to file. If the above seems ok, then could it be a problem with not including the framework? i copied the quicktime framework into my app, and use
#import <QuickTime/QuickTime.h>
to get all of it but project builder still says it cant find the FlattenMovieData method.

GoodDoug
2002.07.03, 07:23 PM
FlattenMovieData is not an objective Cmethod call. It is a C function defined in QuickTime.framework.

Your call:
[pack setObject:[[sound QTMovie]FlattenMovieData] forKey:@"sound"];

Needs to be changed to something more like:
[pack setObject:FlattenMovieData([sound QTMovie], yadda, yadda, yadda, etc) forKey:@"sound"];

hyperzoanoid
2002.07.03, 09:48 PM
gotcha, ill try and get it to work

hyperzoanoid
2002.07.04, 11:57 AM
i found the function here it is but i have some questions

pascal Movie FlattenMovieData ( Movie theMovie,
long movieFlattenFlags,
const FSSpec *theFile,
OSType creator,
ScriptCode scriptTag,
long createMovieFileFlags);

how do you set all of the flags in one variable for passing movieFlattenFlags and createMovieFileFlags?
How do you set an FSSpec to point to a file, i have the path to the file.
I know that in my Cocoa Document Based apps i leave the OSType field blank in the app settings pane, can i leave it blank here? and how?

OneSadCookie
2002.07.04, 03:17 PM
use bitwise or ( | ) on the different flags to put them into one variable.

There is code in QTValuePak showing how to turn a file path into an FSSpec. If the link off iDevGames is broken, you can get it off http://homepage.mac.com/onesadcookie .

If you just want the movie to be played by the quicktime player, use its creator code. Otherwise, '????' is a good bet. Your application should really have its own creator code, of course...

hyperzoanoid
2002.07.04, 03:24 PM
yeah I guess it should, but then i have to choose one and register it with apple. The only reason i want to do this is to load mp3's for my game. Thanks for the link! :)