Re: QTKit: hum, is it a bug?
Re: QTKit: hum, is it a bug?
- Subject: Re: QTKit: hum, is it a bug?
- From: Stéphane Sudre <email@hidden>
- Date: Mon, 14 Nov 2005 23:41:54 +0100
On lundi, novembre 14, 2005, at 06:46 PM, Tim Monroe wrote:
On Nov 14, 2005, at 7:58 AM, Stéphane Sudre wrote:
I've been playing a bit with the QTKit today updating a project which
was using NSMovieView till now.
While the API is better, I am seeing some things I would tend to
believe are bugs.
1. If you set the frame of the QTMovieView and then the movie for this
same view, the first frames of the animation are out of bounds.
[...]
Am I missing something or is this a bug?
It's probably a bug; I will file a bug report. Looks like you have a
workaround until we sort this out, right?
Yes, I have override setMovie: with:
- (void) setMovie:(QTMovie *) inMovie
{
if (inMovie!=nil)
{
NSSize tSize;
NSValue * tValue;
const char * tObjCType;
tSize=[self bounds].size;
tValue=[inMovie attributeForKey:QTMovieCurrentSizeAttribute];
tObjCType=[tValue objCType];
tValue=[NSValue value:&tSize withObjCType:tObjCType];
[inMovie setAttribute:tValue forKey:QTMovieCurrentSizeAttribute];
}
[super setMovie:inMovie];
}
This is not perfect since I need to figure out how to get the tObjCType
without having to get it from the attributeForKey: method. Maybe it's a
@encode thing but in 5 years of Cocoa, I haven't really played a lot
with this NSValue thing. BTW, this is surprising there is no sample
code in the QTKit documentation illustrating how to do this.
2. It looks like the QTMovieDidEndNotification is not very bullet
proof. When you change the movie of the QTMovieView in the
QTMovieDidEndNotification callback, you just crash. I didn't see any
warning against this in the "documentation" so I tend to believe this
is a bug.
You raise a good point. Many of the QTMovie notifications are posted
from within a QuickTime callback where it is unsafe to destroy the
associated QuickTime Movie or MovieController. This means that in
general you should not release a QTMovie object directly or indirectly
in a notification callback (that is, by calling [QTMovie release] or
[QTMovieView setMovie:] with a different QTMovie object).
I need to investigate this issue a bit more. Either QTKit should be
able to work around the problem, or the documentation needs to include
a warning. In the meantime, I think you need to defer calling
setMovie: until you have exited the notification callback. Sorry for
the hassle.
The solution I've found so far is to use the common trick of
performSelector:... afterDelay: with a delay of 0.0f so that the code
is invoked outside the notification.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden