]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/atmo/atmo.cpp
Don't mix up malloc and delete.
[vlc] / modules / video_filter / atmo / atmo.cpp
index 615fb0fabf9277aa24d8e26466a31aca46635dd8..10f728c8c0a22631039c4b67e547039a6d3a93aa 100644 (file)
@@ -4,7 +4,7 @@
 * Copyright (C) 2000-2006 the VideoLAN team
 * $Id$
 *
-* Authors: André Weber (WeberAndre@gmx.de)
+* 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
@@ -34,7 +34,8 @@
 
 // #define __ATMO_DEBUG__
 // [:Zs]+$
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 
 #include <vlc_playlist.h>
@@ -116,53 +117,55 @@ 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 which "\
- "is connected to your computer.\n"\
- "AtmoLight is the homebrew version of that what Philips calls AmbiLight.\n"\
- "If you need further informations feel free to visit us at\n\n"\
- "http://www.vdr-wiki.de/wiki/index.php/Atmo-plugin\n"\
+ "This module allows to control 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"\
+ "http://www.vdr-wiki.de/wiki/index.php/Atmo-plugin\n "\
  "http://www.vdr-wiki.de/wiki/index.php/AtmoWin\n\n"\
- "there you will find detailed descriptions how to build it for your self and "\
- "where you can get the required parts and so on.\n There you can also see "\
- "pictures and some movies showing such a device in live action...")
+ "You can find there detailed descriptions on how to build it for yourself "\
+ "and where to get the required parts.\n" \
+ "You can also have a look at pictures and some movies showing such a device " \
+ "in live action.")
 
 
 
 #if defined( __ATMO_DEBUG__ )
 #   define SAVEFRAMES_TEXT     N_("Save Debug Frames")
-#   define SAVEFRAMES_LONGTEXT N_("Writes every 128th miniframe to a folder.")
+#   define SAVEFRAMES_LONGTEXT N_("Write every 128th miniframe to a folder.")
 #   define FRAMEPATH_TEXT      N_("Debug Frame Folder")
-#   define FRAMEPATH_LONGTEXT  N_("defines the path where the debugframes " \
+#   define FRAMEPATH_LONGTEXT  N_("The path where the debugframes " \
                                   "should be saved")
 #endif
 
 #define WIDTH_TEXT             N_("Extracted Image Width")
-#define WIDTH_LONGTEXT         N_("defines the width of the mini image for " \
+#define WIDTH_LONGTEXT         N_("The width of the mini image for " \
                                   "further processing (64 is default)")
 
 #define HEIGHT_TEXT            N_("Extracted Image Height")
-#define HEIGHT_LONGTEXT        N_("defines the height of the mini image for " \
+#define HEIGHT_LONGTEXT        N_("The height of the mini image for " \
                                   "further processing (48 is default)")
 
-#define PCOLOR_TEXT            N_("use Pause Color")
-#define PCOLOR_LONGTEXT        N_("use the color defined below if the user " \
-                          "paused the video.(have light to get another beer?)")
+#define PCOLOR_TEXT            N_("Color when paused")
+#define PCOLOR_LONGTEXT        N_("Set the color to show if the user " \
+                                  "pauses the video. (Have light to get " \
+                                  "another beer?)")
 #define PCOLOR_RED_TEXT        N_("Pause-Red")
-#define PCOLOR_RED_LONGTEXT    N_("the red component of pause color")
+#define PCOLOR_RED_LONGTEXT    N_("Red component of the pause color")
 #define PCOLOR_GREEN_TEXT      N_("Pause-Green")
-#define PCOLOR_GREEN_LONGTEXT  N_("the green component of pause color")
+#define PCOLOR_GREEN_LONGTEXT  N_("Green component of the pause color")
 #define PCOLOR_BLUE_TEXT       N_("Pause-Blue")
-#define PCOLOR_BLUE_LONGTEXT   N_("the blue component of pause color")
+#define PCOLOR_BLUE_LONGTEXT   N_("Blue component of the pause color")
 #define FADESTEPS_TEXT         N_("Pause-Fadesteps")
 #define FADESTEPS_LONGTEXT     N_("Number of steps to change current color " \
                                   "to pause color (each step takes 40ms)")
 
 #define ECOLOR_RED_TEXT        N_("End-Red")
-#define ECOLOR_RED_LONGTEXT    N_("the red component of the shutdown color")
+#define ECOLOR_RED_LONGTEXT    N_("Red component of the shutdown color")
 #define ECOLOR_GREEN_TEXT      N_("End-Green")
-#define ECOLOR_GREEN_LONGTEXT  N_("the green component of the shutdown color")
+#define ECOLOR_GREEN_LONGTEXT  N_("Green component of the shutdown color")
 #define ECOLOR_BLUE_TEXT       N_("End-Blue")
-#define ECOLOR_BLUE_LONGTEXT   N_("the blue component of the shutdown color")
+#define ECOLOR_BLUE_LONGTEXT   N_("Blue component of the shutdown color")
 #define EFADESTEPS_TEXT        N_("End-Fadesteps")
 #define EFADESTEPS_LONGTEXT  N_("Number of steps to change current color to " \
                              "end color for dimming up the light in cinema " \
@@ -170,7 +173,7 @@ strings for settings menus and hints
 
 #define USEWHITEADJ_TEXT       N_("Use Software White adjust")
 #define USEWHITEADJ_LONGTEXT   N_("Should the buildin driver do a white " \
-                                  "adjust or you LED stripes? recommend.")
+                                  "adjust or your LED stripes? recommend.")
 #define WHITE_RED_TEXT         N_("White Red")
 #define WHITE_RED_LONGTEXT     N_("Red value of a pure white on your "\
                                   "LED stripes.")
@@ -183,33 +186,35 @@ strings for settings menus and hints
 
 #define SERIALDEV_TEXT         N_("Serial Port/Device")
 #define SERIALDEV_LONGTEXT   N_("Name of the serial port where the AtmoLight "\
-                       "controller is attached to\n on Windows usually "\
-                       "something like COM1 or COM2 on Linux /dev/ttyS01 f.e.")
+                                "controller is attached to.\n" \
+                                "On Windows usually something like COM1 or " \
+                                "COM2. On Linux /dev/ttyS01 f.e.")
 
 #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 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 you LED stripes")
+#define BRIGHTNESS_LONGTEXT N_("Overall brightness of your LED stripes")
 #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")
+#define DARKNESS_LONGTEXT   N_("Pixels with a saturation lower than this will "\
+                               "be ignored. Should be greater than one for "\
+                               "letterboxed videos.")
 #define HUEWINSIZE_TEXT     N_("Hue windowing")
-#define HUEWINSIZE_LONGTEXT N_("used for statistics")
+#define HUEWINSIZE_LONGTEXT N_("Used for statistics.")
 #define SATWINSIZE_TEXT     N_("Sat windowing")
-#define SATWINSIZE_LONGTEXT N_("used for statistics")
+#define SATWINSIZE_LONGTEXT N_("Used for statistics.")
 
-#define MEANLENGTH_TEXT     N_("Filter length [ms]")
-#define MEANLENGTH_LONGTEXT N_("Time it takes until a color is complete "\
-                                "changed, removes flickering")
+#define MEANLENGTH_TEXT     N_("Filter length (ms)")
+#define MEANLENGTH_LONGTEXT N_("Time it takes until a color is completely "\
+                                "changed. This prevents flickering.")
 #define MEANTHRESHOLD_TEXT     N_("Filter threshold")
-#define MEANTHRESHOLD_LONGTEXT N_("How much a color must changed, for an "\
-                                  "imediate color change")
-#define MEANPERCENTNEW_TEXT     N_("Filter Smoothness %")
+#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_LONGTEXT N_("Filter Smoothness")
 
-#define FILTERMODE_TEXT        N_("Filtermode")
+/* FIXME: WTF?!! feepk, July 6 '08 */
+#define FILTERMODE_TEXT        N_("Filter mode")
 #define FILTERMODE_LONGTEXT    N_("kind of filtering which should be use to "\
                                   "calcuate the color output")
 static int pi_filtermode_values[] = {
@@ -223,9 +228,10 @@ static const char *ppsz_filtermode_descriptions[] = {
         N_("Percent")
 };
 
-#define FRAMEDELAY_TEXT       N_("Framedelay")
-#define FRAMEDELAY_LONGTEXT   N_("helps to get video out and light effects "\
-                             "insync values around 20ms should do the trick")
+#define FRAMEDELAY_TEXT       N_("Frame delay")
+#define FRAMEDELAY_LONGTEXT   N_("Helps to get the video output and the light "\
+                                 "effects in sync. Values around 20ms should " \
+                                 "do the trick.")
 
 
 #define CHANNEL_0_ASSIGN_TEXT N_("Channel summary")
