Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / renderengine.C
index ed991791f4e147e901da032af26dda5b89bab6e0..7e7a52d75163c108adfe90165b8845b0b07eaa70 100644 (file)
@@ -24,6 +24,7 @@
 #include "asset.h"
 #include "audiodevice.h"
 #include "bcsignals.h"
+#include "canvas.h"
 #include "condition.h"
 #include "edl.h"
 #include "edlsession.h"
@@ -61,7 +62,7 @@ RenderEngine::RenderEngine(PlaybackEngine *playback_engine,
        do_video = 0;
        interrupted = 0;
        this->preferences = new Preferences;
-       this->command = new TransportCommand;
+       this->command = new TransportCommand(preferences);
        this->preferences->copy_from(preferences);
        edl = 0;
 
@@ -468,18 +469,16 @@ void RenderEngine::run()
        close_output();
 
        if( playback_engine ) {
-               double position = command->command == CURRENT_FRAME ? command->playbackstart :
+               double position = command->command == CURRENT_FRAME ||
+                               command->command == LAST_FRAME ? command->playbackstart :
                        playback_engine->is_playing_back && !interrupted ?
                                ( command->get_direction() == PLAY_FORWARD ?
                                        command->end_position : command->start_position ) :
                                playback_engine->get_tracking_position() ;
-               if( command->displacement ) {
-                       position -= 1./command->get_edl()->session->frame_rate;
-                       if( position < 0 ) position = 0;
-               }
+               position -= command->displacement;
+               if( position < 0 ) position = 0;
                playback_engine->is_playing_back = 0;
-               playback_engine->tracking_position = position;
-               playback_engine->stop_tracking();
+               playback_engine->stop_tracking(position);
        }
 
        render_active->unlock();
@@ -493,3 +492,11 @@ void RenderEngine::wait_done()
        render_active->unlock();
 }
 
+void RenderEngine::update_scope(VFrame *frame)
+{
+       if( !video || !output || !output->scope_on() ) return;
+       output->lock_canvas("RenderEngine::update_scope");
+       output->process_scope(video, frame);
+       output->unlock_canvas();
+}
+