fix plugin probe when LANG != en
[goodguy/history.git] / cinelerra-5.0 / cinelerra / pluginserver.C
index b9e7eeffb237ec79bb54ee4d99f15341db5cb4e9..25573cf4b95986e61e61ae4ec3af2af501f73567 100644 (file)
@@ -30,6 +30,7 @@
 #include "edl.h"
 #include "edlsession.h"
 #include "floatautos.h"
+#include "format.inc"
 #include "keyframes.h"
 #include "localsession.h"
 #include "mainerror.h"
@@ -313,16 +314,11 @@ int PluginServer::open_plugin(int master,
        this->plugin = plugin;
        this->edl = edl;
        if( plugin_type != PLUGIN_TYPE_FFMPEG && plugin_type != PLUGIN_TYPE_EXECUTABLE && !load_obj() ) {
-// If the load failed it may still be an executable tool for a specific
-// file format, in which case we just store the path.
-               set_title(path);
-               char string[BCTEXTLEN];
-               strcpy(string, load_error());
-               if( !strstr(string, "executable") ) {
-                       eprintf("PluginServer::open_plugin: load_obj %s = %s\n", path, string);
-                       return PLUGINSERVER_NOT_RECOGNIZED;
-               }
-               plugin_type = PLUGIN_TYPE_EXECUTABLE;
+// If the load failed, can't use error to detect executable
+//  because locale and language selection change the load_error()
+//     if( !strstr(string, "executable") ) { set_title(path); plugin_type = PLUGIN_TYPE_EXECUTABLE; }
+               eprintf("PluginServer::open_plugin: load_obj %s = %s\n", path, load_error());
+               return PLUGINSERVER_NOT_RECOGNIZED;
        }
        if( plugin_type == PLUGIN_TYPE_UNKNOWN || plugin_type == PLUGIN_TYPE_BUILTIN ) {
                new_plugin =
@@ -347,6 +343,8 @@ int PluginServer::open_plugin(int master,
                return PLUGINSERVER_NOT_RECOGNIZED;
        }
        switch( plugin_type ) {
+       case PLUGIN_TYPE_EXECUTABLE:
+               return PLUGINSERVER_OK;
        case PLUGIN_TYPE_BUILTIN:
                client = new_plugin(this);
                break;
@@ -424,28 +422,28 @@ void PluginServer::render_stop()
                client->render_stop();
 }
 
-void PluginServer::write_table(FILE *fp, int idx)
+void PluginServer::write_table(FILE *fp, const char *path, int idx, int64_t mtime)
 {
        if(!fp) return;
-       fprintf(fp, "%d \"%s\" \"%s\" %d %d %d %d %d %d %d %d %d %d %d\n",
-               plugin_type, path, title, idx, audio, video, theme, realtime,
+       fprintf(fp, "%d \"%s\" \"%s\" " _LD " %d %d %d %d %d %d %d %d %d %d %d\n",
+               plugin_type, path, title, mtime, idx, audio, video, theme, realtime,
                fileio, uses_gui, multichannel, synthesis, transition, lad_index);
 }
 
-int PluginServer::scan_table(char *text, int &type, char *path, char *title)
+int PluginServer::scan_table(char *text, int &type, char *path, char *title, int64_t &mtime)
 {
-       int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\"", &type, path, title);
-       return n < 3 ? 1 : 0;
+       int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\" " _LD "", &type, path, title, &mtime);
+       return n < 4 ? 1 : 0;
 }
 
 int PluginServer::read_table(char *text)
 {
        char path[BCTEXTLEN], title[BCTEXTLEN];
-       int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\" %d %d %d %d %d %d %d %d %d %d %d",
-               &plugin_type, path, title, &dir_idx, &audio, &video, &theme, &realtime,
+       int64_t mtime;
+       int n = sscanf(text, "%d \"%[^\"]\" \"%[^\"]\" " _LD " %d %d %d %d %d %d %d %d %d %d %d",
+               &plugin_type, path, title, &mtime, &dir_idx, &audio, &video, &theme, &realtime,
                &fileio, &uses_gui, &multichannel, &synthesis, &transition, &lad_index);
-       if( n != 14 ) return 1;
-       set_path(path);
+       if( n != 15 ) return 1;
        set_title(title);
        return 0;
 }