@@ -234,8 +240,8 @@ static const char *ppsz_filtermode_descriptions[] = {
 #define CHANNEL_3_ASSIGN_TEXT N_("Channel top")
 #define CHANNEL_4_ASSIGN_TEXT N_("Channel bottom")
 
-#define CHANNELASSIGN_LONGTEXT N_("maps the hardware channel X to logical "\
-                                  "channel Y to fix wrong wiring:-)")
+#define CHANNELASSIGN_LONGTEXT N_("Maps the hardware channel X to logical "\
+                                  "channel Y to fix wrong wiring :-)")
 static int pi_channel_assignment_values[] = {
     -1,
      0,
@@ -253,21 +259,21 @@ static const char *ppsz_channel_assignment_descriptions[] = {
         N_("bottom")
 };
 
-#define ZONE_0_GRADIENT_TEXT N_("summary gradient")
-#define ZONE_1_GRADIENT_TEXT N_("left gradient")
-#define ZONE_2_GRADIENT_TEXT N_("right gradient")
-#define ZONE_3_GRADIENT_TEXT N_("top gradient")
-#define ZONE_4_GRADIENT_TEXT N_("bottom gradient")
-#define ZONE_X_GRADIENT_LONG_TEXT N_("defines a small bitmap with 64x48 "\
+#define ZONE_0_GRADIENT_TEXT N_("Summary gradient")
+#define ZONE_1_GRADIENT_TEXT N_("Left gradient")
+#define ZONE_2_GRADIENT_TEXT N_("Right gradient")
+#define ZONE_3_GRADIENT_TEXT N_("Top gradient")
+#define ZONE_4_GRADIENT_TEXT N_("Bottom gradient")
+#define ZONE_X_GRADIENT_LONG_TEXT N_("Defines a small bitmap with 64x48 "\
                                      "pixels, containing a grayscale gradient")
 
 #if defined( WIN32 )
 #   define ATMOWINEXE_TEXT      N_("Filename of AtmoWinA.exe")
-#   define ATMOWINEXE_LONGTEXT  N_("if you wan't that the AtmoLight control "\
-                                   "software is launched by\nVLC enter the "\
-                                   "complete Filename of AtmoWinA.exe here")
-#   define USEBUILDIN_TEXT      N_("Use buildin AtmoLight")
-#   define USEBUILDIN_LONGTEXT N_("VideoLan will directly use your AtmoLight "\
+#   define ATMOWINEXE_LONGTEXT  N_("if you want the AtmoLight control "\
+                                   "software to be launched by VLC, enter the "\
+                                   "complete path of AtmoWinA.exe here.")
+#   define USEBUILDIN_TEXT      N_("Use built-in AtmoLight")
+#   define USEBUILDIN_LONGTEXT N_("VLC will directly use your AtmoLight "\
                                   "hardware without running the external "\
                                   "AtmoWinA.exe Userspace driver.")
 #endif
