olaf neophyte and de.po updates, valgrind tweaks, delete green lady, inkscape dpi=96
[goodguy/history.git] / cinelerra-5.1 / cinelerra / formattools.C
index 711167215e4ed3fcc9f717887f6c4b807ead86d7..312f39c8bb218776556fb6584ec28f4c883855ec 100644 (file)
@@ -27,7 +27,9 @@
 #include "filesystem.h"
 #include "formattools.h"
 #include "language.h"
+#ifdef HAVE_DV
 #include "libdv.h"
+#endif
 #include "libmjpeg.h"
 #include "maxchannels.h"
 #include "mwindow.h"
@@ -46,13 +48,11 @@ FormatTools::FormatTools(MWindow *mwindow,
        this->mwindow = mwindow;
        this->window = window;
        this->asset = asset;
-       this->plugindb = mwindow->plugindb;
 
        aparams_button = 0;
        vparams_button = 0;
        aparams_thread = 0;
        vparams_thread = 0;
-       channels_tumbler = 0;
        audio_switch = 0;
        video_switch = 0;
        path_textbox = 0;
@@ -63,9 +63,7 @@ FormatTools::FormatTools(MWindow *mwindow,
        format_text = 0;
        audio_title = 0;
        video_title = 0;
-       channels_title = 0;
-       channels_button = 0;
-       multiple_files = 0;
+       labeled_files = 0;
        w = window->get_w();
 
        recording = 0;
@@ -100,7 +98,6 @@ SET_TRACE
 SET_TRACE
        if(vparams_thread) delete vparams_thread;
 SET_TRACE
-       if(channels_tumbler) delete channels_tumbler;
 }
 
 void FormatTools::create_objects(
@@ -168,7 +165,7 @@ void FormatTools::create_objects(
        format_button->create_objects();
        x += format_button->get_w() + 5;
        window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 70, 1, asset->fformat));
-       FFMPEG::set_asset_format(asset, asset->fformat);
+       FFMPEG::set_asset_format(asset, mwindow->edl, asset->fformat);
        x += ffmpeg_type->get_w();
        window->add_subwindow(format_ffmpeg = new FormatFFMPEG(x, y, this));
        format_ffmpeg->create_objects();
@@ -187,18 +184,6 @@ void FormatTools::create_objects(
                ylev = y;
                y += aparams_button->get_h() + 10;
 
-// Audio channels only used for recording.
-//             if(prompt_audio_channels)
-//             {
-//                     window->add_subwindow(channels_title = new BC_Title(x, y, _("Number of audio channels to record:")));
-//                     x += 260;
-//                     window->add_subwindow(channels_button = new FormatChannels(x, y, this));
-//                     x += channels_button->get_w() + 5;
-//                     window->add_subwindow(channels_tumbler = new BC_ITumbler(channels_button, 1, MAXCHANNELS, x, y));
-//                     y += channels_button->get_h() + 20;
-//                     x = init_x;
-//             }
-
 //printf("FormatTools::create_objects 6\n");
                aparams_thread = new FormatAThread(this);
        }
@@ -237,9 +222,9 @@ void FormatTools::create_objects(
 
        x = init_x;
        if( file_per_label ) {
-               multiple_files = new FormatMultiple(mwindow, x, y, file_per_label);
-               window->add_subwindow(multiple_files);
-               y += multiple_files->get_h() + 10;
+               labeled_files = new FormatFilePerLabel(this, x, y, file_per_label);
+               window->add_subwindow(labeled_files);
+               y += labeled_files->get_h() + 10;
        }
 
 //printf("FormatTools::create_objects 12\n");
@@ -277,11 +262,12 @@ void FormatTools::update_driver(int driver)
                        format_text->update(File::formattostr(asset->format));
 
                        switch(driver) {
+#ifdef HAVE_DV
                        case CAPTURE_IEC61883:
                        case CAPTURE_FIREWIRE:
                                locked_compressor = (char*)CODEC_TAG_DVSD;
                                break;
-
+#endif
                        case VIDEO4LINUX2JPEG:
                                locked_compressor = (char*)CODEC_TAG_MJPEG;
                                break;
@@ -422,7 +408,7 @@ void FormatTools::update(Asset *asset, int *file_per_label)
 {
        this->asset = asset;
        this->file_per_label = file_per_label;
-       if( file_per_label ) multiple_files->update(file_per_label);
+       if( file_per_label ) labeled_files->update(file_per_label);
        if( path_textbox ) path_textbox->update(asset->path);
        format_text->update(File::formattostr(asset->format));
        update_format();
@@ -490,16 +476,6 @@ void FormatTools::reposition_window(int &init_x, int &init_y)
 
                x = init_x;
                y += aparams_button->get_h() + 10;
-               if(prompt_audio_channels)
-               {
-                       channels_title->reposition_window(x, y);
-                       x += 260;
-                       channels_button->reposition_window(x, y);
-                       x += channels_button->get_w() + 5;
-                       channels_tumbler->reposition_window(x, y);
-                       y += channels_button->get_h() + 20;
-                       x = init_x;
-               }
        }
 
 
@@ -528,8 +504,8 @@ void FormatTools::reposition_window(int &init_x, int &init_y)
        }
 
        if( file_per_label ) {
-               multiple_files->reposition_window(x, y);
-               y += multiple_files->get_h() + 10;
+               labeled_files->reposition_window(x, y);
+               y += labeled_files->get_h() + 10;
        }
 
        init_y = y;
@@ -591,6 +567,7 @@ FormatAParams::~FormatAParams()
 int FormatAParams::handle_event()
 {
        format->set_audio_options();
+       format->handle_event();
        return 1;
 }
 
@@ -612,6 +589,7 @@ FormatVParams::~FormatVParams()
 int FormatVParams::handle_event()
 {
        format->set_video_options();
+       format->handle_event();
        return 1;
 }
 
@@ -714,6 +692,7 @@ FormatAudio::~FormatAudio() {}
 int FormatAudio::handle_event()
 {
        format->asset->audio_data = get_value();
+       format->handle_event();
        return 1;
 }
 
@@ -731,6 +710,7 @@ FormatVideo::~FormatVideo() {}
 int FormatVideo::handle_event()
 {
        format->asset->video_data = get_value();
+       format->handle_event();
        return 1;
 }
 
@@ -768,13 +748,14 @@ int FormatFormat::handle_event()
                                load_items(File::formattostr(format->asset->format));
                        format->update_format();
                }
+               format->handle_event();
        }
        return 1;
 }
 
 
 FormatFFMPEG::FormatFFMPEG(int x, int y, FormatTools *format)
- : FFMPEGPopup(format->plugindb, x, y)
+ : FFMPEGPopup(x, y)
 {
        this->format = format;
 }
@@ -791,69 +772,36 @@ int FormatFFMPEG::handle_event()
                format->ffmpeg_type->update(text);
                format->asset->ff_audio_options[0] = 0;
                format->asset->ff_video_options[0] = 0;
-               FFMPEG::set_asset_format(format->asset, text);
+               FFMPEG::set_asset_format(format->asset, format->mwindow->edl, text);
                format->update_extension();
                format->close_format_windows();
                format->update_format();
+               format->handle_event();
        }
        return 1;
 }
 
 
-
-
-FormatChannels::FormatChannels(int x, int y, FormatTools *format)
- : BC_TextBox(x, y, 100, 1, format->asset->channels)
-{
-       this->format = format;
-}
-
-FormatChannels::~FormatChannels()
-{
-}
-
-int FormatChannels::handle_event()
-{
-       format->asset->channels = atol(get_text());
-       return 1;
-}
-
-
-FormatToTracks::FormatToTracks(int x, int y, int *output)
- : BC_CheckBox(x, y, *output, _("Overwrite project with output"))
-{
-       this->output = output;
-}
-
-FormatToTracks::~FormatToTracks()
-{
-}
-
-int FormatToTracks::handle_event()
-{
-       *output = get_value();
-       return 1;
-}
-
-
-FormatMultiple::FormatMultiple(MWindow *mwindow, int x, int y, int *output)
+FormatFilePerLabel::FormatFilePerLabel(FormatTools *format,
+       int x, int y, int *output)
  : BC_CheckBox(x, y, *output, _("Create new file at each label"))
 {
+       this->format = format;
        this->output = output;
-       this->mwindow = mwindow;
 }
 
-FormatMultiple::~FormatMultiple()
+FormatFilePerLabel::~FormatFilePerLabel()
 {
 }
 
-int FormatMultiple::handle_event()
+int FormatFilePerLabel::handle_event()
 {
        *output = get_value();
+       format->handle_event();
        return 1;
 }
 
-void FormatMultiple::update(int *output)
+void FormatFilePerLabel::update(int *output)
 {
        this->output = output;
        set_value(*output ? 1 : 0);