]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/atmo/atmo.cpp
String removal
[vlc] / modules / video_filter / atmo / atmo.cpp
index a3f5ed95e67ede0a7ca272ed574bf7a6af87b372..27e0f867bd495f51d4529aacbcd70069dffc9c96 100644 (file)
@@ -1,25 +1,29 @@
 /*****************************************************************************
-* atmo.cpp : "Atmo Light" video filter
-*****************************************************************************
-* Copyright (C) 2000-2006 the VideoLAN team
-* $Id$
-*
-* Authors: AndrĂ© Weber (WeberAndre@gmx.de)
-*
-* 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-*****************************************************************************/
+ * atmo.cpp : "Atmo Light" video filter
+ *****************************************************************************
+ * Copyright (C) 2000-2006 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: AndrĂ© Weber (WeberAndre@gmx.de)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 /*****************************************************************************
 * Preamble
 #include <math.h>                                            /* sin(), cos() */
 #include <assert.h>
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
 // #define __ATMO_DEBUG__
 
 // [:Zs]+$
 
 #include <vlc_playlist.h>
 #include <vlc_filter.h>
+#include <vlc_atomic.h>
+#include <vlc_charset.h>
+
+#include "filter_picture.h"
 
 #include "AtmoDefs.h"
 #include "AtmoDynData.h"
@@ -116,7 +120,7 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename);
 strings for settings menus and hints
 */
 #define MODULE_DESCRIPTION N_ ( \
- "This module allows to control an so called AtmoLight device "\
+ "This module allows controlling an so called AtmoLight device "\
  "connected to your computer.\n"\
  "AtmoLight is the homegrown version of what Philips calls AmbiLight.\n"\
  "If you need further information feel free to visit us at\n\n"\
@@ -168,7 +172,7 @@ static const char *const ppsz_device_type_descriptions[] = {
 #define FNORDLICHT_AMOUNT_TEXT      N_("Count of fnordlicht's")
 #define FNORDLICHT_AMOUNT_LONGTEXT  N_("Depending on the amount your " \
                                    "fnordlicht hardware " \
-                                   "choose 1 to 4 channels")
+                                   "choose 1 to 254 channels")
 
 #if defined( WIN32 )
 #  define DEFAULT_DEVICE   0
@@ -226,7 +230,7 @@ static const char *const ppsz_device_type_descriptions[] = {
 #define ZONE_BOTTOM_TEXT       N_("Number of zones on bottom")
 #define ZONE_BOTTOM_LONGTEXT   N_("Number of zones on the bottom of the screen")
 #define ZONE_LR_TEXT           N_("Zones on left / right side")
-#define ZONE_LR_LONGTEXT       N_("left and right side having allways the " \
+#define ZONE_LR_LONGTEXT       N_("left and right side having always the " \
                                   "same number of zones")
 #define ZONE_SUMMARY_TEXT      N_("Calculate a average zone")
 #define ZONE_SUMMARY_LONGTEXT  N_("it contains the average of all pixels " \
@@ -253,12 +257,12 @@ static const char *const ppsz_device_type_descriptions[] = {
                                 "On Windows usually something like COM1 or " \
                                 "COM2. On Linux /dev/ttyS01 f.e.")
 
-#define EDGE_TEXT            N_("Edge Weightning")
+#define EDGE_TEXT            N_("Edge weightning")
 #define EDGE_LONGTEXT        N_("Increasing this value will result in color "\
                                 "more depending on the border of the frame.")
 #define BRIGHTNESS_TEXT     N_("Brightness")
 #define BRIGHTNESS_LONGTEXT N_("Overall brightness of your LED stripes")
-#define DARKNESS_TEXT       N_("Darkness Limit")
+#define DARKNESS_TEXT       N_("Darkness limit")
 #define DARKNESS_LONGTEXT   N_("Pixels with a saturation lower than this will "\
                                "be ignored. Should be greater than one for "\
                                "letterboxed videos.")
@@ -273,7 +277,7 @@ static const char *const ppsz_device_type_descriptions[] = {
 #define MEANTHRESHOLD_TEXT     N_("Filter threshold")
 #define MEANTHRESHOLD_LONGTEXT N_("How much a color has to be changed for an "\
                                   "immediate color change.")
-#define MEANPERCENTNEW_TEXT     N_("Filter Smoothness (in %)")
+#define MEANPERCENTNEW_TEXT     N_("Filter smoothness (%)")
 #define MEANPERCENTNEW_LONGTEXT N_("Filter Smoothness")
 
 #define FILTERMODE_TEXT        N_("Output Color filter mode")
@@ -369,22 +373,22 @@ set_capability( "video filter2", 0 )
 
 set_section( N_("Choose Devicetype and Connection" ), 0 )
 
-add_integer( CFG_PREFIX "device", DEFAULT_DEVICE, NULL,
+add_integer( CFG_PREFIX "device", DEFAULT_DEVICE,
             DRIVER_TEXT, DRIVER_LONGTEXT, false )
 change_integer_list( pi_device_type_values,
-                     ppsz_device_type_descriptions, 0 )
+                     ppsz_device_type_descriptions )
 
 #if defined(WIN32)
