Inside Macintosh: QuickTime Reference

| Previous | Chapter Contents | Chapter Top | Next |

Fetching the Parameters

The parameters to your custom action may be the result of a wired expression. Don't worry about analyzing the kActionParameter child atoms, the wired expression evaluation machinery has been made accessible via a movie controller action called mcActionFetchParameterAs.

Fill out a QTFetchParameterAsRecord and pass it to mcActionFetchParameterAs as in:

CallDoMCActionProc(resolvedTarget->doMCActionCallbackProc,
                    resolvedTarget->callBackRefcon, 
                    mcActionFetchParameterAs, 
                    &fetchAs, &handled );

struct QTFetchParameterAsRecord {
    QTAtomSpec                      paramListSpec;
    long                            paramIndex;
    long                            paramType;
    long                            allowedFlags;
    void *                          min;
    void *                          max;
    void *                          currentValue;
    void *                          newValue;
    Boolean                         isUnsignedValue;
};

Set the container and atom of the paramListSpec to the actionContainer and actionAtom passed to ExecuteWiredAction().

Set the paramIndex to the index of the parameter you wish to fetch. If you allow a variable number of parameters, you may count how many child atoms of type kActionParameter the actionAtom has.

Set the paramType to one of the parameter types from the following enumeration:

enum {
    kFetchAsBooleanPtr                  = 1,
    kFetchAsShortPtr                    = 2,
    kFetchAsLongPtr                     = 3,
    kFetchAsMatrixRecordPtr             = 4,
    kFetchAsModifierTrackGraphicsModeRecord = 5,
    kFetchAsHandle                      = 6,
    kFetchAsStr255                      = 7,
    kFetchAsFloatPtr                    = 8,
    kFetchAsPointPtr                    = 9,
    kFetchAsNewAtomContainer            = 10,
    kFetchAsQTEventRecordPtr            = 11,
    kFetchAsFixedPtr                    = 12,
    kFetchAsSetControllerValuePtr = 13,
    kFetchAsRgnHandle                   = 14,   /* flipped to native*/
    kFetchAsComponentDescriptionPtr = 15,
    kFetchAsCString                     = 16
};

Set the allowedFlags to flags from the following enumeration, or zero fetching without constraints.

enum {
    kActionFlagActionIsDelta                = 1L << 1,
    kActionFlagParameterWrapsAround = 1L << 2,
    kActionFlagActionIsToggle               = 1L << 3
};

If allowedFlags is not set to zero, set the min, max, current, and isUnsignedValue fields to appropriate values based on the data type being fetched.

The newValue field returns the result of the parameter.

For scalar and structure types, pass a pointer to the appropriate data type and it will be filled in.

For Handle, RgnHandle, and Cstring pass in a new empty handle that will be resized as needed, you are responsible for disposing the handle when done.

For kFetchAsNewAtomContainer, pass in a pointer to a non-allocated QTAtomContainer. On return, this container will contain the contents of the single child atom of the parameter atom and all of its children. This lets you pass arbitrary data that is not evaluated in an atom container as a parameter.

A sample custom wired action-handling component has been provided.


© 2000 Apple Computer, Inc.

Inside Macintosh: QuickTime Reference

| Previous | Chapter Contents | Chapter Top | Next |