X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fformattools.C;h=312f39c8bb218776556fb6584ec28f4c883855ec;hp=e8cbef4e8c38dda4260a54980cc799cb861bbe6b;hb=a19a685a46ddc630010788707d9e5b9d2342af46;hpb=90dc26fd7a112ed473878b876f2ed671e2bad8f8 diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index e8cbef4e..312f39c8 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -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; @@ -76,7 +74,7 @@ FormatTools::FormatTools(MWindow *mwindow, prompt_audio_channels = 0; prompt_video = 0; prompt_video_compression = 0; - strategy = 0; + file_per_label = 0; locked_compressor = 0; video_driver = 0; } @@ -100,26 +98,24 @@ SET_TRACE SET_TRACE if(vparams_thread) delete vparams_thread; SET_TRACE - if(channels_tumbler) delete channels_tumbler; -} - -void FormatTools::create_objects(int &init_x, - int &init_y, - int do_audio, // Include support for audio - int do_video, // Include support for video - int prompt_audio, // Include checkbox for audio - int prompt_video, - int prompt_audio_channels, - int prompt_video_compression, - const char *locked_compressor, - int recording, - int *strategy, - int brender, - int horizontal_layout) +} + +void FormatTools::create_objects( + int &init_x, int &init_y, + int do_audio, int do_video, // Include support for audio, video + int prompt_audio, int prompt_video, // Include checkbox for audio, video + int prompt_audio_channels, + int prompt_video_compression, + const char *locked_compressor, + int recording, + int *file_per_label, + int brender, + int horizontal_layout) { int x = init_x; int y = init_y; int ylev = init_y; + int margin = mwindow->theme->widget_border; this->locked_compressor = locked_compressor; this->recording = recording; @@ -130,31 +126,10 @@ void FormatTools::create_objects(int &init_x, this->prompt_audio_channels = prompt_audio_channels; this->prompt_video = prompt_video; this->prompt_video_compression = prompt_video_compression; - this->strategy = strategy; + this->file_per_label = file_per_label; //printf("FormatTools::create_objects 1\n"); -// Modify strategy depending on render farm - if(strategy) - { - if(mwindow->preferences->use_renderfarm) - { - if(*strategy == FILE_PER_LABEL) - *strategy = FILE_PER_LABEL_FARM; - else - if(*strategy == SINGLE_PASS) - *strategy = SINGLE_PASS_FARM; - } - else - { - if(*strategy == FILE_PER_LABEL_FARM) - *strategy = FILE_PER_LABEL; - else - if(*strategy == SINGLE_PASS_FARM) - *strategy = SINGLE_PASS; - } - } - if(!recording) { int px = x; @@ -181,76 +156,60 @@ void FormatTools::create_objects(int &init_x, x = init_x; window->add_subwindow(format_title = new BC_Title(x, y, _("File Format:"))); - x += 90; + x += format_title->get_w() + margin; window->add_subwindow(format_text = new BC_TextBox(x, y, 160, 1, File::formattostr(asset->format))); - x += format_text->get_w(); + x += format_text->get_w() + margin; //printf("FormatTools::create_objects %d %p\n", __LINE__, window); window->add_subwindow(format_button = new FormatFormat(x, y, this)); format_button->create_objects(); x += format_button->get_w() + 5; - window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 64, 1, asset->fformat)); - FFMPEG::set_asset_format(asset, asset->fformat); + window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 70, 1, 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(); x = init_x; y += format_button->get_h() + 10; - if(do_audio) - { - window->add_subwindow(audio_title = new BC_Title(x, y, _("Audio:"), LARGEFONT, BC_WindowBase::get_resources()->audiovideo_color)); - x += 80; + if( do_audio ) { + window->add_subwindow(audio_title = new BC_Title(x, y, _("Audio:"), LARGEFONT, + BC_WindowBase::get_resources()->audiovideo_color)); + x += audio_title->get_w() + margin; window->add_subwindow(aparams_button = new FormatAParams(mwindow, this, x, y)); - x += aparams_button->get_w() + 10; - if(prompt_audio) - { + x += aparams_button->get_w() + margin; + if(prompt_audio) { window->add_subwindow(audio_switch = new FormatAudio(x, y, this, asset->audio_data)); } x = init_x; 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); } //printf("FormatTools::create_objects 7\n"); - if(do_video) - { - if(horizontal_layout && do_audio){ + if( do_video ) { + if( horizontal_layout && do_audio ) { x += 370; y = ylev; } //printf("FormatTools::create_objects 8\n"); - window->add_subwindow(video_title = new BC_Title(x, y, _("Video:"), LARGEFONT, BC_WindowBase::get_resources()->audiovideo_color)); - x += 80; - if(prompt_video_compression) - { + window->add_subwindow(video_title = new BC_Title(x, y, _("Video:"), LARGEFONT, + BC_WindowBase::get_resources()->audiovideo_color)); + x += video_title->get_w() + margin; + if(prompt_video_compression) { window->add_subwindow(vparams_button = new FormatVParams(mwindow, this, x, y)); - x += vparams_button->get_w() + 10; + x += vparams_button->get_w() + margin; } //printf("FormatTools::create_objects 9\n"); - if(prompt_video) - { + if(prompt_video) { window->add_subwindow(video_switch = new FormatVideo(x, y, this, asset->video_data)); y += video_switch->get_h(); } - else - { + else { y += vparams_button->get_h(); } @@ -262,10 +221,10 @@ void FormatTools::create_objects(int &init_x, //printf("FormatTools::create_objects 11\n"); x = init_x; - if(strategy) - { - window->add_subwindow(multiple_files = new FormatMultiple(mwindow, x, y, strategy)); - y += multiple_files->get_h() + 10; + if( file_per_label ) { + 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"); @@ -303,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; @@ -444,19 +404,14 @@ void FormatTools::update_extension() } } -void FormatTools::update(Asset *asset, int *strategy) +void FormatTools::update(Asset *asset, int *file_per_label) { this->asset = asset; - this->strategy = strategy; - - if(path_textbox) - path_textbox->update(asset->path); + this->file_per_label = 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(); - if(strategy) - { - multiple_files->update(strategy); - } close_format_windows(); } @@ -521,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; - } } @@ -558,10 +503,9 @@ void FormatTools::reposition_window(int &init_x, int &init_y) x = init_x; } - if(strategy) - { - multiple_files->reposition_window(x, y); - y += multiple_files->get_h() + 10; + if( file_per_label ) { + labeled_files->reposition_window(x, y); + y += labeled_files->get_h() + 10; } init_y = y; @@ -623,6 +567,7 @@ FormatAParams::~FormatAParams() int FormatAParams::handle_event() { format->set_audio_options(); + format->handle_event(); return 1; } @@ -644,6 +589,7 @@ FormatVParams::~FormatVParams() int FormatVParams::handle_event() { format->set_video_options(); + format->handle_event(); return 1; } @@ -746,6 +692,7 @@ FormatAudio::~FormatAudio() {} int FormatAudio::handle_event() { format->asset->audio_data = get_value(); + format->handle_event(); return 1; } @@ -763,6 +710,7 @@ FormatVideo::~FormatVideo() {} int FormatVideo::handle_event() { format->asset->video_data = get_value(); + format->handle_event(); return 1; } @@ -770,7 +718,7 @@ int FormatVideo::handle_event() FormatFormat::FormatFormat(int x, int y, FormatTools *format) - : FormatPopup(format->plugindb, x, y, format->use_brender) + : FormatPopup(x, y, format->do_audio, format->do_video, format->use_brender) { this->format = format; } @@ -800,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; } @@ -823,92 +772,39 @@ 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")) +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; } -FormatToTracks::~FormatToTracks() +FormatFilePerLabel::~FormatFilePerLabel() { } -int FormatToTracks::handle_event() +int FormatFilePerLabel::handle_event() { *output = get_value(); + format->handle_event(); return 1; } - -FormatMultiple::FormatMultiple(MWindow *mwindow, int x, int y, int *output) - : BC_CheckBox(x, - y, - (*output == FILE_PER_LABEL) || (*output == FILE_PER_LABEL_FARM), - _("Create new file at each label")) -{ - this->output = output; - this->mwindow = mwindow; -} - -FormatMultiple::~FormatMultiple() -{ -} - -int FormatMultiple::handle_event() -{ - if(get_value()) - { - if(mwindow->preferences->use_renderfarm) - *output = FILE_PER_LABEL_FARM; - else - *output = FILE_PER_LABEL; - } - else - { - if(mwindow->preferences->use_renderfarm) - *output = SINGLE_PASS_FARM; - else - *output = SINGLE_PASS; - } - return 1; -} - -void FormatMultiple::update(int *output) +void FormatFilePerLabel::update(int *output) { this->output = output; - if(*output == FILE_PER_LABEL_FARM || - *output ==FILE_PER_LABEL) - set_value(1); - else - set_value(0); + set_value(*output ? 1 : 0); }