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

Intercepting movie controller actions


Q: I'd like to intercept movie controller actions, so I can prevent the action from being handled by the movie controller or to perform some custom action of my own in response to a particular action. Is this possible?

A: Movie controller actions can be intercepted before being sent to the movie controller via a movie controller action filter function. You associate a movie controller action filter procedure with a given movie controller by calling the MCSetActionFilterWithRefCon functions as shown in listing 1.



MCActionFilterWithRefConUPP myFilterProcUPP;
myFilterProcUPP = NewMCActionFilterWithRefConProc(myFilterProcedure);
MCSetActionFilterWithRefCon(movieController,
                           myFilterProcUPP,
                           0);

Listing 1. Calling the MCSetActionFilterWithRefCon functions.



The movie controller component calls your action filter function each time the component receives an action for its movie controller. Your filter function is then free to handle the action or to refer it back to the movie controller component. If you refer it back to the movie controller component, the component handles the action.

Your action filter function should refer any actions that you do not want to handle back to the calling movie controller component. Your function refers actions back to the movie controller component by returning a value of false. If your function returns a value of true, the movie controller component performs no further processing for the action.

Note if you use any Movie Toolbox functions that modify the movie in your action filter function, be sure to call the MCMovieChanged function.

As an example, listing 2 provides a sample filter function which intercepts mouse click actions for the movie.



Boolean myFilterProcedure(MovieController mc, short action,
         void*params, long refCon)
{
        if (action == mcActionMovieClick)
                return TRUE;
                .
                .
                .
        //other action handlers
}

Listing 2. Sample action filter function




[Nov 14 2001]


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.