From 28600526f736ffd4f104f29495a4bb36497e1ea8 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 9 Apr 2017 10:59:40 -0600 Subject: [PATCH] colorpicker cleanup, make ffmpeg probes early default --- cinelerra-5.1/cinelerra/colorpicker.C | 18 +++++++++--------- cinelerra-5.1/cinelerra/colorpicker.h | 10 +++++----- cinelerra-5.1/cinelerra/colorpicker.inc | 2 -- cinelerra-5.1/cinelerra/gwindowgui.C | 3 ++- cinelerra-5.1/cinelerra/gwindowgui.h | 2 +- cinelerra-5.1/cinelerra/indexfile.C | 15 +++++++++------ cinelerra-5.1/cinelerra/preferences.C | 2 +- cinelerra-5.1/plugins/chromakey/chromakey.C | 7 ++++++- cinelerra-5.1/plugins/chromakey/chromakey.h | 3 ++- cinelerra-5.1/plugins/chromakeyhsv/chromakey.C | 6 +++++- cinelerra-5.1/plugins/chromakeyhsv/chromakey.h | 3 ++- cinelerra-5.1/plugins/gradient/gradient.C | 10 ++++++++-- cinelerra-5.1/plugins/gradient/gradient.h | 5 +++-- .../plugins/threshold/thresholdwindow.C | 13 ++++++++++--- .../plugins/threshold/thresholdwindow.h | 7 ++++--- cinelerra-5.1/plugins/titler/titlerwindow.C | 4 ++-- cinelerra-5.1/plugins/titler/titlerwindow.h | 4 ++-- 17 files changed, 71 insertions(+), 43 deletions(-) diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index c82e728a..5c43fb93 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -39,7 +39,7 @@ #define PALETTE_DATA "palette.dat" -ColorThread::ColorThread(int do_alpha, const char *title) +ColorPicker::ColorPicker(int do_alpha, const char *title) : BC_DialogThread() { this->title = title; @@ -49,17 +49,17 @@ ColorThread::ColorThread(int do_alpha, const char *title) this->alpha = 255; } -ColorThread::~ColorThread() +ColorPicker::~ColorPicker() { close_window(); } -void ColorThread::start_window(int output, int alpha, int do_okcancel) +void ColorPicker::start_window(int output, int alpha, int do_okcancel) { if( running() ) { ColorWindow *gui = (ColorWindow *)get_gui(); if( gui ) { - gui->lock_window("ColorThread::start_window"); + gui->lock_window("ColorPicker::start_window"); gui->raise_window(1); gui->unlock_window(); } @@ -71,7 +71,7 @@ void ColorThread::start_window(int output, int alpha, int do_okcancel) start(); } -BC_Window* ColorThread::new_gui() +BC_Window* ColorPicker::new_gui() { char window_title[BCTEXTLEN]; strcpy(window_title, _(PROGRAM_NAME ": ")); @@ -92,7 +92,7 @@ BC_Window* ColorThread::new_gui() return gui; } -void ColorThread::update_gui(int output, int alpha) +void ColorPicker::update_gui(int output, int alpha) { ColorWindow *gui = (ColorWindow *)get_gui(); if( !gui ) return; @@ -104,14 +104,14 @@ void ColorThread::update_gui(int output, int alpha) gui->unlock_window(); } -int ColorThread::handle_new_color(int output, int alpha) +int ColorPicker::handle_new_color(int output, int alpha) { - printf("ColorThread::handle_new_color undefined.\n"); + printf("ColorPicker::handle_new_color undefined.\n"); return 0; } -ColorWindow::ColorWindow(ColorThread *thread, int x, int y, int w, int h, const char *title) +ColorWindow::ColorWindow(ColorPicker *thread, int x, int y, int w, int h, const char *title) : BC_Window(title, x, y, w, h, w, h, 0, 0, 1) { this->thread = thread; diff --git a/cinelerra-5.1/cinelerra/colorpicker.h b/cinelerra-5.1/cinelerra/colorpicker.h index 3170be93..0ae021ed 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.h +++ b/cinelerra-5.1/cinelerra/colorpicker.h @@ -58,11 +58,11 @@ class PaletteHex; class PaletteGrabButton; class PaletteHistory; -class ColorThread : public BC_DialogThread +class ColorPicker : public BC_DialogThread { public: - ColorThread(int do_alpha = 0, const char *title = 0); - ~ColorThread(); + ColorPicker(int do_alpha = 0, const char *title = 0); + ~ColorPicker(); void start_window(int output, int alpha, int do_okcancel=0); virtual int handle_new_color(int output, int alpha); @@ -77,7 +77,7 @@ public: class ColorWindow : public BC_Window { public: - ColorWindow(ColorThread *thread, int x, int y, int w, int h, const char *title); + ColorWindow(ColorPicker *thread, int x, int y, int w, int h, const char *title); ~ColorWindow(); void create_objects(); @@ -103,7 +103,7 @@ public: void update_rgb_hex(const char *hex); int rgb888(); - ColorThread *thread; + ColorPicker *thread; PaletteWheel *wheel; PaletteWheelValue *wheel_value; PaletteOutput *output; diff --git a/cinelerra-5.1/cinelerra/colorpicker.inc b/cinelerra-5.1/cinelerra/colorpicker.inc index e30c52b2..3442aae6 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.inc +++ b/cinelerra-5.1/cinelerra/colorpicker.inc @@ -24,6 +24,4 @@ class ColorPicker; -class ColorThread; - #endif diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 5cf353ca..d0126861 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -248,7 +248,7 @@ void GWindowColorButton::update_gui(int color) } GWindowColorThread::GWindowColorThread(GWindowColorButton *color_button) - : ColorThread(0, color_button->auto_toggle->caption) + : ColorPicker(0, color_button->auto_toggle->caption) { this->color = 0; this->color_button = color_button; @@ -415,6 +415,7 @@ int GWindowGUI::translation_event() int GWindowGUI::close_event() { + delete color_thread; color_thread = 0; hide_window(); mwindow->session->show_gwindow = 0; unlock_window(); diff --git a/cinelerra-5.1/cinelerra/gwindowgui.h b/cinelerra-5.1/cinelerra/gwindowgui.h index 35a524e8..1687e037 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.h +++ b/cinelerra-5.1/cinelerra/gwindowgui.h @@ -103,7 +103,7 @@ public: GWindowToggle *auto_toggle; }; -class GWindowColorThread : public ColorThread +class GWindowColorThread : public ColorPicker { public: GWindowColorThread(GWindowColorButton *color_button); diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index 02ecb66a..a5f12bca 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -866,16 +866,19 @@ int IndexFile::read_info(Indexable *test_indexable) // Read the file format & index state. if(test_indexable->is_asset) { - Asset asset, *test_asset = (Asset *)test_indexable; - asset.read(&xml); + Asset *test_asset = (Asset *)test_indexable; + Asset *asset = new Asset; + asset->read(&xml); + int ret = 0; //printf("IndexFile::read_info %d %f\n", __LINE__, asset->get_frame_rate()); - if( asset.format == FILE_UNKNOWN || - test_asset->format != asset.format ) - { + if( asset->format == FILE_UNKNOWN || + test_asset->format != asset->format ) { if(debug) printf("IndexFile::read_info %d\n", __LINE__); - return 1; + ret = 1; } + asset->remove_user(); + if( ret ) return ret; } else { diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 4b7a92ae..f93a4ba9 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -77,7 +77,7 @@ Preferences::Preferences() renderfarm_job_count = 20; project_smp = processors = calculate_processors(0); real_processors = calculate_processors(1); - ffmpeg_early_probe = 0; + ffmpeg_early_probe = 1; ffmpeg_marker_indexes = 1; warn_indexes = 1; warn_version = 1; diff --git a/cinelerra-5.1/plugins/chromakey/chromakey.C b/cinelerra-5.1/plugins/chromakey/chromakey.C index 8618d03b..9d1926fc 100644 --- a/cinelerra-5.1/plugins/chromakey/chromakey.C +++ b/cinelerra-5.1/plugins/chromakey/chromakey.C @@ -169,6 +169,11 @@ void ChromaKeyWindow::update_sample() sample->flash(); } +void ChromaKeyWindow::done_event(int result) +{ + color_thread->close_window(); +} + @@ -279,7 +284,7 @@ int ChromaKeyUseColorPicker::handle_event() ChromaKeyColorThread::ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui) - : ColorThread(1, _("Inner color")) + : ColorPicker(1, _("Inner color")) { this->plugin = plugin; this->gui = gui; diff --git a/cinelerra-5.1/plugins/chromakey/chromakey.h b/cinelerra-5.1/plugins/chromakey/chromakey.h index cefa8d9d..8e1a1aaf 100644 --- a/cinelerra-5.1/plugins/chromakey/chromakey.h +++ b/cinelerra-5.1/plugins/chromakey/chromakey.h @@ -103,7 +103,7 @@ public: }; -class ChromaKeyColorThread : public ColorThread +class ChromaKeyColorThread : public ColorPicker { public: ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui); @@ -121,6 +121,7 @@ public: void create_objects(); void update_sample(); + void done_event(int result); ChromaKeyColor *color; ChromaKeyThreshold *threshold; diff --git a/cinelerra-5.1/plugins/chromakeyhsv/chromakey.C b/cinelerra-5.1/plugins/chromakeyhsv/chromakey.C index 0636a981..39ff594e 100644 --- a/cinelerra-5.1/plugins/chromakeyhsv/chromakey.C +++ b/cinelerra-5.1/plugins/chromakeyhsv/chromakey.C @@ -287,6 +287,10 @@ ChromaKeyWindow::update_sample () sample->flash (); } +void ChromaKeyWindow::done_event(int result) +{ + color_thread->close_window(); +} ChromaKeyColor::ChromaKeyColor (ChromaKeyHSV * plugin, @@ -525,7 +529,7 @@ ChromaKeySpillAmount::handle_event () ChromaKeyColorThread::ChromaKeyColorThread (ChromaKeyHSV * plugin, ChromaKeyWindow * gui) - : ColorThread (1, _("Inner color")) + : ColorPicker (1, _("Inner color")) { this->plugin = plugin; this->gui = gui; diff --git a/cinelerra-5.1/plugins/chromakeyhsv/chromakey.h b/cinelerra-5.1/plugins/chromakeyhsv/chromakey.h index d8007109..68fd8b3b 100644 --- a/cinelerra-5.1/plugins/chromakeyhsv/chromakey.h +++ b/cinelerra-5.1/plugins/chromakeyhsv/chromakey.h @@ -182,7 +182,7 @@ public: }; -class ChromaKeyColorThread : public ColorThread +class ChromaKeyColorThread : public ColorPicker { public: ChromaKeyColorThread(ChromaKeyHSV *plugin, ChromaKeyWindow *gui); @@ -209,6 +209,7 @@ public: void create_objects(); void update_sample(); + void done_event(int result); ChromaKeyColor *color; ChromaKeyUseColorPicker *use_colorpicker; diff --git a/cinelerra-5.1/plugins/gradient/gradient.C b/cinelerra-5.1/plugins/gradient/gradient.C index a7d7828e..bea77b22 100644 --- a/cinelerra-5.1/plugins/gradient/gradient.C +++ b/cinelerra-5.1/plugins/gradient/gradient.C @@ -317,6 +317,12 @@ void GradientWindow::update_out_color() flash(out_color_x, out_color_y, COLOR_W, COLOR_H); } +void GradientWindow::done_event(int result) +{ + in_color_thread->close_window(); + out_color_thread->close_window(); +} + @@ -534,7 +540,7 @@ int GradientOutColorButton::handle_event() GradientInColorThread::GradientInColorThread(GradientMain *plugin, GradientWindow *window) - : ColorThread(1, _("Inner color")) + : ColorPicker(1, _("Inner color")) { this->plugin = plugin; this->window = window; @@ -569,7 +575,7 @@ int GradientInColorThread::handle_new_color(int output, int alpha) GradientOutColorThread::GradientOutColorThread(GradientMain *plugin, GradientWindow *window) - : ColorThread(1, _("Outer color")) + : ColorPicker(1, _("Outer color")) { this->plugin = plugin; this->window = window; diff --git a/cinelerra-5.1/plugins/gradient/gradient.h b/cinelerra-5.1/plugins/gradient/gradient.h index 715b5b52..736e975a 100644 --- a/cinelerra-5.1/plugins/gradient/gradient.h +++ b/cinelerra-5.1/plugins/gradient/gradient.h @@ -171,7 +171,7 @@ public: }; -class GradientInColorThread : public ColorThread +class GradientInColorThread : public ColorPicker { public: GradientInColorThread(GradientMain *plugin, GradientWindow *window); @@ -181,7 +181,7 @@ public: }; -class GradientOutColorThread : public ColorThread +class GradientOutColorThread : public ColorPicker { public: GradientOutColorThread(GradientMain *plugin, GradientWindow *window); @@ -202,6 +202,7 @@ public: void update_in_color(); void update_out_color(); void update_shape(); + void done_event(int result); GradientMain *plugin; BC_Title *angle_title; diff --git a/cinelerra-5.1/plugins/threshold/thresholdwindow.C b/cinelerra-5.1/plugins/threshold/thresholdwindow.C index f5706b05..7a22ba33 100644 --- a/cinelerra-5.1/plugins/threshold/thresholdwindow.C +++ b/cinelerra-5.1/plugins/threshold/thresholdwindow.C @@ -367,7 +367,7 @@ int ThresholdHighColorButton::handle_event() ThresholdLowColorThread::ThresholdLowColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("Low color")) + : ColorPicker(1, _("Low color")) { this->plugin = plugin; this->window = window; @@ -387,7 +387,7 @@ int ThresholdLowColorThread::handle_new_color(int output, int alpha) ThresholdMidColorThread::ThresholdMidColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("Mid color")) + : ColorPicker(1, _("Mid color")) { this->plugin = plugin; this->window = window; @@ -407,7 +407,7 @@ int ThresholdMidColorThread::handle_new_color(int output, int alpha) ThresholdHighColorThread::ThresholdHighColorThread(ThresholdMain *plugin, ThresholdWindow *window) - : ColorThread(1, _("High color")) + : ColorPicker(1, _("High color")) { this->plugin = plugin; this->window = window; @@ -537,5 +537,12 @@ void ThresholdWindow::update_high_color() flash(high_color_x, high_color_y, COLOR_W, COLOR_H); } +void ThresholdWindow::done_event(int result) +{ + low_color_thread->close_window(); + mid_color_thread->close_window(); + high_color_thread->close_window(); +} + diff --git a/cinelerra-5.1/plugins/threshold/thresholdwindow.h b/cinelerra-5.1/plugins/threshold/thresholdwindow.h index ff843974..8c9f3dd8 100644 --- a/cinelerra-5.1/plugins/threshold/thresholdwindow.h +++ b/cinelerra-5.1/plugins/threshold/thresholdwindow.h @@ -91,7 +91,7 @@ public: ThresholdWindow *window; }; -class ThresholdLowColorThread : public ColorThread +class ThresholdLowColorThread : public ColorPicker { public: ThresholdLowColorThread(ThresholdMain *plugin, ThresholdWindow *window); @@ -100,7 +100,7 @@ public: ThresholdWindow *window; }; -class ThresholdMidColorThread : public ColorThread +class ThresholdMidColorThread : public ColorPicker { public: ThresholdMidColorThread(ThresholdMain *plugin, ThresholdWindow *window); @@ -109,7 +109,7 @@ public: ThresholdWindow *window; }; -class ThresholdHighColorThread : public ColorThread +class ThresholdHighColorThread : public ColorPicker { public: ThresholdHighColorThread(ThresholdMain *plugin, ThresholdWindow *window); @@ -155,6 +155,7 @@ public: void update_low_color(); void update_mid_color(); void update_high_color(); + void done_event(int result); ThresholdMain *plugin; ThresholdMin *min; diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index e2e1f972..66fb01db 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -1268,7 +1268,7 @@ int TitleBottom::handle_event() TitleColorThread::TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline) - : ColorThread(1, is_outline? _("Outline Color") : _("Text Color")) + : ColorPicker(1, is_outline? _("Outline Color") : _("Text Color")) { this->client = client; this->window = window; @@ -1542,7 +1542,7 @@ int TitleFontsPopup::handle_event() } TitleColorPopup::TitleColorPopup(TitleMain *client, TitleWindow *window) - : ColorThread(0, _("Color")) + : ColorPicker(0, _("Color")) { this->client = client; this->window = window; diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.h b/cinelerra-5.1/plugins/titler/titlerwindow.h index 2be28d18..1088aa81 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.h +++ b/cinelerra-5.1/plugins/titler/titlerwindow.h @@ -468,7 +468,7 @@ public: TitleMain *client; TitleWindow *window; }; -class TitleColorThread : public ColorThread +class TitleColorThread : public ColorPicker { public: TitleColorThread(TitleMain *client, TitleWindow *window, int is_outline); @@ -567,7 +567,7 @@ public: TitleWindow *window; }; -class TitleColorPopup : public ColorThread +class TitleColorPopup : public ColorPicker { public: TitleColorPopup(TitleMain *client, TitleWindow *window); -- 2.26.2