Re: Problem saving movie
Re: Problem saving movie
- Subject: Re: Problem saving movie
- From: David Faden <email@hidden>
- Date: Mon, 29 Mar 2004 02:36:58 -0600
Hi,
The behavior I saw was caused by my MyMovie being nil. Adding a call to
EnterMovies() to the emptyMovie method of MyMovie seems to have totally
fixed the problem. I guess it was fair for the author to assume
EnterMovies() had been called so long as MyMovie was used only in the
main thread. I'd still be interested in any comments you may have on my
code. Sorry otherwise that I didn't investigate the problem a bit
further before hitting Send.
Thanks.
David
AIM: pitulx
---
From MyMovie.m:
+ (MyMovie *)emptyMovie
{
Movie movie;
long int flags;
EnterMovies();
flags = 0;
flags |= newMovieActive;
movie = NewMovie(flags);
return [[[[self class] alloc] initWithMovie:movie] autorelease];
}
On Mar 29, 2004, at 1:55 AM, David Faden wrote:
Hi,
I'm having a dickens of a time tracking down a bug in some code that
saves a QuickTime movie. My QuickTime code is based off the
bMoviePalette example. (I have basically just lifted the MyMovie class
out of bMoviePalette.) The code used to write the movie comes from
<http://cocoa.mamasam.com/COCOADEV/2001/06/2/5601.php>. (I also had
this problem with the movie writing code provided in bMoviePalette.)
In my code, a movie is generated in a separate thread (using an
instance of the MyMovie class for the QuickTime stuff). Everything
seems to go fine until the code gets to writing the movie. Then,
around 50% of the time, the -writeToFile:atomically: method returns NO
and indeed the file isn't written. (Otherwise, the movie seems to be
written properly.)
So far, I haven't had much luck debugging the code. When the writes
fail, breakpoints set within the movie writing code are not noticed by
the debugger nor do NSLogs within the writing code produce any visible
output. This suggests the code isn't being called at all. Yet, I get
no signals when the writing code fails. And, when it fails, its
return value (NO) is apparently correctly returned by the
writeToFile:atomically: method.
(Ah. Holy moly. It just occurred to me that if my MyMovie object were
nil, I'd probably see the behavior I'm seeing. If you believe this is
the case, do you have any suggestions on why I might be getting nil
from [MyMovie emptyMovie] and how I can fix this?)
The code for the full application is at
<http://www.public.iastate.edu/~dfaden/fractalanimator/
FractalAnimator_2004_03_29_146.zip>. I've pasted what I think are the
relevant sections of code below (comments stripped). I'd greatly
appreciate any ideas on what might be causing my code's intermittent
writing problems and on how to fix this. (I'd also appreciate comments
on my coding style.)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.