dynamic keyframes, textbox rework, andrea ffmpeg.opts, perpetual chkpt undo, lv2...
[goodguy/history.git] / cinelerra-5.1 / plugins / delayvideo / delayvideo.C
index 7bdcd6d3075c107112665046b8ee586e152b66f7..2ec90f04f3a7f916b08fa638e1820d17d280dc45 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 "bcdisplayinfo.h"
@@ -58,10 +58,10 @@ void DelayVideoConfig::copy_from(DelayVideoConfig &that)
        length = that.length;
 }
 
-void DelayVideoConfig::interpolate(DelayVideoConfig &prev, 
-               DelayVideoConfig &next, 
-               int64_t prev_frame, 
-               int64_t next_frame, 
+void DelayVideoConfig::interpolate(DelayVideoConfig &prev,
+               DelayVideoConfig &next,
+               int64_t prev_frame,
+               int64_t next_frame,
                int64_t current_frame)
 {
        this->length = prev.length;
@@ -70,11 +70,11 @@ void DelayVideoConfig::interpolate(DelayVideoConfig &prev,
 
 
 DelayVideoWindow::DelayVideoWindow(DelayVideo *plugin)
- : PluginClientWindow(plugin, 
-       210, 
-       120, 
-       210, 
-       120, 
+ : PluginClientWindow(plugin,
+       210,
+       120,
+       210,
+       120,
        0)
 {
        this->plugin = plugin;
@@ -84,11 +84,11 @@ DelayVideoWindow::~DelayVideoWindow()
 {
 }
 
-       
+
 void DelayVideoWindow::create_objects()
 {
        int x = 10, y = 10;
-       
+
        add_subwindow(new BC_Title(x, y, _("Delay seconds:")));
        y += 20;
        slider = new DelayVideoSlider(this, plugin, x, y);
@@ -116,15 +116,15 @@ void DelayVideoWindow::update_gui()
 
 
 DelayVideoSlider::DelayVideoSlider(DelayVideoWindow *window,
-       DelayVideo *plugin, 
-       int x, 
+       DelayVideo *plugin,
+       int x,
        int y)
  : BC_TumbleTextBox(window,
        (float)plugin->config.length,
        (float)0,
        (float)10,
-       x, 
-       y, 
+       x,
+       y,
        150)
 {
        this->plugin = plugin;
@@ -168,7 +168,7 @@ DelayVideo::~DelayVideo()
                for(int i = 0; i < allocation; i++)
                        delete buffer[i];
 //printf("DelayVideo::~DelayVideo 1\n");
-       
+
                delete [] buffer;
 //printf("DelayVideo::~DelayVideo 1\n");
        }
@@ -195,12 +195,8 @@ void DelayVideo::reconfigure()
 
        for(int i = reuse; i < new_allocation; i++)
        {
-               new_buffer[i] = new VFrame(0, 
-                       -1,
-                       input->get_w(),
-                       input->get_h(),
-                       PluginVClient::project_color_model,
-                       -1);
+               new_buffer[i] = new VFrame(input->get_w(), input->get_h(),
+                       PluginVClient::project_color_model, 0);
        }
 
        for(int i = reuse; i < allocation; i++)
@@ -209,11 +205,11 @@ void DelayVideo::reconfigure()
        }
 
        if(buffer) delete [] buffer;
-       
-       
+
+
        buffer = new_buffer;
        allocation = new_allocation;
-       
+
        need_reconfigure = 0;
 }
 
@@ -231,7 +227,7 @@ int DelayVideo::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
 
        buffer[allocation - 1]->copy_from(input_ptr);
        output_ptr->copy_from(buffer[0]);
-       
+
        VFrame *temp = buffer[0];
        for(int i = 0; i < allocation - 1; i++)
        {
@@ -240,8 +236,8 @@ int DelayVideo::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
 
        buffer[allocation - 1] = temp;
 //printf("DelayVideo::process_realtime 4\n");
-       
-       
+
+
        return 0;
 }
 
@@ -250,7 +246,7 @@ int DelayVideo::is_realtime()
        return 1;
 }
 
-const char* DelayVideo::plugin_title() { return _("Delay Video"); }
+const char* DelayVideo::plugin_title() { return N_("Delay Video"); }
 
 LOAD_CONFIGURATION_MACRO(DelayVideo, DelayVideoConfig)
 NEW_WINDOW_MACRO(DelayVideo, DelayVideoWindow)
@@ -259,7 +255,7 @@ NEW_WINDOW_MACRO(DelayVideo, DelayVideoWindow)
 void DelayVideo::save_data(KeyFrame *keyframe)
 {
        FileXML output;
-       output.set_shared_output(keyframe->get_data(), MESSAGESIZE);
+       output.set_shared_output(keyframe->xbuf);
 
        output.tag.set_title("DELAYVIDEO");
        output.tag.set_property("LENGTH", (double)config.length);
@@ -273,7 +269,7 @@ void DelayVideo::save_data(KeyFrame *keyframe)
 void DelayVideo::read_data(KeyFrame *keyframe)
 {
        FileXML input;
-       input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data()));
+       input.set_shared_input(keyframe->xbuf);
 
        int result = 0;
        while(!result)
@@ -292,7 +288,7 @@ void DelayVideo::read_data(KeyFrame *keyframe)
 
 void DelayVideo::update_gui()
 {
-       if(thread) 
+       if(thread)
        {
                load_configuration();
                ((DelayVideoWindow*)thread->window)->lock_window();