From: Good Guy Date: Fri, 8 Mar 2019 22:01:16 +0000 (-0700) Subject: fullscreen segv fix, popup for 4opts preview, renderfarm print fix, pan widget upgrad... X-Git-Tag: 2019-08~89 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=e8453fdab4d5ed7b384279a5b37c92010ac13295;p=goodguy%2Fcinelerra.git fullscreen segv fix, popup for 4opts preview, renderfarm print fix, pan widget upgrade, dvd/bd script rework, ffmpeg dvd now muxed --- diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 8b53f7ad..bd7ec0f1 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -95,6 +95,13 @@ const char *AWindowGUI::folder_names[] = N_("Proxy"), }; +const char *AVIconDrawing::avicon_names[] = +{ + N_("Full Play"), + N_("Mouse Over"), + N_("Src Target"), + N_("No Play"), +}; AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length) : VIcon(w, h, framerate), Garbage("AssetVIcon") @@ -277,7 +284,9 @@ void AssetVIconAudio::start(AssetVIcon *vicon) { if( running() ) return; interrupted = 0; - audio_pos = 0; + double pos = vicon->length > 0 ? (double)vicon->seq_no/vicon->length : 0; + int audio_len = vicon->audio_size/sizeof(vicon_audio_t); + audio_pos = pos * audio_len; this->vicon = vicon; Thread::start(); } @@ -305,9 +314,10 @@ void AssetVIcon::start_audio() void AssetVIcon::stop_audio() { - if( playing_audio > 0 ) + if( playing_audio > 0 ) { picon->gui->vicon_audio->stop(0); - playing_audio = 0; + playing_audio = 0; + } } AssetViewPopup::AssetViewPopup(VIconThread *vt, int draw_mode, @@ -328,25 +338,19 @@ int AssetViewPopup::button_press_event() AssetVIconThread *avt = (AssetVIconThread *)vt; if( !avt->vicon ) return 0; - switch( draw_mode ) { - case ASSET_VIEW_MEDIA_MAP: - case ASSET_VIEW_FULL: - break; - default: - return 0; - } - int dir = 1; switch( get_buttonpress() ) { case LEFT_BUTTON: break; case WHEEL_DOWN: - dir = -1; - // fall thru + dir = -1; // fall thru case WHEEL_UP: - if( draw_mode != ASSET_VIEW_FULL ) - return avt->zoom_scale(dir); - // fall thru + switch( draw_mode ) { + case ASSET_VIEW_MEDIA: + case ASSET_VIEW_MEDIA_MAP: + avt->zoom_scale(dir); + return 1; + } // fall thru default: return 0; } @@ -435,7 +439,7 @@ int AssetViewPopup::button_press_event() } } mwindow->gui->lock_window("AssetVIcon::popup_button_press"); - mwindow->select_point(!ctrl_down() && !shift_down() ? pos : start); + mwindow->select_point(start); edl->local_session->set_selectionstart(start); edl->local_session->set_selectionend(!shift_down() ? start : end); mwindow->zoom_sample(edl->local_session->zoom_sample); @@ -454,26 +458,25 @@ int AssetViewPopup::button_release_event() int AssetViewPopup::cursor_motion_event() { - if( !is_event_win() ) return 0; AssetVIconThread *avt = (AssetVIconThread *)vt; - if( !avt->vicon || - ( draw_mode != ASSET_VIEW_FULL && - draw_mode != ASSET_VIEW_MEDIA_MAP ) ) return 0; - if( !get_button_down() || get_buttonpress() != LEFT_BUTTON || - ctrl_down() || alt_down() || shift_down() ) - return 0; AssetVIcon *vicon = (AssetVIcon *)avt->vicon; - MWindow *mwindow = vicon->picon->mwindow; - EDL *edl = mwindow->edl; - if( dragging ) { - int x = get_cursor_x(); - double total_length = edl->tracks->total_length(); - double pos = x * total_length / get_w(); - mwindow->gui->lock_window("AssetVIcon::popup_cursor_motion"); - mwindow->select_point(pos); - mwindow->zoom_sample(edl->local_session->zoom_sample); - mwindow->gui->unlock_window(); - return 1; + if( vicon && dragging && is_event_win() && + get_button_down() && get_buttonpress() == LEFT_BUTTON && + !ctrl_down() && !alt_down() && !shift_down() ) { + switch( draw_mode ) { + case ASSET_VIEW_MEDIA_MAP: + case ASSET_VIEW_FULL: + MWindow *mwindow = vicon->picon->mwindow; + EDL *edl = mwindow->edl; + int x = get_cursor_x(); + double total_length = edl->tracks->total_length(); + double pos = x * total_length / get_w(); + mwindow->gui->lock_window("AssetVIcon::popup_cursor_motion"); + mwindow->select_point(pos); + mwindow->zoom_sample(edl->local_session->zoom_sample); + mwindow->gui->unlock_window(); + return 1; + } } return 0; } @@ -607,14 +610,17 @@ void AssetVIconThread::drawing_stopped() void AssetVIconThread::set_view_popup(AssetVIcon *v, int draw_mode) { gui->stop_vicon_drawing(); - int mode = !v ? ASSET_VIEW_NONE : - draw_mode >= 0 ? draw_mode : - this->draw_mode; - this->vicon = v; - this->draw_mode = mode; + this->draw_mode = draw_mode; + VIconThread::set_view_popup(v); gui->start_vicon_drawing(); } +void AssetVIconThread::set_view_popup(AssetVIcon *v) +{ + if( !v ) draw_mode = ASSET_VIEW_NONE; + VIconThread::set_view_popup(v); +} + ViewPopup *AssetVIconThread::new_view_window() { BC_WindowBase *parent = wdw->get_parent(); @@ -632,8 +638,19 @@ ViewPopup *AssetVIconThread::new_view_window() else parent->get_fullscreen_geometry(rx, ry, rw, rh); AssetViewPopup *popup = new AssetViewPopup(this, draw_mode, rx, ry, rw, rh); - if( draw_mode == ASSET_VIEW_MEDIA_MAP || draw_mode == ASSET_VIEW_FULL ) + switch( draw_mode ) { + case ASSET_VIEW_NONE: + case ASSET_VIEW_ICON: + case ASSET_VIEW_MEDIA_MAP: + case ASSET_VIEW_FULL: + vicon->stop_audio(); vicon->playing_audio = -1; + break; + case ASSET_VIEW_MEDIA: + vicon->playing_audio = 1; + vicon->start_audio(); + break; + } wdw->set_active_subwindow(popup); return popup; } @@ -1248,7 +1265,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) remove_plugin = 0; vicon_thread = 0; vicon_audio = 0; - vicon_drawing = 1; + vicon_drawing = AVICON_FULL_PLAY; displayed_folder = AW_NO_FOLDER; new_folder_thread = 0; modify_folder_thread = 0; @@ -1446,9 +1463,11 @@ void AWindowGUI::create_objects() int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y; int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h; - VFrame **images = mwindow->theme->get_image_set("playpatch_data"); - AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h); - add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images)); + const char *text = _("Preview"); + int tw = get_text_width(MEDIUMFONT, text); + int pw = BC_PopupMenu::calculate_w(4, tw, -1); + add_subwindow(avicon_drawing = new AVIconDrawing(this, fw, fy, pw, text)); + avicon_drawing->create_objects(); add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility"))); add_tools->create_objects(); fy += add_tools->get_h(); fh -= add_tools->get_h(); @@ -1546,7 +1565,7 @@ void AWindowGUI::reposition_objects() int fx = mwindow->theme->afolders_x, fy = mwindow->theme->afolders_y; int fw = mwindow->theme->afolders_w, fh = mwindow->theme->afolders_h; add_tools->resize_event(fw-avicon_w, add_tools->get_h()); - avicon_drawing->reposition_window(fw-avicon_w, fy); + avicon_drawing->reposition_window(fw-avicon_drawing->get_w(), fy); fy += add_tools->get_h(); fh -= add_tools->get_h(); folder_list->reposition_window(fx, fy, fw, fh); } @@ -1583,7 +1602,15 @@ int AWindowGUI::close_event() void AWindowGUI::start_vicon_drawing() { - if( !vicon_drawing || !vicon_thread->interrupted ) return; + if( !vicon_thread->interrupted ) return; + switch( vicon_drawing ) { + case AVICON_FULL_PLAY: // all vicons, viewing, target + case AVICON_MOUSE_OVER: // one vicon, viewing, target + break; + case AVICON_SRC_TARGET: // no vicons, no view, target + case AVICON_NO_PLAY: // no vicons, no view, no target + return; + } if( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER || mwindow->edl->session->awindow_folder == AW_PROXY_FOLDER || mwindow->edl->session->awindow_folder == AW_CLIP_FOLDER || @@ -1601,10 +1628,11 @@ void AWindowGUI::start_vicon_drawing() } } -void AWindowGUI::stop_vicon_drawing() +int AWindowGUI::stop_vicon_drawing() { - if( vicon_thread->interrupted ) return; + if( vicon_thread->interrupted ) return 0; vicon_thread->stop_drawing(); + return 1; } void AWindowGUI::close_view_popup() @@ -2629,7 +2657,7 @@ int AWindowAssets::button_press_event() case WHEEL_UP: { int x = get_cursor_x(), y = get_cursor_y(); if( avt->cursor_inside(x, y) && avt->view_win ) - return avt->zoom_scale(dir); + avt->zoom_scale(dir); return 1; } } } @@ -2743,30 +2771,39 @@ int AWindowAssets::selection_changed() deactivate_selection(); } - else if( gui->vicon_drawing && get_button_down() && - (item = (AssetPicon*)get_selection(0, 0)) != 0 ) { - switch( folder ) { - case AW_MEDIA_FOLDER: - case AW_PROXY_FOLDER: - case AWINDOW_USER_FOLDERS: - if( get_buttonpress() == LEFT_BUTTON || - get_buttonpress() == MIDDLE_BUTTON ) { - AssetVIcon *vicon = 0; - if( !gui->vicon_thread->vicon ) - vicon = item->vicon; - int draw_mode = vicon && get_buttonpress() == MIDDLE_BUTTON ? - ASSET_VIEW_MEDIA_MAP : ASSET_VIEW_MEDIA; - gui->vicon_thread->set_view_popup(vicon, draw_mode); - } - break; - case AW_CLIP_FOLDER: - if( get_buttonpress() == LEFT_BUTTON ) { - AssetVIcon *vicon = 0; - if( !gui->vicon_thread->vicon ) - vicon = item->vicon; - gui->vicon_thread->set_view_popup(vicon, ASSET_VIEW_ICON); + else if( get_button_down() ) { + if( (item = (AssetPicon*)get_selection(0, 0)) != 0 ) { + switch( folder ) { + case AW_MEDIA_FOLDER: + case AW_PROXY_FOLDER: + case AWINDOW_USER_FOLDERS: + if( get_buttonpress() == LEFT_BUTTON || + get_buttonpress() == MIDDLE_BUTTON ) { + AssetVIcon *vicon = 0; + AssetVIconThread *avt = gui->vicon_thread; + if( !avt->vicon && gui->vicon_drawing != AVICON_NO_PLAY ) + vicon = item->vicon; + int draw_mode = !vicon ? + ASSET_VIEW_NONE : + get_buttonpress() == MIDDLE_BUTTON ? + ASSET_VIEW_MEDIA_MAP : ASSET_VIEW_MEDIA; + avt->set_view_popup(vicon, draw_mode); + } + break; + case AW_CLIP_FOLDER: + if( get_buttonpress() == LEFT_BUTTON ) { + AssetVIcon *vicon = 0; + if( !gui->vicon_thread->vicon ) + vicon = item->vicon; + gui->vicon_thread->set_view_popup(vicon, ASSET_VIEW_ICON); + } + break; } - break; + } + else { + gui->vicon_thread->set_view_popup(0); + if( gui->vicon_drawing != AVICON_FULL_PLAY ) + gui->stop_vicon_drawing(); } } return 1; @@ -2940,13 +2977,23 @@ int AWindowAssets::column_resize_event() int AWindowAssets::focus_in_event() { int ret = BC_ListBox::focus_in_event(); - gui->start_vicon_drawing(); + switch( gui->vicon_drawing ) { + case AVICON_FULL_PLAY: + gui->start_vicon_drawing(); + break; + case AVICON_MOUSE_OVER: + case AVICON_SRC_TARGET: + case AVICON_NO_PLAY: + default: + break; + } return ret; } int AWindowAssets::focus_out_event() { gui->stop_vicon_drawing(); + gui->vicon_thread->set_view_popup(0); return BC_ListBox::focus_out_event(); } @@ -2964,10 +3011,25 @@ void AWindowAssets::update_vicon_area() int AWindowAssets::mouse_over_event(int no) { - if( gui->vicon_thread->viewing && - no >= 0 && no < gui->displayed_assets[0].size() ) { - AssetPicon *picon = (AssetPicon *)gui->displayed_assets[0][no]; - gui->vicon_thread->set_view_popup(picon->vicon); + AssetPicon *picon = no >= 0 && no < gui->displayed_assets[0].size() ? + (AssetPicon *)gui->displayed_assets[0][no] : 0; + AssetVIcon *vicon = !picon ? 0 : picon->vicon; + switch( gui->vicon_drawing ) { + case AVICON_FULL_PLAY: + gui->vicon_thread->solo = 0; + if( vicon && gui->vicon_thread->viewing ) + gui->vicon_thread->set_view_popup(vicon); + break; + case AVICON_MOUSE_OVER: + if( !vicon ) break; + gui->vicon_thread->solo = vicon; + if( gui->vicon_thread->viewing ) + gui->vicon_thread->set_view_popup(vicon); + break; + case AVICON_SRC_TARGET: + case AVICON_NO_PLAY: + default: + break; } return 0; } @@ -3131,7 +3193,7 @@ int AWindowView::handle_event() } AddTools::AddTools(MWindow *mwindow, AWindowGUI *gui, int x, int y, const char *title) - : BC_PopupMenu(x, y, BC_Title::calculate_w(gui, title, MEDIUMFONT)+8, title, -1, 0, 4) + : BC_PopupMenu(x, y, gui->get_text_width(MEDIUMFONT, title)+8, title, -1, 0, 4) { this->mwindow = mwindow; this->gui = gui; @@ -3202,37 +3264,46 @@ int AddPluginItem::handle_event() return 1; } -AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images) - : BC_Toggle(x, y, images, agui->vicon_drawing) +AVIconDrawingItem::AVIconDrawingItem(AVIconDrawing *avicon, const char *text, int id) + : BC_MenuItem(text) { - this->agui = agui; - set_tooltip(_("Preview")); + this->avicon = avicon; + this->id = id; +} + +int AVIconDrawingItem::handle_event() +{ + for( int i=0; iget_item(i); + item->set_checked(id == i); + } + AWindowGUI *agui = avicon->agui; + agui->stop_vicon_drawing(); + agui->vicon_thread->set_view_popup(0); + agui->vicon_drawing = id; + agui->start_vicon_drawing(); + return 1; } -void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh) +AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, int w, const char *text) + : BC_PopupMenu(x-w, y, w, text, -1, 0, 4) { - int text_line = -1, toggle_x = -1, toggle_y = -1; - int text_x = -1, text_y = -1, text_w = -1, text_h = -1; - BC_Toggle::calculate_extents(agui, images, 1, - &text_line, ww, hh, &toggle_x, &toggle_y, - &text_x, &text_y, &text_w, &text_h, "", MEDIUMFONT); + this->agui = agui; } AVIconDrawing::~AVIconDrawing() { } -int AVIconDrawing::handle_event() +void AVIconDrawing::create_objects() { - agui->vicon_drawing = get_value(); - if( agui->vicon_drawing ) - agui->start_vicon_drawing(); - else - agui->stop_vicon_drawing(); - return 1; + AVIconDrawingItem *item; + for( int i=0; iset_checked(agui->vicon_drawing == i); + } } - AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui) : BC_MenuItem("","v",'v') { diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index dadc44bc..35fdb923 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -64,6 +64,12 @@ #define ASSET_VIEW_MEDIA_MAP 3 #define ASSET_VIEW_FULL 4 +#define AVICON_FULL_PLAY 0 +#define AVICON_MOUSE_OVER 1 +#define AVICON_SRC_TARGET 2 +#define AVICON_NO_PLAY 3 +#define AVICON_PLAY_MODES 4 + class AWindowFolderItem : public BC_ListBoxItem { public: @@ -194,7 +200,8 @@ public: AssetVIconThread(AWindowGUI *gui, Preferences *preferences); ~AssetVIconThread(); - void set_view_popup(AssetVIcon *v, int draw_mode=-1); + void set_view_popup(AssetVIcon *v, int draw_mode); + void set_view_popup(AssetVIcon *v); ViewPopup *new_view_window(); void drawing_started(); void drawing_stopped(); @@ -276,7 +283,7 @@ public: int save_defaults(BC_Hash *defaults); int load_defaults(BC_Hash *defaults); void start_vicon_drawing(); - void stop_vicon_drawing(); + int stop_vicon_drawing(); void close_view_popup(); void update_picon(Indexable *indexable); int cycle_assetlist_format(); @@ -570,16 +577,26 @@ public: int idx; }; -class AVIconDrawing : public BC_Toggle +class AVIconDrawingItem : public BC_MenuItem { public: - AWindowGUI *agui; - + AVIconDrawingItem(AVIconDrawing *avicon, const char *text, int id); int handle_event(); - static void calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh); - AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images); + AVIconDrawing *avicon; + int id; +}; + +class AVIconDrawing : public BC_PopupMenu +{ +public: + AVIconDrawing(AWindowGUI *agui, int x, int y, int w, const char *text); ~AVIconDrawing(); + + void create_objects(); + static const char *avicon_names[]; + + AWindowGUI *agui; }; diff --git a/cinelerra-5.1/cinelerra/awindowgui.inc b/cinelerra-5.1/cinelerra/awindowgui.inc index b67da703..7758c696 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.inc +++ b/cinelerra-5.1/cinelerra/awindowgui.inc @@ -46,6 +46,7 @@ class AWindowAppend; class AWindowView; class AddTools; class AddPluginItem; +class AVIconDrawingItem; class AVIconDrawing; class AWindowListFormat; class AWindowListSort; diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index dcae332d..6ebaa967 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -164,7 +164,8 @@ char *BD_BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls) int is_usr_mnt = get_udfs_mount(udfs, mopts, mntpt); const char *exec_path = File::get_cinlib_path(); fprintf(fp,"#!/bin/bash -ex\n"); - fprintf(fp,"dir=`dirname $0`\n"); + fprintf(fp,"sdir=`dirname $0`\n"); + fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n"); fprintf(fp,"PATH=$PATH:%s\n",exec_path); fprintf(fp,"mkdir -p $dir/udfs\n"); fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ \t].*//'`\n"); diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index 6b3f6508..14e4351d 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -88,6 +88,7 @@ void Canvas::reset() canvas_subwindow = 0; canvas_fullscreen = 0; is_processing = 0; + is_fullscreen = 0; cursor_inside = 0; } @@ -135,6 +136,16 @@ void Canvas::use_vwindow() canvas_menu->use_vwindow(); } +int Canvas::get_fullscreen() +{ + return is_fullscreen; +} + +void Canvas::set_fullscreen(int value) +{ + is_fullscreen = value; +} + // Get dimensions given a zoom void Canvas::calculate_sizes(float aspect_ratio, int output_w, diff --git a/cinelerra-5.1/cinelerra/canvas.h b/cinelerra-5.1/cinelerra/canvas.h index 1a654260..1b1adb1d 100644 --- a/cinelerra-5.1/cinelerra/canvas.h +++ b/cinelerra-5.1/cinelerra/canvas.h @@ -87,8 +87,8 @@ public: virtual void draw_overlays() {} virtual void toggle_controls() {} virtual int get_cwindow_controls() { return 0; } - virtual int get_fullscreen() { return 0; } - virtual void set_fullscreen(int value) {} + virtual int get_fullscreen(); + virtual void set_fullscreen(int value); int cursor_leave_event_base(BC_WindowBase *caller); int cursor_enter_event_base(BC_WindowBase *caller); @@ -200,6 +200,7 @@ public: // For cases where video is not enabled on the canvas but processing is // occurring for a single frame, this causes the status to update. int is_processing; + int is_fullscreen; // Cursor is inside video surface int cursor_inside; int view_x; diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 0d8b755a..a93964c4 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -480,7 +480,7 @@ int CWindowGUI::keypress_event() break; case 'f': unlock_window(); - if(mwindow->session->cwindow_fullscreen) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); else canvas->start_fullscreen(); @@ -506,7 +506,7 @@ int CWindowGUI::keypress_event() break; case ESC: unlock_window(); - if(mwindow->session->cwindow_fullscreen) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); lock_window("CWindowGUI::keypress_event 4"); result = 1; @@ -1093,17 +1093,6 @@ void CWindowCanvas::status_event() gui->draw_status(1); } -int CWindowCanvas::get_fullscreen() -{ - return mwindow->session->cwindow_fullscreen; -} - -void CWindowCanvas::set_fullscreen(int value) -{ - mwindow->session->cwindow_fullscreen = value; -} - - void CWindowCanvas::update_zoom(int x, int y, float zoom) { use_scrollbars = mwindow->edl->session->cwindow_scrollbars; diff --git a/cinelerra-5.1/cinelerra/cwindowgui.h b/cinelerra-5.1/cinelerra/cwindowgui.h index 67859a29..c23db9bd 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.h +++ b/cinelerra-5.1/cinelerra/cwindowgui.h @@ -294,8 +294,6 @@ public: int cursor_motion_event(); int button_press_event(); int button_release_event(); - int get_fullscreen(); - void set_fullscreen(int value); int test_crop(int button_press, int &redraw); int test_bezier(int button_press, int &redraw, diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index 3e69b52d..157f17ee 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -168,7 +168,8 @@ char *DVD_BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls } fprintf(fp,"#!/bin/bash\n"); - fprintf(fp,"dir=`dirname $0`\n"); + fprintf(fp,"sdir=`dirname $0`\n"); + fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n"); fprintf(fp,"echo \"running %s\"\n", script); fprintf(fp,"\n"); const char *exec_path = File::get_cinlib_path(); @@ -221,7 +222,7 @@ char *DVD_BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls bmin(video_length, audio_length) : idxbl->have_video() ? video_length : idxbl->have_audio() ? audio_length : 0; - fprintf(fp," path); + fprintf(fp," path); chapter = 0; double vob_end = i+1>=total_idxbls ? total_length : vob_pos + length; if( labeled ) { @@ -361,7 +362,7 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const ch } BatchRenderJob *job = new DVD_BatchRenderJob(mwindow->preferences, - use_labeled, use_farmed, use_standard, use_ffmpeg); + use_labeled, use_farmed, use_standard, 0);// use_ffmpeg); jobs->append(job); strcpy(&job->edl_path[0], xml_filename); Asset *asset = job->asset; @@ -377,7 +378,12 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const ch sprintf(&asset->path[0],"%s/dvd.mpg", asset_dir); asset->format = FILE_FFMPEG; strcpy(asset->fformat, "dvd"); - +// if there are many renderfarm jobs, then there are small audio fragments of +// silence that are used at the end of a render to fill the last audio "block". +// this extra data gradually skews the audio/video sync. Therefore, the audio +// is not rendered muxed for ffmpeg, and is remuxed as with mjpeg rendering. +// since this audio is in one file, the only fragment is at the end and is ok. +#if 0 asset->audio_data = 1; asset->channels = session->audio_channels; asset->sample_rate = session->sample_rate; @@ -395,6 +401,28 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const ch asset->ff_video_bitrate = vid_bitrate; asset->ff_video_quality = -1; use_farmed = job->farmed; +#else + asset->video_data = 1; + strcpy(asset->vcodec, "raw.dvd"); + sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir); + FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec); + FFMPEG::load_options(option_path, asset->ff_video_options, + sizeof(asset->ff_video_options)); + asset->ff_video_bitrate = vid_bitrate; + asset->ff_video_quality = -1; + use_farmed = job->farmed; + + job = new BatchRenderJob(mwindow->preferences, 0, 0); + jobs->append(job); + strcpy(&job->edl_path[0], xml_filename); + asset = job->asset; + sprintf(&asset->path[0],"%s/dvd.ac3", asset_dir); + asset->format = FILE_AC3; + asset->audio_data = 1; + asset->channels = session->audio_channels; + asset->sample_rate = session->sample_rate; + asset->ac3_bitrate = dvd_kaudio_rate; +#endif } else { sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir); diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index bd19562d..f1b1974e 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -66,10 +66,6 @@ MainSession::MainSession(MWindow *mwindow) cwindow_controls = 1; trim_edits = 0; current_tip = -1; - cwindow_fullscreen = 0; - rwindow_fullscreen = 0; - vwindow_fullscreen = 0; - zwindow_fullscreen = 0; selected_zwindow = -1; actual_frame_rate = 0; title_bar_alpha = 0; diff --git a/cinelerra-5.1/cinelerra/mainsession.h b/cinelerra-5.1/cinelerra/mainsession.h index a3ad511c..6395b809 100644 --- a/cinelerra-5.1/cinelerra/mainsession.h +++ b/cinelerra-5.1/cinelerra/mainsession.h @@ -184,10 +184,6 @@ public: int menueffect_w, menueffect_h; int transitiondialog_w, transitiondialog_h; - int cwindow_fullscreen; - int rwindow_fullscreen; - int vwindow_fullscreen; - int zwindow_fullscreen; int selected_zwindow; double actual_frame_rate; diff --git a/cinelerra-5.1/cinelerra/recordmonitor.C b/cinelerra-5.1/cinelerra/recordmonitor.C index aa10ec0d..2fb3a098 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.C +++ b/cinelerra-5.1/cinelerra/recordmonitor.C @@ -78,7 +78,6 @@ RecordMonitor::~RecordMonitor() void RecordMonitor::create_objects() { int min_w = 150; - mwindow->session->rwindow_fullscreen = 0; if( !record->default_asset->video_data ) min_w = MeterPanel::get_meters_width(mwindow->theme, @@ -424,7 +423,7 @@ void RecordMonitorGUI::create_objects() int RecordMonitorGUI::button_press_event() { - if(mwindow->session->rwindow_fullscreen && canvas && canvas->get_canvas()) + if( canvas && canvas->get_fullscreen() && canvas->get_canvas()) return canvas->button_press_event_base(canvas->get_canvas()); if( get_buttonpress() == 2 ) { @@ -819,16 +818,6 @@ void RecordMonitorCanvas::zoom_resize_window(float percentage) window->resize_event(new_w, new_h); } -int RecordMonitorCanvas::get_fullscreen() -{ - return mwindow->session->rwindow_fullscreen; -} - -void RecordMonitorCanvas::set_fullscreen(int value) -{ - mwindow->session->rwindow_fullscreen = value; -} - int RecordMonitorCanvas::button_release_event() { diff --git a/cinelerra-5.1/cinelerra/recordmonitor.h b/cinelerra-5.1/cinelerra/recordmonitor.h index d109aff5..956cd214 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.h +++ b/cinelerra-5.1/cinelerra/recordmonitor.h @@ -230,9 +230,6 @@ public: int keypress_event(); int get_output_w(); int get_output_h(); - int get_fullscreen(); - void set_fullscreen(int value); - RecordMonitorGUI *window; MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index ff21962f..faa62ddb 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -736,7 +736,8 @@ void RenderThread::render_single(int test_overwrite, Asset *asset, EDL *edl, render->total_rendered = 0; - if( !render->result ) { + if( !render->result && + ( strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM ) ) { // Start dispatching external jobs if( mwindow ) { mwindow->gui->lock_window("Render::render 1"); @@ -748,24 +749,22 @@ void RenderThread::render_single(int test_overwrite, Asset *asset, EDL *edl, printf("Render::render: starting render farm\n"); } - if( strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM ) { - farm_server = new RenderFarmServer(mwindow, render->packages, - render->preferences, 1, &render->result, - &render->total_rendered, render->counter_lock, - render->default_asset, command->get_edl(), 0); - render->result = farm_server->start_clients(); - - if( render->result ) { - if( mwindow ) { - mwindow->gui->lock_window("Render::render 2"); - mwindow->gui->show_message(_("Failed to start render farm"), - mwindow->theme->message_error); - mwindow->gui->stop_hourglass(); - mwindow->gui->unlock_window(); - } - else { - printf("Render::render: Failed to start render farm\n"); - } + farm_server = new RenderFarmServer(mwindow, render->packages, + render->preferences, 1, &render->result, + &render->total_rendered, render->counter_lock, + render->default_asset, command->get_edl(), 0); + render->result = farm_server->start_clients(); + + if( render->result ) { + if( mwindow ) { + mwindow->gui->lock_window("Render::render 2"); + mwindow->gui->show_message(_("Failed to start render farm"), + mwindow->theme->message_error); + mwindow->gui->stop_hourglass(); + mwindow->gui->unlock_window(); + } + else { + printf("Render::render: Failed to start render farm\n"); } } } diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 814161b6..44a9948c 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -358,7 +358,7 @@ int VWindowGUI::keypress_event() break; case 'f': unlock_window(); - if(mwindow->session->vwindow_fullscreen) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); else canvas->start_fullscreen(); @@ -366,7 +366,7 @@ int VWindowGUI::keypress_event() break; case ESC: unlock_window(); - if(mwindow->session->vwindow_fullscreen) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); lock_window("VWindowGUI::keypress_event 2"); break; @@ -877,13 +877,3 @@ void VWindowCanvas::draw_overlays() } } -int VWindowCanvas::get_fullscreen() -{ - return mwindow->session->vwindow_fullscreen; -} - -void VWindowCanvas::set_fullscreen(int value) -{ - mwindow->session->vwindow_fullscreen = value; -} - diff --git a/cinelerra-5.1/cinelerra/vwindowgui.h b/cinelerra-5.1/cinelerra/vwindowgui.h index 60dcfeff..a6c206e5 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.h +++ b/cinelerra-5.1/cinelerra/vwindowgui.h @@ -122,8 +122,6 @@ public: int need_overlays(); void draw_overlays(); void close_source(); - int get_fullscreen(); - void set_fullscreen(int value); MWindow *mwindow; VWindowGUI *gui; diff --git a/cinelerra-5.1/cinelerra/zwindowgui.C b/cinelerra-5.1/cinelerra/zwindowgui.C index bada1625..9657b573 100644 --- a/cinelerra-5.1/cinelerra/zwindowgui.C +++ b/cinelerra-5.1/cinelerra/zwindowgui.C @@ -98,13 +98,13 @@ int ZWindowGUI::keypress_event() int result = 1; switch( key ) { case 'f': - if( mwindow->session->zwindow_fullscreen ) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); else canvas->start_fullscreen(); break; case ESC: - if( mwindow->session->zwindow_fullscreen ) + if( canvas->get_fullscreen() ) canvas->stop_fullscreen(); break; default: @@ -246,13 +246,3 @@ void ZWindowCanvas::draw_refresh(int flush) cvs->flash(flush); } -int ZWindowCanvas::get_fullscreen() -{ - return mwindow->session->zwindow_fullscreen; -} - -void ZWindowCanvas::set_fullscreen(int value) -{ - mwindow->session->zwindow_fullscreen = value; -} - diff --git a/cinelerra-5.1/cinelerra/zwindowgui.h b/cinelerra-5.1/cinelerra/zwindowgui.h index 9c1fed75..7604c4be 100644 --- a/cinelerra-5.1/cinelerra/zwindowgui.h +++ b/cinelerra-5.1/cinelerra/zwindowgui.h @@ -67,8 +67,6 @@ public: void draw_refresh(int flush = 1); void close_source(); - int get_fullscreen(); - void set_fullscreen(int value); MWindow *mwindow; ZWindowGUI *gui; diff --git a/cinelerra-5.1/ffmpeg/video/raw.dvd b/cinelerra-5.1/ffmpeg/video/raw.dvd new file mode 100644 index 00000000..a86f0769 --- /dev/null +++ b/cinelerra-5.1/ffmpeg/video/raw.dvd @@ -0,0 +1,9 @@ +rawvideo mpeg2video +s 720x480 +r 30000/1001 +pix_fmt yuv420p +g 18 +maxrate 9000000 +minrate 0 +bufsize 1835008 +packetsize 2048 diff --git a/cinelerra-5.1/guicast/bcpan.C b/cinelerra-5.1/guicast/bcpan.C index d8bce872..e40910c3 100644 --- a/cinelerra-5.1/guicast/bcpan.C +++ b/cinelerra-5.1/guicast/bcpan.C @@ -33,15 +33,9 @@ #include #include -BC_Pan::BC_Pan(int x, - int y, - int virtual_r, - float maxvalue, - int total_values, - int *value_positions, - int stick_x, - int stick_y, - float *values) +BC_Pan::BC_Pan(int x, int y, int virtual_r, + float maxvalue, int total_values, int *value_positions, + int stick_x, int stick_y, float *values) : BC_SubWindow(x, y, -1, -1, -1) { this->virtual_r = virtual_r; @@ -69,29 +63,24 @@ BC_Pan::BC_Pan(int x, this->stick_x, this->stick_y); highlighted = 0; - popup = 0; active = 0; + temp_channel = 0; + rotater = 0; + popup = 0; memset(images, 0, sizeof(BC_Pixmap*) * PAN_IMAGES); } BC_Pan::~BC_Pan() { -//printf("BC_Pan::~BC_Pan 1\n"); delete [] values; -//printf("BC_Pan::~BC_Pan 1\n"); delete [] value_positions; -//printf("BC_Pan::~BC_Pan 1\n"); delete [] value_x; -//printf("BC_Pan::~BC_Pan 1\n"); delete [] value_y; -//printf("BC_Pan::~BC_Pan 1\n"); - if(popup) delete popup; -//printf("BC_Pan::~BC_Pan 1\n"); + delete popup; delete temp_channel; -//printf("BC_Pan::~BC_Pan 1\n"); delete rotater; - for(int i = 0; i < PAN_IMAGES; i++) - if(images[i]) delete images[i]; + for( int i=0; ipan_data[PAN_CHANNEL]->get_h(), get_resources()->pan_data[PAN_CHANNEL]->get_color_model(), -1); - rotater = new RotateFrame(1, - get_resources()->pan_data[PAN_CHANNEL]->get_w(), - get_resources()->pan_data[PAN_CHANNEL]->get_h()); draw(1, 0); return 0; } @@ -227,8 +213,8 @@ int BC_Pan::cursor_leave_event() int BC_Pan::deactivate() { - if(popup) delete popup; - popup = 0; + delete popup; popup = 0; + delete rotater; rotater = 0; active = 0; return 0; } @@ -263,6 +249,10 @@ int BC_Pan::activate(int popup_x, int popup_y) if (x < 0) x = 0; } + rotater = new RotateFrame(1, + get_resources()->pan_data[PAN_CHANNEL]->get_w(), + get_resources()->pan_data[PAN_CHANNEL]->get_h()); + delete popup; popup = new BC_Popup(this, x, y, images[PAN_POPUP]->get_w(), diff --git a/cinelerra-5.1/guicast/bcpopupmenu.C b/cinelerra-5.1/guicast/bcpopupmenu.C index 80a02f6a..5a792af0 100644 --- a/cinelerra-5.1/guicast/bcpopupmenu.C +++ b/cinelerra-5.1/guicast/bcpopupmenu.C @@ -134,28 +134,28 @@ int BC_PopupMenu::initialize() int BC_PopupMenu::set_images(VFrame **data) { - BC_Resources *resources = get_resources(); for( int i=0; i<3; ++i ) { delete images[i]; images[i] = new BC_Pixmap(parent_window, data[i], PIXMAP_ALPHA); } - if( w_argument >= 0 ) - w = w_argument + margin + - resources->popupmenu_triangle_margin; - else - w = get_text_width(MEDIUMFONT, text) + margin + - resources->popupmenu_triangle_margin; - + w = w_argument > 0 ? w_argument : + calculate_w(margin, get_text_width(MEDIUMFONT, text), use_title); h = images[BUTTON_UP]->get_h(); return 0; } -int BC_PopupMenu::calculate_w(int w_argument) +int BC_PopupMenu::calculate_w(int margin, int text_width, int use_title) +{ + BC_Resources *resources = get_resources(); + int l = margin >= 0 ? margin : resources->popupmenu_margin; + int r = use_title < 0 ? l : resources->popupmenu_triangle_margin; + return l + text_width + r; +} + +int BC_PopupMenu::calculate_w(int text_width) { - return w_argument + - BC_WindowBase::get_resources()->popupmenu_margin + - BC_WindowBase::get_resources()->popupmenu_triangle_margin; + return calculate_w(-1, text_width, 0); } int BC_PopupMenu::calculate_h(VFrame **data) @@ -203,7 +203,6 @@ int BC_PopupMenu::get_margin() int BC_PopupMenu::draw_face(int dx) { if( !use_title ) return 0; - BC_Resources *resources = get_resources(); // Background draw_top_background(parent_window, 0, 0, w, h); @@ -212,12 +211,12 @@ int BC_PopupMenu::draw_face(int dx) // Overlay text set_color(get_resources()->popup_title_text); int offset = status == BUTTON_DN ? 1 : 0; - int available_w = get_w() - margin*2 - resources->popupmenu_triangle_margin; + int available_w = get_w() - calculate_w(margin, 0, use_title); + if( !icon ) { - set_font(MEDIUMFONT); char truncated[BCTEXTLEN]; truncate_text(truncated, text, available_w); - + set_font(MEDIUMFONT); BC_WindowBase::draw_center_text( dx + available_w/2 + margin + offset, (int)((float)get_h()/2 + get_text_ascent(MEDIUMFONT)/2 - 2) + offset, diff --git a/cinelerra-5.1/guicast/bcpopupmenu.h b/cinelerra-5.1/guicast/bcpopupmenu.h index fbf44e74..9ebef28a 100644 --- a/cinelerra-5.1/guicast/bcpopupmenu.h +++ b/cinelerra-5.1/guicast/bcpopupmenu.h @@ -53,7 +53,8 @@ public: virtual ~BC_PopupMenu(); // Adds popupmenu_margin to width - static int calculate_w(int w_argument); + static int calculate_w(int margin, int text_width, int use_title); + static int calculate_w(int text_width); static int calculate_h(VFrame **data = 0); virtual int handle_event() { return 0; }; virtual int draw_face(int dx); diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 099f8249..1810abc3 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -893,7 +893,7 @@ int BC_WindowBase::dispatch_event(XEvent *event) int result; XClientMessageEvent *ptr; int cancel_resize, cancel_translation; - const int debug = 0; + volatile static int debug = 0; key_pressed = 0; @@ -930,23 +930,22 @@ locking_message = event->xclient.message_type; -//static const char *event_names[] = { -// "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", -// "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", -// "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", -// "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", -// "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", -// "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", -// "GenericEvent", "LASTEvent", -//}; -// -//if(debug) -//if(event->type != ClientMessage) { -// printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n", -//__LINE__, title, event, event->type, -// event->type>=0 && event->typetype] : "Unknown"); -//} +if( debug && event->type != ClientMessage ) { + static const char *event_names[] = { + "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", + "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", + "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", + "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", + "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", + "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", + "GenericEvent", "LASTEvent", + }; + const int nevents = sizeof(event_names)/sizeof(event_names[0]); + + printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n", __LINE__, + title, event, event->type, event->type>=0 && event->typetype] : "Unknown"); +} if( active_grab ) { unlock_window(); diff --git a/cinelerra-5.1/guicast/vicon.C b/cinelerra-5.1/guicast/vicon.C index f27791f9..b1535546 100644 --- a/cinelerra-5.1/guicast/vicon.C +++ b/cinelerra-5.1/guicast/vicon.C @@ -108,12 +108,16 @@ VIconThread(BC_WindowBase *wdw, int vw, int vh, int view_w, int view_h) this->wdw = wdw; this->vw = vw; this->vh = vh; this->view_w = view_w; this->view_h = view_h; - this->view_win = 0; this->vicon = 0; this->viewing = 0; + this->view_win = 0; this->vicon = 0; + this->viewing = 0; this->solo = 0; this->draw_x0 = 0; this->draw_x1 = wdw->get_w(); this->draw_y0 = 0; this->draw_y1 = wdw->get_h(); draw_lock = new Condition(0, "VIconThread::draw_lock", 1); timer = new Timer(); this->refresh_rate = VICON_RATE; + this->draw_flash = 0; + this->seq_no = 0; + this->now = 0; done = 0; interrupted = -1; stop_age = 0; @@ -255,7 +259,11 @@ void ViewPopup::draw_vframe(VFrame *frame) void VIconThread::set_view_popup(VIcon *vicon) { + if( viewing == vicon && !this->vicon ) return; this->vicon = vicon; + if( interrupted ) + update_view(0); + } void VIconThread::close_view_popup() @@ -264,7 +272,7 @@ void VIconThread::close_view_popup() } int VIconThread:: -update_view() +update_view(int do_audio) { if( viewing ) viewing->stop_audio(); delete view_win; view_win = 0; @@ -273,7 +281,7 @@ update_view() view_win->draw_vframe(viewing->frame()); view_win->flash(0); view_win->show_window(); - vicon->start_audio(); + if( do_audio ) vicon->start_audio(); } wdw->set_active_subwindow(view_win); return 1; @@ -334,6 +342,26 @@ void VIconThread::hide_vicons(int v) } } +int VIconThread::show_vicon(VIcon *next) +{ + now = timer->get_difference(); + if( now >= draw_flash ) return 1; + draw(next); + if( !next->seq_no ) { + next->cycle_start = now; + if( next->playing_audio > 0 ) + next->start_audio(); + } + int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate; + int count = ref_no - next->seq_no; + if( count < 1 ) count = 1; + ref_no = next->seq_no + count; + next->age = next->cycle_start + 1000. * ref_no / refresh_rate; + if( !next->set_seq_no(ref_no) ) + next->age = now + 1000.; + return 0; +} + void VIconThread:: run() { @@ -343,35 +371,25 @@ run() wdw->lock_window("BC_WindowBase::run 1"); drawing_started(); reset_images(); - int64_t seq_no = 0, now = 0; - int64_t draw_flash = 1000 / refresh_rate; + draw_flash = 1000 / refresh_rate; + seq_no = 0; now = 0; while( !interrupted ) { if( viewing != vicon ) update_view(); - VIcon *next = low_vicon(); - while( next && next->age < draw_flash ) { - now = timer->get_difference(); - if( now >= draw_flash ) break; - draw(next); - if( !next->seq_no ) { - next->cycle_start = now; - if( next->playing_audio > 0 ) - next->start_audio(); + if( !solo ) { + VIcon *next = low_vicon(); + while( next && next->age < draw_flash ) { + if( show_vicon(next) ) break; + add_vicon(next); + next = low_vicon(); } - int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate; - int count = ref_no - next->seq_no; - if( count < 1 ) count = 1; - ref_no = next->seq_no + count; - next->age = next->cycle_start + 1000. * ref_no / refresh_rate; - if( !next->set_seq_no(ref_no) ) - next->age = now + 1000.; + if( !next ) break; add_vicon(next); - next = low_vicon(); + if( draw_flash < now+1 ) + draw_flash = now+1; } - if( !next ) break; - add_vicon(next); - if( draw_flash < now+1 ) - draw_flash = now+1; + else + show_vicon(solo); wdw->unlock_window(); while( !interrupted ) { now = timer->get_difference(); diff --git a/cinelerra-5.1/guicast/vicon.h b/cinelerra-5.1/guicast/vicon.h index 544e1f96..69cdb362 100644 --- a/cinelerra-5.1/guicast/vicon.h +++ b/cinelerra-5.1/guicast/vicon.h @@ -76,13 +76,16 @@ public: Timer *timer; Condition *draw_lock; ViewPopup *view_win; - VIcon *viewing, *vicon; + VIcon *viewing, *vicon, *solo; int vw, vh, view_w, view_h; int draw_x0, draw_y0; int draw_x1, draw_y1; int img_dirty, win_dirty; double refresh_rate; + int64_t now; + int64_t draw_flash; int64_t stop_age; + int64_t seq_no; ArrayListt_heap; VIcon *low_vicon(); @@ -91,7 +94,7 @@ public: void run(); void flash(); int draw(VIcon *vicon); - int update_view(); + int update_view(int do_audio=1); void draw_images(); void start_drawing(); void stop_drawing(); @@ -105,6 +108,7 @@ public: int zoom_scale(int dir); void close_view_popup(); void hide_vicons(int v=1); + int show_vicon(VIcon *next); virtual ViewPopup *new_view_window(); virtual bool visible(VIcon *vicon, int x, int y);