@@ -278,37 +284,37 @@ static const char *ppsz_channel_assignment_descriptions[] = {
 * Module descriptor
 *****************************************************************************/
 vlc_module_begin();
-set_description( _("AtmoLight Filter") );
+set_description( N_("AtmoLight Filter") );
 set_help( MODULE_DESCRIPTION );
-set_shortname( _( "AtmoLight" ));
+set_shortname( N_( "AtmoLight" ));
 set_capability( "video filter2", 0 );
 
 set_category( CAT_VIDEO );
 set_subcategory( SUBCAT_VIDEO_VFILTER );
 
 #if defined(WIN32)
-set_section( N_("Choose between the buildin AtmoLight "\
+set_section( N_("Choose between the built-in AtmoLight "\
                  "driver or the external" ), 0 );
 
 /*
     only on win32 exists the option to use the buildin driver or
     the more flexible external driver application
 */
-add_bool(CFG_PREFIX "usebuildin", VLC_TRUE, NULL,
-         USEBUILDIN_TEXT, USEBUILDIN_LONGTEXT, VLC_FALSE);
+add_bool(CFG_PREFIX "usebuildin", true, NULL,
+         USEBUILDIN_TEXT, USEBUILDIN_LONGTEXT, false);
 add_string(CFG_PREFIX "serialdev", "COM1", NULL,
-           SERIALDEV_TEXT, SERIALDEV_LONGTEXT, VLC_FALSE );
+           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, VLC_FALSE );
+         ATMOWINEXE_TEXT, ATMOWINEXE_LONGTEXT, false );
 #else
-set_section( N_("Enter connection of your AtmoLight hardware" ), 0 );
+set_section( N_("Enter the connection of your AtmoLight hardware" ), 0 );
 add_string(CFG_PREFIX "serialdev", "/dev/ttyS01", NULL,
-           SERIALDEV_TEXT, SERIALDEV_LONGTEXT, VLC_FALSE );
+           SERIALDEV_TEXT, SERIALDEV_LONGTEXT, false );
 #endif
 
 /*
@@ -316,16 +322,16 @@ add_string(CFG_PREFIX "serialdev", "/dev/ttyS01", 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", VLC_FALSE, NULL,
-         PCOLOR_TEXT, PCOLOR_LONGTEXT, VLC_FALSE);
+add_bool(CFG_PREFIX "usepausecolor", false, NULL,
+         PCOLOR_TEXT, PCOLOR_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "pcolor-red",   0, 0, 255, NULL,
-                       PCOLOR_RED_TEXT, PCOLOR_RED_LONGTEXT, VLC_FALSE);
+                       PCOLOR_RED_TEXT, PCOLOR_RED_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "pcolor-green", 0, 0, 255, NULL,
-                       PCOLOR_GREEN_TEXT, PCOLOR_GREEN_LONGTEXT, VLC_FALSE);
+                       PCOLOR_GREEN_TEXT, PCOLOR_GREEN_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "pcolor-blue",  192, 0, 255, NULL,
-                       PCOLOR_BLUE_TEXT, PCOLOR_BLUE_LONGTEXT, VLC_FALSE);
+                       PCOLOR_BLUE_TEXT, PCOLOR_BLUE_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "fadesteps", 50, 1, 250, NULL,
-                       FADESTEPS_TEXT, FADESTEPS_LONGTEXT, VLC_FALSE);
+                       FADESTEPS_TEXT, FADESTEPS_LONGTEXT, false);
 
 /*
     color which is showed if you finished watching your movie ...
@@ -333,13 +339,13 @@ add_integer_with_range(CFG_PREFIX "fadesteps", 50, 1, 250, NULL,
 */
 set_section( N_("Illuminate the room with this color on shutdown" ), 0 );
 add_integer_with_range(CFG_PREFIX "ecolor-red",   192, 0, 255, NULL,
-                       ECOLOR_RED_TEXT,   ECOLOR_RED_LONGTEXT,   VLC_FALSE);
+                       ECOLOR_RED_TEXT,   ECOLOR_RED_LONGTEXT,   false);
 add_integer_with_range(CFG_PREFIX "ecolor-green", 192, 0, 255, NULL,
-                       ECOLOR_GREEN_TEXT, ECOLOR_GREEN_LONGTEXT, VLC_FALSE);
+                       ECOLOR_GREEN_TEXT, ECOLOR_GREEN_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "ecolor-blue",  192, 0, 255, NULL,
-                       ECOLOR_BLUE_TEXT,  ECOLOR_BLUE_LONGTEXT,  VLC_FALSE);
+                       ECOLOR_BLUE_TEXT,  ECOLOR_BLUE_LONGTEXT,  false);
 add_integer_with_range(CFG_PREFIX "efadesteps",    50, 1, 250, NULL,
-                       EFADESTEPS_TEXT,   EFADESTEPS_LONGTEXT,    VLC_FALSE);
+                       EFADESTEPS_TEXT,   EFADESTEPS_LONGTEXT,    false);
 
 /*
  settings only for the buildin driver (if external driver app is used
@@ -347,66 +353,66 @@ add_integer_with_range(CFG_PREFIX "efadesteps",    50, 1, 250, NULL,
 
  definition of parameters for the buildin filter ...
 */
-set_section( N_("Settings only for buildin Live Video Processor" ), 0 );
+set_section( N_("Settings for the built-in Live Video Processor only" ), 0 );
 
 add_integer_with_range(CFG_PREFIX "EdgeWeightning",   8, 1, 30, NULL,
-                       EDGE_TEXT, EDGE_LONGTEXT, VLC_FALSE);
+                       EDGE_TEXT, EDGE_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "Brightness",   100, 50, 300, NULL,
-                       BRIGHTNESS_TEXT, BRIGHTNESS_LONGTEXT, VLC_FALSE);
+                       BRIGHTNESS_TEXT, BRIGHTNESS_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "DarknessLimit",   5, 0, 10, NULL,
-                       DARKNESS_TEXT, DARKNESS_LONGTEXT, VLC_FALSE);
+                       DARKNESS_TEXT, DARKNESS_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "HueWinSize",   3, 0, 5, NULL,
-                       HUEWINSIZE_TEXT, HUEWINSIZE_LONGTEXT, VLC_FALSE);
+                       HUEWINSIZE_TEXT, HUEWINSIZE_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "SatWinSize",   3, 0, 5, NULL,
-                       SATWINSIZE_TEXT, SATWINSIZE_LONGTEXT, VLC_FALSE);
+                       SATWINSIZE_TEXT, SATWINSIZE_LONGTEXT, false);
 
 add_integer(CFG_PREFIX "filtermode", (int)afmCombined, NULL,
-            FILTERMODE_TEXT, FILTERMODE_LONGTEXT, VLC_FALSE );
+            FILTERMODE_TEXT, FILTERMODE_LONGTEXT, false );
 
 change_integer_list(pi_filtermode_values, ppsz_filtermode_descriptions, 0 );
 
 add_integer_with_range(CFG_PREFIX "MeanLength",    300, 300, 5000, NULL,
-                       MEANLENGTH_TEXT, MEANLENGTH_LONGTEXT, VLC_FALSE);
+                       MEANLENGTH_TEXT, MEANLENGTH_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "MeanThreshold",  40, 1, 100, NULL,
-                       MEANTHRESHOLD_TEXT, MEANTHRESHOLD_LONGTEXT, VLC_FALSE);
+                       MEANTHRESHOLD_TEXT, MEANTHRESHOLD_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "PercentNew", 50, 1, 100, NULL,
-                      MEANPERCENTNEW_TEXT, MEANPERCENTNEW_LONGTEXT, VLC_FALSE);
+                      MEANPERCENTNEW_TEXT, MEANPERCENTNEW_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "FrameDelay", 18, 0, 35, NULL,
-                       FRAMEDELAY_TEXT, FRAMEDELAY_LONGTEXT, VLC_FALSE);
+                       FRAMEDELAY_TEXT, FRAMEDELAY_LONGTEXT, false);
 
 /*
   output channel reordering
 */
 set_section( N_("Change channel assignment (fixes wrong wiring)" ), 0 );
 add_integer( CFG_PREFIX "channel_0", 0, NULL,
-            CHANNEL_0_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, VLC_FALSE );
+            CHANNEL_0_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );
 change_integer_list( pi_channel_assignment_values,
                      ppsz_channel_assignment_descriptions, 0 );
 
 add_integer( CFG_PREFIX "channel_1", 1, NULL,
-            CHANNEL_1_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, VLC_FALSE );
+            CHANNEL_1_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );
 change_integer_list( pi_channel_assignment_values,
                      ppsz_channel_assignment_descriptions, 0 );
 
 add_integer( CFG_PREFIX "channel_2", 2, NULL,
-            CHANNEL_2_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, VLC_FALSE );
+            CHANNEL_2_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );
 change_integer_list( pi_channel_assignment_values,
                      ppsz_channel_assignment_descriptions, 0 );
 
 add_integer( CFG_PREFIX "channel_3", 3, NULL,
-            CHANNEL_3_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, VLC_FALSE );
+            CHANNEL_3_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );
 change_integer_list( pi_channel_assignment_values,
                      ppsz_channel_assignment_descriptions, 0 );
 
 add_integer( CFG_PREFIX "channel_4", 4, NULL,
-            CHANNEL_4_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, VLC_FALSE );
+            CHANNEL_4_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );
 change_integer_list( pi_channel_assignment_values,
                      ppsz_channel_assignment_descriptions, 0 );
 
@@ -414,16 +420,16 @@ change_integer_list( pi_channel_assignment_values,
   LED color white calibration
 */
 set_section( N_("Adjust the white light to your LED stripes" ), 0 );
-add_bool(CFG_PREFIX "whiteadj", VLC_TRUE, NULL,
-         USEWHITEADJ_TEXT, USEWHITEADJ_LONGTEXT, VLC_FALSE);
+add_bool(CFG_PREFIX "whiteadj", true, NULL,
+         USEWHITEADJ_TEXT, USEWHITEADJ_LONGTEXT, false);
 add_integer_with_range(CFG_PREFIX "white-red",   255, 0, 255, NULL,
-                       WHITE_RED_TEXT,   WHITE_RED_LONGTEXT,   VLC_FALSE);
+                       WHITE_RED_TEXT,   WHITE_RED_LONGTEXT,   false);
 
 add_integer_with_range(CFG_PREFIX "white-green", 255, 0, 255, NULL,
-                       WHITE_GREEN_TEXT, WHITE_GREEN_LONGTEXT, VLC_FALSE);
+                       WHITE_GREEN_TEXT, WHITE_GREEN_LONGTEXT, false);
 
 add_integer_with_range(CFG_PREFIX "white-blue",  255, 0, 255, NULL,
-                       WHITE_BLUE_TEXT,  WHITE_BLUE_LONGTEXT,  VLC_FALSE);
+                       WHITE_BLUE_TEXT,  WHITE_BLUE_LONGTEXT,  false);
 /* end of definition of parameter for the buildin filter ... part 1 */
 
 
@@ -437,40 +443,40 @@ 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, VLC_TRUE );
+         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, VLC_TRUE );
+         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, VLC_TRUE );
+         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, VLC_TRUE );
+         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, VLC_TRUE );
+         ZONE_4_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );
 
 
 #if defined(__ATMO_DEBUG__)
