From: Good Guy Date: Sun, 3 Sep 2017 17:06:23 +0000 (-0600) Subject: fred (fwd render enb displ) play pref. info text tweak X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=9d5997d77ab7736be577456d8fd3dda0ba522d39;p=goodguy%2Fhistory.git fred (fwd render enb displ) play pref. info text tweak --- diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index 125202d0..01779b4f 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -162,6 +162,9 @@ void AppearancePrefs::create_objects() DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x1, y1); add_subwindow(focus_deactivate); y1 += focus_deactivate->get_h() + 5; + ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x1, y1); + add_subwindow(displacement); + y1 += displacement->get_h() + 5; add_subwindow(thumbnails = new ViewThumbnails(x1, y1, pwindow)); if( y < y1 ) y = y1; } @@ -468,3 +471,16 @@ int DeactivateFocusPolicy::handle_event() return 1; } +ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y) + : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement, + _("Forward render enable displacement")) +{ + this->pwindow = pwindow; +} + +int ForwardRenderDisplacement::handle_event() +{ + pwindow->thread->preferences->forward_render_displacement = get_value(); + return 1; +} + diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.h b/cinelerra-5.1/cinelerra/appearanceprefs.h index b5f1f6a0..9e0e05ae 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.h +++ b/cinelerra-5.1/cinelerra/appearanceprefs.h @@ -227,5 +227,13 @@ public: PreferencesWindow *pwindow; }; +class ForwardRenderDisplacement : public BC_CheckBox +{ +public: + ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y); + int handle_event(); + PreferencesWindow *pwindow; +}; + #endif diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 2d1c4af2..2da3eff1 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1111,7 +1111,8 @@ int File::read_samples(Samples *samples, int64_t len) int File::read_frame(VFrame *frame, int is_thread) { const int debug = 0; - +//printf("File::read_frame pos=%jd cache=%d 1frame=%d\n", +// current_frame, use_cache, asset->single_frame); if( debug ) PRINT_TRACE //printf("File::read_frame %d\n", __LINE__); diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index 9f826401..7dcea2df 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -392,7 +392,6 @@ void PlaybackEngine::run() case SINGLE_FRAME_FWD: case SINGLE_FRAME_REWIND: - command->playbackstart = get_tracking_position(); // fall through default: last_command = command->command; diff --git a/cinelerra-5.1/cinelerra/playtransport.C b/cinelerra-5.1/cinelerra/playtransport.C index 38a5725f..7ffb8532 100644 --- a/cinelerra-5.1/cinelerra/playtransport.C +++ b/cinelerra-5.1/cinelerra/playtransport.C @@ -282,7 +282,7 @@ void PlayTransport::handle_transport(int command, // Resume or change direction switch( prev_command ) { default: - engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); + engine->que->send_command(STOP, CHANGE_NONE, 0, 0); engine->interrupt_playback(wait_tracking); resume = 1; // fall through @@ -292,25 +292,22 @@ void PlayTransport::handle_transport(int command, case SINGLE_FRAME_REWIND: // Start from scratch engine->que->send_command(command, CHANGE_NONE, get_edl(), - 1, resume, use_inout, toggle_audio); + 1, resume, use_inout, toggle_audio, + mwindow->preferences->forward_render_displacement); break; } break; // Commands that stop case STOP: - do_stop = 1; - break; - case REWIND: case GOTO_END: - engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); - engine->interrupt_playback(wait_tracking); - break; + do_stop = 1; + break; } if( do_stop ) { - engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); + engine->que->send_command(STOP, CHANGE_NONE, 0, 0); engine->interrupt_playback(wait_tracking); } } @@ -496,7 +493,7 @@ void PlayTransport::change_position(double position) // stop transport if( prev_command != STOP && prev_command != COMMAND_NONE && prev_command != SINGLE_FRAME_FWD && prev_command != SINGLE_FRAME_REWIND ) { - engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0); + engine->que->send_command(STOP, CHANGE_NONE, 0, 0); engine->interrupt_playback(0); } mwindow->gui->lock_window("PlayTransport::change_position"); @@ -511,7 +508,7 @@ void PlayTransport::change_position(double position) case NORMAL_FWD: case FAST_FWD: engine->que->send_command(prev_command, CHANGE_NONE, - get_edl(), 1, 1, using_inout); + get_edl(), 1, 1, using_inout, 0); } } diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 1341277a..5fb48ad6 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -85,6 +85,7 @@ Preferences::Preferences() bd_warn_root = 1; popupmenu_btnup = 1; textbox_focus_policy = 0; + forward_render_displacement = 0; dvd_yuv420p_interlace = 0; // Default brender asset @@ -199,6 +200,7 @@ void Preferences::copy_from(Preferences *that) bd_warn_root = that->bd_warn_root; popupmenu_btnup = that->popupmenu_btnup; textbox_focus_policy = that->textbox_focus_policy; + forward_render_displacement = that->forward_render_displacement; dvd_yuv420p_interlace = that->dvd_yuv420p_interlace; renderfarm_nodes.remove_all_objects(); renderfarm_ports.remove_all(); @@ -352,6 +354,7 @@ int Preferences::load_defaults(BC_Hash *defaults) bd_warn_root = defaults->get("BD_WARN_ROOT", bd_warn_root); popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup); textbox_focus_policy = defaults->get("TEXTBOX_FOCUS_POLICY", textbox_focus_policy); + forward_render_displacement = defaults->get("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement); dvd_yuv420p_interlace = defaults->get("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace); use_brender = defaults->get("USE_BRENDER", use_brender); brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment); @@ -481,6 +484,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("BD_WARN_ROOT", bd_warn_root); defaults->update("POPUPMENU_BTNUP", popupmenu_btnup); defaults->update("TEXTBOX_FOCUS_POLICY", textbox_focus_policy); + defaults->update("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement); defaults->update("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace); brender_asset->save_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0); defaults->update("USE_BRENDER", use_brender); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index 85a1522d..779363a3 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -114,6 +114,8 @@ public: int popupmenu_btnup; // textbox focus policy: click, leave int textbox_focus_policy; +// forward playback starts next frame, not this frame + int forward_render_displacement; // use dvd yuv420p interlace format int dvd_yuv420p_interlace; diff --git a/cinelerra-5.1/cinelerra/renderengine.C b/cinelerra-5.1/cinelerra/renderengine.C index 8ded04e4..628255b5 100644 --- a/cinelerra-5.1/cinelerra/renderengine.C +++ b/cinelerra-5.1/cinelerra/renderengine.C @@ -544,6 +544,12 @@ void RenderEngine::run() } } + if( playback_engine->is_playing_back && command->displacement ) { + double position = playback_engine->tracking_position - + 1./command->get_edl()->session->frame_rate; + playback_engine->tracking_position = position >= 0 ? position : 0; + } + if(!interrupted) playback_engine->command->command = STOP; playback_engine->stop_tracking(); diff --git a/cinelerra-5.1/cinelerra/transportque.C b/cinelerra-5.1/cinelerra/transportque.C index 61dbdb6d..01ba565d 100644 --- a/cinelerra-5.1/cinelerra/transportque.C +++ b/cinelerra-5.1/cinelerra/transportque.C @@ -53,6 +53,7 @@ void TransportCommand::reset() realtime = 0; resume = 0; audio_toggle = 0; + displacement = 0; // Don't reset the change type for commands which don't perform the change if(command != STOP) change_type = 0; command = COMMAND_NONE; @@ -87,6 +88,7 @@ void TransportCommand::copy_from(TransportCommand *command) this->realtime = command->realtime; this->resume = command->resume; this->audio_toggle = command->audio_toggle; + this->displacement = command->displacement; } TransportCommand& TransportCommand::operator=(TransportCommand &command) @@ -160,77 +162,74 @@ float TransportCommand::get_speed() } // Assume starting without pause -void TransportCommand::set_playback_range(EDL *edl, int use_inout, int toggle_audio) +void TransportCommand::set_playback_range(EDL *edl, + int use_inout, int toggle_audio, int use_displacement) { if(!edl) edl = this->edl; - switch(command) - { + double length = edl->tracks->total_playable_length(); + double frame_period = 1.0 / edl->session->frame_rate; + double start = edl->local_session->get_selectionstart(1); + double end = edl->local_session->get_selectionend(1); + + displacement = 0; + if( use_inout ) { + if( edl->local_session->inpoint_valid() ) + start_position = edl->local_session->get_inpoint(); + if( edl->local_session->outpoint_valid() ) + end_position = edl->local_session->get_outpoint(); + } + else if( !EQUIV(start, end) ) { + start_position = start; + end_position = end; + } + else { + switch( command ) { case SLOW_FWD: case FAST_FWD: - case NORMAL_FWD: - start_position = edl->local_session->get_selectionstart(1); - if(EQUIV(edl->local_session->get_selectionend(1), edl->local_session->get_selectionstart(1))) - end_position = edl->tracks->total_playable_length(); - else - end_position = edl->local_session->get_selectionend(1); + case NORMAL_FWD: { + start_position = start; + end_position = length; // this prevents a crash if start position is after the loop when playing forwards - if (edl->local_session->loop_playback && - start_position > edl->local_session->loop_end) - { - start_position = edl->local_session->loop_start; + if( edl->local_session->loop_playback && + start_position > edl->local_session->loop_end ) { + start_position = edl->local_session->loop_start; } - break; + break; } case SLOW_REWIND: case FAST_REWIND: case NORMAL_REWIND: - end_position = edl->local_session->get_selectionend(1); - if(EQUIV(edl->local_session->get_selectionend(1), edl->local_session->get_selectionstart(1))) - start_position = 0; - else - start_position = edl->local_session->get_selectionstart(1); - + end_position = end; + start_position = 0; // this prevents a crash if start position is before the loop when playing backwards - if (edl->local_session->loop_playback && - end_position <= edl->local_session->loop_start) - { + if( edl->local_session->loop_playback && + end_position <= edl->local_session->loop_start ) { end_position = edl->local_session->loop_end; } break; case CURRENT_FRAME: case SINGLE_FRAME_FWD: - start_position = edl->local_session->get_selectionstart(1); - end_position = start_position + 1.0 / edl->session->frame_rate; + start_position = start; + end_position = start_position + frame_period; break; case SINGLE_FRAME_REWIND: - end_position = edl->local_session->get_selectionend(1); - start_position = end_position - 1.0 / edl->session->frame_rate; - break; - } - - - if(use_inout) - { - if(edl->local_session->inpoint_valid()) - start_position = edl->local_session->get_inpoint(); - if(edl->local_session->outpoint_valid()) - end_position = edl->local_session->get_outpoint(); - } - - switch(get_direction()) - { - case PLAY_FORWARD: - playbackstart = start_position; + end_position = end; + start_position = end_position - frame_period; break; + } - case PLAY_REVERSE: - playbackstart = end_position; - break; + if( use_displacement && command != CURRENT_FRAME && + get_direction() == PLAY_FORWARD ) { + start_position += frame_period; + end_position += frame_period; + displacement = 1; + } } + playbackstart = get_direction() == PLAY_FORWARD ? start_position : end_position; audio_toggle = toggle_audio; } @@ -281,8 +280,9 @@ TransportQue::~TransportQue() delete output_lock; } -int TransportQue::send_command(int command, int change_type, EDL *new_edl, - int realtime, int resume, int use_inout, int toggle_audio) +int TransportQue::send_command(int command, int change_type, + EDL *new_edl, int realtime, int resume, + int use_inout, int toggle_audio, int use_displacement) { input_lock->lock("TransportQue::send_command 1"); this->command.command = command; @@ -309,7 +309,8 @@ int TransportQue::send_command(int command, int change_type, EDL *new_edl, } // Set playback range - this->command.set_playback_range(new_edl, use_inout, toggle_audio); + this->command.set_playback_range(new_edl, + use_inout, toggle_audio, use_displacement); } input_lock->unlock(); diff --git a/cinelerra-5.1/cinelerra/transportque.h b/cinelerra-5.1/cinelerra/transportque.h index 4e9c3635..7d0c1819 100644 --- a/cinelerra-5.1/cinelerra/transportque.h +++ b/cinelerra-5.1/cinelerra/transportque.h @@ -45,7 +45,8 @@ public: void copy_from(TransportCommand *command); TransportCommand& operator=(TransportCommand &command); // Get the range to play back from the EDL - void set_playback_range(EDL *edl=0, int use_inout=0, int toggle_audio=0); + void set_playback_range(EDL *edl=0, + int use_inout=0, int toggle_audio=0, int use_displacement=0); // Adjust playback range with in/out points for rendering void playback_range_adjust_inout(); @@ -68,6 +69,8 @@ public: int infinite; // Position used when starting playback double playbackstart; +// start position at this=0/next=1 frame + int displacement; // Send output to device int realtime; // Use persistant starting point @@ -94,7 +97,8 @@ public: // Persistent starting point int resume = 0, int use_inout = 0, - int toggle_audio = 0); + int toggle_audio = 0, + int use_displacement = 0); void update_change_type(int change_type); TransportCommand command; diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index dd738ac5..c59c3fec 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -301,7 +301,7 @@ void VRender::run() // before we start dropping. int64_t current_sample, start_sample, end_sample; // Absolute counts. int64_t skip_countdown = VRENDER_THRESHOLD; // frames remaining until drop - int64_t delay_countdown = VRENDER_THRESHOLD; // Frames remaining until delay + int64_t delay_countdown = 0; // Frames remaining until delay // Number of frames before next reconfigure int64_t current_input_length; // Number of frames to skip. @@ -354,11 +354,11 @@ void VRender::run() current_sample = (int64_t)(renderengine->sync_position() * renderengine->command->get_speed()); // latest sample at which the frame can be shown. - end_sample = Units::tosamples(session_frame, + end_sample = Units::tosamples(session_frame + 1, renderengine->get_edl()->session->sample_rate, renderengine->get_edl()->session->frame_rate); // earliest sample by which the frame needs to be shown. - start_sample = Units::tosamples(session_frame - 1, + start_sample = Units::tosamples(session_frame, renderengine->get_edl()->session->sample_rate, renderengine->get_edl()->session->frame_rate); diff --git a/cinelerra-5.1/info/plugins.txt b/cinelerra-5.1/info/plugins.txt index 2382e95f..89128f48 100644 --- a/cinelerra-5.1/info/plugins.txt +++ b/cinelerra-5.1/info/plugins.txt @@ -1,7 +1,9 @@ # plugin info # # Name of plugin followed by: and then description. -# Additional lines start with a blank/tab. +# Additional lines start with 2 tabs. +# Lines should be less than 70 characters long. +# For usage/readability, a period (.) creates space. # 1080 to 480: Extracts 2 1920x540 fields from 1920x1080 image, resizes them separately, and @@ -663,7 +665,8 @@ Flash: The video flashes when transitioning between segments. IrisSquare: Video switches segments via a small rectangular view that gradually grows to full size. Shape Wipe: Wipe a specific shape across the video. Available - shapes are: circle, clock, heart, tile2x2h, tile2x2v. + shapes are: burst, circle, clock, heart, specks, spiral, + tile2x2h, tile2x2v. Slide: Image slides into view - can set: Left/Right/In/Out. Wipe: Wipe the image across screen starting left or right. Zoom: Zoom out video at X/Y magnification for some seconds.