-add_string(CFG_PREFIX "serialdev", "COM1", NULL,
+add_string(CFG_PREFIX "serialdev", "COM1",
            SERIALDEV_TEXT, SERIALDEV_LONGTEXT, false )
 /*
     on win32 the executeable external driver application
     for automatic start if needed
 */
-add_file(CFG_PREFIX "atmowinexe", NULL, NULL,
-         ATMOWINEXE_TEXT, ATMOWINEXE_LONGTEXT, false )
+add_loadfile(CFG_PREFIX "atmowinexe", NULL,
+             ATMOWINEXE_TEXT, ATMOWINEXE_LONGTEXT, false )
 #else
-add_string(CFG_PREFIX "serialdev", "/dev/ttyUSB0", NULL,
+add_string(CFG_PREFIX "serialdev", "/dev/ttyUSB0",
            SERIALDEV_TEXT, SERIALDEV_LONGTEXT, false )
 #endif
 
@@ -393,15 +397,15 @@ add_string(CFG_PREFIX "serialdev", "/dev/ttyUSB0", NULL,
     your movie ... used for both buildin / external
 */
 set_section( N_("Illuminate the room with this color on pause" ), 0 )
-add_bool(CFG_PREFIX "usepausecolor", false, NULL,
+add_bool(CFG_PREFIX "usepausecolor", false,
          PCOLOR_TEXT, PCOLOR_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "pcolor-red",   0, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "pcolor-red",   0, 0, 255,
                        PCOLOR_RED_TEXT, PCOLOR_RED_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "pcolor-green", 0, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "pcolor-green", 0, 0, 255,
                        PCOLOR_GREEN_TEXT, PCOLOR_GREEN_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "pcolor-blue",  192, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "pcolor-blue",  192, 0, 255,
                        PCOLOR_BLUE_TEXT, PCOLOR_BLUE_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "fadesteps", 50, 1, 250, NULL,
+add_integer_with_range(CFG_PREFIX "fadesteps", 50, 1, 250,
                        FADESTEPS_TEXT, FADESTEPS_LONGTEXT, false)
 
 /*
@@ -409,31 +413,31 @@ add_integer_with_range(CFG_PREFIX "fadesteps", 50, 1, 250, NULL,
     used for both buildin / external
 */
 set_section( N_("Illuminate the room with this color on shutdown" ), 0 )
-add_integer_with_range(CFG_PREFIX "ecolor-red",   192, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "ecolor-red",   192, 0, 255,
                        ECOLOR_RED_TEXT,   ECOLOR_RED_LONGTEXT,   false)
-add_integer_with_range(CFG_PREFIX "ecolor-green", 192, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "ecolor-green", 192, 0, 255,
                        ECOLOR_GREEN_TEXT, ECOLOR_GREEN_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "ecolor-blue",  192, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "ecolor-blue",  192, 0, 255,
                        ECOLOR_BLUE_TEXT,  ECOLOR_BLUE_LONGTEXT,  false)
-add_integer_with_range(CFG_PREFIX "efadesteps",    50, 1, 250, NULL,
+add_integer_with_range(CFG_PREFIX "efadesteps",    50, 1, 250,
                        EFADESTEPS_TEXT,   EFADESTEPS_LONGTEXT,    false)
 
 
 set_section( N_("DMX options" ), 0 )
-add_integer_with_range(CFG_PREFIX "dmx-channels",   5, 1, 64, NULL,
+add_integer_with_range(CFG_PREFIX "dmx-channels",   5, 1, 64,
                        DMX_CHANNELS_TEXT, DMX_CHANNELS_LONGTEXT, false)
-add_string(CFG_PREFIX "dmx-chbase", "0,3,6,9,12", NULL,
+add_string(CFG_PREFIX "dmx-chbase", "0,3,6,9,12",
                        DMX_CHBASE_TEXT, DMX_CHBASE_LONGTEXT, false )
 
 set_section( N_("MoMoLight options" ), 0 )
-add_integer_with_range(CFG_PREFIX "momo-channels",   3, 3, 4, NULL,
+add_integer_with_range(CFG_PREFIX "momo-channels",   3, 3, 4,
                        MOMO_CHANNELS_TEXT, MOMO_CHANNELS_LONGTEXT, false)
 
 /* 2,2,4 means 2 is the default value, 1 minimum amount,
    4 maximum amount
 */
 set_section( N_("fnordlicht options" ), 0 )
-add_integer_with_range(CFG_PREFIX "fnordlicht-amount",   2, 1, 4, NULL,
+add_integer_with_range(CFG_PREFIX "fnordlicht-amount",   2, 1, 254,
                        FNORDLICHT_AMOUNT_TEXT,
                        FNORDLICHT_AMOUNT_LONGTEXT, false)
 
@@ -475,13 +479,13 @@ add_integer_with_range(CFG_PREFIX "fnordlicht-amount",   2, 1, 4, NULL,
 */
 
 set_section( N_("Zone Layout for the build-in Atmo" ), 0 )
-add_integer_with_range(CFG_PREFIX "zones-top",   1, 0, 16, NULL,
+add_integer_with_range(CFG_PREFIX "zones-top",   1, 0, 16,
                        ZONE_TOP_TEXT, ZONE_TOP_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "zones-bottom",   1, 0, 16, NULL,
+add_integer_with_range(CFG_PREFIX "zones-bottom",   1, 0, 16,
                        ZONE_BOTTOM_TEXT, ZONE_BOTTOM_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "zones-lr",   1, 0, 16, NULL,
+add_integer_with_range(CFG_PREFIX "zones-lr",   1, 0, 16,
                        ZONE_LR_TEXT, ZONE_LR_LONGTEXT, false)
-add_bool(CFG_PREFIX "zone-summary", false, NULL,
+add_bool(CFG_PREFIX "zone-summary", false,
          ZONE_SUMMARY_TEXT, ZONE_SUMMARY_LONGTEXT, false)
 
 /*
@@ -492,68 +496,68 @@ add_bool(CFG_PREFIX "zone-summary", false, NULL,
 */
 set_section( N_("Settings for the built-in Live Video Processor only" ), 0 )
 
-add_integer_with_range(CFG_PREFIX "edgeweightning",   3, 1, 30, NULL,
+add_integer_with_range(CFG_PREFIX "edgeweightning",   3, 1, 30,
                        EDGE_TEXT, EDGE_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "brightness",   100, 50, 300, NULL,
+add_integer_with_range(CFG_PREFIX "brightness",   100, 50, 300,
                        BRIGHTNESS_TEXT, BRIGHTNESS_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "darknesslimit",   3, 0, 10, NULL,
+add_integer_with_range(CFG_PREFIX "darknesslimit",   3, 0, 10,
                        DARKNESS_TEXT, DARKNESS_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "huewinsize",   3, 0, 5, NULL,
+add_integer_with_range(CFG_PREFIX "huewinsize",   3, 0, 5,
                        HUEWINSIZE_TEXT, HUEWINSIZE_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "satwinsize",   3, 0, 5, NULL,
+add_integer_with_range(CFG_PREFIX "satwinsize",   3, 0, 5,
                        SATWINSIZE_TEXT, SATWINSIZE_LONGTEXT, false)
 
-add_integer(CFG_PREFIX "filtermode", (int)afmCombined, NULL,
+add_integer(CFG_PREFIX "filtermode", (int)afmCombined,
             FILTERMODE_TEXT, FILTERMODE_LONGTEXT, false )
 
-change_integer_list(pi_filtermode_values, ppsz_filtermode_descriptions, NULL )
+change_integer_list(pi_filtermode_values, ppsz_filtermode_descriptions )
 
-add_integer_with_range(CFG_PREFIX "meanlength",    300, 300, 5000, NULL,
+add_integer_with_range(CFG_PREFIX "meanlength",    300, 300, 5000,
                        MEANLENGTH_TEXT, MEANLENGTH_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "meanthreshold",  40, 1, 100, NULL,
+add_integer_with_range(CFG_PREFIX "meanthreshold",  40, 1, 100,
                        MEANTHRESHOLD_TEXT, MEANTHRESHOLD_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "percentnew", 50, 1, 100, NULL,
+add_integer_with_range(CFG_PREFIX "percentnew", 50, 1, 100,
                       MEANPERCENTNEW_TEXT, MEANPERCENTNEW_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "framedelay", 18, 0, 200, NULL,
+add_integer_with_range(CFG_PREFIX "framedelay", 18, 0, 200,
                        FRAMEDELAY_TEXT, FRAMEDELAY_LONGTEXT, false)
 
 /*
   output channel reordering
 */
 set_section( N_("Change channel assignment (fixes wrong wiring)" ), 0 )
-add_integer( CFG_PREFIX "channel_0", 4, NULL,
+add_integer( CFG_PREFIX "channel_0", 4,
             CHANNEL_0_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false )
 change_integer_list( pi_zone_assignment_values,
-                     ppsz_zone_assignment_descriptions, 0 )
+                     ppsz_zone_assignment_descriptions )
 
-add_integer( CFG_PREFIX "channel_1", 3, NULL,
+add_integer( CFG_PREFIX "channel_1", 3,
             CHANNEL_1_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false )
 change_integer_list( pi_zone_assignment_values,
-                     ppsz_zone_assignment_descriptions, 0 )
+                     ppsz_zone_assignment_descriptions )
 
-add_integer( CFG_PREFIX "channel_2", 1, NULL,
+add_integer( CFG_PREFIX "channel_2", 1,
             CHANNEL_2_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false )
 change_integer_list( pi_zone_assignment_values,
-                     ppsz_zone_assignment_descriptions, 0 )
+                     ppsz_zone_assignment_descriptions )
 
-add_integer( CFG_PREFIX "channel_3", 0, NULL,
+add_integer( CFG_PREFIX "channel_3", 0,
             CHANNEL_3_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false )
 change_integer_list( pi_zone_assignment_values,
-                     ppsz_zone_assignment_descriptions, 0 )
+                     ppsz_zone_assignment_descriptions )
 
-add_integer( CFG_PREFIX "channel_4", 2, NULL,
+add_integer( CFG_PREFIX "channel_4", 2,
             CHANNEL_4_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false )
 change_integer_list( pi_zone_assignment_values,
-                     ppsz_zone_assignment_descriptions, 0 )
+                     ppsz_zone_assignment_descriptions )
 
-add_string(CFG_PREFIX "channels", NULL, NULL,
+add_string(CFG_PREFIX "channels", "",
            CHANNELS_ASSIGN_TEXT, CHANNELS_ASSIGN_LONGTEXT, false )
 
 
@@ -561,15 +565,15 @@ add_string(CFG_PREFIX "channels", NULL, NULL,
   LED color white calibration
 */
 set_section( N_("Adjust the white light to your LED stripes" ), 0 )
-add_bool(CFG_PREFIX "whiteadj", true, NULL,
+add_bool(CFG_PREFIX "whiteadj", true,
          USEWHITEADJ_TEXT, USEWHITEADJ_LONGTEXT, false)
-add_integer_with_range(CFG_PREFIX "white-red",   255, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "white-red",   255, 0, 255,
                        WHITE_RED_TEXT,   WHITE_RED_LONGTEXT,   false)
 
-add_integer_with_range(CFG_PREFIX "white-green", 255, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "white-green", 255, 0, 255,
                        WHITE_GREEN_TEXT, WHITE_GREEN_LONGTEXT, false)
 
-add_integer_with_range(CFG_PREFIX "white-blue",  255, 0, 255, NULL,
+add_integer_with_range(CFG_PREFIX "white-blue",  255, 0, 255,
                        WHITE_BLUE_TEXT,  WHITE_BLUE_LONGTEXT,  false)
 /* end of definition of parameter for the buildin filter ... part 1 */
 
@@ -583,34 +587,34 @@ effects with this...) the images MUST not compressed, should have 24-bit per
 pixel, or a simple 256 color grayscale palette
 */
 set_section( N_("Change gradients" ), 0 )
-add_file(CFG_PREFIX "gradient_zone_0", NULL, NULL,
-         ZONE_0_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
-add_file(CFG_PREFIX "gradient_zone_1", NULL, NULL,
-         ZONE_1_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
-add_file(CFG_PREFIX "gradient_zone_2", NULL, NULL,
-         ZONE_2_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
-add_file(CFG_PREFIX "gradient_zone_3", NULL, NULL,
-         ZONE_3_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
-add_file(CFG_PREFIX "gradient_zone_4", NULL, NULL,
-         ZONE_4_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
-add_directory(CFG_PREFIX "gradient_path", NULL, NULL,
+add_loadfile(CFG_PREFIX "gradient_zone_0", NULL,
+             ZONE_0_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
+add_loadfile(CFG_PREFIX "gradient_zone_1", NULL,
+             ZONE_1_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
+add_loadfile(CFG_PREFIX "gradient_zone_2", NULL,
+             ZONE_2_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
+add_loadfile(CFG_PREFIX "gradient_zone_3", NULL,
+             ZONE_3_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
+add_loadfile(CFG_PREFIX "gradient_zone_4", NULL,
+             ZONE_4_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true )
+add_directory(CFG_PREFIX "gradient_path", NULL,
            GRADIENT_PATH_TEXT, GRADIENT_PATH_LONGTEXT, false )
 
 #if defined(__ATMO_DEBUG__)
-add_bool(CFG_PREFIX "saveframes", false, NULL,
+add_bool(CFG_PREFIX "saveframes", false,
          SAVEFRAMES_TEXT, SAVEFRAMES_LONGTEXT, false)
-add_string(CFG_PREFIX "framepath", "", NULL,
+add_string(CFG_PREFIX "framepath", "",
            FRAMEPATH_TEXT, FRAMEPATH_LONGTEXT, false )
 #endif
 /*
    may be later if computers gets more power ;-) than now we increase
    the samplesize from which we do the stats for output color calculation
 */
-add_integer_with_range(CFG_PREFIX "width",  64, 64, 512, NULL,
+add_integer_with_range(CFG_PREFIX "width",  64, 64, 512,
                        WIDTH_TEXT,  WIDTH_LONGTEXT, true)
-add_integer_with_range(CFG_PREFIX "height", 48, 48, 384, NULL,
+add_integer_with_range(CFG_PREFIX "height", 48, 48, 384,
                        HEIGHT_TEXT,  HEIGHT_LONGTEXT, true)
-add_bool(CFG_PREFIX "showdots", false, NULL,
+add_bool(CFG_PREFIX "showdots", false,
                    SHOW_DOTS_TEXT, SHOW_DOTS_LONGTEXT, false)
 add_shortcut( "atmo" )
 set_callbacks( CreateFilter, DestroyFilter  )
@@ -697,8 +701,10 @@ static const char *const ppsz_filter_options[] = {
 */
 typedef struct
 {
-    VLC_COMMON_MEMBERS
-        filter_t *p_filter;
+    filter_t *p_filter;
+    vlc_thread_t thread;
+    vlc_atomic_t abort;
+
     /* tell the thread which color should be the target of fading */
     uint8_t ui_red;
     uint8_t ui_green;
@@ -708,7 +714,7 @@ typedef struct
 
 } fadethread_t;
 
-static void *FadeToColorThread(vlc_object_t *);
+static void *FadeToColorThread(void *);
 
 
 /*****************************************************************************
@@ -730,6 +736,8 @@ struct filter_sys_t
     bool b_show_dots;
     int32_t i_device_type;
 
+    bool b_swap_uv;
+
     int32_t i_atmo_width;
     int32_t i_atmo_height;
     /* used to disable fadeout if less than 50 frames are processed
@@ -767,7 +775,7 @@ struct filter_sys_t
     /* storage for temporal settings "volatile" */
     CAtmoDynData *p_atmo_dyndata;
     /* initialized for buildin driver with AtmoCreateTransferBuffers */
-    BITMAPINFOHEADER mini_image_format;
+    VLC_BITMAPINFOHEADER mini_image_format;
     /* is only use buildin driver! */
     uint8_t *p_atmo_transfer_buffer;
     /* end buildin driver */
@@ -814,7 +822,7 @@ static int32_t AtmoInitialize(filter_t *p_filter, bool b_for_thread)
     filter_sys_t *p_sys = p_filter->p_sys;
     if(p_sys->p_atmo_config)
     {
-        if(b_for_thread == false)
+        if(!b_for_thread)
         {
             /* open com port */
             /* setup Output Threads ... */
@@ -984,9 +992,9 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter,
         p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel *
                                                           width *  height);
 
-        memset(&p_sys->mini_image_format,0,sizeof(BITMAPINFOHEADER));
+        memset(&p_sys->mini_image_format,0,sizeof(VLC_BITMAPINFOHEADER));
 
-        p_sys->mini_image_format.biSize = sizeof(BITMAPINFOHEADER);
+        p_sys->mini_image_format.biSize = sizeof(VLC_BITMAPINFOHEADER);
         p_sys->mini_image_format.biWidth = width;
         p_sys->mini_image_format.biHeight = height;
         p_sys->mini_image_format.biBitCount = bytePerPixel*8;
@@ -1084,7 +1092,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
 {
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    if(p_sys->b_enabled == true)
+    if(p_sys->b_enabled)
     {
         msg_Dbg( p_filter, "shut down atmo!");
         /*
@@ -1103,9 +1111,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
         p_sys->b_pause_live = true;
 
 
-        p_sys->p_fadethread = (fadethread_t *)vlc_object_create( p_filter,
-                                                    sizeof(fadethread_t) );
-
+        p_sys->p_fadethread = (fadethread_t *)calloc( 1, sizeof(fadethread_t) );
         p_sys->p_fadethread->p_filter = p_filter;
         p_sys->p_fadethread->ui_red   = p_sys->ui_endcolor_red;
         p_sys->p_fadethread->ui_green = p_sys->ui_endcolor_green;
@@ -1114,14 +1120,15 @@ static void Atmo_Shutdown(filter_t *p_filter)
           p_sys->p_fadethread->i_steps  = 1;
         else
           p_sys->p_fadethread->i_steps  = p_sys->i_endfadesteps;
+        vlc_atomic_set(&p_sys->p_fadethread->abort, 0);
 
-        if( vlc_thread_create( p_sys->p_fadethread,
-            "AtmoLight fadeing",
-            FadeToColorThread,
-            VLC_THREAD_PRIORITY_LOW ) )
+        if( vlc_clone( &p_sys->p_fadethread->thread,
+                       FadeToColorThread,
+                       p_sys->p_fadethread,
+                       VLC_THREAD_PRIORITY_LOW ) )
         {
             msg_Err( p_filter, "cannot create FadeToColorThread" );
-            vlc_object_release( p_sys->p_fadethread );
+            free( p_sys->p_fadethread );
             p_sys->p_fadethread = NULL;
             vlc_mutex_unlock( &p_sys->filter_lock );
 
@@ -1130,9 +1137,9 @@ static void Atmo_Shutdown(filter_t *p_filter)
             vlc_mutex_unlock( &p_sys->filter_lock );
 
             /* wait for the thread... */
-            vlc_thread_join(p_sys->p_fadethread);
+            vlc_join(p_sys->p_fadethread->thread, NULL);
 
-            vlc_object_release(p_sys->p_fadethread);
+            free(p_sys->p_fadethread);
 
             p_sys->p_fadethread = NULL;
         }
@@ -1232,7 +1239,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
               p_filter,
               CFG_PREFIX "channels"
             );
-    if( psz_channels && strlen(psz_channels) > 0 )
+    if( !EMPTY_STR(psz_channels) )
     {
         msg_Dbg( p_filter, "deal with new zone mapping %s", psz_channels );
         int channel = 0;
@@ -1316,7 +1323,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
             p_filter,
             psz_gradient_var_name
             );
-        if(psz_gradient_file && strlen(psz_gradient_file)>0)
+        if( !EMPTY_STR(psz_gradient_file) )
         {
             msg_Dbg( p_filter, "loading gradientfile %s for "\
                                 "zone %d", psz_gradient_file, i);
@@ -1348,7 +1355,7 @@ static void Atmo_SetupBuildZones(filter_t *p_filter)
               p_filter,
               CFG_PREFIX "gradient_path"
             );
-    if( psz_gradient_path && strlen(psz_gradient_path) > 0 )
+    if( EMPTY_STR(psz_gradient_path) )
     {
         char *psz_file_name = (char *)malloc( strlen(psz_gradient_path) + 16 );
         assert( psz_file_name );
@@ -1397,7 +1404,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config)
                                                       CFG_PREFIX "serialdev" );
     char *psz_temp = psz_serialdev;
 
-    if( psz_temp && strlen(psz_temp) > 0 )
+    if( !EMPTY_STR(psz_serialdev) )
     {
         char *psz_token;
         int i_port = 0;
@@ -1528,7 +1535,7 @@ static void Atmo_SetupConfig(filter_t *p_filter, CAtmoConfig *p_atmo_config)
 
     char *psz_chbase = var_CreateGetStringCommand( p_filter,
                                                    CFG_PREFIX "dmx-chbase" );
-    if( psz_chbase && strlen(psz_chbase) > 0 )
+    if( !EMPTY_STR(psz_chbase) )
         p_atmo_config->setDMX_BaseChannels( psz_chbase );
 
     free( psz_chbase );
@@ -1557,7 +1564,6 @@ if this fails fallback to the buildin software
 */
 static void Atmo_SetupParameters(filter_t *p_filter)
 {
-    char *psz_path;
     filter_sys_t *p_sys =  p_filter->p_sys;
 
 
@@ -1593,12 +1599,12 @@ static void Atmo_SetupParameters(filter_t *p_filter)
         if(p_sys->h_AtmoCtrl == NULL)
         {
             /*
-              be clever if the location of atmowina.exe is set
+              be clever if the location of atmowin.exe is set
               try to load the dll from the same folder :-)
             */
             char *psz_path = var_CreateGetStringCommand( p_filter,
                                                CFG_PREFIX "atmowinexe" );
-            if( psz_path && strlen(psz_path) > 0 )
+            if( !EMPTY_STR(psz_path) )
             {
                 char *psz_bs = strrchr( psz_path , '\\');
                 if( psz_bs )
@@ -1612,7 +1618,9 @@ static void Atmo_SetupParameters(filter_t *p_filter)
                     if( psz_dllname )
                     {
                         msg_Dbg( p_filter, "Try Loading '%s'", psz_dllname );
-                        p_sys->h_AtmoCtrl = LoadLibraryA( psz_dllname );
+                        TCHAR* ptsz_dllname = ToT(psz_dllname);
+                        p_sys->h_AtmoCtrl = LoadLibrary( ptsz_dllname );
+                        free(ptsz_dllname);
                     }
                     free( psz_dllname );
                 }
@@ -1733,8 +1741,12 @@ static void Atmo_SetupParameters(filter_t *p_filter)
     switch( p_filter->fmt_in.video.i_chroma )
     {
     case VLC_CODEC_I420:
+        p_sys->pf_extract_mini_image = ExtractMiniImage_YUV;
+        p_sys->b_swap_uv = false;
+        break;
     case VLC_CODEC_YV12:
         p_sys->pf_extract_mini_image = ExtractMiniImage_YUV;
+        p_sys->b_swap_uv = true;
         break;
     default:
         msg_Warn( p_filter, "InitFilter-unsupported chroma: %4.4s",
@@ -1764,7 +1776,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
     if(psz_path != NULL)
     {
         strcpy(p_sys->sz_framepath, psz_path);
-#if defined( WIN32 )
+#if defined( WIN32 ) || defined( __OS2__ )
         size_t i_strlen = strlen(p_sys->sz_framepath);
         if((i_strlen>0) && (p_sys->sz_framepath[i_strlen-1] != '\\'))
         {
@@ -1838,18 +1850,19 @@ static void Atmo_SetupParameters(filter_t *p_filter)
           COM Server for AtmoLight not running ?
           if the exe path is configured try to start the "userspace" driver
         */
-        psz_path = var_CreateGetStringCommand( p_filter,
+        char *psz_path = var_CreateGetStringCommand( p_filter,
                                                CFG_PREFIX "atmowinexe" );
+        LPTSTR ptsz_path = ToT(psz_path);
         if(psz_path != NULL)
         {
             STARTUPINFO startupinfo;
             PROCESS_INFORMATION pinfo;
             memset(&startupinfo, 0, sizeof(STARTUPINFO));
             startupinfo.cb = sizeof(STARTUPINFO);
-            if(CreateProcess(psz_path, NULL, NULL, NULL,
+            if(CreateProcess(ptsz_path, NULL, NULL, NULL,
                 FALSE, 0, NULL, NULL, &startupinfo, &pinfo) == TRUE)
             {
-                msg_Dbg(p_filter,"launched AtmoWin from %s",psz_path);
+                msg_Dbg(p_filter,"launched AtmoWin from %s", psz_path);
                 WaitForInputIdle(pinfo.hProcess, 5000);
                 /*
                   retry to initialize the library COM ... functionality
@@ -1860,6 +1873,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
                 msg_Err(p_filter,"failed to launch AtmoWin from %s", psz_path);
             }
             free(psz_path);
+            free(ptsz_path);
         }
     }
 #endif
@@ -2021,7 +2035,7 @@ static inline void yuv_to_rgb( uint8_t *r, uint8_t *g, uint8_t *b,
 * p_sys is a pointer to
 * p_inpic is the source frame
 * p_transfer_dest is the target buffer for the picture must be big enough!
-* (in win32 enviroment this buffer comes from the external DLL where it is
+* (in win32 environment this buffer comes from the external DLL where it is
 * create as "variant array" and returned through the AtmoLockTransferbuffer
 */
 static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
@@ -2053,7 +2067,7 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
 
     /*  these two ugly loops extract the small image - goes it faster? how?
     the loops are so designed that there is a small border around the extracted
-    image so we wont get column and row - zero from the frame, and not the most
+    image so we won't get column and row - zero from the frame, and not the most
     right and bottom pixels --- which may be clipped on computers useing TV out
     - through overscan!
 
@@ -2102,6 +2116,16 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
         p_src_v = p_inpic->p[V_PLANE].p_pixels +
             p_inpic->p[V_PLANE].i_pitch * i_v_row;
 
+        if(p_sys->b_swap_uv)
+        {
+          /*
+           swap u and v plane for YV12 images
+          */
+          uint8_t *p_temp_plane = p_src_u;
+          p_src_u = p_src_v;
+          p_src_v = p_temp_plane;
+        }
+
         for(i_col = 1; i_col < i_col_count; i_col++)
         {
             i_pixel_col = (i_col * p_sys->i_crop_width) / i_col_count +
@@ -2173,12 +2197,12 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
 void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
 {
     /* for debug out only used*/
-    BITMAPINFO bmp_info;
+    VLC_BITMAPINFO bmp_info;
     BITMAPFILEHEADER  bmp_fileheader;
     FILE *fp_bitmap;
 
-    memset(&bmp_info, 0, sizeof(BITMAPINFO));
-    bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    memset(&bmp_info, 0, sizeof(VLC_BITMAPINFO));
+    bmp_info.bmiHeader.biSize = sizeof(VLC_BITMAPINFOHEADER);
     bmp_info.bmiHeader.biSizeImage   = p_sys->i_atmo_height *
                                        p_sys->i_atmo_width * 4;
     bmp_info.bmiHeader.biCompression = BI_RGB;
@@ -2190,17 +2214,17 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
     bmp_fileheader.bfReserved1 = 0;
     bmp_fileheader.bfReserved2 = 0;
     bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) +
-                            sizeof(BITMAPINFOHEADER) +
+                            sizeof(VLC_BITMAPINFOHEADER) +
                             bmp_info.bmiHeader.biSizeImage;
     bmp_fileheader.bfType = VLC_TWOCC('B','M');
     bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) +
-                               sizeof(BITMAPINFOHEADER);
+                               sizeof(VLC_BITMAPINFOHEADER);
 
     fp_bitmap = fopen(psz_filename,"wb");
     if( fp_bitmap != NULL)
     {
         fwrite(&bmp_fileheader, sizeof(BITMAPFILEHEADER), 1, fp_bitmap);
-        fwrite(&bmp_info.bmiHeader, sizeof(BITMAPINFOHEADER), 1, fp_bitmap);
+        fwrite(&bmp_info.bmiHeader, sizeof(VLC_BITMAPINFOHEADER), 1, fp_bitmap);
         fwrite(p_pixels, bmp_info.bmiHeader.biSizeImage, 1, fp_bitmap);
         fclose(fp_bitmap);
     }
@@ -2251,7 +2275,7 @@ static void CreateMiniImage( filter_t *p_filter, picture_t *p_inpic)
     /*
     if debugging enabled save every 128th image to disk
     */
-    if((p_sys->b_saveframes == true) && (p_sys->sz_framepath[0] != 0 ))
+    if(p_sys->b_saveframes && p_sys->sz_framepath[0] != 0 )
     {
 
         if((p_sys->ui_frame_counter & 127) == 0)
@@ -2290,25 +2314,31 @@ static picture_t * Filter( filter_t *p_filter, picture_t *p_pic )
     filter_sys_t *p_sys = p_filter->p_sys;
     if( !p_pic ) return NULL;
 
+    picture_t *p_outpic = filter_NewPicture( p_filter );
+    if( !p_outpic )
+    {
+        picture_Release( p_pic );
+        return NULL;
+    }
+    picture_CopyPixels( p_outpic, p_pic );
+
     vlc_mutex_lock( &p_sys->filter_lock );
 
-    if((p_sys->b_enabled == true) &&
-        (p_sys->pf_extract_mini_image != NULL) &&
-        (p_sys->b_pause_live == false))
+    if(p_sys->b_enabled && p_sys->pf_extract_mini_image &&
+       !p_sys->b_pause_live)
     {
         p_sys->i_crop_x_offset  = p_filter->fmt_in.video.i_x_offset;
         p_sys->i_crop_y_offset  = p_filter->fmt_in.video.i_y_offset;
         p_sys->i_crop_width     = p_filter->fmt_in.video.i_visible_width;
         p_sys->i_crop_height    = p_filter->fmt_in.video.i_visible_height;
 
-        CreateMiniImage(p_filter, p_pic);
+        CreateMiniImage(p_filter, p_outpic);
     }
 
     vlc_mutex_unlock( &p_sys->filter_lock );
 
 
-
-    return p_pic;
+    return CopyInfoAndRelease( p_outpic, p_pic );
 }
 
 
@@ -2317,7 +2347,7 @@ static picture_t * Filter( filter_t *p_filter, picture_t *p_pic )
 * to a target color defined in p_fadethread struct
 * use for: Fade to Pause Color,  and Fade to End Color
 *****************************************************************************/
-static void *FadeToColorThread(vlc_object_t *obj)
+static void *FadeToColorThread(void *obj)
 {
     fadethread_t *p_fadethread = (fadethread_t *)obj;
     filter_sys_t *p_sys = (filter_sys_t *)p_fadethread->p_filter->p_sys;
@@ -2360,7 +2390,7 @@ static void *FadeToColorThread(vlc_object_t *obj)
             /* send the same pixel data again... to unlock the buffer! */
             AtmoSendPixelData( p_fadethread->p_filter );
 
-            while( (vlc_object_alive (p_fadethread)) &&
+            while( (!vlc_atomic_get (&p_fadethread->abort)) &&
                 (i_steps_done < p_fadethread->i_steps))
             {
                 p_transfer = AtmoLockTransferBuffer( p_fadethread->p_filter );
@@ -2373,7 +2403,7 @@ static void *FadeToColorThread(vlc_object_t *obj)
                 thread improvements wellcome!
                 */
                 for(i_index = 0;
-                    (i_index < i_size) && (vlc_object_alive (p_fadethread));
+                    (i_index < i_size) && (!vlc_atomic_get (&p_fadethread->abort));
                     i_index+=4)
                 {
                     i_src_blue  = p_source[i_index+0];
@@ -2429,11 +2459,10 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
     {
         msg_Dbg(p_filter, "kill still running fadeing thread...");
 
-        p_sys->p_fadethread->b_die = true;
-
-        vlc_thread_join(p_sys->p_fadethread);
+        vlc_atomic_set(&p_sys->p_fadethread->abort, 1);
 
-        vlc_object_release(p_sys->p_fadethread);
+        vlc_join(p_sys->p_fadethread->thread, NULL);
+        free(p_sys->p_fadethread);
         p_sys->p_fadethread = NULL;
     }
     vlc_mutex_unlock( &p_sys->filter_lock );
@@ -2443,14 +2472,14 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
 * StateCallback: Callback for the inputs variable "State" to get notified
 * about Pause and Continue Playback events.
 *****************************************************************************/
-static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
+static int StateCallback( vlc_object_t *, char const *,
                          vlc_value_t oldval, vlc_value_t newval,
                          void *p_data )
 {
     filter_t *p_filter = (filter_t *)p_data;
     filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
 
-    if((p_sys->b_usepausecolor == true) && (p_sys->b_enabled == true))
+    if(p_sys->b_usepausecolor && p_sys->b_enabled)
     {
         msg_Dbg(p_filter, "state change from: %"PRId64" to %"PRId64, oldval.i_int,
             newval.i_int);
@@ -2472,23 +2501,21 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
             */
             if(p_sys->p_fadethread == NULL)
             {
-                p_sys->p_fadethread = (fadethread_t *)vlc_object_create(
-                     p_filter,
-                     sizeof(fadethread_t) );
-
+                p_sys->p_fadethread = (fadethread_t *)calloc( 1, sizeof(fadethread_t) );
                 p_sys->p_fadethread->p_filter = p_filter;
                 p_sys->p_fadethread->ui_red   = p_sys->ui_pausecolor_red;
                 p_sys->p_fadethread->ui_green = p_sys->ui_pausecolor_green;
                 p_sys->p_fadethread->ui_blue  = p_sys->ui_pausecolor_blue;
                 p_sys->p_fadethread->i_steps  = p_sys->i_fadesteps;
+                vlc_atomic_set(&p_sys->p_fadethread->abort, 0);
 
-                if( vlc_thread_create( p_sys->p_fadethread,
-                    "AtmoLight fadeing",
-                    FadeToColorThread,
-                    VLC_THREAD_PRIORITY_LOW ) )
+                if( vlc_clone( &p_sys->p_fadethread->thread,
+                               FadeToColorThread,
+                               p_sys->p_fadethread,
+                               VLC_THREAD_PRIORITY_LOW ) )
                 {
                     msg_Err( p_filter, "cannot create FadeToColorThread" );
-                    vlc_object_release( p_sys->p_fadethread );
+                    free( p_sys->p_fadethread );
                     p_sys->p_fadethread = NULL;
                 }
             }
@@ -2529,7 +2556,7 @@ static void AddStateVariableCallback(filter_t *p_filter)
 *****************************************************************************
 * Delete the callback function to the "state" variable of the input thread...
 * first find the PlayList and get the input thread from there to attach
-* my callback? is vlc_object_find the right way for this??
+* my callback.
 *****************************************************************************/
 static void DelStateVariableCallback( filter_t *p_filter )
 {
@@ -2545,7 +2572,7 @@ static void DelStateVariableCallback( filter_t *p_filter )
 * StateCallback: Callback for the inputs variable "State" to get notified
 * about Pause and Continue Playback events.
 *****************************************************************************/
-static int AtmoSettingsCallback( vlc_object_t *p_this, char const *psz_var,
+static int AtmoSettingsCallback( vlc_object_t *, char const *psz_var,
                                  vlc_value_t oldval, vlc_value_t newval,
                                  void *p_data )
 {