Commit 8ebd2349 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Visualisation: fix preferences, warnings and cosmetics

parent 63e333c2
/***************************************************************************** /*****************************************************************************
* projectm: visualization module based on libprojectM * projectm: visualization module based on libprojectM
***************************************************************************** *****************************************************************************
* Copyright (C) 2009 the VideoLAN team * Copyright © 2009-2011 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Rémi Duraffort <ivoire@videolan.org> * Authors: Rémi Duraffort <ivoire@videolan.org>
* Laurent Aimar
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the Free
...@@ -39,7 +40,6 @@ ...@@ -39,7 +40,6 @@
#include <libprojectM/projectM.hpp> #include <libprojectM/projectM.hpp>
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -90,9 +90,9 @@ vlc_module_begin () ...@@ -90,9 +90,9 @@ vlc_module_begin ()
add_directory( "projectm-preset-path", "/usr/share/projectM/presets", add_directory( "projectm-preset-path", "/usr/share/projectM/presets",
#endif #endif
PRESET_PATH_TXT, PRESET_PATH_LONGTXT, true ) PRESET_PATH_TXT, PRESET_PATH_LONGTXT, true )
add_font( "projectm-title-font", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", add_loadfile( "projectm-title-font", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
TITLE_FONT_TXT, TITLE_FONT_LONGTXT, true ) TITLE_FONT_TXT, TITLE_FONT_LONGTXT, true )
add_font( "projectm-menu-font", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf", add_loadfile( "projectm-menu-font", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",
MENU_FONT_TXT, MENU_FONT_LONGTXT, true ) MENU_FONT_TXT, MENU_FONT_LONGTXT, true )
#endif #endif
add_integer( "projectm-width", 800, WIDTH_TEXT, WIDTH_LONGTEXT, add_integer( "projectm-width", 800, WIDTH_TEXT, WIDTH_LONGTEXT,
...@@ -174,15 +174,15 @@ static int Open( vlc_object_t * p_this ) ...@@ -174,15 +174,15 @@ static int Open( vlc_object_t * p_this )
/* Create the object for the thread */ /* Create the object for the thread */
vlc_sem_init( &p_sys->ready, 0 ); vlc_sem_init( &p_sys->ready, 0 );
p_sys->b_error = false; p_sys->b_error = false;
p_sys->b_quit = false; p_sys->b_quit = false;
p_sys->i_width = var_InheritInteger( p_filter, "projectm-width" ); p_sys->i_width = var_InheritInteger( p_filter, "projectm-width" );
p_sys->i_height = var_InheritInteger( p_filter, "projectm-height" ); p_sys->i_height = var_InheritInteger( p_filter, "projectm-height" );
p_sys->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio ); p_sys->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
vlc_mutex_init( &p_sys->lock ); vlc_mutex_init( &p_sys->lock );
p_sys->p_buffer = NULL; p_sys->p_buffer = NULL;
p_sys->i_buffer_size = 0; p_sys->i_buffer_size = 0;
p_sys->i_nb_samples = 0; p_sys->i_nb_samples = 0;
/* Create the thread */ /* Create the thread */
if( vlc_clone( &p_sys->thread, Thread, p_filter, VLC_THREAD_PRIORITY_LOW ) ) if( vlc_clone( &p_sys->thread, Thread, p_filter, VLC_THREAD_PRIORITY_LOW ) )
...@@ -210,7 +210,7 @@ error: ...@@ -210,7 +210,7 @@ error:
*/ */
static void Close( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
/* Stop the thread /* Stop the thread
...@@ -267,6 +267,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf ) ...@@ -267,6 +267,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
static int VoutCallback( vlc_object_t *p_vout, char const *psz_name, static int VoutCallback( vlc_object_t *p_vout, char const *psz_name,
vlc_value_t oldv, vlc_value_t newv, void *p_data ) vlc_value_t oldv, vlc_value_t newv, void *p_data )
{ {
VLC_UNUSED( p_vout ); VLC_UNUSED( oldv );
vout_display_t *p_vd = (vout_display_t*)p_data; vout_display_t *p_vd = (vout_display_t*)p_data;
if( !strcmp(psz_name, "fullscreen") ) if( !strcmp(psz_name, "fullscreen") )
...@@ -282,13 +283,13 @@ static int VoutCallback( vlc_object_t *p_vout, char const *psz_name, ...@@ -282,13 +283,13 @@ static int VoutCallback( vlc_object_t *p_vout, char const *psz_name,
*/ */
static void *Thread( void *p_data ) static void *Thread( void *p_data )
{ {
filter_t *p_filter = (filter_t*)p_data; filter_t *p_filter = (filter_t*)p_data;
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
int cancel = vlc_savecancel();
video_format_t fmt; video_format_t fmt;
vlc_gl_t *gl; vlc_gl_t *gl;
int i_last_width = 0; unsigned int i_last_width = 0;
int i_last_height = 0; unsigned int i_last_height = 0;
locale_t loc; locale_t loc;
locale_t oldloc; locale_t oldloc;
...@@ -302,6 +303,8 @@ static void *Thread( void *p_data ) ...@@ -302,6 +303,8 @@ static void *Thread( void *p_data )
projectM::Settings settings; projectM::Settings settings;
#endif #endif
vlc_savecancel();
/* Create the openGL provider */ /* Create the openGL provider */
p_sys->p_vout = p_sys->p_vout =
(vout_thread_t *)vlc_object_create( p_filter, sizeof(vout_thread_t) ); (vout_thread_t *)vlc_object_create( p_filter, sizeof(vout_thread_t) );
...@@ -345,8 +348,10 @@ static void *Thread( void *p_data ) ...@@ -345,8 +348,10 @@ static void *Thread( void *p_data )
goto error; goto error;
} }
/* Work-around the projectM locale bug */
loc = newlocale (LC_NUMERIC_MASK, "C", NULL); loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
oldloc = uselocale (loc); oldloc = uselocale (loc);
/* Create the projectM object */ /* Create the projectM object */
#ifndef HAVE_PROJECTM2 #ifndef HAVE_PROJECTM2
psz_config = var_InheritString( p_filter, "projectm-config" ); psz_config = var_InheritString( p_filter, "projectm-config" );
...@@ -362,30 +367,33 @@ static void *Thread( void *p_data ) ...@@ -362,30 +367,33 @@ static void *Thread( void *p_data )
free( psz_data_path ); free( psz_data_path );
} }
#endif #endif
psz_title_font = var_InheritString( p_filter, "projectm-title-font" );
psz_menu_font = var_InheritString( p_filter, "projectm-menu-font" ); psz_title_font = var_InheritString( p_filter, "projectm-title-font" );
psz_menu_font = var_InheritString( p_filter, "projectm-menu-font" );
settings.meshX = var_InheritInteger( p_filter, "projectm-meshx" );
settings.meshY = var_InheritInteger( p_filter, "projectm-meshy" ); settings.meshX = var_InheritInteger( p_filter, "projectm-meshx" );
settings.fps = 35; settings.meshY = var_InheritInteger( p_filter, "projectm-meshy" );
settings.textureSize = var_InheritInteger( p_filter, "projectm-texture-size" ); settings.fps = 35;
settings.windowWidth = p_sys->i_width; settings.textureSize = var_InheritInteger( p_filter, "projectm-texture-size" );
settings.windowHeight = p_sys->i_height; settings.windowWidth = p_sys->i_width;
settings.presetURL = psz_preset_path; settings.windowHeight = p_sys->i_height;
settings.titleFontURL = psz_title_font; settings.presetURL = psz_preset_path;
settings.menuFontURL = psz_menu_font; settings.titleFontURL = psz_title_font;
settings.menuFontURL = psz_menu_font;
settings.smoothPresetDuration = 5; settings.smoothPresetDuration = 5;
settings.presetDuration = 30; settings.presetDuration = 30;
settings.beatSensitivity = 10; settings.beatSensitivity = 10;
settings.aspectCorrection = 1; settings.aspectCorrection = 1;
settings.easterEgg = 1; settings.easterEgg = 1;
settings.shuffleEnabled = 1; settings.shuffleEnabled = 1;
p_projectm = new projectM( settings ); p_projectm = new projectM( settings );
free( psz_menu_font ); free( psz_menu_font );
free( psz_title_font ); free( psz_title_font );
free( psz_preset_path ); free( psz_preset_path );
#endif #endif /* HAVE_PROJECTM2 */
p_sys->i_buffer_size = p_projectm->pcm()->maxsamples; p_sys->i_buffer_size = p_projectm->pcm()->maxsamples;
p_sys->p_buffer = (float*)calloc( p_sys->i_buffer_size, p_sys->p_buffer = (float*)calloc( p_sys->i_buffer_size,
sizeof( float ) ); sizeof( float ) );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment