add missing ffmpeg encoder flush, bdwrite leaks + fixes
[goodguy/history.git] / cinelerra-5.0 / cinelerra / file.C
index 17e555aa11e8e6221c93afda84d10e0effba9125..c574921886e30ae954913b338e2e37f8a703a7dc 100644 (file)
@@ -76,7 +76,6 @@
 #include "pluginserver.h"
 #include "preferences.h"
 #include "samples.h"
-#include "stringfile.h"
 #include "vframe.h"
 
 //suppress noref warning
@@ -314,7 +313,7 @@ int File::get_options(FormatTools *format,
 
        if(!format_window)
        {
-               ErrorBox *errorbox = new ErrorBox(PROGRAM_NAME ": Error",
+               ErrorBox *errorbox = new ErrorBox(_(PROGRAM_NAME ": Error"),
                        parent_window->get_abs_cursor_x(1),
                        parent_window->get_abs_cursor_y(1));
                format_window = errorbox;
@@ -516,7 +515,7 @@ int File::open_file(Preferences *preferences,
                        buffer, 
                        buffer_size);
                delete [] buffer;
-               delete [] string;
+               free(string);
 //printf("File::open_file %d\n", __LINE__);
 
 // Get the updated asset from the fork
@@ -797,7 +796,7 @@ int File::open_file(Preferences *preferences,
 
 // Reopen file with correct parser and get header.
        if(file->open_file(rd, wr)) {
-               delete file;
+               delete file;  file = 0;
                return FILE_NOT_FOUND;
        }
 
@@ -2237,7 +2236,7 @@ const char* File::formattostr(ArrayList<PluginServer*> *plugindb, int format)
                case FILE_FFMPEG:       return _(FFMPEG_NAME);
                case FILE_DB:           return _(DBASE_NAME);
        }
-       return "Unknown";
+       return _("Unknown");
 }
 
 int File::strtobits(const char *bits)
@@ -2267,7 +2266,7 @@ const char* File::bitstostr(int bits)
                case BITSFLOAT:         return (NAME_FLOAT);
                case BITSIMA4:          return (NAME_IMA4);
        }
-       return "Unknown";
+       return _("Unknown");
 }
 
 
@@ -2489,7 +2488,7 @@ const char* File::get_tag(int format)
                case FILE_VMPEG:        return "m2v";
                case FILE_VORBIS:       return "ogg";
                case FILE_WAV:          return "wav";
-               case FILE_FFMPEG:       return "media";
+               case FILE_FFMPEG:       return "ffmpg";
        }
        return 0;
 }
@@ -2534,7 +2533,7 @@ const char* File::get_prefix(int format)
        case FILE_GIF_LIST:     return "GIF_LIST";
        case FILE_DB:           return "DB";
        }
-       return "UNKNOWN";
+       return _("UNKNOWN");
 }
 
 
@@ -2561,3 +2560,22 @@ int File::record_fd()
 }
 
 
+void get_exe_path(char *result)
+{
+// Get executable path
+       pid_t pid = getpid();
+       char proc_path[BCTEXTLEN];
+       int len = 0;
+       result[0] = 0;
+       sprintf(proc_path, "/proc/%d/exe", pid);
+       if((len = readlink(proc_path, result, BCTEXTLEN)) >= 0)
+       {
+               result[len] = 0;
+//printf("Preferences::Preferences %d %s\n", __LINE__, result);
+               char *ptr = strrchr(result, '/');
+               if(ptr) *ptr = 0;
+       }
+
+}
+
+