From: Good Guy Date: Thu, 3 Sep 2020 01:16:24 +0000 (-0600) Subject: add ids to auto/labels, fix awdw gui deadlock, fix fourier bfr bug, fix cache critica... X-Git-Tag: 2020-09~15 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=22c6251d37911a11e322bf7518e6a992ea0bb6c7;p=goodguy%2Fcinelerra.git add ids to auto/labels, fix awdw gui deadlock, fix fourier bfr bug, fix cache critical section, rework normalize_speed, fix delete_track gang bug --- diff --git a/cinelerra-5.1/cinelerra/auto.C b/cinelerra-5.1/cinelerra/auto.C index 4171fa83..03d4aa01 100644 --- a/cinelerra-5.1/cinelerra/auto.C +++ b/cinelerra-5.1/cinelerra/auto.C @@ -21,6 +21,7 @@ #include "auto.h" #include "autos.h" +#include "edl.h" #include "filexml.h" Auto::Auto() @@ -29,10 +30,11 @@ Auto::Auto() this->edl = 0; this->autos = 0; position = 0; - skip = 0; WIDTH = xS(10); HEIGHT = yS(10); is_default = 0; + id = EDL::next_id(); + orig_id = id; } Auto::Auto(EDL *edl, Autos *autos) @@ -41,10 +43,11 @@ Auto::Auto(EDL *edl, Autos *autos) this->edl = edl; this->autos = autos; position = 0; - skip = 0; WIDTH = xS(10); HEIGHT = yS(10); is_default = 0; + id = EDL::next_id(); + orig_id = id; } Auto& Auto::operator=(Auto& that) @@ -66,6 +69,7 @@ void Auto::copy(int64_t start, int64_t end, FileXML *file, int default_only) void Auto::copy_from(Auto *that) { + this->orig_id = orig_id; this->position = that->position; } diff --git a/cinelerra-5.1/cinelerra/auto.h b/cinelerra-5.1/cinelerra/auto.h index f91451ef..63309524 100644 --- a/cinelerra-5.1/cinelerra/auto.h +++ b/cinelerra-5.1/cinelerra/auto.h @@ -57,10 +57,9 @@ public: virtual void get_caption(char *string) {}; - - int skip; // if added by selection event for moves EDL *edl; Autos *autos; + int id, orig_id; int WIDTH, HEIGHT; // Units native to the track int is_default; diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index a2914d82..a48afbb5 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -274,6 +274,12 @@ Auto* Autos::get_auto_at_position(double position) return 0; } +Auto* Autos::get_auto(int id) +{ + Auto *current = first; + while( current && current->orig_id != id ) current = NEXT; + return current; +} Auto* Autos::get_auto_for_editing(double position, int create) { diff --git a/cinelerra-5.1/cinelerra/autos.h b/cinelerra-5.1/cinelerra/autos.h index ee53f63a..dcb997d8 100644 --- a/cinelerra-5.1/cinelerra/autos.h +++ b/cinelerra-5.1/cinelerra/autos.h @@ -61,6 +61,7 @@ public: int auto_exists_for_editing(double position); // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames Auto* get_auto_at_position(double position = -1); + Auto* get_auto(int id); // Get keyframe for editing with creation // create: <0: always new keyframe, =0: no new keyframe, >0: auto keyframe diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 4688e7bc..c9a9a898 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -945,6 +945,11 @@ void AssetPicon::create_objects() if( asset->video_data ) { if( mwindow->preferences->use_thumbnails ) { gui->unlock_window(); + char string[BCTEXTLEN]; + sprintf(string, _("Reading %s"), name); + mwindow->gui->lock_window("AssetPicon::create_objects"); + mwindow->gui->show_message(string); + mwindow->gui->unlock_window(); File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1); @@ -968,11 +973,6 @@ void AssetPicon::create_objects() asset->width, asset->height, BC_RGB888, -1); } - { char string[BCTEXTLEN]; - sprintf(string, _("Reading %s"), name); - mwindow->gui->lock_window("AssetPicon::create_objects"); - mwindow->gui->show_message(string); - mwindow->gui->unlock_window(); } file->read_frame(gui->temp_picon); mwindow->video_cache->check_in(asset); diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index cec86c84..71dd3b18 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -560,6 +560,13 @@ Edit* Edits::editof(int64_t position, int direction, int use_nudge) return 0; // return 0 on failure } +Edit* Edits::get_edit(int id) +{ + Edit *current = first; + while( current && current->orig_id != id ) current = NEXT; + return current; +} + Edit* Edits::get_playable_edit(int64_t position, int use_nudge) { Edit *current; diff --git a/cinelerra-5.1/cinelerra/edits.h b/cinelerra-5.1/cinelerra/edits.h index bd73e4e7..5550cb55 100644 --- a/cinelerra-5.1/cinelerra/edits.h +++ b/cinelerra-5.1/cinelerra/edits.h @@ -109,6 +109,7 @@ public: // ==================================== accounting Edit* editof(int64_t position, int direction, int use_nudge); + Edit* get_edit(int id); // Return an edit if position is over an edit and the edit has a source file Edit* get_playable_edit(int64_t position, int use_nudge); // int64_t total_length(); diff --git a/cinelerra-5.1/cinelerra/fourier.C b/cinelerra-5.1/cinelerra/fourier.C index f78a45bd..7f52fe0c 100644 --- a/cinelerra-5.1/cinelerra/fourier.C +++ b/cinelerra-5.1/cinelerra/fourier.C @@ -429,9 +429,11 @@ int CrossfadeFFT::process_buffer(int64_t output_sample, } input_buffer->set_offset(input_size); - result = read_samples(input_sample, need_samples-input_size, input_buffer); + if( need_samples > input_size ) { + result = read_samples(input_sample, need_samples-input_size, input_buffer); + input_sample += step * (need_samples - input_size); + } input_buffer->set_offset(0); - input_sample += step * (need_samples - input_size); input_size = need_samples; diff --git a/cinelerra-5.1/cinelerra/labels.C b/cinelerra-5.1/cinelerra/labels.C index 211b8767..ad3626bf 100644 --- a/cinelerra-5.1/cinelerra/labels.C +++ b/cinelerra-5.1/cinelerra/labels.C @@ -272,7 +272,9 @@ void Labels::copy_from(Labels *labels) for(Label *current = labels->first; current; current = NEXT) { - append(new Label(edl, this, current->position, current->textstr)); + Label *new_label = new Label(edl, this, current->position, current->textstr); + new_label->orig_id = current->orig_id; + append(new_label); } } @@ -460,6 +462,13 @@ Label* Labels::next_label(double position) return current; } +Label* Labels::get_label(int id) +{ + Label *current = first; + while( current && current->orig_id != id ) current = NEXT; + return current; +} + int Labels::insert(double start, double length) { // shift every label including the first one back Label *current; @@ -541,6 +550,8 @@ Label* Labels::label_of(double position) Label::Label() : ListItem