improve ffmpeg format selection popup menu, more ffmpeg audio fixes
[goodguy/history.git] / cinelerra-5.0 / cinelerra / file.C
index 5e870d42d5f3c0491aa198c989391a55bd17df71..be231980711914260d79003cde01ade0bfd3b39c 100644 (file)
 #include "pluginserver.h"
 #include "preferences.h"
 #include "samples.h"
-#include "stringfile.h"
 #include "vframe.h"
 
-
-
+//suppress noref warning
+void *vorbis0_ov_callbacks[] = {
+ &OV_CALLBACKS_DEFAULT, &OV_CALLBACKS_NOCLOSE,
+ &OV_CALLBACKS_STREAMONLY, &OV_CALLBACKS_STREAMONLY_NOCLOSE,
+};
 
 File::File()
 {
@@ -513,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
@@ -794,29 +796,32 @@ int File::open_file(Preferences *preferences,
 
 // Reopen file with correct parser and get header.
        if(file->open_file(rd, wr)) {
-               delete file;
-               file = 0;
+               delete file;  file = 0;
+               return FILE_NOT_FOUND;
        }
 
 
 
 // Set extra writing parameters to mandatory settings.
-       if(file && wr) {
+       if( wr ) {
                if(this->asset->dither) file->set_dither();
        }
 
-
+       if( rd ) {
+// one frame image file, no specific length
+               if( !this->asset->audio_data && this->asset->video_data &&
+                   this->asset->video_length <= 1 )
+                       this->asset->video_length = -1;
+       }
 
 // Synchronize header parameters
-       if(file) {
-               asset->copy_from(this->asset, 1);
+       asset->copy_from(this->asset, 1);
 //asset->dump();
-       }
 
        if(debug) printf("File::open_file %d file=%p\n", __LINE__, file);
 // sleep(1);
 
-       return file ? FILE_OK : FILE_NOT_FOUND;
+       return FILE_OK;
 }
 
 void File::delete_temp_samples_buffer()
@@ -2483,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;
 }