]> git.sesse.net Git - mlt/blobdiff - src/modules/frei0r/factory.c
Some frei0r filters need to be initialized before getting param info.
[mlt] / src / modules / frei0r / factory.c
index 8e2ab997bc03ea270f1901b53a2a640c224baac5..2d076ffe55ef5e676fed80d4a270d15aae5f5ed1 100644 (file)
@@ -71,6 +71,8 @@ static mlt_properties fill_param_info ( mlt_service_type type, const char *servi
        if (!handle) return NULL;
        void (*plginfo)(f0r_plugin_info_t*)=dlsym(handle,"f0r_get_plugin_info");
        void (*param_info)(f0r_param_info_t*,int param_index)=dlsym(handle,"f0r_get_param_info");
+       void (*f0r_init)(void)=dlsym(handle,"f0r_init");
+       void (*f0r_deinit)(void)=dlsym(handle,"f0r_deinit");
        if (!plginfo || !param_info) {
                dlclose(handle);
                return NULL;
@@ -80,6 +82,7 @@ static mlt_properties fill_param_info ( mlt_service_type type, const char *servi
        char string[48];
        int j=0;
 
+       f0r_init();
        plginfo(&info);
        snprintf ( string, sizeof(string) , "%d.%d" , info.major_version , info.minor_version );
        mlt_properties_set ( metadata, "schema_version" , "0.1" );
@@ -139,6 +142,7 @@ static mlt_properties fill_param_info ( mlt_service_type type, const char *servi
                        mlt_properties_set ( pnum , "readonly" , "no" );
                }
        }
+       f0r_deinit();
        dlclose(handle);
        free(name);
 
@@ -283,9 +287,12 @@ MLT_REPOSITORY
        mlt_tokeniser tokeniser = mlt_tokeniser_init ( );
        int dircount=mlt_tokeniser_parse_new (
                tokeniser ,
-       getenv("MLT_FREI0R_PLUGIN_PATH") ? getenv("MLT_FREI0R_PLUGIN_PATH") : FREI0R_PLUGIN_PATH,
+               getenv("MLT_FREI0R_PLUGIN_PATH") ? getenv("MLT_FREI0R_PLUGIN_PATH") : FREI0R_PLUGIN_PATH,
                ":"
        );
+       char temp[ 1024 ];
+       sprintf( temp, "%s/frei0r/blacklist.txt", mlt_environment( "MLT_DATA" ) );
+       mlt_properties blacklist = mlt_properties_load( temp );
 
        while (dircount--){
 
@@ -293,7 +300,7 @@ MLT_REPOSITORY
                char* dirname = mlt_tokeniser_get_string ( tokeniser , dircount ) ;
                mlt_properties_dir_list(direntries, dirname ,"*.so",1);
 
-               for (i=0;i<mlt_properties_count(direntries);i++){
+               for (i=0; i<mlt_properties_count(direntries);i++){
                        char* name=mlt_properties_get_value(direntries,i);
                        char* shortname=name+strlen(dirname)+1;
                        char fname[1024]="";
@@ -306,6 +313,9 @@ MLT_REPOSITORY
                        char* firstname = strtok_r ( shortname , "." , &save_firstptr );
                        strcat(pluginname,firstname);
 
+                       if ( mlt_properties_get( blacklist, firstname ) )
+                               continue;
+
                        void* handle=dlopen(strcat(name,".so"),RTLD_LAZY);
                        if (handle){
                                void (*plginfo)(f0r_plugin_info_t*)=dlsym(handle,"f0r_get_plugin_info");
@@ -332,4 +342,5 @@ MLT_REPOSITORY
                mlt_properties_close(direntries);
        }
        mlt_tokeniser_close ( tokeniser );
+       mlt_properties_close( blacklist );
 }