/*****************************************************************************
-* 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"
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"\
#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 " \
"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.")
#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")
set_section( N_("Illuminate the room with this color on pause" ), 0 )
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)
/*
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",
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, 254, NULL,
+add_integer_with_range(CFG_PREFIX "fnordlicht-amount", 2, 1, 254,
FNORDLICHT_AMOUNT_TEXT,
FNORDLICHT_AMOUNT_LONGTEXT, false)
*/
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,
ZONE_SUMMARY_TEXT, ZONE_SUMMARY_LONGTEXT, false)
*/
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,
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)
/*
set_section( N_("Adjust the white light to your LED stripes" ), 0 )
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 */
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,
SHOW_DOTS_TEXT, SHOW_DOTS_LONGTEXT, false)
*/
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;
} fadethread_t;
-static void *FadeToColorThread(vlc_object_t *);
+static void *FadeToColorThread(void *);
/*****************************************************************************
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
/* 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 */
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 ... */
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;
{
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!");
/*
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;
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 );
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;
}
*/
static void Atmo_SetupParameters(filter_t *p_filter)
{
- char *psz_path;
filter_sys_t *p_sys = p_filter->p_sys;
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,
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 );
}
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",
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] != '\\'))
{
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
msg_Err(p_filter,"failed to launch AtmoWin from %s", psz_path);
}
free(psz_path);
+ free(ptsz_path);
}
}
#endif
/* 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!
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 +
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;
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);
}
/*
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)
{
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 )
{
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;
* 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;
/* 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 );
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];
{
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 );
* 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);
*/
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;
}
}
*****************************************************************************
* 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 )
{
* 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 )
{