/// @brief Constructor
/// @param filename The filename to open
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(agi::fs::path const& filename, std::string const&) {
	fps_rat.num = -1;
	fps_rat.den = 1;

	try {
#ifdef WIN32
		sf = _wfopen(filename.c_str(), L"rb");
#else
		sf = fopen(filename.c_str(), "rb");
#endif

		if (!sf) throw agi::fs::FileNotFound(filename);

		CheckFileFormat();

		ParseFileHeader(ReadHeader(0));

		if (w <= 0 || h <= 0)
			throw VideoOpenError("Invalid resolution");
		if (fps_rat.num <= 0 || fps_rat.den <= 0) {
			fps_rat.num = 25;
			fps_rat.den = 1;
			LOG_D("provider/video/yuv4mpeg") << "framerate info unavailable, assuming 25fps";
		}
		if (pixfmt == Y4M_PIXFMT_NONE)
			pixfmt = Y4M_PIXFMT_420JPEG;
		if (imode == Y4M_ILACE_NOTSET)
			imode = Y4M_ILACE_UNKNOWN;

		luma_sz = w * h;
		switch (pixfmt) {
		case Y4M_PIXFMT_420JPEG:
		case Y4M_PIXFMT_420MPEG2:
		case Y4M_PIXFMT_420PALDV:
			chroma_sz	= (w * h) >> 2; break;
		case Y4M_PIXFMT_422:
			chroma_sz	= (w * h) >> 1; break;
			/// @todo add support for more pixel formats
		default:
			throw VideoOpenError("Unsupported pixel format");
		}
		frame_sz	= luma_sz + chroma_sz*2;

		num_frames = IndexFile();
		if (num_frames <= 0 || seek_table.empty())
			throw VideoOpenError("Unable to determine file length");

		fseeko(sf, 0, SEEK_SET);
	}
	catch (...) {
		if (sf) fclose(sf);
		throw;
	}
}
Exemple #2
0
/*!
*/
uint32_t Library::Load(const wcl::string& file)
{
    wheel::buffer_t* file_buffer = (wheel::buffer_t*)wheel::GetBuffer(file);
    if (file_buffer == nullptr)
        return WHEEL_RESOURCE_UNAVAILABLE;

    uint32_t file_type = CheckFileFormat(*file_buffer);

    uint32_t rval = WHEEL_UNINITIALISED_RESOURCE;

    // If there is registered handler for the file type, use it
    if (file_handlers.count(file_type))
        rval = file_handlers[file_type](file, *file_buffer);
    else
        rval = file_handlers[WHEEL_FILE_FORMAT_UNKNOWN](file, *file_buffer);

    // We don't want to keep the original buffer.
    wheel::DeleteBuffer(file);

    return rval;
}
Exemple #3
0
int main(int argc, char *argv[])
{
    int fd;
    char *pFile;
    int ret;
    int iType;
    Elf32_Ehdr ehdr;
    const CarcodeStruct *pCarCode = NULL;

    if (argc == 2) {
        pFile = argv[1];
        ret = CheckFileType(pFile);
        iType = INFO_ALL;
    } else if (argc == 3) {
        pFile = argv[2];
        ret = CheckFileType(pFile);
        iType = CheckParam(argv[1]);
    } else {
        ShowUsage();
        goto err;
    }

    if (ret || iType == INFO_NULL) {
        goto err;
    }

    fd = open(pFile, O_RDONLY, 0);
    if(fd == -1) {
        printf("open %s failed! <%s,line:%d>\n", pFile, __FUNCTION__, __LINE__);
        goto err;
    }

    ret = CheckFileFormat(fd, &ehdr);
    if (ret) {
        goto err;
    }

    pCarCode = (CarcodeStruct *)ReadResourceSection(fd, &ehdr);
    if (NULL == pCarCode) {
        goto err;
    }

    if (RESOURCE_MATIC != pCarCode->uMagic) {
        printf("resource section magic mismatch!!\n");
        goto err;
    }

    switch (iType) {
        case INFO_GET_BUILDDATE:
            printf("bd:0x%x\n", pCarCode->bDate);
            break;

        case INFO_GET_CARCODE:
            printf("fp:0x%x\n", pCarCode->cCode);
            break;

        case INFO_GET_URN:
            printf("urn:%s\n", pCarCode->puRn);
            break;

        case INFO_DEPENDENCE:
            getdependence(pCarCode->puRn + pCarCode->uSize);
            break;

        case INFO_ALL:
            printf("%s resource infomation:\n", pFile);
            printf("build date: 0x%x\n", pCarCode->bDate);
            printf("carcode:    0x%x\n", pCarCode->cCode);
            printf("uRn:        %s\n", pCarCode->puRn);
            getdependence(pCarCode->puRn + pCarCode->uSize);
            break;

        default:
            printf("Error!!\n");
            break;
    }

err:
    if (gbuf)
        free((void *)gbuf);
    if (pCarCode)
        free((void *)pCarCode);
    return 0;
}
//*****************************************************************************
// GetMDInternalInterface.
// This function will check the metadata section and determine if it should
// return an interface which implements ReadOnly or ReadWrite.
//*****************************************************************************
STDAPI GetMDInternalInterface(
    LPVOID      pData, 
    ULONG       cbData, 
    DWORD       flags,                  // [IN] ofRead or ofWrite.
    REFIID      riid,                   // [in] The interface desired.
    void        **ppIUnk)               // [out] Return interface on success.
{
    HRESULT     hr = NOERROR;
    MDInternalRO *pInternalRO = NULL;
    IMDCommon    *pInternalROMDCommon = NULL;
    MDFileFormat format;

    BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW);

    if (ppIUnk == NULL)
        IfFailGo(E_INVALIDARG);

    // Determine the file format we're trying to read.
    IfFailGo( CheckFileFormat(pData, cbData, &format) );

    // Found a fully-compressed, read-only format.
    if ( format == MDFormat_ReadOnly )
    {
        pInternalRO = new (nothrow) MDInternalRO;
        IfNullGo( pInternalRO );

        IfFailGo( pInternalRO->Init(const_cast<void*>(pData), cbData) );

#ifdef FEATURE_COMINTEROP
        IfFailGo(pInternalRO->QueryInterface(IID_IMDCommon, (void**)&pInternalROMDCommon));
        IfFailGo( (flags & ofNoTransform) ? S_FALSE : CheckIfWinMDAdapterNeeded(pInternalROMDCommon));
        if (hr == S_OK)
        {
            IfFailGo(CreateWinMDInternalImportRO(pInternalROMDCommon, riid, (void**)ppIUnk));
        }
        else
#endif // FEATURE_COMINTEROP
        {
            IfFailGo(pInternalRO->QueryInterface(riid, ppIUnk));
        }

    }
    else
    {
        // Found a not-fully-compressed, ENC format.
        _ASSERTE( format == MDFormat_ReadWrite );
        IfFailGo( GetInternalWithRWFormat( pData, cbData, flags, riid, ppIUnk ) );
    }

ErrExit:

    // clean up
    if ( pInternalRO )
        pInternalRO->Release();
    if ( pInternalROMDCommon )
        pInternalROMDCommon->Release();

    END_SO_INTOLERANT_CODE;
    
    return hr;
}   // GetMDInternalInterface
ASErr Plugin::Message(char *caller, char *selector, void *message)
{
	ASErr error = kUnhandledMsgErr;

	//sAIUser->MessageAlert(ai::UnicodeString(caller));
	
	// Acquire any missing optional suites.
	AcquireOptionalSuites();

	/* Sweet Pea messages */

	

	if (strcmp(caller, kSPAccessCaller ) == 0)
	{
		if (strcmp( selector, kSPAccessUnloadSelector) == 0)
			error = UnloadPlugin((SPInterfaceMessage *)message);

		else if (strcmp( selector, kSPAccessReloadSelector) == 0)
			error = ReloadPlugin((SPInterfaceMessage *)message);
	}
	else if (strcmp(caller, kSPInterfaceCaller) == 0)
	{
		if (strcmp(selector, kSPInterfaceAboutSelector) == 0)
			error = kNoErr;

		else if (strcmp(selector, kSPInterfaceStartupSelector) == 0)
			error = kNoErr;
	}
	else if (strcmp(caller, kSPCacheCaller) == 0)
	{
		if (strcmp(selector, kSPPluginPurgeCachesSelector) == 0)
		{
			if (Purge())
				error = kSPPluginCachesFlushResponse;
			else
				error = kSPPluginCouldntFlushResponse;
		}
	}
	else if (strcmp( caller, kSPPropertiesCaller ) == 0)
	{
		if (strcmp( selector, kSPPropertiesAcquireSelector ) == 0)
		{
			error = AcquireProperty((SPPropertiesMessage *) message);
		}
		else if (strcmp( selector, kSPPropertiesReleaseSelector ) == 0)
		{
			error = ReleaseProperty((SPPropertiesMessage *) message);
		}
	}

	/* Some common AI messages */

	else if (strcmp(caller, kCallerAINotify) == 0)
	{
		AppContext appContext(((SPInterfaceMessage *)message)->d.self);

		// Ideally we would rely upon the caller to envelop our Notify method.
		// But since we won't work right if he doesn't, do this ourselves

		AINotifierMessage *msg = (AINotifierMessage *)message;

		if (strcmp(msg->type, kAIApplicationStartedNotifier) == 0)
			error = PostStartupPlugin();

		if (!error || error == kUnhandledMsgErr)
		{
			if (strcmp( selector, kSelectorAINotify ) == 0)
				error = Notify(msg);
		}
	}
	else if (strcmp(caller, kActionCaller) == 0)
	{
		if (strcmp( selector, kDoActionSelector ) == 0)
		{
			/*
			char *my_argv[] = { "program name", "arg1", "arg2", NULL };
			int my_argc = sizeof(my_argv) / sizeof(char*) - 1;

			QApplication a(my_argc, my_argv);
			MyQTUI w;
			w.show();
			a.exec();*/
			error = GoAction((DoActionMessage *)message);
		}
	}
	else if (strcmp(caller, kCallerAIMenu) == 0)
	{
		if (strcmp( selector, kSelectorAIGoMenuItem ) == 0)
		{
			//sAIUser->MessageAlert(ai::UnicodeString("GoMenuItem"));
			error = GoMenuItem((AIMenuMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIUpdateMenuItem ) == 0)
		{
			//sAIUser->MessageAlert(ai::UnicodeString("UpdateMenuItem"));
			error = UpdateMenuItem((AIMenuMessage *)message);
		}
	}
	else if (strcmp(caller, kCallerAIFilter) == 0)
	{
		if (strcmp( selector, kSelectorAIGetFilterParameters ) == 0)
		{
			error = GetFilterParameters((AIFilterMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIGoFilter ) == 0)
		{
			error = GoFilter((AIFilterMessage *)message);
		}
	}
	else if (strcmp(caller, kCallerAIPluginGroup) == 0)
	{
		if (strcmp( selector, kSelectorAINotifyEdits ) == 0)
		{
			error = PluginGroupNotify((AIPluginGroupMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIUpdateArt ) == 0)
		{
			error = PluginGroupUpdate((AIPluginGroupMessage *)message);
		}
	}
	else if (strcmp(caller, kCallerAIFileFormat) == 0)
	{
		if (strcmp( selector, kSelectorAIGetFileFormatParameters ) == 0)
		{
			error = GetFileFormatParameters((AIFileFormatMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIGoFileFormat ) == 0)
		{
			error = GoFileFormat((AIFileFormatMessage *)message);
		}
		else if (strcmp( selector, kSelectorAICheckFileFormat ) == 0)
		{
			error = CheckFileFormat((AIFileFormatMessage *)message);
		}
		else if ( strcmp( selector, kSelectorAIUpdateFileFormat ) == 0 )
		{
			error = FileFormatUpdate( (AIUpdateFileFormatMessage *)message );
		}
		else if (!strcmp( selector, kDoActionSelector))
		{
			error = SetFileFormatParameters( (DoActionMessage *) message );
		}
	}
	else if (strcmp(caller, kCallerAITool) == 0)
	{
		if (strcmp( selector, kSelectorAIEditToolOptions ) == 0)
		{
			error = EditTool((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAITrackToolCursor ) == 0)
		{
			error = TrackToolCursor((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIToolMouseDown ) == 0)
		{
			error = ToolMouseDown((AIToolMessage *)message);
			sAIUser->MessageAlert(ai::UnicodeString("Mouse down"));
		}
		else if (strcmp( selector, kSelectorAIToolMouseDrag ) == 0)
		{
			error = ToolMouseDrag((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIToolMouseUp ) == 0)
		{
			sAIUser->MessageAlert(ai::UnicodeString("Mouse up"));
			//error = ToolMouseUp((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAISelectTool ) == 0)
		{
			error = SelectTool((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIDeselectTool ) == 0)
		{
			error = DeselectTool((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIReselectTool ) == 0)
		{
			error = ReselectTool((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIToolDecreaseDiameter ) == 0)
		{
			error = DecreaseDiameter((AIToolMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIToolIncreaseDiameter ) == 0)
		{
			error = IncreaseDiameter((AIToolMessage *)message);
		}
		

	} else if (strcmp(caller, kCallerAILiveEffect ) == 0)
	{
		if (strcmp( selector, kSelectorAIEditLiveEffectParameters ) == 0)
		{
			error = EditLiveEffectParameters((AILiveEffectEditParamMessage *)message);
		}
		else if (strcmp( selector, kSelectorAIGoLiveEffect ) == 0)
		{
			error = GoLiveEffect((AILiveEffectGoMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectInterpolate ) == 0)
		{
			error = LiveEffectInterpolate((AILiveEffectInterpParamMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectInputType ) == 0)
		{
			error = LiveEffectGetInputType((AILiveEffectInputTypeMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectScaleParameters ) == 0)
		{
			error = LiveEffectScaleParameters((AILiveEffectScaleParamMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectConverColorSpace ) == 0)
		{
			error = LiveEffectConvertColorSpace((AILiveEffectConvertColorMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectAdjustColors ) == 0)
		{
			error = LiveEffectAdjustColors((AILiveEffectAdjustColorsMessage *)message);
		}
		else if (strcmp( selector, kSelectorAILiveEffectHandleMerge ) == 0)
		{
			error = LiveEffectHandleMerge((AILiveEffectHandleMergeMessage *)message);
		}
	} else if (strcmp(caller, kCallerAITimer ) == 0)
	{
		if (strcmp( selector, kSelectorAIGoTimer ) == 0)
		{
			error = GoTimer((AITimerMessage *)message);
		}
	}
	else if (strcmp(caller, kCallerAIClipboard ) == 0)
	{
		if ( strcmp( selector, kSelectorAIGoClipboard ) == 0 )
			error = GoClipboard( (AIClipboardMessage *) message );

		else if ( strcmp( selector, kSelectorAICanCopyClipboard ) == 0 )
			error = CanCopyClipboard( (AIClipboardMessage *) message );

		else if ( strcmp( selector, kSelectorAICloneClipboard ) == 0 )
			error = CloneClipboard( (AIClipboardMessage *) message );

		else if ( strcmp( selector, kSelectorAIDisposeClipboard ) == 0 )
			error = DisposeClipboard( (AIClipboardMessage *) message );
	}
	else if (strcmp(caller, kAIWorkspaceCaller ) == 0)
	{
		if ( strcmp( selector, kAIWSWriteSelector ) == 0 )
			error = WorkspaceWrite( (AIWorkspaceMessage *) message );

		else if ( strcmp( selector, kAIWSRestoreSelector ) == 0 )
			error = WorkspaceRestore( (AIWorkspaceMessage *) message );

		else if ( strcmp( selector, kAIWSDefaultSelector ) == 0 )
			error = WorkspaceDefault( (AIWorkspaceMessage *) message );
	}
	return error;
}
Exemple #6
0
/// @brief Constructor
/// @param filename The filename to open
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname)
: sf(NULL)
, inited(false)
, w (0)
, h (0)
, num_frames(-1)
, cur_fn(-1)
, pixfmt(Y4M_PIXFMT_NONE)
, imode(Y4M_ILACE_NOTSET)
{
	fps_rat.num = -1;
	fps_rat.den = 1;

	try {
		wxString filename = wxFileName(fname).GetShortPath();

#ifdef WIN32
		sf = _wfopen(filename.wc_str(), L"rb");
#else
		sf = fopen(filename.utf8_str(), "rb");
#endif

		if (sf == NULL) throw agi::FileNotFoundError(STD_STR(fname));

		CheckFileFormat();

		ParseFileHeader(ReadHeader(0, false));

		if (w <= 0 || h <= 0)
			throw VideoOpenError("Invalid resolution");
		if (fps_rat.num <= 0 || fps_rat.den <= 0) {
			fps_rat.num = 25;
			fps_rat.den = 1;
			LOG_D("provider/video/yuv4mpeg") << "framerate info unavailable, assuming 25fps";
		}
		if (pixfmt == Y4M_PIXFMT_NONE)
			pixfmt = Y4M_PIXFMT_420JPEG;
		if (imode == Y4M_ILACE_NOTSET)
			imode = Y4M_ILACE_UNKNOWN;

		luma_sz = w * h;
		switch (pixfmt) {
		case Y4M_PIXFMT_420JPEG:
		case Y4M_PIXFMT_420MPEG2:
		case Y4M_PIXFMT_420PALDV:
			chroma_sz	= (w * h) >> 2; break;
		case Y4M_PIXFMT_422:
			chroma_sz	= (w * h) >> 1; break;
			/// @todo add support for more pixel formats
		default:
			throw VideoOpenError("Unsupported pixel format");
		}
		frame_sz	= luma_sz + chroma_sz*2;

		num_frames = IndexFile();
		if (num_frames <= 0 || seek_table.empty())
			throw VideoOpenError("Unable to determine file length");
		cur_fn = 0;

		fseeko(sf, 0, SEEK_SET);
	}
	catch (...) {
		if (sf) fclose(sf);
		throw;
	}
}
Exemple #7
0
ASErr Plugin::Message(char *caller, char *selector, void *message)
{
	ASErr error = kUnhandledMsgErr;

	/* Sweet Pea messages */

	if (sSPBasic->IsEqual(caller, kSPAccessCaller )) 
	{
		if (sSPBasic->IsEqual( selector, kSPAccessUnloadSelector))
			error = UnloadPlugin(static_cast<SPInterfaceMessage *>(message));
			
		else if (sSPBasic->IsEqual( selector, kSPAccessReloadSelector))
			error = ReloadPlugin(static_cast<SPInterfaceMessage *>(message));
	}
	else if (sSPBasic->IsEqual(caller, kSPInterfaceCaller)) 
	{	
		if (sSPBasic->IsEqual(selector, kSPInterfaceAboutSelector))
			error = About(static_cast<SPInterfaceMessage *>(message));

		else if (sSPBasic->IsEqual(selector, kSPInterfaceStartupSelector))
			error = StartupPlugin(static_cast<SPInterfaceMessage *>(message));

		else if (sSPBasic->IsEqual(selector, kSPInterfaceShutdownSelector))
			error = ShutdownPlugin(static_cast<SPInterfaceMessage *>(message));
	}
	else if (sSPBasic->IsEqual(caller, kSPCacheCaller)) 
	{	
		if (sSPBasic->IsEqual(selector, kSPPluginPurgeCachesSelector))
		{
			if (Purge())
				error = kSPPluginCachesFlushResponse;
			else
				error = kSPPluginCouldntFlushResponse;
		}
	}
	else if (sSPBasic->IsEqual( caller, kSPPropertiesCaller ))
	{
		if (sSPBasic->IsEqual( selector, kSPPropertiesAcquireSelector ))
		{
			error = AcquireProperty((SPPropertiesMessage *) message);
		}
		else if (sSPBasic->IsEqual( selector, kSPPropertiesReleaseSelector ))
		{
			error = ReleaseProperty((SPPropertiesMessage *) message);
		}
	}

	/* Some common AI messages */

	else if (sSPBasic->IsEqual(caller, kCallerAINotify)) 
	{
		AppContext appContext(((SPInterfaceMessage *)message)->d.self);

		// Ideally we would rely upon the caller to envelop our Notify method.
		// But since we won't work right if he doesn't, do this ourselves

		AINotifierMessage *msg = (AINotifierMessage *)message;

		if (sSPBasic->IsEqual(msg->type, kAIApplicationStartedNotifier))
			error = PostStartupPlugin();

		if (!error || error == kUnhandledMsgErr)
		{
			if (sSPBasic->IsEqual( selector, kSelectorAINotify ))
				error = Notify(msg);
		}
	}
	else if (sSPBasic->IsEqual(caller, kCallerAIMenu))
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIGoMenuItem ))
		{
			error = GoMenuItem((AIMenuMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIUpdateMenuItem ))
		{
			error = UpdateMenuItem((AIMenuMessage *)message);
		}
	}
	else if (sSPBasic->IsEqual(caller, kCallerAIFilter))
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIGetFilterParameters ))
		{
			error = GetFilterParameters((AIFilterMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIGoFilter ))
		{
			error = GoFilter((AIFilterMessage *)message);
		}
	}
	else if (sSPBasic->IsEqual(caller, kCallerAIPluginGroup))
	{
		if (sSPBasic->IsEqual( selector, kSelectorAINotifyEdits ))
		{
			error = PluginGroupNotify((AIPluginGroupMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIUpdateArt ))
		{
			error = PluginGroupUpdate((AIPluginGroupMessage *)message);
		}
	}
	else if (sSPBasic->IsEqual(caller, kCallerAIFileFormat))
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIGetFileFormatParameters ))
		{
			error = GetFileFormatParameters((AIFileFormatMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIGoFileFormat ))
		{
			error = GoFileFormat((AIFileFormatMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAICheckFileFormat ))
		{
			error = CheckFileFormat((AIFileFormatMessage *)message);
		}
	}
	else if (sSPBasic->IsEqual(caller, kCallerAITool))
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIEditToolOptions ))
		{
			error = EditTool((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAITrackToolCursor ))
		{
			error = TrackToolCursor((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIToolMouseDown ))
		{
			error = ToolMouseDown((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIToolMouseDrag ))
		{
			error = ToolMouseDrag((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIToolMouseUp ))
		{
			error = ToolMouseUp((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAISelectTool ))
		{
			error = SelectTool((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIDeselectTool ))
		{
			error = DeselectTool((AIToolMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIReselectTool ))
		{
			error = ReselectTool((AIToolMessage *)message);
		}
	} 
	else if (sSPBasic->IsEqual(caller, kCallerAILiveEffect )) 
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIEditLiveEffectParameters ))
		{
			error = EditLiveEffectParameters((AILiveEffectEditParamMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAIGoLiveEffect ))
		{
			error = GoLiveEffect((AILiveEffectGoMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAILiveEffectInterpolate ))
		{
			error = LiveEffectInterpolate((AILiveEffectInterpParamMessage *)message);
		}
		else if (sSPBasic->IsEqual( selector, kSelectorAILiveEffectInputType ))
		{
			error = LiveEffectGetInputType((AILiveEffectInputTypeMessage *)message);
		}

	}
	else if (sSPBasic->IsEqual(caller, kCallerAITimer )) 
	{
		if (sSPBasic->IsEqual( selector, kSelectorAIGoTimer ))
		{
			error = Timer((AITimerMessage *)message);
		}
	}
	// We should probably handle some ADM messages too, but I don't know
	// which ones right now...

	return error;
}