MediaHandler and x86_64 target

Snow Leopard is ready for full 64bit applications. However, it doesn’t boot into 64bit mode by default. Apple people seem to give more time for 3rd party developers to migrate their code from 32bit to 64bit.

Is it true? Yeah.. kind of… Truth is that even Apple doesn’t seem to be prepared for full 64bit environment. For example, QuickTime is not fully ready yet.
I have heard about 64bit issues with QuickTime from here and there.
Today I noticed my own.

This part of codes causes compilation error with x86_64 target.

MediaHandler is not recognized when x86_64 target is enabled

Because the MediaHandler is not recognized, it complains something else is wrong. The compiler is confused.
Then, how to solve this problem? Set the target to 32bit.

No compilation error when targeted for 32bit

So, I looked up the header files to figure out how the MediaHandler is compiled into. It was declared in Movies.h which is a part of QuickTime header files. ( QuickTime.h )
If you use QTKit, it is imported like this from QTMovie.h

#import <Cocoa/Cocoa.h>
#if !__LP64__
	#import <QuickTime/QuickTime.h>
#endif

if you use QuickTime framework directly, it is imported by :

#if !__LP64__

#ifndef __MEDIAHANDLERS__
#include <QuickTime/MediaHandlers.h>
#endif

#ifndef __MOVIES__
#include <QuickTime/Movies.h>
#endif

If its following lines more, you can see that MediaHandler is not defined, if __LP64 is defined.

Conclusion is that you should compile your code in 32bit mode to manipulate media types like timecode. ( or virtually anything which is referenced using MediaHandler.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: