From: Good Guy Date: Mon, 6 Feb 2017 00:00:22 +0000 (-0700) Subject: format tools ffmpeg quality/bitrate fixes, preset fix, align edits X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=c66c09b32c6f46ef67550a6c63ba7f9d1d46628d;p=goodguy%2Fhistory.git format tools ffmpeg quality/bitrate fixes, preset fix, align edits --- diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index 3133649b..d8db797b 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -88,7 +88,7 @@ int Asset::init_values() ff_video_options[0] = 0; ff_audio_bitrate = 0; ff_video_bitrate = 0; - ff_video_quality = 0; + ff_video_quality = -1; jpeg_quality = 80; aspect_ratio = -1; diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index 02386bd0..cc0fbc8c 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -321,7 +321,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char strncpy(cp, opts, sizeof(asset->ff_video_options)-len); } asset->ff_video_bitrate = vid_bitrate; - asset->ff_video_quality = 0; + asset->ff_video_quality = -1; job = new BatchRenderJob(mwindow->preferences); jobs->append(job); diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index 9fbee552..98281659 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -314,7 +314,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const ch FFMPEG::load_options(option_path, asset->ff_video_options, sizeof(asset->ff_video_options)); asset->ff_video_bitrate = vid_bitrate; - asset->ff_video_quality = 0; + asset->ff_video_quality = -1; } else { sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir); diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index f3f9dcc4..69b8a9dd 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -1837,7 +1837,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec) sprintf(arg, "%d", asset->ff_video_bitrate); av_dict_set(&sopts, "b", arg, 0); } - else if( asset->ff_video_quality > 0 ) { + else if( asset->ff_video_quality >= 0 ) { ctx->global_quality = asset->ff_video_quality * FF_QP2LAMBDA; ctx->qmin = ctx->qmax = asset->ff_video_quality; ctx->mb_lmin = ctx->qmin * FF_QP2LAMBDA; diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index 6c360da3..d4f89e6c 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -40,8 +40,7 @@ FileFFMPEG::~FileFFMPEG() FFMpegConfigNum::FFMpegConfigNum(BC_Window *window, int x, int y, char *title_text, int *output) - : BC_TumbleTextBox(window, (int64_t)*output, - (int64_t)-1, (int64_t)25000000, 100, y, 100) + : BC_TumbleTextBox(window, *output, -1, INT_MAX, 100, y, 100) { this->window = window; this->x = x; this->y = y; @@ -63,19 +62,19 @@ int FFMpegConfigNum::update_param(const char *param, const char *opts) { char value[BCTEXTLEN]; if( !FileFFMPEG::get_ff_option(param, opts, value) ) { - if( (*output = atol(value)) < 0 ) { + if( (*output = atoi(value)) < 0 ) { disable(1); return 0; } - BC_TumbleTextBox::update(value); } + BC_TumbleTextBox::update((int64_t)*output); enable(); return 1; } int FFMpegConfigNum::handle_event() { - *output = atol(get_text()); + *output = atoi(get_text()); return 1; } @@ -101,9 +100,9 @@ int FFMpegVideoBitrate::handle_event() { int ret = FFMpegVideoNum::handle_event(); Asset *asset = window()->asset; - if( asset->ff_video_bitrate ) + if( asset->ff_video_bitrate > 0 ) window()->quality->disable(); - else + else if( !window()->quality->get_textbox()->is_hidden() ) window()->quality->enable(); return ret; } @@ -112,9 +111,9 @@ int FFMpegVideoQuality::handle_event() { int ret = FFMpegVideoNum::handle_event(); Asset *asset = window()->asset; - if( asset->ff_video_quality ) + if( asset->ff_video_quality >= 0 ) window()->bitrate->disable(); - else + else if( !window()->bitrate->get_textbox()->is_hidden() ) window()->bitrate->enable(); return ret; } @@ -450,6 +449,7 @@ void FFMPEGConfigAudio::create_objects() bitrate = new FFMpegAudioBitrate(this, x, y, _("Bitrate:"), &asset->ff_audio_bitrate); bitrate->create_objects(); bitrate->set_increment(1000); + bitrate->set_boundaries((int64_t)0, (int64_t)INT_MAX); y += bitrate->get_h() + 10; BC_Title *title = new BC_Title(x, y, _("Audio Options:")); @@ -471,11 +471,10 @@ void FFMPEGConfigAudio::create_objects() audio_options->create_objects(); add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this)); + show_window(1); bitrate->update_param("cin_bitrate", asset->ff_audio_options); - show_window(1); - bitrate->handle_event(); unlock_window(); } @@ -503,6 +502,7 @@ int FFMPEGConfigAudioPopup::handle_event() { strcpy(popup->asset->acodec, get_text()); Asset *asset = popup->asset; + asset->ff_audio_bitrate = 0; char option_path[BCTEXTLEN]; FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec); FFMPEG::load_options(option_path, asset->ff_audio_options, @@ -589,20 +589,20 @@ void FFMPEGConfigVideo::create_objects() preset_popup = new FFMPEGConfigVideoPopup(this, x, y); preset_popup->create_objects(); - if( asset->ff_video_bitrate && asset->ff_video_quality ) { - asset->ff_video_bitrate = 0; - asset->ff_video_quality = 0; + if( asset->ff_video_bitrate > 0 && asset->ff_video_quality >= 0 ) { + asset->ff_video_bitrate = 0; asset->ff_video_quality = -1; } y += 50; bitrate = new FFMpegVideoBitrate(this, x, y, _("Bitrate:"), &asset->ff_video_bitrate); bitrate->create_objects(); bitrate->set_increment(100000); + bitrate->set_boundaries((int64_t)0, (int64_t)INT_MAX); y += bitrate->get_h() + 5; quality = new FFMpegVideoQuality(this, x, y, _("Quality:"), &asset->ff_video_quality); quality->create_objects(); quality->set_increment(1); - quality->set_boundaries((int64_t)0, (int64_t)31); + quality->set_boundaries((int64_t)-1, (int64_t)51); y += quality->get_h() + 10; BC_Title *title = new BC_Title(x, y, _("Video Options:")); @@ -624,15 +624,13 @@ void FFMPEGConfigVideo::create_objects() video_options->create_objects(); add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this)); + show_window(1); bitrate->update_param("cin_bitrate", asset->ff_video_options); quality->update_param("cin_quality", asset->ff_video_options); - show_window(1); - if( asset->ff_video_bitrate ) - quality->disable(); - if( asset->ff_video_quality ) - bitrate->disable(); + if( asset->ff_video_bitrate > 0 ) quality->disable(); + else if( asset->ff_video_quality >= 0 ) bitrate->disable(); unlock_window(); } @@ -661,6 +659,7 @@ int FFMPEGConfigVideoPopup::handle_event() strcpy(popup->asset->vcodec, get_text()); Asset *asset = popup->asset; char option_path[BCTEXTLEN]; + asset->ff_video_bitrate = 0; asset->ff_video_quality = -1; FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec); FFMPEG::load_options(option_path, asset->ff_video_options, sizeof(asset->ff_video_options)); diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index d3d5ca29..4f6580d4 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -166,7 +166,7 @@ void FormatTools::create_objects(int &init_x, path_textbox, 10, px, y, 300, 100); window->add_subwindow(path_recent); path_recent->load_items(File::formattostr(asset->format)); - px += path_recent->get_w() + 8; + px += path_recent->get_w(); window->add_subwindow(path_button = new BrowseButton( mwindow->theme, window, path_textbox, px, y, asset->path, _("Output to file"), _("Select a file to write to:"), 0)); diff --git a/cinelerra-5.1/cinelerra/keyframegui.C b/cinelerra-5.1/cinelerra/keyframegui.C index 51f73310..197ceed9 100644 --- a/cinelerra-5.1/cinelerra/keyframegui.C +++ b/cinelerra-5.1/cinelerra/keyframegui.C @@ -108,7 +108,7 @@ void KeyFrameThread::update_values() keyframe_data[1].append(new BC_ListBoxItem(hash.get_value(i))); } keyframe_data[0].append(new BC_ListBoxItem((char*)_("TEXT"))); - keyframe_data[1].append(new BC_ListBoxItem(text)); + keyframe_data[1].append(new BC_ListBoxItem(text ? text : "")); delete [] text; delete [] extra; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 9f596c26..b7f25ca6 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -4674,7 +4674,8 @@ int TrackCanvas::button_press_event() activate(); } - if( get_buttonpress() == LEFT_BUTTON ) { + if( get_buttonpress() == LEFT_BUTTON && + gui->mbuttons->transport->engine->command->command != STOP ) { gui->unlock_window(); gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); gui->lock_window("TrackCanvas::button_press_event"); @@ -4817,7 +4818,7 @@ int TrackCanvas::button_press_event() int TrackCanvas::start_selection(double position) { int rerender = 0; - position = mwindow->edl->align_to_frame(position, 0); + position = mwindow->edl->align_to_frame(position, 1); // Extend a border diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 7d52d98c..0fae1250 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -625,11 +625,9 @@ void BC_FileBox::create_objects() add_subwindow(recent_popup = new BC_FileBoxRecent(this, x, y)); add_subwindow(directory_title = new BC_FileBoxDirectoryText(x, y, this)); - directory_title->reposition_window(x, y, - get_w() - recent_popup->get_w() - 20, 1); - recent_popup->reposition_window( - x + directory_title->get_w(), y, - directory_title->get_w(), 200); + directory_title->reposition_window(x, y, get_w() - recent_popup->get_w() - 20, 1); + x += directory_title->get_w() + 8; + recent_popup->reposition_window(x, y, directory_title->get_w(), 200); x = 10; y += directory_title->get_h() + 5; @@ -738,7 +736,7 @@ int BC_FileBox::resize_event(int w, int h) get_w() - recent_popup->get_w() - 20, 1); recent_popup->reposition_window( - directory_title->get_x() + directory_title->get_w(), + directory_title->get_x() + directory_title->get_w() + 8, directory_title->get_y(), directory_title->get_w() + recent_popup->get_w(), recent_popup->get_h()); diff --git a/cinelerra-5.1/guicast/bctextbox.C b/cinelerra-5.1/guicast/bctextbox.C index cac049a2..f1d8f596 100644 --- a/cinelerra-5.1/guicast/bctextbox.C +++ b/cinelerra-5.1/guicast/bctextbox.C @@ -772,8 +772,9 @@ int BC_TextBox::cursor_leave_event() if(highlighted) { highlighted = 0; - draw_border(); hide_tooltip(); + draw_border(); + flash(1); } if( !suggestions_popup ) deactivate(); @@ -2523,22 +2524,14 @@ void BC_PopupTextBox::reposition_window(int x, int y) BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup, - int64_t default_value, - int64_t min, - int64_t max, - int x, - int y) + int64_t default_value, int x, int y) : BC_TextBox(x, y, popup->text_w, 1, default_value) { this->popup = popup; } BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup, - float default_value, - float min, - float max, - int x, - int y) + float default_value, int x, int y) : BC_TextBox(x, y, popup->text_w, 1, default_value) { this->popup = popup; @@ -2694,20 +2687,12 @@ int BC_TumbleTextBox::create_objects() if(use_float) { parent_window->add_subwindow(textbox = new BC_TumbleTextBoxText(this, - default_value_f, - min_f, - max_f, - x, - y)); + default_value_f, x, y)); textbox->set_precision(precision); } else parent_window->add_subwindow(textbox = new BC_TumbleTextBoxText(this, - default_value, - min, - max, - x, - y)); + default_value, x, y)); x += textbox->get_w(); diff --git a/cinelerra-5.1/guicast/bctextbox.h b/cinelerra-5.1/guicast/bctextbox.h index 7b07ded1..56514cad 100644 --- a/cinelerra-5.1/guicast/bctextbox.h +++ b/cinelerra-5.1/guicast/bctextbox.h @@ -423,19 +423,8 @@ private: class BC_TumbleTextBoxText : public BC_TextBox { public: - BC_TumbleTextBoxText(BC_TumbleTextBox *popup, - int64_t default_value, - int64_t min, - int64_t max, - int x, - int y); - BC_TumbleTextBoxText(BC_TumbleTextBox *popup, - float default_value, - float min, - float max, - int x, - int y); - BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int x, int y); + BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int64_t default_value, int x, int y); + BC_TumbleTextBoxText(BC_TumbleTextBox *popup, float default_value, int x, int y); virtual ~BC_TumbleTextBoxText(); int handle_event(); int button_press_event();