Credit Andrew - updating patches for FFmpeg 7.0 as needed since 6.1, now at 7.0,...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / yuv411 / yuv411.C
index 100541f5c27a553928f76a44a5e160735f1a41ed..7bfd2f441dd1730fea7dfd951643311f88a6c3d3 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * CINELERRA
+ * Copyright (C) 2016 Eric Olson
+ *
+ * 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 "clip.h"
 #include "bccmodels.h"
 #include "bchash.h"
@@ -13,6 +33,11 @@ REGISTER_PLUGIN(yuv411Main)
 
 
 yuv411Config::yuv411Config()
+{
+       reset();
+}
+
+void yuv411Config::reset()
 {
        int_horizontal = 0;
        avg_vertical = 0;
@@ -156,7 +181,7 @@ int yuv411Main::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
        load_configuration();
        int w = input_ptr->get_w();
        int h = input_ptr->get_h();
-       int colormodel = input_ptr->get_color_model();
+       colormodel = input_ptr->get_color_model();
 
        if( input_ptr == output_ptr ||
            ( config.avg_vertical && config.int_horizontal ) ) {
@@ -182,11 +207,7 @@ int yuv411Main::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
                break;
        }
 
-       if( this->colormodel != colormodel ) {
-               this->colormodel = colormodel;
-               send_render_gui(this);
-       }
-
+       send_render_gui(this);
        return 0;
 }
 
@@ -216,19 +237,23 @@ void yuv411Main::update_gui()
 void yuv411Main::render_gui(void *data)
 {
        if(thread) {
-               thread->window->lock_window();
                yuv411Window *window = (yuv411Window *)thread->window;
                yuv411Main *client = (yuv411Main *)data;
-               switch( client->colormodel ) {
-               case BC_YUV888:
-               case BC_YUVA8888:
-                       window->show_warning(0);
-                       break;
-               default:
-                       window->show_warning(1);
-                       break;
+               if( window->colormodel != client->colormodel ) {
+                       int warn = 1;
+                       switch( client->colormodel ) {
+                       case BC_YUV888:
+                       case BC_YUVA8888:
+                               warn = 0;
+                               break;
+                       }
+                       if( warn == window->yuv_warning->is_hidden() ) {
+                               window->lock_window("yuv411Main::render_gui");
+                               window->show_warning(warn);
+                               window->colormodel = client->colormodel;
+                               window->unlock_window();
+                       }
                }
-               window->unlock_window();
        }
 }