#include "mwindowgui.h"
#include "patchbay.h"
#include "tracking.h"
+#include "tracks.h"
#include "playbackengine.h"
#include "playtransport.h"
#include "preferences.h"
#include "mainsession.h"
#include "trackcanvas.h"
#include "transportque.h"
+#include "videodevice.h"
+#include "vdevicex11.h"
#include "vrender.h"
init_meters();
}
-void PlaybackEngine::stop_tracking()
+void PlaybackEngine::stop_tracking(double position)
{
+ tracking_position = position;
tracking_active = 0;
stop_cursor();
tracking_done->unlock();
// Dispatch the command
start_render_engine();
break;
-
- case SINGLE_FRAME_FWD:
- case SINGLE_FRAME_REWIND:
// fall through
default:
is_playing_back = 1;
+ case REWIND:
+ case GOTO_END:
perform_change();
arm_render_engine();
// Start tracking after arming so the tracking position doesn't change.
// The tracking for a single frame command occurs during PAUSE
init_tracking();
- if( !command->single_frame() )
- clear_output();
+ clear_borders();
// Dispatch the command
start_render_engine();
break;
}
}
-void PlaybackEngine::clear_output()
+void PlaybackEngine::clear_borders()
{
- BC_WindowBase *cwdw = output->get_canvas();
- if( !cwdw ) return;
- cwdw->lock_window("PlaybackEngine::clear_output");
- output->clear();
- cwdw->unlock_window();
+ EDL *edl = command->get_edl();
+ PlaybackConfig *config = edl->session->playback_config;
+ if( config->vconfig->driver == PLAYBACK_X11_GL ) {
+ if( render_engine && render_engine->video ) {
+ VDeviceBase *vdriver = render_engine->video->get_output_base();
+ ((VDeviceX11*)vdriver)->clear_output();
+ return;
+ }
+ }
+ BC_WindowBase *window = output->get_canvas();
+ if( !window ) return;
+ window->lock_window("PlaybackEngine::clear_output");
+ output->clear_borders(edl);
+ window->unlock_window();
}
void PlaybackEngine::stop_playback(int wait_tracking)
renderengine_lock->unlock();
}
+int PlaybackEngine::get_direction()
+{
+ int curr_command = is_playing_back ? this->command->command : STOP;
+ return TransportCommand::get_direction(curr_command);
+}
void PlaybackEngine::send_command(int command, EDL *edl, int wait_tracking, int use_inout)
{
//printf("PlaybackEngine::send_command 1 %d\n", command);
// Stop requires transferring the output buffer to a refresh buffer.
- int do_stop = 0;
int curr_command = is_playing_back ? this->command->command : STOP;
int curr_single_frame = TransportCommand::single_frame(curr_command);
int curr_audio = this->command->toggle_audio ?
int single_frame = TransportCommand::single_frame(command);
int next_audio = next_command->toggle_audio ? !single_frame : single_frame;
float next_speed = next_command->speed;
-
// Dispatch command
switch( command ) {
+ case STOP:
+ transport_stop(wait_tracking);
+ break;
case FAST_REWIND: // Commands that play back
case NORMAL_REWIND:
case SLOW_REWIND:
if( next_speed ) curr_command = COMMAND_NONE;
// Same direction pressed twice, not shuttle, and no change in audio state, Stop
if( curr_command == command && !curr_single_frame &&
- curr_audio == next_audio ) { do_stop = 1; break; }
-
+ curr_audio == next_audio ) {
+ transport_stop(wait_tracking);
+ break;
+ }
// Resume or change direction
switch( curr_command ) {
- default:
- transport_stop(0);
- next_command->resume = 1;
-// fall through
+ case REWIND:
+ case GOTO_END:
case STOP:
case COMMAND_NONE:
case SINGLE_FRAME_FWD:
case SINGLE_FRAME_REWIND:
case CURRENT_FRAME:
case LAST_FRAME:
- next_command->realtime = 1;
-// Start from scratch
- transport_command(command, CHANGE_NONE, edl, use_inout);
+// already stopped
+ break;
+ default:
+ transport_stop(0);
+ next_command->resume = 1;
break;
}
+ next_command->realtime = 1;
+ transport_command(command, CHANGE_NONE, edl, use_inout);
break;
-
-// Commands that stop
- case STOP:
case REWIND:
case GOTO_END:
- do_stop = 1;
+ transport_stop(1);
+ next_command->realtime = 1;
+ transport_command(command, CHANGE_NONE, edl, use_inout);
+ stop_tracking(this->command->playbackstart);
break;
}
-
- if( do_stop ) {
- transport_stop(wait_tracking);
- }
}
int PlaybackEngine::put_command(TransportCommand *command, int reset)
// Just change the EDL if the change requires it because renderengine
// structures won't point to the new EDL otherwise and because copying the
// EDL for every cursor movement is slow.
- if( change_type & CHANGE_EDL )
+ if( change_type == CHANGE_EDL || change_type == CHANGE_ALL )
next_command->get_edl()->copy_all(new_edl);
- else if( change_type & CHANGE_PARAMS )
+ else if( change_type == CHANGE_PARAMS )
next_command->get_edl()->synchronize_params(new_edl);
next_command->set_playback_range(new_edl, use_inout,
preferences->forward_render_displacement);