ADC Home > Reference Library > Technical Q&As > QuickTime > Movie Basics >

QuickTime movies require a valid graphics port


Q: I'm experiencing what appear to be random, inconsistent crashes in my application after calling NewMovie , even though I'm properly initializing the Movie Toolbox with a call to EnterMovies . What could be the problem?

A: QuickTime requires a valid graphics port be set (you can use GetGWorld to check for a valid port) before instantiating a movie with NewMovie or any of the NewMovieFromX functions, and that graphics port must remain valid for the life of the movie (or at least until another valid graphics port is set for the same movie with SetMovieGWorld ).



Note:
All movies require a valid graphics port, even those movies that don't contain video media such as sound-only movies.



The NewMovie and NewMovieFromX functions associate the current graphics port with the newly created movie. Therefore, if no graphics port exists at movie creation time, calling NewMovie or NewMovieFromX may result in a crash, or if the current graphics port associated with a movie is deleted sometime later any subsequent QuickTime operations on the movie will most certainly result in a crash.

If your code does not require a port at movie creation time (for example if you are creating a sound-only movie) you can create a temporary offscreen graphics world using NewGWorld (any size/format will do) then set the current port to it with SetGWorld prior to creating your movie.

Keep this temporary offscreen graphics world around until all movies which depend upon it are removed.


[Mar 19, 2004]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.