Re: QTMovie problem, thread-safety issue?
Re: QTMovie problem, thread-safety issue?
- Subject: Re: QTMovie problem, thread-safety issue?
- From: "Michael Ash" <email@hidden>
- Date: Thu, 9 Oct 2008 13:26:24 -0400
On Thu, Oct 9, 2008 at 12:24 PM, Daniel Thorpe <email@hidden> wrote:
> Hi everyone,
>
> I'm trying to access metadata from audio files (m4a files encoded using aac
> in iTunes) using the Quicktime QTMetaDataRef class. So, to do this I first
> need to get a QTMovie instance, hence I'm calling this bit of code:
>
> NSLog(@"processing %@", fullpath);
> if([QTMovie canInitWithFile:fullpath]) {
> NSLog(@"We're in business!");
> }
>
> This is being executed within the main function of an NSOperation subclass.
> The first NSLog call works fine, and prints out the path to the file, but
> the QTMovie class method crashes. I've stepped through the execution in the
> debugger and it crashes with mach_msg_trap. Anyway, I've not used QTKit
> before, but I've been reading about thread safety with it, and am now
> calling EnterMoviesOnThread(0); and ExitMoviesOnThread(); in my newly
> created threads, but it still fails. I'm not calling
> AttachMovieToCurrentThread and DetachMovieFromCurrentThread because I don't
> yet have any QTMovie and/or Movie objects (I'm going to create one at this
> point in the program's execution).
>
> I also saw this post
> http://lists.apple.com/archives/quicktime-api/2005/Nov/msg00251.html and so
> it seems as though the + (BOOL)canInitWith functions should be thread safe,
> can anyone confirm this?
The contradiction is interesting but I'm not sure how important it is.
This technote discusses QTKit and threading:
http://developer.apple.com/technotes/tn2005/tn2138.html
And the very first thing it says is "allocate all QTMovie objects on
the main thread."
So even if the canInit methods worked on the background threads, for
your particular scenario you're not going to be able to do anything
with the result.
Unless you can create the QTMovie instances on the main thread (which
I assume is the slow part you're trying to multithread, so that would
kind of defeat the whole purpose) then you'll probably have to drop
down to the C API.
You may want to ask on quicktime-api as well. Even though it's
Objective-C, QTKit is really more "QuickTime" than "Cocoa", and you're
probably more likely to get knowledgeable people over there.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden