//////////////////////////////////////////////////////////////////////////////// // the plugin's description routine static OfxStatus describe(OfxImageEffectHandle effect) { // fetch the host APIs OfxStatus stat; if((stat = ofxuFetchHostSuites()) != kOfxStatOK) return stat; // see if the host supports overlays int supportsOverlays; gPropHost->propGetInt(gHost->host, kOfxImageEffectPropSupportsOverlays, 0, &supportsOverlays); if(supportsOverlays == 0) return kOfxStatErrMissingHostFeature; // get the property handle for the plugin OfxPropertySetHandle effectProps; gEffectHost->getPropertySet(effect, &effectProps); // define the plugin to the host gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 0, kOfxBitDepthByte); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 1, kOfxBitDepthShort); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 2, kOfxBitDepthFloat); // set the bit depths the plugin can handle gPropHost->propSetString(effectProps, kOfxPropLabel, 0, "OFX Overlay Example"); gPropHost->propSetString(effectProps, kOfxImageEffectPluginPropGrouping, 0, "OFX Example"); // define the contexts we can be used in gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 0, kOfxImageEffectContextFilter); // set the property that is the overlay's main entry point for the plugin gPropHost->propSetPointer(effectProps, kOfxImageEffectPluginPropOverlayInteractV1, 0, (void *) overlayMain); return kOfxStatOK; }
//////////////////////////////////////////////////////////////////////////////// // the plugin's description routine static OfxStatus describe(OfxImageEffectHandle effect) { // first fetch the host APIs, this cannot be done before this call OfxStatus stat; if((stat = ofxuFetchHostSuites()) != kOfxStatOK) return stat; gOpenGLSuite = (OfxImageEffectOpenGLRenderSuiteV1 *)gHost->fetchSuite(gHost->host, kOfxOpenGLRenderSuite, 1); // record a few host features gPropHost->propGetInt(gHost->host, kOfxImageEffectPropSupportsMultipleClipDepths, 0, &gHostSupportsMultipleBitDepths); // get the property handle for the plugin OfxPropertySetHandle effectProps; gEffectHost->getPropertySet(effect, &effectProps); // We can render both fields in a fielded images in one hit if there is no animation // So set the flag that allows us to do this gPropHost->propSetInt(effectProps, kOfxImageEffectPluginPropFieldRenderTwiceAlways, 0, 0); // say we can support multiple pixel depths and let the clip preferences action deal with it all. gPropHost->propSetInt(effectProps, kOfxImageEffectPropSupportsMultipleClipDepths, 0, 1); // set the bit depths the plugin can handle gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 0, kOfxBitDepthByte); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 1, kOfxBitDepthShort); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 2, kOfxBitDepthFloat); // set some labels and the group it belongs to gPropHost->propSetString(effectProps, kOfxPropLabel, 0, "OFX OpenGL Example"); gPropHost->propSetString(effectProps, kOfxImageEffectPluginPropGrouping, 0, "OFX Example"); // define the contexts we can be used in gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 0, kOfxImageEffectContextFilter); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 1, kOfxImageEffectContextGeneral); // we support OpenGL rendering (could also say "needed" here) gPropHost->propSetString(effectProps, kOfxImageEffectPropOpenGLRenderSupported, 0, "true"); { char *s = NULL; stat = gPropHost->propGetString(gHost->host, kOfxImageEffectPropOpenGLRenderSupported, 0, &s); DPRINT(("Host has OpenGL render support: %s (stat=%d)\n", s, stat)); gHostSupportsOpenGL = stat == 0 && !strcmp(s, "true"); } // we support all the OpenGL bit depths gPropHost->propSetString(effectProps, kOfxOpenGLPropPixelDepth, 0, kOfxBitDepthByte); gPropHost->propSetString(effectProps, kOfxOpenGLPropPixelDepth, 1, kOfxBitDepthShort); gPropHost->propSetString(effectProps, kOfxOpenGLPropPixelDepth, 2, kOfxBitDepthFloat); return kOfxStatOK; }
//////////////////////////////////////////////////////////////////////////////// // the plugin's description routine static OfxStatus describe(OfxImageEffectHandle effect) { // first fetch the host APIs, this cannot be done before this call OfxStatus stat; if((stat = ofxuFetchHostSuites()) != kOfxStatOK) return stat; // record a few host features gPropHost->propGetInt(gHost->host, kOfxImageEffectPropSupportsMultipleClipDepths, 0, &gHostSupportsMultipleBitDepths); // get the property handle for the plugin OfxPropertySetHandle effectProps; gEffectHost->getPropertySet(effect, &effectProps); // We can render both fields in a fielded images in one hit if there is no animation // So set the flag that allows us to do this gPropHost->propSetInt(effectProps, kOfxImageEffectPluginPropFieldRenderTwiceAlways, 0, 0); // say we can support multiple pixel depths and let the clip preferences action deal with it all. gPropHost->propSetInt(effectProps, kOfxImageEffectPropSupportsMultipleClipDepths, 0, 1); // set the bit depths the plugin can handle gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 0, kOfxBitDepthByte); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 1, kOfxBitDepthShort); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 2, kOfxBitDepthFloat); // set some labels and the group it belongs to gPropHost->propSetString(effectProps, kOfxPropLabel, 0, "OFX Gain Example"); gPropHost->propSetString(effectProps, kOfxImageEffectPluginPropGrouping, 0, "OFX Example"); // define the contexts we can be used in gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 0, kOfxImageEffectContextFilter); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 1, kOfxImageEffectContextGeneral); return kOfxStatOK; }
//////////////////////////////////////////////////////////////////////////////// // the plugin's description routine static OfxStatus describe(OfxImageEffectHandle effect) { // first fetch the host APIs, this cannot be done before this call OfxStatus stat; if((stat = ofxuFetchHostSuites()) != kOfxStatOK) return stat; int hostSupportsMultipleDepths; // record a few host features gPropHost->propGetInt(gHost->host, kOfxImageEffectPropSupportsMultipleClipDepths, 0, &hostSupportsMultipleDepths); // see how many bit depths the host supports, this affects our parameter values int nHostDepths; gPropHost->propGetDimension(gHost->host, kOfxImageEffectPropSupportedPixelDepths, &nHostDepths); // If the host cannot support multiple bit depths on in and out clips or it only supports 1 bit depth // we cant do any work, so refuse to load and explain why. if(!hostSupportsMultipleDepths || nHostDepths == 1) { // post a message gMessageSuite->message(effect, kOfxMessageError, kMessageNotEnoughBits, "OFX GeneratorExample : cannot run on this application because the it does not allow effects to change the bit depth of images."); // and refuse to load return kOfxStatErrMissingHostFeature; } // get the property handle for the plugin OfxPropertySetHandle effectProps; gEffectHost->getPropertySet(effect, &effectProps); // We can render both fields in a fielded image in one hit as there is no animation and no spatially dependant parameters gPropHost->propSetInt(effectProps, kOfxImageEffectPluginPropFieldRenderTwiceAlways, 0, 0); // say we can support multiple pixel depths on in and out gPropHost->propSetInt(effectProps, kOfxImageEffectPropSupportsMultipleClipDepths, 0, 1); // set the bit depths the plugin can handle gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 0, kOfxBitDepthByte); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 1, kOfxBitDepthShort); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedPixelDepths, 2, kOfxBitDepthFloat); // figure which bit depths are supported int i; for(i = 0; i < nHostDepths; i++) { char *depthStr; gPropHost->propGetString(gHost->host, kOfxImageEffectPropSupportedPixelDepths, i, &depthStr); int nBits = ofxuMapPixelDepth(depthStr); switch(nBits) { case 8 : gSupportsBytes = true; break; case 16 : gSupportsShorts = true; break; case 32 : gSupportsFloats = true; break; } } // now set a mapping from parameter value to bit depth i = 0; if(gSupportsBytes) gDepthParamToBytes[i++] = 8; if(gSupportsShorts) gDepthParamToBytes[i++] = 16; if(gSupportsFloats) gDepthParamToBytes[i++] = 32; // set some labels and the group it belongs to gPropHost->propSetString(effectProps, kOfxPropLabel, 0, "OFX Depth Converter"); gPropHost->propSetString(effectProps, kOfxImageEffectPluginPropGrouping, 0, "OFX Example"); // define the contexts we can be used in gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 0, kOfxImageEffectContextFilter); gPropHost->propSetString(effectProps, kOfxImageEffectPropSupportedContexts, 1, kOfxImageEffectContextGeneral); return kOfxStatOK; }