ADC Home > Reference Library > Technical Q&As > Legacy Documents > QuickTime >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

QuickTime & EnterMovies Call

Q The QuickTime 1.0 documentation states that you can use the EnterMovies call multiple times, as long as you balance each EnterMovies with ExitMovies. However, an article in issue 13 of develop says, not to call ExitMovies, as ExitToShell does this for me. This seems to destroy the balance of these routines. Which is the correct technique?

A EnterMovies creates a new QuickTime environment if the current A5 world doesn't already have one. If the current A5 world has a QuickTime environment from a previous EnterMovies call, then nothing is done except to increment a counter that keeps track of the number of times EnterMovies was called. This is done to account for DAs which use an application's A5 world, so that if an application has already called EnterMovies, the movie toolbox knows that it doesn't have to reinitialize when the DA calls EnterMovies. When the DA calls ExitMovies, it decrements the counter, and as long as all EnterMovies and ExitMovies calls are balanced, the Movie Toolbox doesn't dispose of the QuickTime world until the last ExitMovies call is made.

Since ExitToShell automatically calls ExitMovies for you, you can avoid some of the problems that developers have with disposing of movie structures improperly and in the wrong order. Letting ExitToShell do the final cleanup avoids these problems, because the entire A5 world and heap is disposed of as well.

If you currently have nested EnterMovies and ExitMovies calls, this is what we recommend:

1. If you're writing an application, and you call EnterMovies, but don't call ExitMovies, any external that uses the same A5 world and calls EnterMovies and ExitMovies increments the counter and then decrements the counter and does nothing else.

2. If you're writing an external that runs under someone else's application, you have two choices:

A. Call EnterMovies, but never call ExitMovies. This causes QuickTime to initialize once during the first call to any of your externals.

B. Call EnterMovies at the beginning of each external and ExitMovies at the end of each external. Be aware that this can waste a lot of CPU time if the main application (or something else in the A5 world) doesn't call EnterMovies first, since each of the EnterMovies calls in your externals requires QuickTime to reinitialize. This can be a serious problem if your external is called often. However, if your external has an initialization routine and a close routine that is called before and after all your other routines, you can call EnterMovies in the initialization routine, and then call ExitMovies in your close routine. Of course, each of the routines called in between could call either EnterMovies and ExitMovies, or not call either of them at all, depending on your implementation.

[May 01 1995]


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.