-add_bool(CFG_PREFIX "saveframes", VLC_FALSE, NULL,
-         SAVEFRAMES_TEXT, SAVEFRAMES_LONGTEXT, VLC_FALSE);
+add_bool(CFG_PREFIX "saveframes", false, NULL,
+         SAVEFRAMES_TEXT, SAVEFRAMES_LONGTEXT, false);
 add_string(CFG_PREFIX "framepath", "", NULL,
-           FRAMEPATH_TEXT, FRAMEPATH_LONGTEXT, VLC_FALSE );
+           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,
-                       WIDTH_TEXT,  WIDTH_LONGTEXT, VLC_TRUE);
+                       WIDTH_TEXT,  WIDTH_LONGTEXT, true);
 add_integer_with_range(CFG_PREFIX "height", 48, 48, 384, NULL,
-                       HEIGHT_TEXT,  HEIGHT_LONGTEXT, VLC_TRUE);
+                       HEIGHT_TEXT,  HEIGHT_LONGTEXT, true);
 
 add_shortcut( "atmo" );
 set_callbacks( CreateFilter, DestroyFilter  );
 vlc_module_end();
 
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
 #if defined(WIN32)
-    "usebuildin",
+        "usebuildin",
 #endif
         "serialdev",
 
@@ -565,21 +571,21 @@ struct filter_sys_t
     */
     vlc_mutex_t filter_lock;
 
-    vlc_bool_t b_enabled;
+    bool b_enabled;
     int32_t i_AtmoOldEffect;
-    vlc_bool_t b_pause_live;
+    bool b_pause_live;
 
     int32_t i_atmo_width;
     int32_t i_atmo_height;
 
 #if defined(__ATMO_DEBUG__)
-    vlc_bool_t  b_saveframes;
+    bool  b_saveframes;
     int i_framecounter;
     char sz_framepath[MAX_PATH];
 #endif
 
     /* light color durring movie pause ... */
-    vlc_bool_t  b_usepausecolor;
+    bool  b_usepausecolor;
     uint8_t ui_pausecolor_red;
     uint8_t ui_pausecolor_green;
     uint8_t ui_pausecolor_blue;
@@ -641,12 +647,12 @@ the previously loaded DLL ...
 Return Values may be: -1 (failed for some reason - filter will be disabled)
 1 Ok. lets rock
 */
-static int32_t AtmoInitialize(filter_t *p_filter, vlc_bool_t b_for_thread)
+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 == VLC_FALSE)
+        if(b_for_thread == false)
         {
             /* open com port */
             /* setup Output Threads ... */
@@ -907,7 +913,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
 {
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    if(p_sys->b_enabled == VLC_TRUE)
+    if(p_sys->b_enabled == true)
     {
         /*
         if there is a still running show pause color thread kill him!
@@ -921,7 +927,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
             assume that the static color will equal to this
             one to get a soft change and no flash!
             */
-            p_sys->b_pause_live = VLC_TRUE;
+            p_sys->b_pause_live = true;
 
             // perpare spawn fadeing thread
             vlc_mutex_lock( &p_sys->filter_lock );
@@ -939,7 +945,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
                 "AtmoLight fadeing",
                 FadeToColorThread,
                 VLC_THREAD_PRIORITY_LOW,
-                VLC_FALSE ) )
+                false ) )
             {
                 msg_Err( p_filter, "cannot create FadeToColorThread" );
                 vlc_object_release( p_sys->p_fadethread );
@@ -967,7 +973,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
         AtmoFinalize(p_filter, 1);
 
         /* disable filter method .. */
-        p_sys->b_enabled = VLC_FALSE;
+        p_sys->b_enabled = false;
     }
 }
 
