Important: The information in this document is obsolete and should not be used for new development.
QuickTime 6 provides three new media handler calls that developers can use to write media handlers that support keyboard focus. These are
MediaRefConSetProperty
MediaRefConGetProperty
MediaNavigateTargetRefCon
If you want to add interactive capabilities to your application, you need to use these media handler calls, discussed in this section.
When authoring the movie, you need to make sure that you add
a media property atom of type kTrackFocusCanEditFlag and
set that to TRUE. Then
you should check for the presence of this flag when called via MediaHasCharacteristic checking
on the kCharacteristicProvidesKeyFocus.
You add the kTrackFocusCanEditFlag atom.
If this property has been set to TRUE,
the media handler receives the NavigateRefCon and
Get/SetRefCon calls.
{ |
QTAtomContainer mediaProperties; |
Boolean canEdit = true; |
QTNewAtomContainer(&mediaProperties); |
QTInsertChild(mediaProperties, 0, kTrackFocusCanEditFlag, 1, 1, |
sizeof(canEdit), &canEdit, NULL); |
myErr = SetMediaPropertyAtom(myMedia, mediaProperties); |
QTDisposeAtomContainer(mediaProperties); |
} |
pascal ComponentResult MediaHasCharacteristic( |
MediaHandler mh, |
OSType characteristic, |
Boolean *hasIt) |
{ |
if (kCharacteristicProvidesKeyFocus == characteristic) { |
OSErr err; |
Boolean canEdit = false; |
QTAtomContainer propertyContainer = nil; |
err = GetMediaPropertyAtom (store->media, &propertyContainer); |
if ((noErr == err) && (propertyContainer)) { |
QTAtom canEditAtom = QTFindChildByIndex(propertyContainer, |
kParentAtomIsContainer, kTrackFocusCanEditFlag, 1, nil); |
if (canEditAtom) |
QTCopyAtomDataToPtr(propertyContainer, canEditAtom, |
false, sizeof(Boolean), &canEdit, |
nil); |
} |
if (propertyContainer) (void) QTDisposeAtomContainer |
(propertyContainer); |
*hasIt = canEdit; |
} |
... |
} |
{ |
QTAtomContainer mediaProperties; |
Boolean hasActions = true; |
QTNewAtomContainer(&mediaProperties); |
QTInsertChild(mediaProperties, 0, kMediaPropertyHasActions, 1, 1, |
sizeof(hasActions), &hasActions, NULL); |
myErr = SetMediaPropertyAtom(myMedia, mediaProperties); |
QTDisposeAtomContainer(mediaProperties); |
} |
Locates the object for hit testing.
ComponentResult MediaHitTestForTargetRefCon ( MediaHandler mh, long flags, Point loc, long *targetRefCon );
A media handler. You can obtain this reference
from GetMediaHandler (I-443).
Flags (see below) that define the hit.
The point may only be within the targetRefCon bounding
box.
The point must be within the shape of the targetRefCon image.
An invisible targetRefCon may
be hit tested, even if the object is invisible.
The hit is a mouse click for codecs that want mouse events.
The location of the mouse.
Returns a reference constant representing
an object you’re interested in. If this reference constant is
not 0, your media handler will receive calls to MediaGetActionsForQTEvent.
See “Error Codes”
(IV-2718). Returns noErr if
there is no error.
MediaHandlers.h
The following flags are set by the Standard Controller, which
currently sets mHitTestImage and mHitTestInvisible before
it calls you.
This routine is used to locate the object for hit testing.
Introduced in QuickTime 6.
C interface file: MediaHandlers.h
Detects if the mouse click and its release are in the same location, and within the object.
ComponentResult MediaHitTestTargetRefCon ( MediaHandler mh, long targetRefCon, long flags, Point loc, Boolean *wasHit );
A media handler. You can obtain this reference
from GetMediaHandler (I-443).
A reference constant set by the media handler
in MediaHitTestForTargetRefCon.
Flags (see below) that define the hit.
The point may only be within the targetRefCon bounding
box.
The point must be within the shape of the targetRefCon image.
An invisible targetRefCon may
be hit tested.
The hit is a mouse click for codecs that want mouse events.
The location of the mouse.
A pointer to a Boolean; return TRUE if
there was a hit, FALSE otherwise.
See
“Error Codes” (IV-2718). Returns noErr if
there is no error.
MediaHandlers.h
This routine is called after MediaGetActionsForQTEvent if
a reference constant was set in MediaHitTestForTargetRefCon.
Introduced in QuickTime 6.
C interface file: MediaHandlers.h
Returns an Event Handler for your Media Handler.
ComponentResult MediaGetActionsForQTEvent ( MediaHandler mh, QTEventRecordPtr event, long targetRefCon, QTAtomContainer *container, QTAtom *atom );
A media handler. You can obtain this reference
from GetMediaHandler (I-443).
A pointer to a QTEventRecord (IV-2409)
structure.
A reference constant set by the media handler
in MediaHitTestForTargetRefCon.
An atom container that you can pass back to the standard controller used for implementing sprite actions.
An atom you can pass back to the standard controller used for implementing sprite actions.
See “Error
Codes” (IV-2718). Returns noErr if
there is no error. Returns qtEventWasHandledErr if
event was handled by the media handler qtEventWasHandledErr =
-2129.
MediaHandlers.h
This routine returns an Event Handler for your Media Handler,
and is called with the targetRefcon set
in MediaHitTestForTargetRefCon.
Introduced in QuickTime 6.
C interface file: MediaHandlers.h
Disposes any resources allocated as part of the RefCon.
ComponentResult MediaDisposeTargetRefCon ( MediaHandler mh, long targetRefCon );
A media handler. You can obtain this reference
from GetMediaHandler (I-443).
A reference constant set by the media handler
in MediaHitTestForTargetRefCon.
See
“Error Codes” (IV-2718). Returns noErr if
there is no error.
MediaHandlers.h
This routine disposes any resources that your application has allocated as part of the reference constant.
Introduced in QuickTime 6.
C interface file: MediaHandlers.h
Locates the object for keyboard focus.
ComponentResult MediaNavigateTargetRefCon ( MediaHandler mh, long navigation, long * refCon );
A media handler. You can obtain this reference
from GetMediaHandler (I-443).
Flags (see below) that define the direction.
Returns a reference constant representing
an object you’re interested in. If this reference constant is
not 0, your media handler will receive calls to MediaRefConSetProperty and MediaRefConGetProperty.
See
“Error Codes” (IV-2718). Returns noErr if
there is no error.
The following flags are set by the Standard Controller, which is determined by the user’s interaction with the tab and shift keys, and/or mouse.
Tabbing direction is forward. If no item currently selection, then use first.
Tabbing direction is backward. If no item currently selection, then use the last.
MediaHandlers.h
These constants, which enable navigational direction, are defined as follows:
enum { |
kRefConNavigationNext = 0, |
kRefConNavigationPrevious = 1 |
}; |
This routine is locates the object for keyboard focus.
Introduced in QuickTime 6.
C interface file: MediaHandlers.h
Last updated: 2002-07-01