format tools ffmpeg quality/bitrate fixes, preset fix, align edits
authorGood Guy <good1.2guy@gmail.com>
Mon, 6 Feb 2017 00:00:22 +0000 (17:00 -0700)
committerGood Guy <good1.2guy@gmail.com>
Mon, 6 Feb 2017 00:00:22 +0000 (17:00 -0700)
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/bdcreate.C
cinelerra-5.1/cinelerra/dvdcreate.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/fileffmpeg.C
cinelerra-5.1/cinelerra/formattools.C
cinelerra-5.1/cinelerra/keyframegui.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/guicast/bctextbox.C
cinelerra-5.1/guicast/bctextbox.h

index 3133649b9ae161077c3b1afdb49e8327452c9213..d8db797b916d868632f89290e8e7b0ca7ae91108 100644 (file)
@@ -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;
index 02386bd05ca28da2950689d2af8c78b999fca0a5..cc0fbc8cf51375dc2c57bb8535840e0f4d2adacf 100644 (file)
@@ -321,7 +321,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *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);
index 9fbee552f0fa25f13957fe0ec085edc7b17fa5a5..9828165941db009393dd0cbe195077ac8716fedd 100644 (file)
@@ -314,7 +314,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *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);
index f3f9dcc4cff4a4cd5cb86a8d78d0206475788c7a..69b8a9dd86bb4801c5929069f07a3f2d4e023c61 100644 (file)
@@ -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;
index 6c360da35bd2e8bd0ba50852c96660c24ede04a9..d4f89e6c47795c4fef2feab4f7b6efb46ae25d3d 100644 (file)
@@ -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));
index d3d5ca29e6ec0fae5e83a8225a81310f1ad68c16..4f6580d4fa21628ed578a7059e2f343ebf932462 100644 (file)
@@ -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));
index 51f73310618818e4a1964723140e8a50958ac43e..197ceed992bfdf08d4c3b941084a92a8bbdf395a 100644 (file)
@@ -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;
index 9f596c26ae7c2cf91457bf561118b902fe72ebfd..b7f25ca69d4c47495a8b83d0440c6df75de665a8 100644 (file)
@@ -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
index 7d52d98c9e56250266cae06a4104132f17b3597e..0fae125014cba9c23d97c15c8e9d6c3c621e4028 100644 (file)
@@ -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());
index cac049a27807845676cf276a30267424b3b5477a..f1d8f596f486aa590193b034781724ffd76022df 100644 (file)
@@ -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();
 
index 7b07ded12e1ebbabca9eaffcb4fb63e64ffbbc4a..56514cad4e6c6df0d3df9402f86531081f62e33c 100644 (file)
@@ -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();