@@ -978,20 +984,20 @@ if this fails fallback to the buildin software
 */
 static void Atmo_SetupParameters(filter_t *p_filter)
 {
-    vlc_bool_t b_use_buildin_driver = VLC_TRUE;
+    bool b_use_buildin_driver = true;
     char *psz_path;
     filter_sys_t *p_sys =  p_filter->p_sys;
 
 
     /* default filter disabled until DLL loaded and Init Success!*/
-    p_sys->b_enabled             = VLC_FALSE;
+    p_sys->b_enabled             = false;
 
     /* setup default mini image size (may be later a user option) */
     p_sys->i_atmo_width          = 64;
     p_sys->i_atmo_height         = 48;
 
 
-    vlc_mutex_init( p_filter, &p_sys->filter_lock );
+    vlc_mutex_init( &p_sys->filter_lock );
 
 
 #if defined(WIN32)
@@ -1002,7 +1008,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
     b_use_buildin_driver = var_CreateGetBoolCommand( p_filter,
         CFG_PREFIX "usebuildin" );
 
-    if(b_use_buildin_driver == VLC_FALSE) {
+    if(b_use_buildin_driver == false) {
 
         /* Load the Com Wrapper Library (source available) */
         p_sys->h_AtmoCtrl = LoadLibraryA("AtmoCtrlLib.dll");
@@ -1048,13 +1054,13 @@ static void Atmo_SetupParameters(filter_t *p_filter)
         } else {
             /* the DLL is missing try internal filter ...*/
             msg_Warn( p_filter, "AtmoCtrlLib.dll missing fallback to internal driver");
-            b_use_buildin_driver = VLC_TRUE;
+            b_use_buildin_driver = true;
         }
     }
 #endif
 
 
-    if(b_use_buildin_driver == VLC_TRUE) {
+    if(b_use_buildin_driver == true) {
         msg_Dbg( p_filter, "use buildin driver");
         /*
         now we have to read a lof of options from the config dialog
@@ -1170,7 +1176,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
                                           "error %d",psz_gradient_file,i_res);
                     }
                 }
-                delete psz_gradient_file;
+                free( psz_gradient_file );
             }
 
             p_sys->p_atmo_dyndata = new CAtmoDynData((vlc_object_t *)p_filter,
@@ -1298,7 +1304,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
     /* if the external DLL was loaded successfully call AtmoInitialize -
     (must be done for each thread where you wan't to use AtmoLight!
     */
-    int i = AtmoInitialize(p_filter, VLC_FALSE);
+    int i = AtmoInitialize(p_filter, false);
 #if defined( WIN32 )
     if((i != 1) && !b_use_buildin_driver)
     {
@@ -1322,7 +1328,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
                 retry to initialize the library COM ... functionality
                 after the server was launched
                 */
-                i = AtmoInitialize(p_filter, VLC_FALSE);
+                i = AtmoInitialize(p_filter, false);
             } else {
                 msg_Err(p_filter,"failed to launch AtmoWin from %s", psz_path);
             }
@@ -1354,7 +1360,7 @@ static void Atmo_SetupParameters(filter_t *p_filter)
         AtmoSetLiveSource(p_filter, lvsExternal);
 
         /* enable other parts only if everything is fine */
-        p_sys->b_enabled = VLC_TRUE;
+        p_sys->b_enabled = true;
     }
 
 }
@@ -1374,10 +1380,7 @@ static int CreateFilter( vlc_object_t *p_this )
     p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) );
     p_filter->p_sys = p_sys;
     if( p_filter->p_sys == NULL )
-    {
-        msg_Err( p_filter, "out of memory for p_sys structure" );
         return VLC_ENOMEM;
-    }
     /* set all entries to zero */
     memset(p_sys, 0, sizeof( filter_sys_t ));
 
@@ -1656,7 +1659,7 @@ static void CreateMiniImage( filter_t *p_filter, picture_t *p_inpic)
     {
         msg_Err( p_filter, "AtmoLight no transferbuffer available. "\
                            "AtmoLight will be disabled!");
-        p_sys->b_enabled = VLC_FALSE;
+        p_sys->b_enabled = false;
         return;
     }
 
