Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
sources/SourcingSupport.c
/* |
File: SourcingSupport.c |
Copyright: © 2000-2001 by Apple Computer, Inc., all rights reserved. |
*/ |
#include <ConditionalMacros.h> |
#include <MacTypes.h> |
#include "QTSSampleCodeUtils.h" |
#include "SourcingSupport.h" |
// ----- source handlers we know about ----- |
#include "MovieSourcing.h" |
// --------------------------------------------------------------------------- |
// D E F I N I T I O N S |
// --------------------------------------------------------------------------- |
#define kSignature_NotAStandardSourceHandler FOUR_CHAR_CODE('xstd') |
// --------------------------------------------------------------------------- |
// P R O T O T Y P E S |
// --------------------------------------------------------------------------- |
static OSType SourcingSupport_GetHandlerType(StandardSourceHandler *inHandler); |
// --------------------------------------------------------------------------- |
// SourcingSupport_GetHandlerType |
// --------------------------------------------------------------------------- |
static OSType SourcingSupport_GetHandlerType(StandardSourceHandler *inHandler) |
{ |
OSType handlerType = kSignature_NotAStandardSourceHandler; |
if (inHandler == NULL) { |
handlerType = kSignature_NoSourceHandler; |
} else { |
if (inHandler->standardSignature == kSignature_StandardSourceHandler) { |
handlerType = inHandler->signature; |
} |
} |
return handlerType; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_Dispose |
// --------------------------------------------------------------------------- |
void SourcingSupport_DisposeHandler(StandardSourceHandler *inHandler) |
{ |
OSType handlerType; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
MovieSourcing_Dispose((MovieSourcing*)inHandler); |
break; |
default: |
DEBUGF(("SourcingSupport_DisposeHandler $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return; |
} |
#pragma mark - |
// --------------------------------------------------------------------------- |
// SourcingSupport_Idle |
// --------------------------------------------------------------------------- |
void SourcingSupport_Idle(StandardSourceHandler *inHandler, Boolean inPlaying) |
{ |
OSType handlerType; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
MovieSourcing_Idle((MovieSourcing*)inHandler, inPlaying); |
break; |
default: |
DEBUGF(("SourcingSupport_Idle $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_SetEnable |
// --------------------------------------------------------------------------- |
void SourcingSupport_SetEnable(StandardSourceHandler *inHandler, Boolean inEnableMode) |
{ |
OSType handlerType; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
MovieSourcing_SetEnable((MovieSourcing*)inHandler, inEnableMode); |
break; |
default: |
DEBUGF(("SourcingSupport_SetEnable $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_HasCharacteristic |
// --------------------------------------------------------------------------- |
void SourcingSupport_HasCharacteristic(StandardSourceHandler *inHandler, |
OSType inCharacteristic, Boolean *outHasIt) |
{ |
OSType handlerType; |
*outHasIt = false; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
MovieSourcing_HasCharacteristic((MovieSourcing*)inHandler, inCharacteristic, outHasIt); |
break; |
default: |
DEBUGF(("SourcingSupport_HasCharacteristic $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_HandleNotification |
// --------------------------------------------------------------------------- |
void SourcingSupport_HandleNotification(StandardSourceHandler *inHandler, OSType inNotificationType, void *inParams) |
{ |
OSType handlerType; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
MovieSourcing_HandleNotification((MovieSourcing*)inHandler, inNotificationType, inParams); |
break; |
default: |
DEBUGF(("SourcingSupport_HandleNotification $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_GetInfo |
// --------------------------------------------------------------------------- |
OSErr SourcingSupport_GetInfo(StandardSourceHandler *inHandler, OSType inSelector, void *ioParams) |
{ |
OSType handlerType; |
OSErr err = qtsBadSelectorErr; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
err = MovieSourcing_GetInfo((MovieSourcing*)inHandler, inSelector, ioParams); |
break; |
default: |
DEBUGF(("SourcingSupport_GetInfo $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return err; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_SetInfo |
// --------------------------------------------------------------------------- |
OSErr SourcingSupport_SetInfo(StandardSourceHandler *inHandler, OSType inSelector, void *ioParams) |
{ |
OSType handlerType; |
OSErr err = qtsBadSelectorErr; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
err = MovieSourcing_SetInfo((MovieSourcing*)inHandler, inSelector, ioParams); |
break; |
default: |
DEBUGF(("SourcingSupport_SetInfo $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return err; |
} |
// --------------------------------------------------------------------------- |
// SourcingSupport_DoCommand |
// --------------------------------------------------------------------------- |
OSErr SourcingSupport_DoCommand(StandardSourceHandler *inHandler, OSType inCommand, void *ioCommandParams) |
{ |
OSType handlerType; |
OSErr err = qtsBadSelectorErr; |
handlerType = SourcingSupport_GetHandlerType(inHandler); |
switch (handlerType) { |
case kSignature_MovieSourcing: |
err = MovieSourcing_DoCommand((MovieSourcing*)inHandler, inCommand, ioCommandParams); |
break; |
default: |
DEBUGF(("SourcingSupport_DoCommand $%.8x - unknown handlertype $%.8x", inHandler, &handlerType)); |
break; |
} |
return err; |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14