@@ -1493,30 +1493,12 @@ OfxHost MltOfxHost = {NULL, MltOfxfetchSuite};
14931493void mltofx_init_host_properties (OfxPropertySetHandle host_properties )
14941494{
14951495 propSetString (host_properties , kOfxPropName , 0 , "MLT" );
1496- propSetString (host_properties , kOfxImageEffectPropContext , 0 , kOfxImageEffectContextGeneral );
1497- propSetString (host_properties ,
1498- kOfxImageEffectPropSupportedPixelDepths ,
1499- 0 ,
1500- kOfxBitDepthByte ); /* kOfxBitDepthByte is hardcoded */
1496+ propSetString (host_properties , kOfxImageEffectPropSupportedContexts , 0 , kOfxImageEffectContextFilter );
1497+ propSetString (host_properties , kOfxImageEffectPropSupportedPixelDepths , 0 , kOfxBitDepthByte );
15011498 propSetString (host_properties , kOfxImageEffectPropSupportedPixelDepths , 1 , kOfxBitDepthShort );
1502- propSetString (host_properties , kOfxImageEffectPropSupportedPixelDepths , 2 , kOfxBitDepthHalf );
1503- propSetString (host_properties , kOfxImageEffectPropSupportedPixelDepths , 3 , kOfxBitDepthFloat );
1504-
1505- propSetString (host_properties ,
1506- kOfxImageEffectPropSupportedComponents ,
1507- 0 ,
1508- kOfxImageComponentNone );
1509- propSetString (host_properties ,
1510- kOfxImageEffectPropSupportedComponents ,
1511- 1 ,
1512- kOfxImageComponentRGBA );
1513- propSetString (host_properties , kOfxImageEffectPropSupportedComponents , 2 , kOfxImageComponentRGB );
1514- propSetString (host_properties ,
1515- kOfxImageEffectPropSupportedComponents ,
1516- 3 ,
1517- kOfxImageComponentAlpha );
1518-
1519- propSetInt (host_properties , kOfxImageEffectPropSupportsMultipleClipDepths , 0 , 1 );
1499+ propSetString (host_properties , kOfxImageEffectPropSupportedComponents , 0 , kOfxImageComponentRGBA );
1500+ propSetString (host_properties , kOfxImageEffectPropSupportedComponents , 1 , kOfxImageComponentRGB );
1501+ propSetInt (host_properties , kOfxImageEffectPropSupportsMultipleClipDepths , 0 , 0 );
15201502
15211503 /* TODO: add support for OpenGL plugins */
15221504 propSetString (host_properties , kOfxImageEffectPropOpenGLRenderSupported , 0 , "false" );
@@ -1753,7 +1735,7 @@ void mltofx_set_output_clip_data(OfxPlugin *plugin,
17531735 (double ) width / (double ) height );
17541736}
17551737
1756- OfxStatus mltofx_is_plugin_supported (OfxPlugin * plugin )
1738+ int mltofx_detect_plugin (OfxPlugin * plugin )
17571739{
17581740 mlt_properties image_effect = mlt_properties_new ();
17591741 mlt_properties clips = mlt_properties_new ();
@@ -1792,39 +1774,56 @@ OfxStatus mltofx_is_plugin_supported(OfxPlugin *plugin)
17921774 (mlt_destructor ) mlt_properties_close ,
17931775 NULL );
17941776
1795- propSetString ((OfxPropertySetHandle ) props ,
1796- kOfxImageEffectPropContext ,
1797- 0 ,
1798- kOfxImageEffectContextGeneral );
1799-
18001777 plugin -> setHost (& MltOfxHost );
18011778
18021779 OfxStatus status_code = kOfxStatErrUnknown ;
18031780 status_code = plugin -> mainEntry (kOfxActionLoad , NULL , NULL , NULL );
18041781 mltofx_log_status_code (status_code , "kOfxActionLoad" );
1782+ if (status_code != kOfxStatOK ) {
1783+ return 0 ;
1784+ }
18051785 status_code
18061786 = plugin -> mainEntry (kOfxActionDescribe , (OfxImageEffectHandle ) image_effect , NULL , NULL );
18071787 mltofx_log_status_code (status_code , "kOfxActionDescribe" );
18081788
18091789 if (status_code != kOfxStatOK ) {
18101790 plugin -> mainEntry (kOfxActionUnload , NULL , NULL , NULL );
1811- return status_code ;
1791+ return 0 ;
18121792 }
18131793
1814- /* test describe in context action because some plugins say they are unsupported at this stage */
1815- status_code = plugin -> mainEntry (kOfxImageEffectActionDescribeInContext ,
1816- (OfxImageEffectHandle ) image_effect ,
1817- (OfxPropertySetHandle ) MltOfxHost .host ,
1818- NULL );
1794+ int i = 0 ;
1795+ int count = 0 ;
18191796
1820- mltofx_log_status_code (status_code , "kOfxImageEffectActionDescribeInContext" );
1821- if (status_code != kOfxStatErrMissingHostFeature ) {
1797+ propGetDimension ((OfxPropertySetHandle ) props , kOfxImageEffectPropSupportedContexts , & count );
1798+ for (i = 0 ; i < count ; i ++ ) {
1799+ char * context ;
1800+ propGetString ((OfxPropertySetHandle ) props , kOfxImageEffectPropSupportedContexts , i , & context );
1801+ if (!strcmp (context , kOfxImageEffectContextFilter )) {
1802+ break ;
1803+ }
1804+ }
1805+ if (i == count ) {
1806+ mlt_log_debug (NULL , "[ofx] Plugin not a filter: %s\n" , plugin -> pluginIdentifier );
18221807 plugin -> mainEntry (kOfxActionUnload , NULL , NULL , NULL );
1823- return kOfxStatOK ;
1808+ return 0 ;
1809+ }
1810+
1811+ propGetDimension ((OfxPropertySetHandle ) props , kOfxImageEffectPropSupportedPixelDepths , & count );
1812+ for (i = 0 ; i < count ; i ++ ) {
1813+ char * depth ;
1814+ propGetString ((OfxPropertySetHandle ) props , kOfxImageEffectPropSupportedPixelDepths , i , & depth );
1815+ if (!strcmp (depth , kOfxBitDepthByte ) || !strcmp (depth , kOfxBitDepthShort )) {
1816+ break ;
1817+ }
1818+ }
1819+ if (i == count ) {
1820+ mlt_log_debug (NULL , "[ofx] Plugin not byte/short: %s\n" , plugin -> pluginIdentifier );
1821+ plugin -> mainEntry (kOfxActionUnload , NULL , NULL , NULL );
1822+ return 0 ;
18241823 }
18251824
18261825 plugin -> mainEntry (kOfxActionUnload , NULL , NULL , NULL );
1827- return status_code ;
1826+ return 1 ;
18281827}
18291828
18301829void * mltofx_fetch_params (OfxPlugin * plugin , mlt_properties params )
@@ -1865,11 +1864,6 @@ void *mltofx_fetch_params(OfxPlugin *plugin, mlt_properties params)
18651864 (mlt_destructor ) mlt_properties_close ,
18661865 NULL );
18671866
1868- propSetString ((OfxPropertySetHandle ) props ,
1869- kOfxImageEffectPropContext ,
1870- 0 ,
1871- kOfxImageEffectContextGeneral );
1872-
18731867 plugin -> setHost (& MltOfxHost );
18741868
18751869 OfxStatus status_code = kOfxStatErrUnknown ;
0 commit comments