manual goto rework, resize asset/track tweaks and fixes, filelist resize fix, allow...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index a9f71b187c36a3267fce66767f47907ceaf2b4b2..4dc1ce2853d26250839170642f34ea931616dd1a 100644 (file)
@@ -128,7 +128,7 @@ VFrame *AssetVIcon::frame()
        AssetVIconThread *avt = picon->gui->vicon_thread;
        Indexable *idxbl = picon->indexable;
        Asset *asset = idxbl && idxbl->is_asset ? (Asset *)idxbl : 0;
-       if( !asset ) return vframes()>0 ? (VFrame*)*images[0] : 0;
+       if( !asset ) return vframes()>0 ? images[0]->vfrm : 0;
        if( !asset->video_data && audio_data && audio_size && length > 0 ) {
                if( !temp ) temp = new VFrame(0, -1, w, h, BC_RGB888, -1);
                temp->clear_frame();
@@ -174,15 +174,17 @@ VFrame *AssetVIcon::frame()
                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 ) {
+               while( file && seq_no >= images.size() ) {
                        int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
                        file->set_video_position(pos,0);
                        file->set_layer(0);
                        if( file->read_frame(temp) ) temp->clear_frame();
                        add_image(temp, vw, vh, vicon_cmodel);
+                       if( seq_no < images.size() ) break;
                        mwindow->video_cache->check_in(asset);
                        if( timer.get_difference() > 500 ) return 0;
                        Thread::yield();
+                       if( avt->interrupted ) return 0;
                        file = mwindow->video_cache->check_out(asset, mwindow->edl, 0);
                        for( int retries=10; !file && --retries>=0; usleep(1000) ) {
                                if( avt->interrupted ) return 0;
@@ -193,7 +195,7 @@ VFrame *AssetVIcon::frame()
                mwindow->video_cache->check_in(asset);
        }
        if( seq_no >= images.size() ) return 0;
-       return *images[seq_no];
+       return images[seq_no]->vfrm;
 }
 
 int64_t AssetVIcon::set_seq_no(int64_t no)