X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fawindowgui.C;h=4688e7bc04cead9a205e6a0fd67288640dc10b25;hb=3cbe62ca61e2b35d3e228978f6cdedd11218077f;hp=a0a2d5cfde8499e2f5024820fc1c0ef9bfdaf203;hpb=b2d226c1f41e84bbb3af93ebc0aa89f98ec0fd52;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index a0a2d5cf..4688e7bc 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -29,8 +29,9 @@ #include "awindow.h" #include "awindowgui.h" #include "bccmodels.h" -#include "bcsignals.h" #include "bchash.h" +#include "bcsignals.h" +#include "bctimer.h" #include "binfolder.h" #include "cache.h" #include "cstrdup.h" @@ -170,6 +171,8 @@ VFrame *AssetVIcon::frame() if( !temp ) temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1); File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1); + if( !file ) { broken = 1; return 0; } + Timer timer; while( file && seq_no >= images.size() && !avt->interrupted ) { int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate; file->set_video_position(pos,0); @@ -177,14 +180,15 @@ VFrame *AssetVIcon::frame() if( file->read_frame(temp) ) temp->clear_frame(); add_image(temp, vw, vh, vicon_cmodel); mwindow->video_cache->check_in(asset); + if( timer.get_difference() > 500 ) return 0; Thread::yield(); - file = 0; - for( int retries=1000; !file && --retries>=0; usleep(10000) ) { + file = mwindow->video_cache->check_out(asset, mwindow->edl, 0); + for( int retries=10; !file && --retries>=0; usleep(1000) ) { if( avt->interrupted ) return 0; file = mwindow->video_cache->check_out(asset, mwindow->edl, 0); } + if( !file ) return 0; } - if( !file ) { broken = 1; return 0; } mwindow->video_cache->check_in(asset); } if( seq_no >= images.size() ) return 0; @@ -608,22 +612,10 @@ AssetVIconThread::AssetVIconThread(AWindowGUI *gui, Preferences *preferences) case VICON_COLOR_MODE_HIGH: vicon_cmodel = BC_RGB888; break; } this->vicon_cmodel = vicon_cmodel; - this->draw_lock = new Mutex("AssetVIconThread::draw_lock"); } AssetVIconThread::~AssetVIconThread() { - delete draw_lock; -} - -void AssetVIconThread::drawing_started() -{ - draw_lock->lock("AssetVIconThread::drawing_started"); -} - -void AssetVIconThread::drawing_stopped() -{ - draw_lock->unlock(); } void AssetVIconThread::set_view_popup(AssetVIcon *v, int draw_mode) @@ -684,11 +676,11 @@ ViewPopup *AssetVIconThread::new_view_window(ViewPopup *vpopup) return av_popup; } -void AssetVIconThread::close_view_popup() +void AssetVIconThread::stop_vicon_drawing(int wait) { stop_drawing(); - drawing_started(); // waits for draw lock - drawing_stopped(); + gui->lock_window("AssetVIconThread::stop_vicon_drawing"); + gui->unlock_window(); } @@ -1698,17 +1690,12 @@ int AWindowGUI::start_vicon_drawing() return 1; } -int AWindowGUI::stop_vicon_drawing() +int AWindowGUI::stop_vicon_drawing(int wait) { - if( !vicon_thread->interrupted ) - vicon_thread->stop_drawing(); + vicon_thread->stop_vicon_drawing(wait); return 0; } -void AWindowGUI::close_view_popup() -{ - vicon_thread->close_view_popup(); -} VFrame *AssetPicon::get_vicon_frame() {