cocoa - How to properly save a QTMovie after editing using QTKit? -


i making minor edits qtmovie in application using nsdocument architecture (such adding track, shown below). after edit, want save original file. however, keep getting 'file busy' error. assume due oversight made in handling of files, or failure in how using nsdocument. tips helpful! here (some of) relevant code:

// open file has track want add movie qtmovie* tempmovie = [qtmovie moviewithurl:outputfileurl error:nil];  // use old api add track  addmovieselection([movie quicktimemovie], [tempmovie quicktimemovie]);  // filename nsdocument nsstring *filename = [[self fileurl] path]; nslog(@"writing filename: %@", filename);  // flatten movie file don't external references nsmutabledictionary *attributes = [nsmutabledictionary dictionarywithcapacity:1]; [attributes setobject:[nsnumber numberwithbool:yes] forkey:qtmovieflatten];  // attempt write nserror *error; //  "file busy" if (![movie writetofile:filename withattributes:attributes error:&error]) {     nslog(@"error: %@", [error localizeddescription]);     nsrunalertpanel(@"error", [error localizeddescription], nil, nil, nil); }     

do have first release movie in nsdocument? "proper" way that? keep in mind, not finished document, not closing it. have finished operation, , want file on disk reflect changes. love use [movie updatemoviefile], call doesn't seem flatten movie. don't want external references in file.

i not familiar quicktime c api, can't tell going wrong there. absolute guesswork: maybe call endmediaedits missing?
though shouldn't required addmovieselection, said "[...] such as adding track [...]". maybe there else going on, addmediasample or similar?

that said, if don't need target below 10.5 , need add segment movie, can achieve without dropping down c api:

have at

do have first release movie in nsdocument?

you mean in order write disk? no: should result in crash.

the role of release handle memory-management. doesn't have busy-state of file.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -