add bluray support, add dialog close fixes, scale fix
[goodguy/history.git] / cinelerra-5.0 / cinelerra / fileffmpeg.C
index bfe0a107b0ab0145285bcb55337b8e9d6aeb2042..6a8681d4fe01cc530a7fdb075abc519c48528d9a 100644 (file)
@@ -136,24 +136,24 @@ void FileFFMPEG::get_info(char *path, char *text)
 {
        char *cp = text;
        FFMPEG ffmpeg(0);
-       cp += sprintf(cp, "file path: %s\n", path);
+       cp += sprintf(cp, _("file path: %s\n"), path);
        struct stat st;
        int ret = 0;
        if( stat(path, &st) < 0 ) {
-               cp += sprintf(cp, " err: %s\n", strerror(errno));
+               cp += sprintf(cp, _(" err: %s\n"), strerror(errno));
                ret = 1;
        }
        else {
-               cp += sprintf(cp, "  %jd bytes\n", st.st_size);
+               cp += sprintf(cp, _("  %jd bytes\n"), st.st_size);
        }
        if( !ret ) ret = ffmpeg.init_decoder(path);
        if( !ret ) ret = ffmpeg.open_decoder();
        if( !ret ) {
-               cp += sprintf(cp, "info:\n");
+               cp += sprintf(cp, _("info:\n"));
                ffmpeg.info(cp, BCTEXTLEN-(cp-text));
        }
        else
-               sprintf(cp, "== open failed\n");
+               sprintf(cp, _("== open failed\n"));
 }
 
 int FileFFMPEG::get_video_info(int track, int &pid, double &framerate,
@@ -318,23 +318,10 @@ int FileFFMPEG::get_best_colormodel(Asset *asset, int driver)
        return BC_YUV420P;
 }
 
-static void load_options(const char *path, char *bfr, int len)
-{
-       *bfr = 0;
-       FILE *fp = fopen(path, "r");
-       if( !fp ) return;
-       fgets(bfr, len, fp); // skip hdr
-       len = fread(bfr, 1, len-1, fp);
-       if( len < 0 ) len = 0;
-       bfr[len] = 0;
-       fclose(fp);
-}
-
 //======
-extern void get_exe_path(char *result); // from main.C
 
 FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
- : BC_Window(PROGRAM_NAME ": Audio Preset",
+ : BC_Window(_(PROGRAM_NAME ": Audio Preset"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
        420, 420)
@@ -362,16 +349,15 @@ void FFMPEGConfigAudio::create_objects()
 
         FileSystem fs;
        char option_path[BCTEXTLEN];
-       FFMPEG::set_option_path(option_path, "/audio");
+       FFMPEG::set_option_path(option_path, "audio");
         fs.update(option_path);
         int total_files = fs.total_files();
         for(int i = 0; i < total_files; i++) {
                 const char *name = fs.get_entry(i)->get_name();
                if( asset->fformat[0] != 0 ) {
                        const char *ext = strrchr(name,'.');
-                       if( !ext ) ext = name;
-                       else if( !strcmp("opts", ++ext) ) continue;
-                       if( strcmp(asset->fformat, ext) ) continue;
+                       if( !ext ) continue;
+                       if( strcmp(asset->fformat, ++ext) ) continue;
                }
                 presets.append(new BC_ListBoxItem(name));
         }
@@ -400,7 +386,7 @@ void FFMPEGConfigAudio::create_objects()
        y += 25;
        if( !asset->ff_audio_options[0] && asset->acodec[0] ) {
                FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-               load_options(option_path, asset->ff_audio_options,
+               FFMPEG::load_options(option_path, asset->ff_audio_options,
                         sizeof(asset->ff_audio_options));
        }
        add_subwindow(audio_options = new FFAudioOptions(this, x, y, get_w()-x-20, 10,
@@ -444,7 +430,7 @@ int FFMPEGConfigAudioPopup::handle_event()
        Asset *asset = popup->asset;
        char option_path[BCTEXTLEN];
        FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-       load_options(option_path, asset->ff_audio_options,
+       FFMPEG::load_options(option_path, asset->ff_audio_options,
                         sizeof(asset->ff_audio_options));
        popup->audio_options->update(asset->ff_audio_options);
        return 1;
@@ -468,7 +454,7 @@ int FFMPEGConfigAudioToggle::handle_event()
 //======
 
 FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
- : BC_Window(PROGRAM_NAME ": Video Preset",
+ : BC_Window(_(PROGRAM_NAME ": Video Preset"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
        420, 420)
@@ -478,6 +464,7 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
        preset_popup = 0;
 
        bitrate = 0;
+       quality = 0;
        video_options = 0;
 }
 
@@ -506,9 +493,8 @@ void FFMPEGConfigVideo::create_objects()
                 const char *name = fs.get_entry(i)->get_name();
                if( asset->fformat[0] != 0 ) {
                        const char *ext = strrchr(name,'.');
-                       if( !ext ) ext = name;
-                       else if( !strcmp("opts", ++ext) ) continue;
-                       if( strcmp(asset->fformat, ext) ) continue;
+                       if( !ext ) continue;
+                       if( strcmp(asset->fformat, ++ext) ) continue;
                }
                 presets.append(new BC_ListBoxItem(name));
         }
@@ -545,7 +531,7 @@ void FFMPEGConfigVideo::create_objects()
        y += 25;
        if( !asset->ff_video_options[0] && asset->vcodec[0] ) {
                FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-               load_options(option_path, asset->ff_video_options,
+               FFMPEG::load_options(option_path, asset->ff_video_options,
                         sizeof(asset->ff_video_options));
        }
        add_subwindow(video_options = new FFVideoOptions(this, x, y, get_w()-x-20, 10,
@@ -593,7 +579,7 @@ int FFMPEGConfigVideoPopup::handle_event()
        Asset *asset = popup->asset;
        char option_path[BCTEXTLEN];
        FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-       load_options(option_path, asset->ff_video_options,
+       FFMPEG::load_options(option_path, asset->ff_video_options,
                         sizeof(asset->ff_video_options));
        popup->video_options->update(asset->ff_video_options);
        return 1;