Commit ce25f1e8 authored by Gildas Bazin's avatar Gildas Bazin

* added config_GetFloatVariable() and config_PutFloatVariable() to the config
  module.
* added a --zoom <float> config option.
* added a call to RestoreCPUState() in InitIDCT() in idct_sparse.h so that the
  FPU is still available after a call to InitIDCT().
* deactivate stream buffering when logging to a file.
parent b9d43101
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.95 2002/04/19 13:56:10 sam Exp $
* $Id: common.h,v 1.96 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -512,12 +512,14 @@ typedef struct module_symbols_s
struct aout_bank_s* p_aout_bank;
struct vout_bank_s* p_vout_bank;
int ( * config_GetIntVariable ) ( const char * );
char * ( * config_GetPszVariable ) ( const char * );
void ( * config_PutIntVariable ) ( const char *, int );
void ( * config_PutPszVariable ) ( const char *, char * );
int ( * config_LoadConfigFile ) ( const char * );
int ( * config_SaveConfigFile ) ( const char * );
int ( * config_GetIntVariable ) ( const char * );
float ( * config_GetFloatVariable ) ( const char * );
char * ( * config_GetPszVariable ) ( const char * );
void ( * config_PutIntVariable ) ( const char *, int );
void ( * config_PutFloatVariable ) ( const char *, float );
void ( * config_PutPszVariable ) ( const char *, char * );
int ( * config_LoadConfigFile ) ( const char * );
int ( * config_SaveConfigFile ) ( const char * );
struct module_config_s * ( * config_FindConfig ) ( const char * );
struct module_config_s * ( * config_Duplicate ) ( struct module_config_s* );
......
......@@ -4,7 +4,7 @@
* It includes functions allowing to declare, get or set configuration options.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: configuration.h,v 1.5 2002/04/19 13:56:10 sam Exp $
* $Id: configuration.h,v 1.6 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -41,7 +41,7 @@
#define MODULE_CONFIG_ITEM_PLUGIN 0x0030 /* Plugin option */
#define MODULE_CONFIG_ITEM_INTEGER 0x0040 /* Integer option */
#define MODULE_CONFIG_ITEM_BOOL 0x0050 /* Bool option */
#define MODULE_CONFIG_ITEM_ALIAS 0x0060 /* Alias option */
#define MODULE_CONFIG_ITEM_FLOAT 0x0060 /* Float option */
#define MODULE_CONFIG_ITEM 0x00F0
......@@ -53,6 +53,7 @@ typedef struct module_config_s
char *psz_longtext; /* Long comment on the configuration option */
char *psz_value; /* Option value */
int i_value; /* Option value */
float f_value; /* Option value */
void *p_callback; /* Function to call when commiting a change */
vlc_mutex_t *p_lock; /* lock to use when modifying the config */
boolean_t b_dirty; /* Dirty flag to indicate a config change */
......@@ -65,8 +66,10 @@ typedef struct module_config_s
*****************************************************************************/
#ifndef PLUGIN
int config_GetIntVariable( const char *psz_name );
float config_GetFloatVariable( const char *psz_name );
char * config_GetPszVariable( const char *psz_name );
void config_PutIntVariable( const char *psz_name, int i_value );
void config_PutFloatVariable( const char *psz_name, float f_value );
void config_PutPszVariable( const char *psz_name, char *psz_value );
int config_LoadConfigFile( const char *psz_module_name );
......@@ -80,6 +83,8 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
#else
# define config_GetIntVariable p_symbols->config_GetIntVariable
# define config_PutIntVariable p_symbols->config_PutIntVariable
# define config_GetFloatVariable p_symbols->config_GetFloatVariable
# define config_PutFloatVariable p_symbols->config_PutFloatVariable
# define config_GetPszVariable p_symbols->config_GetPszVariable
# define config_PutPszVariable p_symbols->config_PutPszVariable
# define config_Duplicate p_symbols->config_Duplicate
......@@ -104,29 +109,32 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
static module_config_t p_config[] = {
#define MODULE_CONFIG_STOP \
{ MODULE_CONFIG_HINT_END, NULL, NULL, NULL, NULL, 0, NULL, 0 } };
{ MODULE_CONFIG_HINT_END, NULL, NULL, NULL, NULL, 0, 0, NULL, 0 } };
#define ADD_CATEGORY_HINT( text, longtext ) \
{ MODULE_CONFIG_HINT_CATEGORY, NULL, text, longtext, NULL, 0, NULL, \
{ MODULE_CONFIG_HINT_CATEGORY, NULL, text, longtext, NULL, 0, 0, NULL, \
NULL, 0 },
#define ADD_SUBCATEGORY_HINT( text, longtext ) \
{ MODULE_CONFIG_HINT_SUBCATEGORY, NULL, text, longtext, NULL, 0, NULL, \
{ MODULE_CONFIG_HINT_SUBCATEGORY, NULL, text, longtext, NULL, 0, 0, NULL, \
NULL, 0 },
#define END_SUBCATEGORY_HINT \
{ MODULE_CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, NULL, NULL, 0, NULL, \
{ MODULE_CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, NULL, NULL, 0, 0, NULL, \
NULL, 0 },
#define ADD_STRING( name, value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_STRING, name, text, longtext, value, 0, \
{ MODULE_CONFIG_ITEM_STRING, name, text, longtext, value, 0, 0, \
p_callback, NULL, 0 },
#define ADD_FILE( name, psz_value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_FILE, name, text, longtext, psz_value, 0, \
{ MODULE_CONFIG_ITEM_FILE, name, text, longtext, psz_value, 0, 0, \
p_callback, NULL, 0 },
#define ADD_PLUGIN( name, i_capability, psz_value, p_callback, text, longtext)\
{ MODULE_CONFIG_ITEM_PLUGIN, name, text, longtext, psz_value, \
i_capability, p_callback, NULL, 0 },
i_capability, 0, p_callback, NULL, 0 },
#define ADD_INTEGER( name, i_value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_INTEGER, name, text, longtext, NULL, i_value, \
{ MODULE_CONFIG_ITEM_INTEGER, name, text, longtext, NULL, i_value, 0, \
p_callback, NULL, 0 },
#define ADD_FLOAT( name, f_value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_FLOAT, name, text, longtext, NULL, 0, f_value, \
p_callback, NULL, 0 },
#define ADD_BOOL( name, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_BOOL, name, text, longtext, NULL, 0, p_callback, \
{ MODULE_CONFIG_ITEM_BOOL, name, text, longtext, NULL, 0, 0, p_callback, \
NULL, 0 },
......@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.24 2002/04/21 10:32:20 sam Exp $
* $Id: gtk_preferences.c,v 1.25 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
......@@ -62,6 +62,7 @@ static void GtkConfigDialogDestroyed ( GtkObject *, gpointer );
static void GtkStringChanged ( GtkEditable *, gpointer );
static void GtkIntChanged ( GtkEditable *, gpointer );
static void GtkFloatChanged ( GtkEditable *, gpointer );
static void GtkBoolChanged ( GtkToggleButton *, gpointer );
static void GtkFreeHashTable ( gpointer );
......@@ -149,6 +150,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
GtkWidget *item_vbox;
GtkWidget *string_entry;
GtkWidget *integer_spinbutton;
GtkWidget *float_spinbutton;
GtkObject *item_adj;
GtkWidget *bool_checkbutton;
GtkWidget *plugin_clist;
......@@ -439,6 +441,25 @@ static void GtkCreateConfigDialog( char *psz_module_name,
integer_spinbutton, p_item->psz_longtext );
break;
case MODULE_CONFIG_ITEM_FLOAT:
/* add input box with default value */
item_adj = gtk_adjustment_new( p_item->f_value,
0, 99999, 0.01, 10, 10 );
float_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT(item_adj),
0.01, 2 );
/* connect signal to track changes in the spinbutton value */
gtk_object_set_data( GTK_OBJECT(float_spinbutton),
"config_option", p_item->psz_name );
gtk_signal_connect( GTK_OBJECT(float_spinbutton), "changed",
GTK_SIGNAL_FUNC(GtkFloatChanged),
(gpointer)config_dialog );
LABEL_AND_WIDGET( p_item->psz_text,
float_spinbutton, p_item->psz_longtext );
break;
case MODULE_CONFIG_ITEM_BOOL:
/* add check button */
......@@ -677,7 +698,7 @@ static void GtkStringChanged( GtkEditable *editable, gpointer user_data )
}
/****************************************************************************
* GtkIntChanged: signal called when the user changes a an integer value.
* GtkIntChanged: signal called when the user changes an integer value.
****************************************************************************/
static void GtkIntChanged( GtkEditable *editable, gpointer user_data )
{
......@@ -695,8 +716,36 @@ static void GtkIntChanged( GtkEditable *editable, gpointer user_data )
p_config = malloc( sizeof(module_config_t) );
p_config->i_type = MODULE_CONFIG_ITEM_INTEGER;
p_config->i_value = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(editable) );
p_config->i_value = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(editable) );
p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable),
"config_option" );
g_hash_table_insert( hash_table, (gpointer)editable,
(gpointer)p_config );
}
/****************************************************************************
* GtkFloatChanged: signal called when the user changes a float value.
****************************************************************************/
static void GtkFloatChanged( GtkEditable *editable, gpointer user_data )
{
module_config_t *p_config;
GHashTable *hash_table;
hash_table = (GHashTable *)gtk_object_get_data( GTK_OBJECT(user_data),
"config_hash_table" );
/* free old p_config */
p_config = (module_config_t *)g_hash_table_lookup( hash_table,
(gpointer)editable );
if( p_config ) GtkFreeHashValue( NULL, (gpointer)p_config, NULL );
p_config = malloc( sizeof(module_config_t) );
p_config->i_type = MODULE_CONFIG_ITEM_FLOAT;
p_config->f_value = gtk_spin_button_get_value_as_float(
GTK_SPIN_BUTTON(editable) );
p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable),
"config_option" );
......@@ -776,6 +825,9 @@ static void GtkSaveHashValue( gpointer key, gpointer value, gpointer user_data)
case MODULE_CONFIG_ITEM_BOOL:
config_PutIntVariable( p_config->psz_name, p_config->i_value );
break;
case MODULE_CONFIG_ITEM_FLOAT:
config_PutFloatVariable( p_config->psz_name, p_config->f_value );
break;
}
}
......
......@@ -2,7 +2,7 @@
* idct.c : C IDCT module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: idct.c,v 1.21 2002/04/19 13:56:11 sam Exp $
* $Id: idct.c,v 1.22 2002/04/21 11:23:03 gbazin Exp $
*
* Author: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -1247,5 +1247,10 @@ static __inline__ void IDCT( dctelem_t * p_block )
}
}
static __inline__ void RestoreCPUState( )
{
;
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* idct_sparse.h : Sparse IDCT functions (must be include at the end)
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct_sparse.h,v 1.1 2001/09/05 16:07:49 massiot Exp $
* $Id: idct_sparse.h,v 1.2 2002/04/21 11:23:03 gbazin Exp $
*
* Author: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -40,6 +40,8 @@ static void InitIDCT ( void ** pp_idct_data )
}
InitBlock();
RestoreCPUState();
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: idctclassic.c,v 1.22 2002/04/19 13:56:11 sam Exp $
* $Id: idctclassic.c,v 1.23 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -287,6 +287,11 @@ static __inline__ void IDCT( dctelem_t * p_block )
}
}
static __inline__ void RestoreCPUState( )
{
;
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* idctmmx.c : MMX IDCT module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: idctmmx.c,v 1.24 2002/04/19 13:56:11 sam Exp $
* $Id: idctmmx.c,v 1.25 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -411,5 +411,11 @@ static void IDCT( dctelem_t * p_block )
Col( p_block, 4 );
}
static __inline__ void RestoreCPUState( )
{
/* reenables the FPU */
__asm__ __volatile__ ("emms");
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* idctmmxext.c : MMX EXT IDCT module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: idctmmxext.c,v 1.21 2002/04/19 13:56:11 sam Exp $
* $Id: idctmmxext.c,v 1.22 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -394,5 +394,11 @@ static void IDCT( dctelem_t * p_block )
Col( p_block, 4 );
}
static __inline__ void RestoreCPUState( )
{
/* reenables the FPU */
__asm__ __volatile__ ("emms");
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* logger.c : file logging plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: logger.c,v 1.6 2002/04/19 13:56:11 sam Exp $
* $Id: logger.c,v 1.7 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -125,9 +125,10 @@ static int intf_Open( intf_thread_t *p_intf )
psz_filename = LOG_FILE;
}
/* Open the log file */
/* Open the log file and remove any buffering for the stream */
intf_WarnMsg( 1, "intf: opening logfile `%s'", psz_filename );
p_intf->p_sys->p_file = fopen( psz_filename, "w" );
setvbuf( p_intf->p_sys->p_file, NULL, _IONBF, 0 );
p_intf->p_sys->p_sub = intf_MsgSub();
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.181 2002/04/21 10:32:21 sam Exp $
* $Id: main.c,v 1.182 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -183,6 +183,10 @@
"You can enforce the video height here.\nNote that by default vlc will " \
"adapt to the video characteristics.")
#define ZOOM_TEXT N_("zoom video")
#define ZOOM_LONGTEXT N_( \
"You can zoom the video by the specified factor.")
#define GRAYSCALE_TEXT N_("grayscale video output")
#define GRAYSCALE_LONGTEXT N_( \
"Using this option, vlc will not decode the color information from the " \
......@@ -331,7 +335,7 @@
MODULE_CONFIG_START
/* Interface options */
ADD_CATEGORY_HINT( N_("Interface"), NULL)
ADD_CATEGORY_HINT( N_("Interface"), NULL )
ADD_PLUGIN ( "intf", MODULE_CAPABILITY_INTF, NULL, NULL, INTF_TEXT, INTF_LONGTEXT )
ADD_INTEGER ( "warning", 0, NULL, WARNING_TEXT, WARNING_LONGTEXT )
ADD_BOOL ( "stats", NULL, STATS_TEXT, STATS_LONGTEXT )
......@@ -354,6 +358,7 @@ ADD_PLUGIN ( "vout", MODULE_CAPABILITY_VOUT, NULL, NULL, VOUT_TEXT, VOUT_LONGTE
ADD_BOOL ( "novideo", NULL, NOVIDEO_TEXT, NOVIDEO_LONGTEXT )
ADD_INTEGER ( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT )
ADD_INTEGER ( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT )
ADD_FLOAT ( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT )
ADD_BOOL ( "grayscale", NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT )
ADD_BOOL ( "fullscreen", NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT )
ADD_BOOL ( "nooverlay", NULL, NOOVERLAY_TEXT, NOOVERLAY_LONGTEXT )
......@@ -440,16 +445,16 @@ MODULE_DEACTIVATE_STOP
static module_t help_module;
static module_config_t p_help_config[] = {
{ MODULE_CONFIG_ITEM_BOOL, "help", N_("print help (or use -h)"),
NULL, NULL, 0, NULL, NULL, 0 },
NULL, NULL, 0, 0, NULL, NULL, 0 },
{ MODULE_CONFIG_ITEM_BOOL, "longhelp", N_("print detailed help (or use -H)"),
NULL, NULL, 0, NULL, NULL, 0 },
NULL, NULL, 0, 0, NULL, NULL, 0 },
{ MODULE_CONFIG_ITEM_BOOL, "list", N_("print a list of available plugins "
"(or use -l)"), NULL, NULL, 0, NULL, NULL, 0 },
"(or use -l)"), NULL, NULL, 0, 0, NULL, NULL, 0 },
{ MODULE_CONFIG_ITEM_STRING, "plugin", N_("print help on plugin "
"(or use -p)"), NULL, NULL, 0, NULL, &help_module.config_lock, 0 },
"(or use -p)"), NULL, NULL, 0, 0, NULL, &help_module.config_lock, 0 },
{ MODULE_CONFIG_ITEM_BOOL, "version", N_("print version information"),
NULL, NULL, 0, NULL, NULL, 0 },
{ MODULE_CONFIG_HINT_END, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0 } };
NULL, NULL, 0, 0, NULL, NULL, 0 },
{ MODULE_CONFIG_HINT_END, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, 0 } };
/*****************************************************************************
* End configuration.
......@@ -974,6 +979,17 @@ static void Usage( const char *psz_module_name )
_(" <integer>"), psz_spaces, p_item->psz_text );
psz_spaces[i] = 32;
break;
case MODULE_CONFIG_ITEM_FLOAT:
/* Nasty hack, but right now I'm too tired to think about
* a nice solution */
i = 25 - strlen( p_item->psz_name )
- strlen(_(" <float>")) - 1;
if( i < 0 ) i = 0; psz_spaces[i] = 0;
intf_Msg( " --%s%s%s %s", p_item->psz_name,
_(" <float>"), psz_spaces, p_item->psz_text );
psz_spaces[i] = 32;
break;
case MODULE_CONFIG_ITEM_BOOL:
/* Nasty hack, but right now I'm too tired to think about
* a nice solution */
......
......@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.15 2002/04/19 13:56:12 sam Exp $
* $Id: configuration.c,v 1.16 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -26,7 +26,7 @@
#include <stdio.h> /* sprintf() */
#include <stdlib.h> /* free(), strtol() */
#include <string.h> /* strdup() */
#include <errno.h> /* errno */
#include <errno.h> /* errno */
#ifdef HAVE_UNISTD_H
# include <unistd.h> /* getuid() */
......@@ -77,6 +77,34 @@ int config_GetIntVariable( const char *psz_name )
return p_config->i_value;
}
/*****************************************************************************
* config_GetFloatVariable: get the value of a float variable
*****************************************************************************
* This function is used to get the value of variables which are internally
* represented by a float (MODULE_CONFIG_ITEM_FLOAT).
*****************************************************************************/
float config_GetFloatVariable( const char *psz_name )
{
module_config_t *p_config;
p_config = config_FindConfig( psz_name );
/* sanity checks */
if( !p_config )
{
intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
return -1;
}
if( p_config->i_type != MODULE_CONFIG_ITEM_FLOAT )
{
intf_ErrMsg( "config error: option %s doesn't refer to a float",
psz_name );
return -1;
}
return p_config->f_value;
}
/*****************************************************************************
* config_GetPszVariable: get the string value of a string variable
*****************************************************************************
......@@ -188,6 +216,34 @@ void config_PutIntVariable( const char *psz_name, int i_value )
p_config->i_value = i_value;
}
/*****************************************************************************
* config_PutFloatVariable: set the value of a float variable
*****************************************************************************
* This function is used to set the value of variables which are internally
* represented by a float (MODULE_CONFIG_ITEM_FLOAT).
*****************************************************************************/
void config_PutFloatVariable( const char *psz_name, float f_value )
{
module_config_t *p_config;
p_config = config_FindConfig( psz_name );
/* sanity checks */
if( !p_config )
{
intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
return;
}
if( p_config->i_type != MODULE_CONFIG_ITEM_FLOAT )
{
intf_ErrMsg( "config error: option %s doesn't refer to a float",
psz_name );
return;
}
p_config->f_value = f_value;
}
/*****************************************************************************
* config_FindConfig: find the config structure associated with an option.
*****************************************************************************
......@@ -249,6 +305,7 @@ module_config_t *config_Duplicate( module_config_t *p_orig )
{
p_config[i].i_type = p_orig[i].i_type;
p_config[i].i_value = p_orig[i].i_value;
p_config[i].f_value = p_orig[i].f_value;
p_config[i].b_dirty = p_orig[i].b_dirty;
p_config[i].psz_name = p_orig[i].psz_name ?
......@@ -386,6 +443,15 @@ int config_LoadConfigFile( const char *psz_module_name )
p_item->psz_name, p_item->i_value );
break;
case MODULE_CONFIG_ITEM_FLOAT:
if( !*psz_option_value )
break; /* ignore empty option */
p_item->f_value = (float)atof( psz_option_value);
intf_WarnMsg( 7, "config: found <%s> option %s=%f",
p_module->psz_name, p_item->psz_name,
(double)p_item->f_value );
break;
default:
vlc_mutex_lock( p_item->p_lock );
......@@ -609,12 +675,19 @@ int config_SaveConfigFile( const char *psz_module_name )
case MODULE_CONFIG_ITEM_INTEGER:
if( p_item->psz_text )
fprintf( file, "# %s %s\n", p_item->psz_text,
MODULE_CONFIG_ITEM_BOOL ? _("<boolean>")
: _("<integer>") );
(p_item->i_type == MODULE_CONFIG_ITEM_BOOL) ?
_("<boolean>") : _("<integer>") );
fprintf( file, "%s=%i\n", p_item->psz_name,
p_item->i_value );
break;
case MODULE_CONFIG_ITEM_FLOAT:
if( p_item->psz_text )
fprintf( file, _("# %s <float>\n"), p_item->psz_text );
fprintf( file, "%s=%f\n", p_item->psz_name,
(double)p_item->f_value );
break;
default:
if( p_item->psz_text )
fprintf( file, _("# %s <string>\n"), p_item->psz_text );
......@@ -762,6 +835,10 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
case MODULE_CONFIG_ITEM_INTEGER:
config_PutIntVariable( p_longopts[i_index].name, atoi(optarg));
break;
case MODULE_CONFIG_ITEM_FLOAT:
config_PutFloatVariable( p_longopts[i_index].name,
(float)atof(optarg) );
break;
case MODULE_CONFIG_ITEM_BOOL:
config_PutIntVariable( p_longopts[i_index].name, 1 );
break;
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.171 2002/04/05 01:05:22 gbazin Exp $
* $Id: video_output.c,v 1.172 2002/04/21 11:23:03 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -812,47 +812,51 @@ static void MaskToShift( int *pi_left, int *pi_right, u32 i_mask )
/*****************************************************************************
* InitWindowSize: find the initial dimensions the video window should have.
*****************************************************************************
* This function will check the "width" and "height" config options and
* This function will check the "width", "height" and "zoom" config options and
* will calculate the size that the video window should have.
*****************************************************************************/
static void InitWindowSize( vout_thread_t *p_vout, int *pi_width,
int *pi_height )
{
int i_width, i_height;
double f_zoom;
i_width = config_GetIntVariable( "width" );
i_height = config_GetIntVariable( "height" );
f_zoom = config_GetFloatVariable( "zoom" );
if( (i_width >= 0) && (i_height >= 0))
{
*pi_width = i_width;
*pi_height = i_height;
*pi_width = i_width * f_zoom;
*pi_height = i_height * f_zoom;
return;
}
else if( i_width >= 0 )
{
*pi_width = i_width;
*pi_height = i_width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
*pi_width = i_width * f_zoom;
*pi_height = i_width * f_zoom * VOUT_ASPECT_FACTOR /
p_vout->render.i_aspect;
return;
}
else if( i_height >= 0 )
{
*pi_height = i_height;
*pi_width = i_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
*pi_height = i_height * f_zoom;
*pi_width = i_height * f_zoom * p_vout->render.i_aspect /
VOUT_ASPECT_FACTOR;
return;
}
if( p_vout->render.i_height * p_vout->render.i_aspect
>= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
{
*pi_width = p_vout->render.i_height
*pi_width = p_vout->render.i_height * f_zoom
* p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
*pi_height = p_vout->render.i_height;
*pi_height = p_vout->render.i_height * f_zoom;
}
else
{
*pi_width = p_vout->render.i_width;
*pi_height = p_vout->render.i_width
*pi_width = p_vout->render.i_width * f_zoom;
*pi_height = p_vout->render.i_width * f_zoom
* VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
}
}
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