awindowgui / mwindowedit / label rework
[goodguy/history.git] / cinelerra-5.1 / cinelerra / playbackengine.C
index 7f31a6c13117f23b9669be4cff7c294855293273..802b7b610c24e04ed931085319a6310d3d0fa4f4 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  */
 
 #include "bchash.h"
@@ -66,7 +66,7 @@ PlaybackEngine::~PlaybackEngine()
 {
        done = 1;
        que->send_command(STOP,
-               CHANGE_NONE, 
+               CHANGE_NONE,
                0,
                0);
        interrupt_playback();
@@ -107,8 +107,6 @@ ChannelDB* PlaybackEngine::get_channeldb()
        {
                case VIDEO4LINUX2JPEG:
                        return mwindow->channeldb_v4l2jpeg;
-               case PLAYBACK_BUZ:
-                       return mwindow->channeldb_buz;
        }
        return 0;
 }
@@ -117,13 +115,7 @@ int PlaybackEngine::create_render_engine()
 {
 // Fix playback configurations
        delete_render_engine();
-
-
-       render_engine = new RenderEngine(this,
-               preferences, 
-               output,
-               get_channeldb(),
-               0);
+       render_engine = new RenderEngine(this, preferences, output, 0);
 //printf("PlaybackEngine::create_render_engine %d\n", __LINE__);
        return 0;
 }
@@ -252,7 +244,7 @@ void PlaybackEngine::stop_cursor()
 
 void PlaybackEngine::init_tracking()
 {
-       tracking_active = !command->single_frame() ? 1 : 0; 
+       tracking_active = !command->single_frame() ? 1 : 0;
        tracking_position = command->playbackstart;
        tracking_done->lock("PlaybackEngine::init_tracking");
        init_cursor(tracking_active);
@@ -308,8 +300,8 @@ double PlaybackEngine::get_tracking_position()
                        if(command->get_direction() == PLAY_FORWARD)
                        {
 // Interpolate
-                               result = tracking_position + 
-                                       command->get_speed() * 
+                               result = tracking_position +
+                                       command->get_speed() *
                                        tracking_timer.get_difference() /
                                        1000.0;
 
@@ -323,8 +315,8 @@ double PlaybackEngine::get_tracking_position()
                        else
                        {
 // Interpolate
-                               result = tracking_position - 
-                                       command->get_speed() * 
+                               result = tracking_position -
+                                       command->get_speed() *
                                        tracking_timer.get_difference() /
                                        1000.0;
 
@@ -366,7 +358,6 @@ void PlaybackEngine::run()
 
                wait_render_engine();
 
-
 // Read the new command
                que->input_lock->lock("PlaybackEngine::run");
                if(done) return;
@@ -377,7 +368,6 @@ void PlaybackEngine::run()
 
 //printf("PlaybackEngine::run 1 %d\n", command->command);
 
-
                switch(command->command)
                {
 // Parameter change only
@@ -431,4 +421,13 @@ void PlaybackEngine::run()
 }
 
 
+void PlaybackEngine::stop_playback()
+{
+       que->send_command(STOP, CHANGE_NONE, 0, 0);
+       interrupt_playback(1);
+       renderengine_lock->lock("PlaybackEngine::stop_playback");
+       if(render_engine)
+               render_engine->wait_done();
+       renderengine_lock->unlock();
+}