@@ -1671,7 +1674,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 == VLC_TRUE) && (p_sys->sz_framepath[0] != 0 ))
+    if((p_sys->b_saveframes == true) && (p_sys->sz_framepath[0] != 0 ))
     {
 
         if((p_sys->i_framecounter & 127) == 0)
@@ -1704,9 +1707,9 @@ 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;
 
-    if((p_sys->b_enabled == VLC_TRUE) &&
+    if((p_sys->b_enabled == true) &&
         (p_sys->pf_extract_mini_image != NULL) &&
-        (p_sys->b_pause_live == VLC_FALSE))
+        (p_sys->b_pause_live == false))
     {
         CreateMiniImage(p_filter, p_pic);
     }
@@ -1738,7 +1741,7 @@ static void FadeToColorThread(fadethread_t *p_fadethread)
     uint8_t *p_source = NULL;
 
     /* initialize AtmoWin for this thread! */
-    AtmoInitialize(p_fadethread->p_filter , VLC_TRUE);
+    AtmoInitialize(p_fadethread->p_filter , true);
 
     uint8_t *p_transfer = AtmoLockTransferBuffer( p_fadethread->p_filter );
     if(p_transfer != NULL) {
@@ -1763,7 +1766,7 @@ static void FadeToColorThread(fadethread_t *p_fadethread)
             /* send the same pixel data again... to unlock the buffer! */
             AtmoSendPixelData( p_fadethread->p_filter );
 
-            while( (!p_fadethread->b_die) &&
+            while( (vlc_object_alive (p_fadethread)) &&
                 (i_steps_done < p_fadethread->i_steps))
             {
                 p_transfer = AtmoLockTransferBuffer( p_fadethread->p_filter );
@@ -1776,7 +1779,7 @@ static void FadeToColorThread(fadethread_t *p_fadethread)
                 thread improvements wellcome!
                 */
                 for(i_index = 0;
-                    (i_index < i_size) && (!p_fadethread->b_die);
+                    (i_index < i_size) && (vlc_object_alive (p_fadethread));
                     i_index+=4)
                 {
                     i_src_blue  = p_source[i_index+0];
@@ -1804,13 +1807,13 @@ static void FadeToColorThread(fadethread_t *p_fadethread)
                 the VLC libaries? inside native win32 I would use an Event
                 (CreateEvent) and here an WaitForSingleObject?
                 */
-                if(p_fadethread->b_die) break;
+                if(!vlc_object_alive (p_fadethread)) break;
                 msleep(10000);
-                if(p_fadethread->b_die) break;
+                if(!vlc_object_alive (p_fadethread)) break;
                 msleep(10000);
-                if(p_fadethread->b_die) break;
+                if(!vlc_object_alive (p_fadethread)) break;
                 msleep(10000);
-                if(p_fadethread->b_die) break;
+                if(!vlc_object_alive (p_fadethread)) break;
                 msleep(10000);
             }
             free(p_source);
@@ -1837,7 +1840,7 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
     {
         msg_Dbg(p_filter, "kill still running fadeing thread...");
 
-        p_sys->p_fadethread->b_die = VLC_TRUE;
+        p_sys->p_fadethread->b_die = true;
 
         vlc_thread_join(p_sys->p_fadethread);
 
@@ -1858,7 +1861,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
     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 == VLC_TRUE) && (p_sys->b_enabled == VLC_TRUE))
+    if((p_sys->b_usepausecolor == true) && (p_sys->b_enabled == true))
     {
         msg_Dbg(p_filter, "state change from: %d to %d", oldval.i_int,
             newval.i_int);
@@ -1867,9 +1870,9 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
         {
             /* tell the other thread to stop sending images to light
                controller */
-            p_sys->b_pause_live = VLC_TRUE;
+            p_sys->b_pause_live = true;
 
-            // ggf. alten Thread abräumen should not happen....
+            // ggf. alten Thread abräumen should not happen....
             CheckAndStopFadeThread(p_filter);
 
             // perpare spawn fadeing thread
@@ -1894,7 +1897,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
                     "AtmoLight fadeing",
                     FadeToColorThread,
                     VLC_THREAD_PRIORITY_LOW,
-                    VLC_FALSE) )
+                    false) )
                 {
                     msg_Err( p_filter, "cannot create FadeToColorThread" );
                     vlc_object_release( p_sys->p_fadethread );
@@ -1909,7 +1912,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
             /* playback continues check thread state */
             CheckAndStopFadeThread(p_filter);
             /* reactivate the Render function... to do its normal work */
-            p_sys->b_pause_live = VLC_FALSE;
+            p_sys->b_pause_live = false;
         }
     }
 
@@ -1925,18 +1928,13 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
 *****************************************************************************/
 static void AddStateVariableCallback(filter_t *p_filter)
 {
-    playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_filter,
-        VLC_OBJECT_PLAYLIST,
-        FIND_ANYWHERE );
-    if( p_playlist )
+    playlist_t *p_playlist = pl_Yield( p_filter );
+    input_thread_t *p_input = p_playlist->p_input;
+    if(p_input)
     {
-        input_thread_t *p_input = p_playlist->p_input;
-        if(p_input)
-        {
-            var_AddCallback( p_input, "state", StateCallback, p_filter );
-        }
-        vlc_object_release( p_playlist );
+        var_AddCallback( p_input, "state", StateCallback, p_filter );
     }
+    vlc_object_release( p_playlist );
 }
 
 /*****************************************************************************
@@ -1948,18 +1946,13 @@ static void AddStateVariableCallback(filter_t *p_filter)
 *****************************************************************************/
 static void DelStateVariableCallback( filter_t *p_filter )
 {
-    playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_filter,
-        VLC_OBJECT_PLAYLIST,
-        FIND_ANYWHERE );
-    if( p_playlist )
+    playlist_t *p_playlist = pl_Yield( p_filter );
+    input_thread_t *p_input = p_playlist->p_input;
+    if(p_input)
     {
-        input_thread_t *p_input = p_playlist->p_input;
-        if(p_input)
-        {
-            var_DelCallback( p_input, "state", StateCallback, p_filter );
-        }
-        vlc_object_release( p_playlist );
+        var_DelCallback( p_input, "state", StateCallback, p_filter );
     }
+    vlc_object_release( p_playlist );
 }