INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output aout_common aout_ext-dec aout_spdif
-MISC := mtime modules netutils iso_lang
+MISC := mtime modules configuration netutils iso_lang
C_OBJ := $(INTERFACE:%=src/interface/%.o) \
$(INPUT:%=src/input/%.o) \
* audio_output.h : audio output thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: audio_output.h,v 1.41 2002/01/14 12:15:10 asmax Exp $
+ * $Id: audio_output.h,v 1.42 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
* will be played */
mtime_t date;
- /* Path to the audio output device (default is set to "/dev/dsp") */
- char * psz_device;
- int i_fd;
-
/* The current volume */
int i_volume;
int i_savedvolume;
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.75 2002/02/20 23:23:53 sam Exp $
+ * $Id: common.h,v 1.76 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
struct playlist_s;
struct playlist_item_s;
struct module_s;
+struct module_config_s;
typedef struct playlist_s * p_playlist_t;
typedef struct playlist_item_s * p_playlist_item_t;
+typedef struct module_s * p_module_t;
+typedef struct module_config_s * p_module_config_t;
/* Interface */
struct intf_thread_s;
struct aout_bank_s* p_aout_bank;
struct vout_bank_s* p_vout_bank;
- int ( * main_GetIntVariable ) ( char *, int );
- char * ( * main_GetPszVariable ) ( char *, char * );
- void ( * main_PutIntVariable ) ( char *, int );
- void ( * main_PutPszVariable ) ( char *, char * );
+ int ( * config_GetIntVariable ) ( const char * );
+ char * ( * config_GetPszVariable ) ( const char * );
+ void ( * config_PutIntVariable ) ( const char *, int );
+ void ( * config_PutPszVariable ) ( const char *, char * );
+ struct module_config_s * ( * config_FindConfig ) ( const char * );
+ struct module_config_s * ( * config_Duplicate ) ( struct module_config_s *,
+ int );
struct intf_subscription_s * ( * intf_MsgSub ) ( void );
void ( * intf_MsgUnsub ) ( struct intf_subscription_s * );
void ( * intf_UrlDecode ) ( char * );
int ( * intf_Eject ) ( const char * );
- void ( * msleep ) ( mtime_t );
- mtime_t ( * mdate ) ( void );
- char * ( * mstrtime ) ( char *, mtime_t );
+ void ( * msleep ) ( mtime_t );
+ mtime_t ( * mdate ) ( void );
+ char * ( * mstrtime ) ( char *, mtime_t );
int ( * network_ChannelCreate )( void );
int ( * network_ChannelJoin ) ( int );
char * ( * DecodeLanguage ) ( u16 );
- struct module_s * ( * module_Need ) ( int, char *, void * );
- void ( * module_Unneed ) ( struct module_s * );
+ struct module_s * ( * module_Need ) ( int, char *, void * );
+ void ( * module_Unneed ) ( struct module_s * );
} module_symbols_t;
*
* - Symbols should begin with a prefix indicating in which module they are
* used, such as INTF_, VOUT_ or ADEC_.
- *
- * - Regarding environment variables, which are used as initialization
- * parameters for threads :
- * + variable names should end with '_VAR'
- * + environment variable default value should end with '_DEFAULT'
- * + values having a special meaning with '_VAL'
- *
*/
/*****************************************************************************
* outputting an error message (in second) */
#define THREAD_COND_TIMEOUT 5
-/* Environment variable containing the memcpy method */
-#define MEMCPY_METHOD_VAR "vlc_memcpy"
-
-/*
- * Paths
- */
-
-#define MAX_PLUGIN_COUNT 32
-
/*****************************************************************************
* Interface configuration
*****************************************************************************/
-/* Environment variable containing the display method */
-#define INTF_METHOD_VAR "vlc_intf"
-#define INTF_METHOD_DEFAULT "gtk"
-
-/* Environment variable used to store startup script name and default value */
-#define INTF_INIT_SCRIPT_VAR "vlcrc"
-#define INTF_INIT_SCRIPT_DEFAULT ".vlcrc"
-
-/* Environment variable used to store channels file and default value */
-#define INTF_CHANNELS_VAR "vlc_channels"
-#define INTF_CHANNELS_DEFAULT "vlc.channels"
-
/* Base delay in micro second for interface sleeps */
#define INTF_IDLE_SLEEP ((int)(0.050*CLOCK_FREQ))
#define INTF_GAMMA_STEP .1
#define INTF_GAMMA_LIMIT 3
-/* Maximum number of channels */
-#define INTF_MAX_CHANNELS 10
-
-/* Default search path for interface file browser */
-#define INTF_PATH_VAR "vlc_search_path"
-#define INTF_PATH_DEFAULT ""
-
/*****************************************************************************
* Input thread configuration
*****************************************************************************/
-/* Environment variable containing the input method */
-#define INPUT_METHOD_VAR "vlc_input"
-#define INPUT_METHOD_DEFAULT "ps"
-
/* XXX?? */
#define INPUT_IDLE_SLEEP ((int)(0.100*CLOCK_FREQ))
/* Maximum memory the input is allowed to use (20 MB) */
#define INPUT_MAX_ALLOCATION 20971520
-/* Default network protocol */
-#define INPUT_NETWORK_PROTOCOL_VAR "vlc_network_protocol"
-#define INPUT_NETWORK_PROTOCOL_DEFAULT "ts"
-
-/* Default input port */
-#define INPUT_PORT_VAR "vlc_server_port"
-#define INPUT_PORT_DEFAULT 1234
-
-/* FIXME : Delete those ! */
-/* Default remote server */
-#define INPUT_SERVER_VAR "vlc_server"
-#define INPUT_SERVER_DEFAULT "138.195.143.220"
-
-/* Broadcast mode */
-#define INPUT_BROADCAST_VAR "vlc_broadcast"
-#define INPUT_BROADCAST_DEFAULT 0
-
-/* Default broadcast address */
-#define INPUT_BCAST_ADDR_VAR "vlc_broadcast_addr"
-#define INPUT_BCAST_ADDR_DEFAULT "138.195.143.255"
-
-/* Channels mode */
-#define INPUT_NETWORK_CHANNEL_VAR "vlc_channel"
-#define INPUT_NETWORK_CHANNEL_DEFAULT 0
-
/*
* Channel method
*/
-/* Default network interface and environment variable */
-#define INPUT_IFACE_VAR "vlc_iface"
-#define INPUT_IFACE_DEFAULT "eth0"
-
-/* Default server and port */
-#define INPUT_CHANNEL_SERVER_VAR "vlc_channel_server"
-#define INPUT_CHANNEL_SERVER_DEFAULT "138.195.143.120"
-#define INPUT_CHANNEL_PORT_VAR "vlc_channel_port"
-#define INPUT_CHANNEL_PORT_DEFAULT 6010
-
/* Delay between channel changes - this is required to avoid flooding the
* channel server */
#define INPUT_CHANNEL_CHANGE_DELAY (mtime_t)(5*CLOCK_FREQ)
* mark it to be presented */
#define DEFAULT_PTS_DELAY (mtime_t)(.2*CLOCK_FREQ)
-/* DVD defaults */
-#define INPUT_DVD_DEVICE_VAR "vlc_dvd_device"
-
-#define INPUT_TITLE_VAR "vlc_input_title"
-#define INPUT_CHAPTER_VAR "vlc_input_chapter"
-#define INPUT_ANGLE_VAR "vlc_input_angle"
-#define INPUT_AUDIO_VAR "vlc_input_audio"
-#define INPUT_CHANNEL_VAR "vlc_input_channel"
-#define INPUT_SUBTITLE_VAR "vlc_input_subtitle"
-
-/* VCD defaults */
-#define INPUT_VCD_DEVICE_VAR "vlc_vcd_device"
-
/*****************************************************************************
* Audio configuration
*****************************************************************************/
/* Maximum number of audio output threads */
#define AOUT_MAX_THREADS 10
-/* Environment variable containing the audio output method */
-#define AOUT_METHOD_VAR "vlc_aout"
-#define AOUT_METHOD_DEFAULT "dsp"
-
-/* Environment variable used to store dsp device name, and default value */
-#define AOUT_DSP_VAR "vlc_dsp"
-#define AOUT_DSP_DEFAULT "/dev/dsp"
-
/* Default audio output format (AOUT_FMT_S16_NE = Native Endianess) */
#define AOUT_FORMAT_DEFAULT AOUT_FMT_S16_NE
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_S8 */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_U16_BE */
/* #define AOUT_FORMAT_DEFAULT AOUT_FMT_U16_LE */
-/* Environment variable for stereo, and default value */
-#define AOUT_STEREO_VAR "vlc_stereo"
-#define AOUT_STEREO_DEFAULT 1
-
-/* Environment variable for spdif mode */
-#define AOUT_SPDIF_VAR "vlc_spdif"
-#define AOUT_SPDIF_DEFAULT 0
-
-/* Environment variable containing the AC3 downmix method */
-#define DOWNMIX_METHOD_VAR "vlc_downmix"
-
-/* Environment variable containing the AC3 IMDCT method */
-#define IMDCT_METHOD_VAR "vlc_imdct"
-
/* Volume */
#define VOLUME_DEFAULT 512
#define VOLUME_STEP 128
#define VOLUME_MAX 1024
-/* Environment variable for volume */
-#define AOUT_VOLUME_VAR "vlc_volume"
-
-/* Environment variable for output rate, and default value */
-#define AOUT_RATE_VAR "vlc_audio_rate"
-#define AOUT_RATE_DEFAULT 44100
-
/* Number of audio output frames contained in an audio output fifo.
* (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
* %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
* - long, in order to perform the buffer calculations as few as possible */
#define AOUT_BUFFER_DURATION 100000
-/* Environment variable for audio decoders */
-#define ADEC_MPEG_VAR "vlc_mpeg_adec"
-#define ADEC_AC3_VAR "vlc_ac3_adec"
-
/*****************************************************************************
* Video configuration
*****************************************************************************/
* Default settings for video output threads
*/
-/* Environment variable containing the display method */
-#define VOUT_METHOD_VAR "vlc_vout"
-#define VOUT_METHOD_DEFAULT "x11"
-
-/* Environment variable containing the display method */
-#define VOUT_FILTER_VAR "vlc_filter"
-#define VOUT_FILTER_DEFAULT "x11"
-
-/* Environment variable containing the motion compensation method */
-#define MOTION_METHOD_VAR "vlc_motion"
-
-/* Environment variable containing the IDCT method */
-#define IDCT_METHOD_VAR "vlc_idct"
-
-/* Environment variable containing the YUV method */
-#define YUV_METHOD_VAR "vlc_yuv"
-
-/* Environment variable used in place of DISPLAY if available */
-#define VOUT_DISPLAY_VAR "vlc_display"
-
-/* Default dimensions for display window - these dimensions are enough for the
- * standard width and height broadcasted MPEG-2 streams or DVDs */
-#define VOUT_WIDTH_VAR "vlc_width"
-#define VOUT_WIDTH_DEFAULT 720
-#define VOUT_HEIGHT_VAR "vlc_height"
-#define VOUT_HEIGHT_DEFAULT 576
-#define VOUT_DEPTH_VAR "vlc_depth"
-#define VOUT_DEPTH_DEFAULT 15
-
-/* Default SPU margin is -1, which means we don't force their position */
-#define VOUT_SPUMARGIN_VAR "vlc_spumargin"
-#define VOUT_SPUMARGIN_DEFAULT -1
-
/* Multiplier value for aspect ratio calculation (2^7 * 3^3 * 5^3) */
#define VOUT_ASPECT_FACTOR 432000
* joined. */
#define VOUT_MAX_AREAS 5
-/* Environment variable for grayscale output mode, and default value */
-#define VOUT_GRAYSCALE_VAR "vlc_grayscale"
-#define VOUT_GRAYSCALE_DEFAULT 0
-
-/* Environment variable for fullscreen mode, and default value */
-#define VOUT_FULLSCREEN_VAR "vlc_fullscreen"
-#define VOUT_FULLSCREEN_DEFAULT 0
-
-/* Environment variable for overlay mode, and default value */
-#define VOUT_NOOVERLAY_VAR "vlc_nooverlay"
-#define VOUT_NOOVERLAY_DEFAULT 0
-
-/* Default gamma */
-#define VOUT_GAMMA_VAR "vlc_gamma"
-#define VOUT_GAMMA_DEFAULT 0.
-
/* Default fonts */
#define VOUT_DEFAULT_FONT "default8x9.psf"
#define VOUT_LARGE_FONT "default8x16.psf"
/* The default video output window title */
#define VOUT_TITLE "VideoLAN Client " VERSION
-/* Environment variable for framebuffer device, and default value */
-#define VOUT_FB_DEV_VAR "vlc_fb_dev"
-#define VOUT_FB_DEV_DEFAULT "/dev/fb0"
-
-/* Environment variable for XVideo adaptor, and default value */
-#define VOUT_XVADAPTOR_VAR "vlc_xv_adaptor"
-
/*****************************************************************************
* Video parser configuration
*****************************************************************************/
/* Maximum number of macroblocks in a picture. */
#define MAX_MB 2048
-/* The synchro variable name */
-#define VPAR_SYNCHRO_VAR "vlc_synchro"
-
/*****************************************************************************
* Video decoder configuration
*****************************************************************************/
/* Maximum range of values out of the IDCT + motion compensation. */
#define VDEC_CROPRANGE 2048
-/* Environment variable containing the SMP value. */
-#define VDEC_SMP_VAR "vlc_smp"
-
/* No SMP by default, since it slows down things on non-smp machines. */
#define VDEC_SMP_DEFAULT 0
* queue are printed, but not sent to the threads */
#define INTF_MSG_QSIZE 256
-/* Interface warnig message level */
-#define INTF_WARNING_VAR "vlc_warning_level"
-#define INTF_WARNING_DEFAULT 0
/****************************************************************************
- * Playlist defaults
+ * Macros for the names of the main options
+ * Instead of directly manipulating the option names, we define macros for
+ * them. This makes sense only for the main options (ie. only the ones defined
+ * in main.c) because they are widely used.
+ * We won't bother doing this for plugins as plugin specific options should
+ * by definition be restricted in useage to the plugin that defines them.
+ *
****************************************************************************/
-/* Launch on start-up */
-#define PLAYLIST_STARTUP_VAR "vlc_playlist_on_start_up"
-#define PLAYLIST_STARTUP_DEFAULT 0
+/*
+ * Interface option names
+ */
-/* Enqueue drag'n dropped item */
-#define PLAYLIST_ENQUEUE_VAR "vlc_playlist_enqueue"
-#define PLAYLIST_ENQUEUE_DEFAULT 0
+/* Variable containing the display method */
+#define INTF_METHOD_VAR "intf"
+/* Variable used to store startup script */
+#define INTF_INIT_SCRIPT_VAR "vlcrc"
+/* Default search path for interface file browser */
+#define INTF_PATH_VAR "search_path"
+/* Interface warnig message level */
+#define INTF_WARNING_VAR "warning"
+/* Variable to enable stats mode */
+#define INTF_STATS_VAR "stats"
+
+/*
+ * Audio output option names
+ */
+
+/* Variable to disable the audio output */
+#define AOUT_NOAUDIO_VAR "noaudio"
+/* Variable containing the audio output method */
+#define AOUT_METHOD_VAR "aout"
+/* Variable for spdif mode */
+#define AOUT_SPDIF_VAR "spdif"
+/* Variable for volume */
+#define AOUT_VOLUME_VAR "volume"
+/* Variable for mono */
+#define AOUT_MONO_VAR "audio_mono"
+/* Variable for output rate */
+#define AOUT_RATE_VAR "audio_rate"
+/* Variable for output rate */
+#define AOUT_DESYNC_VAR "audio_desync"
+
+/*
+ * Video output option names
+ */
+
+/* Variable to disable the video output */
+#define VOUT_NOVIDEO_VAR "novideo"
+/* Variable containing the display method */
+#define VOUT_METHOD_VAR "vout"
+/* Variable used in place of DISPLAY if available */
+#define VOUT_DISPLAY_VAR "display"
+/* Dimensions for display window */
+#define VOUT_WIDTH_VAR "width"
+#define VOUT_HEIGHT_VAR "height"
+/* Variable for grayscale output mode */
+#define VOUT_GRAYSCALE_VAR "grayscale"
+/* Variable for fullscreen mode */
+#define VOUT_FULLSCREEN_VAR "fullscreen"
+/* Variable for overlay mode */
+#define VOUT_NOOVERLAY_VAR "nooverlay"
+/* Variable containing the filter method */
+#define VOUT_FILTER_VAR "filter"
+/* Variable containing the SPU margin */
+#define VOUT_SPUMARGIN_VAR "spumargin"
+/*
+ * Input option names
+ */
+
+/* Variable containing the input method */
+#define INPUT_METHOD_VAR "input"
+/* Input port */
+#define INPUT_PORT_VAR "server_port"
+/* Channels mode */
+#define INPUT_NETWORK_CHANNEL_VAR "network_channel"
+/* Variable containing channel server and port */
+#define INPUT_CHANNEL_SERVER_VAR "channel_server"
+#define INPUT_CHANNEL_PORT_VAR "channel_port"
+/* Variable containing network interface */
+#define INPUT_IFACE_VAR "iface"
+
+#define INPUT_TITLE_VAR "input_title"
+#define INPUT_CHAPTER_VAR "input_chapter"
+#define INPUT_ANGLE_VAR "input_angle"
+#define INPUT_AUDIO_VAR "input_audio"
+#define INPUT_CHANNEL_VAR "input_channel"
+#define INPUT_SUBTITLE_VAR "input_subtitle"
+/* DVD defaults */
+#define INPUT_DVD_DEVICE_VAR "dvd_device"
+/* VCD defaults */
+#define INPUT_VCD_DEVICE_VAR "vcd_device"
+
+/*
+ * Decoders option names
+ */
+
+/* Variables for audio decoders */
+#define ADEC_MPEG_VAR "mpeg_adec"
+#define ADEC_AC3_VAR "ac3_adec"
+/* The synchro variable name */
+#define VPAR_SYNCHRO_VAR "vpar_synchro"
+/* Variable containing the SMP value */
+#define VDEC_SMP_VAR "vdec_smp"
+
+/*
+ * Playlist option names
+ */
+
+/* Launch on start-up */
+#define PLAYLIST_STARTUP_VAR "playlist_on_startup"
+/* Enqueue drag'n dropped item */
+#define PLAYLIST_ENQUEUE_VAR "playlist_enqueue"
/* Loop on playlist end */
-#define PLAYLIST_LOOP_VAR "vlc_playlist_loop"
-#define PLAYLIST_LOOP_DEFAULT 0
+#define PLAYLIST_LOOP_VAR "playlist_loop"
+
+/*
+ * CPU options
+ */
+#define NOMMX_VAR "nommx"
+#define NO3DN_VAR "no3dn"
+#define NOMMXEXT_VAR "nommxext"
+#define NOSSE_VAR "nosse"
+#define NOALTIVEC_VAR "noaltivec"
+
+/*
+ * Misc option names
+ */
+/* Variable containing the memcpy method */
+#define MEMCPY_METHOD_VAR "memcpy"
--- /dev/null
+/*****************************************************************************
+ * configuration.h : configuration management module
+ * This file describes the programming interface for the configuration module.
+ * It includes functions allowing to declare, get or set configuration options.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: configuration.h,v 1.1 2002/02/24 20:51:09 gbazin Exp $
+ *
+ * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Macros used to build the configuration structure.
+ *****************************************************************************/
+
+/* Mandatory last part of the structure */
+#define MODULE_CONFIG_ITEM_END 0x000 /* End of config */
+
+/* Configuration widgets */
+#define MODULE_CONFIG_ITEM_CATEGORY 0x0001 /* Start of new category */
+#define MODULE_CONFIG_ITEM_SUBCATEGORY 0x0002 /* Start of sub-category */
+#define MODULE_CONFIG_ITEM_SUBCATEGORY_END 0x0003 /* End of sub-category */
+#define MODULE_CONFIG_ITEM_STRING 0x0004 /* String option */
+#define MODULE_CONFIG_ITEM_FILE 0x0005 /* File option */
+#define MODULE_CONFIG_ITEM_PLUGIN 0x0006 /* Plugin option */
+#define MODULE_CONFIG_ITEM_INTEGER 0x0007 /* Integer option */
+#define MODULE_CONFIG_ITEM_BOOL 0x0008 /* Bool option */
+#define MODULE_CONFIG_ITEM_ALIAS 0x0009 /* Alias option */
+
+typedef struct module_config_s
+{
+ int i_type; /* Configuration type */
+ char * psz_name; /* Option name */
+ char * psz_text; /* Short comment on the configuration option */
+ char * psz_longtext; /* Long comment on the configuration option */
+ char * psz_value; /* Option value */
+ int i_value; /* Option value */
+ void * p_callback; /* Function to call when commiting a change */
+ boolean_t b_dirty; /* Dirty flag to indicate a config change */
+
+} module_config_t;
+
+/*****************************************************************************
+ * Prototypes - these methods are used to get, set or manipulate configuration
+ * data.
+ *****************************************************************************/
+#ifndef PLUGIN
+int config_GetIntVariable( const char *psz_name );
+char * config_GetPszVariable( const char *psz_name );
+void config_PutIntVariable( const char *psz_name, int i_value );
+void config_PutPszVariable( const char *psz_name, char *psz_value );
+
+module_config_t *config_FindConfig( const char *psz_name );
+module_config_t *config_Duplicate ( module_config_t *p_config_orig,
+ int i_config_options );
+#else
+# define config_GetIntVariable p_symbols->config_GetIntVariable
+# define config_PutIntVariable p_symbols->config_PutIntVariable
+# define config_GetPszVariable p_symbols->config_GetPszVariable
+# define config_PutPszVariable p_symbols->config_PutPszVariable
+# define config_Duplicate p_symbols->config_Duplicate
+# define config_FindConfig p_symbols->config_FindConfig
+#endif
+
+/*****************************************************************************
+ * Macros used to build the configuration structure.
+ *
+ * Note that internally we support only 2 types of config data: int and string.
+ * The other types declared here just map to one of these 2 basic types but
+ * have the advantage of also providing very good hints to a configuration
+ * interface so as to make it more user friendly.
+ * The configuration structure also includes category hints. These hints can
+ * provide a configuration inteface with some very useful data and also allow
+ * for a more user friendly interface.
+ *****************************************************************************/
+
+#define MODULE_CONFIG_START \
+ static module_config_t p_config[] = {
+
+#define MODULE_CONFIG_STOP \
+ { MODULE_CONFIG_ITEM_END, NULL, NULL, NULL, NULL, 0, NULL, 0 } };
+
+#define ADD_CATEGORY_HINT( text, longtext ) \
+ { MODULE_CONFIG_ITEM_CATEGORY, NULL, text, longtext, NULL, 0, NULL, 0 },
+#define ADD_SUBCATEGORY_HINT( text, longtext ) \
+ { MODULE_CONFIG_ITEM_SUBCATEGORY, NULL, text, longtext, NULL, 0, NULL, 0 },
+#define END_SUBCATEGORY_HINT \
+ { MODULE_CONFIG_ITEM_SUBCATEGORY_END, NULL, NULL, NULL, NULL, 0, NULL, 0 },
+#define ADD_STRING( name, value, p_callback, text, longtext ) \
+ { MODULE_CONFIG_ITEM_STRING, name, text, longtext, value, 0, \
+ p_callback, 0 },
+#define ADD_FILE( name, psz_value, p_callback, text, longtext ) \
+ { MODULE_CONFIG_ITEM_FILE, name, text, longtext, psz_value, 0, \
+ p_callback, 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, 0 },
+#define ADD_INTEGER( name, i_value, p_callback, text, longtext ) \
+ { MODULE_CONFIG_ITEM_INTEGER, name, text, longtext, NULL, i_value, \
+ p_callback, 0 },
+#define ADD_BOOL( name, p_callback, text, longtext ) \
+ { MODULE_CONFIG_ITEM_BOOL, name, text, longtext, NULL, 0, p_callback, 0 },
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: main.h,v 1.29 2002/02/15 13:32:52 sam Exp $
+ * $Id: main.h,v 1.30 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
/* Global properties */
int i_argc; /* command line arguments count */
char ** ppsz_argv; /* command line arguments */
- char ** ppsz_env; /* environment variables */
char * psz_arg0; /* program name (whithout path) */
u32 i_cpu_capabilities; /* CPU extensions */
boolean_t b_audio; /* is audio output allowed ? */
boolean_t b_video; /* is video output allowed ? */
boolean_t b_ac3;
+ boolean_t b_stereo;
mtime_t i_desync; /* relative desync of the audio ouput */
/* Fast memcpy plugin used */
*****************************************************************************/
#define FAST_MEMCPY p_main->pf_memcpy
#define FAST_MEMSET p_main->pf_memset
-
-/*****************************************************************************
- * Prototypes - these methods are used to get default values for some threads
- * and modules.
- *****************************************************************************/
-#ifndef PLUGIN
-int main_GetIntVariable( char *psz_name, int i_default );
-char * main_GetPszVariable( char *psz_name, char *psz_default );
-void main_PutIntVariable( char *psz_name, int i_value );
-void main_PutPszVariable( char *psz_name, char *psz_value );
-#else
-# define main_GetIntVariable p_symbols->main_GetIntVariable
-# define main_PutIntVariable p_symbols->main_PutIntVariable
-# define main_GetPszVariable p_symbols->main_GetPszVariable
-# define main_PutPszVariable p_symbols->main_PutPszVariable
-#endif
-
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.h,v 1.41 2002/02/15 13:32:52 sam Exp $
+ * $Id: modules.h,v 1.42 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* new capability. */
static char *pp_capa[] =
{
+ "main",
+#define MODULE_CAPABILITY_MAIN 0 /* Main */
"interface",
-#define MODULE_CAPABILITY_INTF 0 /* Interface */
+#define MODULE_CAPABILITY_INTF 1 /* Interface */
"access",
-#define MODULE_CAPABILITY_ACCESS 1 /* Input */
+#define MODULE_CAPABILITY_ACCESS 2 /* Input */
"input",
-#define MODULE_CAPABILITY_INPUT 2 /* Input */
+#define MODULE_CAPABILITY_INPUT 3 /* Input */
"decaps",
-#define MODULE_CAPABILITY_DECAPS 3 /* Decaps */
+#define MODULE_CAPABILITY_DECAPS 4 /* Decaps */
"decoder",
-#define MODULE_CAPABILITY_DECODER 4 /* Audio or video decoder */
+#define MODULE_CAPABILITY_DECODER 5 /* Audio or video decoder */
"motion",
-#define MODULE_CAPABILITY_MOTION 5 /* Motion compensation */
+#define MODULE_CAPABILITY_MOTION 6 /* Motion compensation */
"iDCT",
-#define MODULE_CAPABILITY_IDCT 6 /* IDCT transformation */
+#define MODULE_CAPABILITY_IDCT 7 /* IDCT transformation */
"audio output",
-#define MODULE_CAPABILITY_AOUT 7 /* Audio output */
+#define MODULE_CAPABILITY_AOUT 8 /* Audio output */
"video output",
-#define MODULE_CAPABILITY_VOUT 8 /* Video output */
+#define MODULE_CAPABILITY_VOUT 9 /* Video output */
"chroma transformation",
-#define MODULE_CAPABILITY_CHROMA 9 /* colorspace conversion */
+#define MODULE_CAPABILITY_CHROMA 10 /* colorspace conversion */
"iMDCT",
-#define MODULE_CAPABILITY_IMDCT 10 /* IMDCT transformation */
+#define MODULE_CAPABILITY_IMDCT 11 /* IMDCT transformation */
"downmix",
-#define MODULE_CAPABILITY_DOWNMIX 11 /* AC3 downmix */
+#define MODULE_CAPABILITY_DOWNMIX 12 /* AC3 downmix */
"memcpy",
-#define MODULE_CAPABILITY_MEMCPY 12 /* memcpy */
+#define MODULE_CAPABILITY_MEMCPY 13 /* memcpy */
"unknown"
-#define MODULE_CAPABILITY_MAX 13 /* Total number of capabilities */
+#define MODULE_CAPABILITY_MAX 14 /* Total number of capabilities */
};
return pp_capa[ (i_capa) > MODULE_CAPABILITY_MAX ? MODULE_CAPABILITY_MAX :
struct module_functions_s *p_functions; /* Capability functions */
struct module_config_s *p_config; /* Module configuration structure */
+ int i_config_options; /* number of configuration options */
/*
* Variables used internally by the module manager
typedef struct module_functions_s * p_module_functions_t;
-/*****************************************************************************
- * Macros used to build the configuration structure.
- *****************************************************************************/
-
-/* Mandatory first and last parts of the structure */
-#define MODULE_CONFIG_ITEM_START 0xdead /* The main window */
-#define MODULE_CONFIG_ITEM_END 0xbeef /* End of the window */
-
-/* Configuration widgets */
-#define MODULE_CONFIG_ITEM_WINDOW 0x0001 /* The main window */
-#define MODULE_CONFIG_ITEM_PANE 0x0002 /* A notebook pane */
-#define MODULE_CONFIG_ITEM_FRAME 0x0003 /* A frame */
-#define MODULE_CONFIG_ITEM_COMMENT 0x0004 /* A comment text */
-#define MODULE_CONFIG_ITEM_STRING 0x0005 /* A string */
-#define MODULE_CONFIG_ITEM_FILE 0x0006 /* A file selector */
-#define MODULE_CONFIG_ITEM_CHECK 0x0007 /* A checkbox */
-#define MODULE_CONFIG_ITEM_CHOOSE 0x0008 /* A choose box */
-#define MODULE_CONFIG_ITEM_RADIO 0x0009 /* A radio box */
-#define MODULE_CONFIG_ITEM_SCALE 0x000a /* A horizontal ruler */
-#define MODULE_CONFIG_ITEM_SPIN 0x000b /* A numerical selector */
-
-typedef struct module_config_s
-{
- int i_type; /* Configuration widget type */
- char * psz_text; /* Text commenting or describing the widget */
- char * psz_name; /* Variable name */
- void * p_getlist; /* Function to call to get a choice list */
- void * p_change; /* Function to call when commiting a change */
-} module_config_t;
-
/*****************************************************************************
* Exported functions.
*****************************************************************************/
#ifndef PLUGIN
void module_InitBank ( void );
+void module_LoadMain ( void );
+void module_LoadBuiltins ( void );
+void module_LoadPlugins ( void );
void module_EndBank ( void );
void module_ResetBank ( void );
void module_ManageBank ( void );
# define module_Need p_symbols->module_Need
# define module_Unneed p_symbols->module_Unneed
#endif
-
* modules_inner.h : Macros used from within a module.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules_inner.h,v 1.11 2002/01/09 02:01:14 sam Exp $
+ * $Id: modules_inner.h,v 1.12 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
/*
* InitModule: this function is called once and only once, when the module
* is looked at for the first time. We get the useful data from it, for
- * instance the module name, its shortcuts, its capabilities...
+ * instance the module name, its shortcuts, its capabilities... we also create
+ * a copy of its config because the module can be unloaded at any time.
*/
#define MODULE_INIT_START \
+ DECLARE_SYMBOLS; \
+ \
int __VLC_SYMBOL( InitModule ) ( module_t *p_module ) \
{ \
int i_shortcut = 0; \
p_module->i_cpu_capabilities = 0;
#define MODULE_INIT_STOP \
+ STORE_SYMBOLS; \
p_module->pp_shortcuts[ i_shortcut ] = NULL; \
+ p_module->i_config_options = sizeof(p_config)/sizeof(module_config_t);\
+ p_module->p_config = config_Duplicate( p_config, \
+ p_module->i_config_options ); \
+ if( p_module->p_config == NULL ) \
+ { \
+ intf_ErrMsg( MODULE_STRING \
+ " InitModule error: can't duplicate p_config" ); \
+ return( -1 ); \
+ } \
return( 0 ); \
}
* module will be used.
*/
#define MODULE_ACTIVATE_START \
- DECLARE_SYMBOLS; \
- \
int __VLC_SYMBOL( ActivateModule ) ( module_t *p_module ) \
{ \
p_module->p_functions = \
{ \
return( -1 ); \
} \
- p_module->p_config = p_config; \
STORE_SYMBOLS;
#define MODULE_ACTIVATE_STOP \
#define MODULE_DEACTIVATE_STOP \
return( 0 ); \
}
-
-/*****************************************************************************
- * Macros used to build the configuration structure.
- *****************************************************************************/
-
-#define MODULE_CONFIG_START \
- static module_config_t p_config[] = { \
- { MODULE_CONFIG_ITEM_START, NULL, NULL, NULL, NULL },
-
-#define MODULE_CONFIG_STOP \
- { MODULE_CONFIG_ITEM_END, NULL, NULL, NULL, NULL } };
-
-#define ADD_WINDOW( text ) \
- { MODULE_CONFIG_ITEM_WINDOW, text, NULL, NULL, NULL },
-#define ADD_FRAME( text ) \
- { MODULE_CONFIG_ITEM_FRAME, text, NULL, NULL, NULL },
-#define ADD_PANE( text ) \
- { MODULE_CONFIG_ITEM_PANE, text, NULL, NULL, NULL },
-#define ADD_COMMENT( text ) \
- { MODULE_CONFIG_ITEM_COMMENT, text, NULL, NULL, NULL },
-#define ADD_STRING( text, name, p_update ) \
- { MODULE_CONFIG_ITEM_STRING, text, name, NULL, p_update },
-#define ADD_FILE( text, name, p_update ) \
- { MODULE_CONFIG_ITEM_FILE, text, name, NULL, p_update },
-#define ADD_CHECK( text, name, p_update ) \
- { MODULE_CONFIG_ITEM_CHECK, text, name, NULL, p_update },
-#define ADD_CHOOSE( text, name, p_getlist, p_update ) \
- { MODULE_CONFIG_ITEM_CHOOSE, text, name, p_getlist, p_update },
-#define ADD_RADIO( text, name, p_getlist, p_update ) \
- { MODULE_CONFIG_ITEM_RADIO, text, name, p_getlist, p_update },
-#define ADD_SCALE( text, name, p_getlist, p_update ) \
- { MODULE_CONFIG_ITEM_SCALE, text, name, p_getlist, p_update },
-#define ADD_SPIN( text, name, p_getlist, p_update ) \
- { MODULE_CONFIG_ITEM_SPIN, text, name, p_getlist, p_update },
-
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc.h,v 1.3 2002/01/04 14:01:34 sam Exp $
+ * $Id: vlc.h,v 1.4 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
#include "modules.h"
#include "main.h"
-
+#include "configuration.h"
* (http://liba52.sf.net/).
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: a52.c,v 1.3 2002/02/15 13:32:52 sam Exp $
+ * $Id: a52.c,v 1.4 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
-#include <stdint.h>
+#include <stdint.h> /* int16_t .. */
#include <videolan/vlc.h>
}
/*****************************************************************************
- * Build configuration tree.
+ * Build configuration structure.
*****************************************************************************/
MODULE_CONFIG_START
MODULE_CONFIG_STOP
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_adec.c,v 1.20 2002/02/19 00:50:19 sam Exp $
+ * $Id: ac3_adec.c,v 1.21 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
+/* Variable containing the AC3 downmix method */
+#define DOWNMIX_METHOD_VAR "ac3_downmix"
+/* Variable containing the AC3 IMDCT method */
+#define IMDCT_METHOD_VAR "ac3_imdct"
+
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL)
+ADD_PLUGIN ( DOWNMIX_METHOD_VAR, MODULE_CAPABILITY_DOWNMIX, NULL, NULL,
+ "AC3 downmix method", NULL )
+ADD_PLUGIN ( IMDCT_METHOD_VAR, MODULE_CAPABILITY_IMDCT, NULL, NULL,
+ "AC3 IMDCT method", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
*****************************************************************************/
static int InitThread( ac3dec_thread_t * p_ac3thread )
{
+ char *psz_name;
+
/*
* Thread properties
*/
* Choose the best downmix module
*/
#define DOWNMIX p_ac3thread->ac3_decoder->downmix
- DOWNMIX.p_module = module_Need( MODULE_CAPABILITY_DOWNMIX,
- main_GetPszVariable( DOWNMIX_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( DOWNMIX_METHOD_VAR );
+ DOWNMIX.p_module = module_Need( MODULE_CAPABILITY_DOWNMIX, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( DOWNMIX.p_module == NULL )
{
p_ac3thread->ac3_decoder->imdct = memalign(16, sizeof(imdct_t));
#define IMDCT p_ac3thread->ac3_decoder->imdct
- IMDCT->p_module = module_Need( MODULE_CAPABILITY_IMDCT,
- main_GetPszVariable( IMDCT_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( IMDCT_METHOD_VAR );
+ IMDCT->p_module = module_Need( MODULE_CAPABILITY_IMDCT, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( IMDCT->p_module == NULL )
{
#undef F
/* Initialize the ac3 decoder structures */
-#define p_dec p_ac3thread->ac3_decoder
-#if defined( __MINGW32__ )
- p_dec->samples_back = memalign( 16, 6 * 256 * sizeof(float) + 15 );
- p_dec->samples = (float *)
- (((unsigned long) p_dec->samples_back + 15 ) & ~0xFUL);
-#else
- p_dec->samples = memalign( 16, 6 * 256 * sizeof(float) );
-#endif
-#undef p_dec
+ p_ac3thread->ac3_decoder->samples = memalign( 16, 6 * 256 * sizeof(float) );
IMDCT->buf = memalign( 16, N/4 * sizeof(complex_t) );
IMDCT->delay = memalign( 16, 6 * 256 * sizeof(float) );
DecoderError( p_config->p_decoder_fifo );
return( -1 );
}
-
+
/*
* Initialize the thread properties
*/
AlignWord( p_bit_stream );
b_sync = 1;
#undef p_bit_stream
- }
+ }
if (ac3_sync_frame (p_ac3thread->ac3_decoder, &sync_info))
{
if( ( p_ac3thread->p_aout_fifo != NULL ) &&
( p_ac3thread->p_aout_fifo->l_rate != sync_info.sample_rate ) )
{
- aout_DestroyFifo (p_ac3thread->p_aout_fifo);
-
/* Make sure the output thread leaves the NextFrame() function */
vlc_mutex_lock (&(p_ac3thread->p_aout_fifo->data_lock));
+ aout_DestroyFifo (p_ac3thread->p_aout_fifo);
vlc_cond_signal (&(p_ac3thread->p_aout_fifo->data_wait));
vlc_mutex_unlock (&(p_ac3thread->p_aout_fifo->data_lock));
p_ac3thread->p_aout_fifo = NULL;
}
-
+
/* Creating the audio output fifo if not created yet */
if (p_ac3thread->p_aout_fifo == NULL ) {
p_ac3thread->p_aout_fifo = aout_CreateFifo( AOUT_ADEC_STEREO_FIFO,
free( IMDCT->delay );
free( IMDCT->buf );
#undef IMDCT
-
- #if defined( __MINGW32__ )
- free( p_ac3thread->ac3_decoder->samples_back );
- #else
+
free( p_ac3thread->ac3_decoder->samples );
- #endif
module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module );
module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
free( IMDCT->buf );
#undef IMDCT
-#if defined( __MINGW32__ )
- free( p_ac3thread->ac3_decoder->samples_back );
-#else
free( p_ac3thread->ac3_decoder->samples );
-#endif
/* Unlock the modules */
module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
* ac3_decoder.h : ac3 decoder interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder.h,v 1.1 2001/11/13 12:09:17 henri Exp $
+ * $Id: ac3_decoder.h,v 1.2 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org>
struct ac3dec_s
{
float * samples;
-#if defined( __MINGW32__ )
- float * samples_back;
-#endif
imdct_t * imdct;
/*
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: ac3_spdif.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
*****************************************************************************/
static int decoder_Probe( u8 *pi_type )
{
- return( ( main_GetIntVariable( AOUT_SPDIF_VAR, 0 )
+ return( ( config_GetIntVariable( AOUT_SPDIF_VAR )
&& *pi_type == AC3_AUDIO_ES ) ? 0 : -1 );
}
* alsa.c : alsa plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: alsa.c,v 1.13 2001/12/30 07:09:54 sam Exp $
+ * $Id: alsa.c,v 1.14 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_COMMENT( "Yeah, alsa rocks !" )
+
MODULE_CONFIG_STOP
MODULE_INIT_START
static int aout_Open( aout_thread_t *p_aout )
{
int i_err = 0;
- p_aout->i_format = AOUT_FORMAT_DEFAULT;
- p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
- p_aout->l_rate = AOUT_RATE_DEFAULT;
/* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for arts module" )
- ADD_FRAME( "aRts" )
- ADD_COMMENT( "This module does not need configuration" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* aout_beos.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: aout_beos.cpp,v 1.21 2002/02/15 13:32:52 sam Exp $
+ * $Id: aout_beos.cpp,v 1.22 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
}
/* Initialize some variables */
- p_aout->i_format = AOUT_FORMAT_DEFAULT;
- p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
- AOUT_STEREO_DEFAULT );
- p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
-
p_aout->p_sys->p_format->frame_rate = 44100.0;
p_aout->p_sys->p_format->channel_count = p_aout->i_channels;
p_aout->p_sys->p_format->format = gs_audio_format::B_GS_S16;
* beos.cpp : BeOS plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: beos.cpp,v 1.16 2002/01/05 18:25:48 sam Exp $
+ * $Id: beos.cpp,v 1.17 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for BeOS module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* vout_beos.cpp: beos video output display method
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_beos.cpp,v 1.41 2002/02/15 13:32:52 sam Exp $
+ * $Id: vout_beos.cpp,v 1.42 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
static int BeosOpenDisplay( vout_thread_t *p_vout )
{
p_vout->p_sys->p_window = new VideoWindow(
- main_GetIntVariable( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT ) - 1,
- main_GetIntVariable( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT ) - 1,
+ config_GetIntVariable( VOUT_WIDTH_VAR ) - 1,
+ config_GetIntVariable( VOUT_HEIGHT_VAR ) - 1,
p_vout );
if( p_vout->p_sys->p_window == NULL )
* aout_directx.c: Windows DirectX audio output method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: aout_directx.c,v 1.18 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: aout_directx.c,v 1.19 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
vlc_mutex_init( &p_aout->p_sys->buffer_lock );
- p_aout->psz_device = 0;
-
/* Initialise DirectSound */
if( DirectxInitDSound( p_aout ) )
{
* directx.c : Windows DirectX plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.5 2002/01/17 23:02:45 gbazin Exp $
+ * $Id: directx.c,v 1.6 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for Windows DirectX module" )
- ADD_COMMENT( "For now, the Windows DirectX module cannot be configured" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: vout_directx.c,v 1.22 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: vout_directx.c,v 1.23 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
p_vout->p_sys->b_caps_overlay_clipping = 0;
SetRectEmpty( &p_vout->p_sys->rect_display );
p_vout->p_sys->b_using_overlay =
- !main_GetIntVariable( VOUT_NOOVERLAY_VAR, VOUT_NOOVERLAY_DEFAULT );
+ !config_GetIntVariable( VOUT_NOOVERLAY_VAR );
p_vout->p_sys->b_cursor = 1;
}
#if 0
- p_vout->p_sys->i_window_width = main_GetIntVariable( VOUT_WIDTH_VAR,
- VOUT_WIDTH_DEFAULT );
- p_vout->p_sys->i_window_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
- VOUT_HEIGHT_DEFAULT );
+ p_vout->p_sys->i_window_width = config_GetIntVariable( VOUT_WIDTH_VAR );
+ p_vout->p_sys->i_window_height = config_GetIntVariable( VOUT_HEIGHT_VAR );
#endif
/* Set locks and condition variables */
* aout_dsp.c : dsp functions library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_dsp.c,v 1.21 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_dsp.c,v 1.22 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#include "audio_output.h" /* aout_thread_t */
+#define DSP_DEV_VAR "dsp_dev"
/*****************************************************************************
* aout_sys_t: dsp audio output method descriptor
*****************************************************************************
{
audio_buf_info audio_buf;
+ /* Path to the audio output device */
+ char * psz_device;
+ int i_fd;
+
} aout_sys_t;
/*****************************************************************************
* aout_Open: opens the audio device (the digital sound processor)
*****************************************************************************
* This function opens the dsp as a usual non-blocking write-only file, and
- * modifies the p_aout->i_fd with the file's descriptor.
+ * modifies the p_aout->p_sys->i_fd with the file's descriptor.
*****************************************************************************/
static int aout_Open( aout_thread_t *p_aout )
{
}
/* Initialize some variables */
- p_aout->psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
+ if( !(p_aout->p_sys->psz_device = config_GetPszVariable( DSP_DEV_VAR )) )
+ {
+ intf_ErrMsg( "aout error: don't know which audio device to open" );
+ free( p_aout->p_sys );
+ return( -1 );
+ }
/* Open the sound device */
- if( (p_aout->i_fd = open( p_aout->psz_device, O_WRONLY )) < 0 )
+ if( (p_aout->p_sys->i_fd = open( p_aout->p_sys->psz_device, O_WRONLY ))
+ < 0 )
{
intf_ErrMsg( "aout error: can't open audio device (%s)",
- p_aout->psz_device );
+ p_aout->p_sys->psz_device );
+ free( p_aout->p_sys->psz_device );
+ free( p_aout->p_sys );
return( -1 );
}
boolean_t b_stereo = p_aout->b_stereo;
/* Reset the DSP device */
- if( ioctl( p_aout->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
+ if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
{
intf_ErrMsg( "aout error: can't reset audio device (%s)",
- p_aout->psz_device );
+ p_aout->p_sys->psz_device );
return( -1 );
}
/* Set the output format */
i_format = p_aout->i_format;
- if( ioctl( p_aout->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
+ if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
intf_ErrMsg( "aout error: can't set audio output format (%i)",
p_aout->i_format );
if( i_format != p_aout->i_format )
{
- intf_WarnMsg( 2, "aout warning: audio output format not supported (%i)",
- p_aout->i_format );
+ intf_WarnMsg( 2, "aout warning: audio output format not supported (%i)"
+ ,p_aout->i_format );
p_aout->i_format = i_format;
}
/* Set the number of channels */
- if( ioctl( p_aout->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
+ if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
{
intf_ErrMsg( "aout error: can't set number of audio channels (%i)",
p_aout->i_channels );
if( b_stereo != p_aout->b_stereo )
{
- intf_WarnMsg( 2, "aout warning: number of audio channels not supported (%i)",
- p_aout->i_channels );
+ intf_WarnMsg( 2, "aout warning: number of audio channels not supported"
+ " (%i)", p_aout->i_channels );
p_aout->b_stereo = b_stereo;
p_aout->i_channels = 1 + b_stereo;
}
/* Set the output rate */
l_rate = p_aout->l_rate;
- if( ioctl( p_aout->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
+ if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
{
intf_ErrMsg( "aout error: can't set audio output rate (%li)",
p_aout->l_rate );
*****************************************************************************/
static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
- ioctl( p_aout->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf );
+ ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_GETOSPACE,
+ &p_aout->p_sys->audio_buf );
/* returns the allocated space in bytes */
return ( (p_aout->p_sys->audio_buf.fragstotal
{
if( p_aout->b_active )
{
- write( p_aout->i_fd, buffer, i_size );
+ write( p_aout->p_sys->i_fd, buffer, i_size );
}
}
*****************************************************************************/
static void aout_Close( aout_thread_t *p_aout )
{
- close( p_aout->i_fd );
+ close( p_aout->p_sys->i_fd );
+ free( p_aout->p_sys->psz_device );
}
-
* dsp.c : OSS /dev/dsp module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: dsp.c,v 1.12 2001/12/30 07:09:54 sam Exp $
+ * $Id: dsp.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
+#define DSP_DEV_VAR "dsp_dev"
+
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for dsp module" )
- ADD_FRAME( "OSS Device" )
- ADD_FILE( "Device name: ", MODULE_VAR(device), NULL )
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_FILE ( DSP_DEV_VAR, "/dev/dsp", NULL,"OSS dsp device",NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: dummy.c,v 1.14 2002/01/09 02:01:14 sam Exp $
+ * $Id: dummy.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for dummy module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
* null.c : NULL module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: null.c,v 1.4 2001/12/30 07:09:55 sam Exp $
+ * $Id: null.c,v 1.5 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for null module" )
- ADD_PANE( "First pane" )
- ADD_FRAME( "First frame" )
- ADD_COMMENT( "You can put whatever you want here." )
+ /* ADD_PANE( "First pane" )
+ ADD_SUBCATEGORY_HINT( "First frame" )
+
ADD_STRING( "Random text: ", MODULE_VAR(text), NULL )
- ADD_FRAME( "Second frame" )
- ADD_COMMENT( "The file below is not used." )
+ ADD_SUBCATEGORY_HINT( "Second frame" )
+
ADD_FILE( "Select file: ", MODULE_VAR(file), NULL )
- ADD_FRAME( "Third frame" )
- ADD_COMMENT( "This space intentionally left blank." )
+ ADD_SUBCATEGORY_HINT( "Third frame" )
+
ADD_PANE( "Second pane" )
- ADD_FRAME( "Frame" )
- ADD_COMMENT( "There is nothing in this frame." )
+ ADD_SUBCATEGORY_HINT( "Frame" )
+ */
MODULE_CONFIG_STOP
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.120 2002/02/19 00:50:19 sam Exp $
+ * $Id: input_dvd.c,v 1.121 2002/02/24 20:51:09 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
#undef area
/* Get requested title - if none try the first title */
- i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+ i_title = config_GetIntVariable( INPUT_TITLE_VAR );
if( i_title <= 0 || i_title > title_inf.i_title_nb )
{
i_title = 1;
#undef title_inf
/* Get requested chapter - if none defaults to first one */
- i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+ i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
if( i_chapter <= 0 )
{
i_chapter = 1;
*psz_parser = '\0';
psz_parser++;
- main_PutPszVariable( "DVDCSS_RAW_DEVICE", psz_parser );
+ config_PutPszVariable( "DVDCSS_RAW_DEVICE", psz_parser );
}
intf_WarnMsg( 2, "input: dvd=%s raw=%s", psz_device, psz_parser );
* Angle management
*/
p_dvd->i_angle_nb = vmg.title_inf.p_attr[p_dvd->i_title-1].i_angle_nb;
- p_dvd->i_angle = main_GetIntVariable( INPUT_ANGLE_VAR, 1 );
+ p_dvd->i_angle = config_GetIntVariable( INPUT_ANGLE_VAR );
if( ( p_dvd->i_angle <= 0 ) || p_dvd->i_angle > p_dvd->i_angle_nb )
{
p_dvd->i_angle = 1;
if( p_main->b_audio )
{
/* For audio: first one if none or a not existing one specified */
- i_audio = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+ i_audio = config_GetIntVariable( INPUT_CHANNEL_VAR );
if( i_audio < 0 || i_audio > i_audio_nb )
{
- main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
i_audio = 1;
}
if( i_audio > 0 && i_audio_nb > 0 )
{
- if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) ||
- ( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) ==
+ if( config_GetIntVariable( AOUT_SPDIF_VAR ) ||
+ ( config_GetIntVariable( INPUT_AUDIO_VAR ) ==
REQUESTED_AC3 ) )
{
int i_ac3 = i_audio;
if( p_main->b_video )
{
/* for spu, default is none */
- i_spu = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+ i_spu = config_GetIntVariable( INPUT_SUBTITLE_VAR );
if( i_spu < 0 || i_spu > i_spu_nb )
{
- main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
i_spu = 0;
}
if( i_spu > 0 && i_spu_nb > 0 )
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: input_dvdread.c,v 1.20 2002/02/15 13:32:53 sam Exp $
+ * $Id: input_dvdread.c,v 1.21 2002/02/24 20:51:09 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
#undef area
/* Get requested title - if none try the first title */
- i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+ i_title = config_GetIntVariable( INPUT_TITLE_VAR );
if( i_title <= 0 || i_title > tt_srpt->nr_of_srpts )
{
i_title = 1;
#undef tt_srpt
/* Get requested chapter - if none defaults to first one */
- i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+ i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
if( i_chapter <= 0 )
{
i_chapter = 1;
* Angle management
*/
p_area->i_angle_nb = p_vmg->tt_srpt->title[p_area->i_id-1].nr_of_angles;
- p_area->i_angle = main_GetIntVariable( INPUT_ANGLE_VAR, 1 );
+ p_area->i_angle = config_GetIntVariable( INPUT_ANGLE_VAR );
if( ( p_area->i_angle <= 0 ) || p_area->i_angle > p_area->i_angle_nb )
{
if( p_main->b_audio )
{
/* For audio: first one if none or a not existing one specified */
- int i_audio = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+ int i_audio = config_GetIntVariable( INPUT_CHANNEL_VAR );
if( i_audio < 0 || i_audio > i_audio_nb )
{
- main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
i_audio = 1;
}
if( i_audio > 0 && i_audio_nb > 0 )
{
- if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) ||
- ( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) ==
+ if( config_GetIntVariable( AOUT_SPDIF_VAR ) ||
+ ( config_GetIntVariable( INPUT_AUDIO_VAR ) ==
REQUESTED_AC3 ) )
{
int i_ac3 = i_audio;
if( p_main->b_video )
{
/* for spu, default is none */
- int i_spu = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+ int i_spu = config_GetIntVariable( INPUT_SUBTITLE_VAR );
if( i_spu < 0 || i_spu > i_spu_nb )
{
- main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
i_spu = 0;
}
if( i_spu > 0 && i_spu_nb > 0 )
* aout_esd.c : Esound functions library
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: aout_esd.c,v 1.19 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_esd.c,v 1.20 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
typedef struct aout_sys_s
{
esd_format_t esd_format;
+ int i_fd;
} aout_sys_t;
}
/* Initialize some variables */
- p_aout->l_rate = esd_audio_rate; /* We use actual esd rate value, not AOUT_RATE_DEFAULT */
+ p_aout->l_rate = esd_audio_rate; /* We use actual esd rate value, not
+ * initial value */
i_bits = ESD_BITS16;
i_mode = ESD_STREAM;
/* open a socket for playing a stream
* and try to open /dev/dsp if there's no EsounD */
- if ( (p_aout->i_fd
+ if ( (p_aout->p_sys->i_fd
= esd_play_stream_fallback(p_aout->p_sys->esd_format,
p_aout->l_rate, NULL, "vlc")) < 0 )
{
}
}
- write( p_aout->i_fd, buffer, i_size );
+ write( p_aout->p_sys->i_fd, buffer, i_size );
}
/*****************************************************************************
*****************************************************************************/
static void aout_Close( aout_thread_t *p_aout )
{
- close( p_aout->i_fd );
+ close( p_aout->p_sys->i_fd );
}
* esd.c : EsounD module
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: esd.c,v 1.12 2001/12/31 04:53:33 sam Exp $
+ * $Id: esd.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for esd module" )
- ADD_FRAME( "EsounD" )
- ADD_COMMENT( "This module does not need configuration" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* fb.c : framebuffer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: fb.c,v 1.13 2002/02/15 13:32:53 sam Exp $
+ * $Id: fb.c,v 1.14 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
/*****************************************************************************
* Building configuration tree
*****************************************************************************/
+#define FB_DEV_VAR "fb_dev"
+
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_STRING ( FB_DEV_VAR, "/dev/fb0", NULL,"framebuffer device",NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
struct fb_fix_screeninfo fix_info; /* framebuffer fix information */
/* Open framebuffer device */
- psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT );
+ if( !(psz_device = config_GetPszVariable( FB_DEV_VAR )) )
+ {
+ intf_ErrMsg( "vout error: don't know which fb device to open" );
+ return( 1 );
+ }
+
p_vout->p_sys->i_fd = open( psz_device, O_RDWR);
+
if( p_vout->p_sys->i_fd == -1 )
{
- intf_ErrMsg("vout error: can't open %s (%s)", psz_device, strerror(errno) );
+ intf_ErrMsg("vout error: can't open %s (%s)",
+ psz_device, strerror(errno) );
+ free( psz_device );
return( 1 );
}
+ free( psz_device );
/* Get framebuffer device informations */
if( ioctl( p_vout->p_sys->i_fd,
* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.5 2002/02/15 13:32:53 sam Exp $
+ * $Id: deinterlace.c,v 1.6 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
- char *psz_method;
+ char *psz_method, *psz_method_tmp;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
}
/* Look what method was requested */
- psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+ if( !(psz_method = psz_method_tmp
+ = config_GetPszVariable( VOUT_FILTER_VAR )) )
+ {
+ intf_ErrMsg( "vout error: configuration variable %s empty",
+ VOUT_FILTER_VAR );
+ return( 1 );
+ }
while( *psz_method && *psz_method != ':' )
{
p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
}
+ free( psz_method_tmp );
+
return( 0 );
}
}
/* Try to open the real video output, with half the height our images */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video output" );
break;
}
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
p_vout->p_sys->last_date = 0;
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
* distort.c : Misc video effects plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: distort.c,v 1.7 2002/02/15 13:32:53 sam Exp $
+ * $Id: distort.c,v 1.8 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
- char *psz_method;
+ char *psz_method, *psz_method_tmp;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
}
/* Look what method was requested */
- psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+ if( !(psz_method = psz_method_tmp
+ = config_GetPszVariable( VOUT_FILTER_VAR )) )
+ {
+ intf_ErrMsg( "vout error: configuration variable %s empty",
+ VOUT_FILTER_VAR );
+ return( 1 );
+ }
while( *psz_method && *psz_method != ':' )
{
p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
}
+ free( psz_method_tmp );
+
return( 0 );
}
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Try to open the real video output */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video output" );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
return( 0 );
}
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
p_vout->p_sys->f_angle = 0.0;
* invert.c : Invert video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: invert.c,v 1.7 2002/02/15 13:32:53 sam Exp $
+ * $Id: invert.c,v 1.8 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
int i_index;
char *psz_filter;
picture_t *p_pic;
-
+
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Try to open the real video output */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video output" );
-
+
p_vout->p_sys->p_vout =
vout_CreateThread( NULL,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
return( 0 );
}
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
* transform.c : transform image plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: transform.c,v 1.6 2002/02/15 13:32:53 sam Exp $
+ * $Id: transform.c,v 1.7 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
- char *psz_method;
+ char *psz_method, *psz_method_tmp;
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
}
/* Look what method was requested */
- psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+ if( !(psz_method = psz_method_tmp
+ = config_GetPszVariable( VOUT_FILTER_VAR )) )
+ {
+ intf_ErrMsg( "vout error: configuration variable %s empty",
+ VOUT_FILTER_VAR );
+ return( 1 );
+ }
while( *psz_method && *psz_method != ':' )
{
p_vout->p_sys->b_rotation = 1;
}
+ free( psz_method_tmp );
+
return( 0 );
}
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Try to open the real video output */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video output" );
p_vout->render.i_chroma, p_vout->render.i_aspect );
}
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
+
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
return( 0 );
}
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
return( 0 );
* wall.c : Wall video plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: wall.c,v 1.12 2002/02/15 13:32:53 sam Exp $
+ * $Id: wall.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
static int vout_Create( vout_thread_t *p_vout )
{
- char *psz_method, *psz_tmp;
+ char *psz_method, *psz_tmp, *psz_method_tmp;
int i_vout;
/* Allocate structure */
}
/* Look what method was requested */
- psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+ if( !(psz_method = psz_method_tmp
+ = config_GetPszVariable( VOUT_FILTER_VAR )) )
+ {
+ intf_ErrMsg( "vout error: configuration variable %s empty",
+ VOUT_FILTER_VAR );
+ return( 1 );
+ }
while( *psz_method && *psz_method != ':' )
{
if( p_vout->p_sys->pp_vout == NULL )
{
intf_ErrMsg("error: %s", strerror(ENOMEM) );
+ free( psz_method_tmp );
free( p_vout->p_sys );
return( 1 );
}
}
}
+ free( psz_method_tmp );
+
return( 0 );
}
p_vout->output.i_aspect = p_vout->render.i_aspect;
/* Try to open the real video output */
- psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, NULL );
- main_PutPszVariable( VOUT_FILTER_VAR, "" );
+ psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+ config_PutPszVariable( VOUT_FILTER_VAR, NULL );
intf_WarnMsg( 1, "filter: spawning the real video outputs" );
intf_ErrMsg( "vout error: failed to get %ix%i vout threads",
p_vout->p_sys->i_col, p_vout->p_sys->i_row );
RemoveAllVout( p_vout );
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
return 0;
}
}
}
- main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+ if( psz_filter ) free( psz_filter );
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
* ggi.c : GGI plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: ggi.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: ggi.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
}
/* Open display */
- psz_display = main_GetPszVariable( VOUT_DISPLAY_VAR, NULL );
+ psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
+ if( psz_display ) free( psz_display );
if( p_vout->p_sys->p_display == NULL )
{
/* Find most appropriate mode */
p_vout->p_sys->mode.frames = 2; /* 2 buffers */
- p_vout->p_sys->mode.visible.x = main_GetIntVariable( VOUT_WIDTH_VAR,
- VOUT_WIDTH_DEFAULT );
- p_vout->p_sys->mode.visible.y = main_GetIntVariable( VOUT_HEIGHT_VAR,
- VOUT_HEIGHT_DEFAULT );
+ p_vout->p_sys->mode.visible.x = config_GetIntVariable( VOUT_WIDTH_VAR );
+ p_vout->p_sys->mode.visible.y = config_GetIntVariable( VOUT_HEIGHT_VAR );
p_vout->p_sys->mode.virt.x = GGI_AUTO;
p_vout->p_sys->mode.virt.y = GGI_AUTO;
p_vout->p_sys->mode.size.x = GGI_AUTO;
/* Exit library */
ggiExit();
}
-
* gtk_display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.13 2002/01/10 04:11:25 sam Exp $
+ * $Id: gtk_display.c,v 1.14 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
p_input_bank->pp_input[0]->p_source );
p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "network_channel_box" ) );
- if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) )
+ if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
{
gtk_widget_show( GTK_WIDGET( p_channel ) );
}
}
else
{
- if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) )
+ if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
{
gtk_widget_show( GTK_WIDGET( p_network_box ) );
* gtk_open.c : functions to handle file/disc/network open widgets.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_open.c,v 1.15 2002/01/31 23:18:27 massiot Exp $
+ * $Id: gtk_open.c,v 1.16 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
/* If we have never used the file selector, open it */
if( !GTK_IS_WIDGET( p_intf->p_sys->p_fileopen ) )
{
+ char *psz_path;
+
p_intf->p_sys->p_fileopen = create_intf_fileopen();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
"p_intf", p_intf );
- gtk_file_selection_set_filename( GTK_FILE_SELECTION(
- p_intf->p_sys->p_fileopen ),
- main_GetPszVariable( INTF_PATH_VAR, INTF_PATH_DEFAULT ) );
+ if( (psz_path = config_GetPszVariable( INTF_PATH_VAR )) )
+ gtk_file_selection_set_filename( GTK_FILE_SELECTION(
+ p_intf->p_sys->p_fileopen ), psz_path );
+ if( psz_path ) free( psz_path );
}
gtk_widget_show( p_intf->p_sys->p_fileopen );
{
if( togglebutton->active )
{
- gtk_entry_set_text(
- GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
- main_GetPszVariable( INPUT_DVD_DEVICE_VAR, DVD_DEVICE )
- );
+ char *psz_dvd_device;
+
+ if( (psz_dvd_device = config_GetPszVariable( INPUT_DVD_DEVICE_VAR )) )
+ gtk_entry_set_text(
+ GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton),
+ "disc_name" ) ), psz_dvd_device );
+ if( psz_dvd_device ) free( psz_dvd_device );
}
}
{
if( togglebutton->active )
{
- gtk_entry_set_text(
- GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
- main_GetPszVariable( INPUT_VCD_DEVICE_VAR, VCD_DEVICE )
- );
+ char *psz_vcd_device;
+
+ if( (psz_vcd_device = config_GetPszVariable( INPUT_VCD_DEVICE_VAR )) )
+ gtk_entry_set_text(
+ GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton),
+ "disc_name" ) ), psz_vcd_device );
+ if( psz_vcd_device ) free( psz_vcd_device );
}
}
}
/* Select title and chapter */
- main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
+ config_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_title" ) ) ) );
- main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
+ config_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( lookup_widget(
GTK_WIDGET(button), "disc_chapter" ) ) ) );
if( !GTK_IS_WIDGET( p_intf->p_sys->p_network ) )
{
+ char *psz_channel_server;
+
p_intf->p_sys->p_network = create_intf_network();
gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_network ),
"p_intf", p_intf );
- gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
- GTK_OBJECT( p_intf->p_sys->p_network ), "network_server" ) ),
- main_GetPszVariable( INPUT_SERVER_VAR,
- INPUT_SERVER_DEFAULT ) );
-
gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_network ), "network_port" ) ),
- main_GetIntVariable( INPUT_PORT_VAR,
- INPUT_PORT_DEFAULT ) );
-
- gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
- GTK_OBJECT( p_intf->p_sys->p_network ), "network_broadcast" ) ),
- main_GetPszVariable( INPUT_BCAST_ADDR_VAR,
- INPUT_BCAST_ADDR_DEFAULT ) );
+ config_GetIntVariable( INPUT_PORT_VAR ) );
- gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
- GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel" ) ),
- main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR,
- INPUT_CHANNEL_SERVER_DEFAULT ) );
+ psz_channel_server = config_GetPszVariable( INPUT_CHANNEL_SERVER_VAR );
+ if( psz_channel_server )
+ gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+ GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel" ) ),
+ psz_channel_server );
+ if( psz_channel_server ) free( psz_channel_server );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel_port" ) ),
- main_GetIntVariable( INPUT_CHANNEL_PORT_VAR,
- INPUT_CHANNEL_PORT_DEFAULT ) );
+ config_GetIntVariable( INPUT_CHANNEL_PORT_VAR ) );
gtk_toggle_button_set_active( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_network ), "network_channel_check" ),
- main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) );
-
- gtk_toggle_button_set_active( gtk_object_get_data( GTK_OBJECT(
- p_intf->p_sys->p_network ), "network_broadcast_check" ),
- main_GetIntVariable( INPUT_BROADCAST_VAR,
- INPUT_BROADCAST_DEFAULT ) );
+ config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) );
}
gtk_widget_show( p_intf->p_sys->p_network );
/* Manage channel server */
b_channel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(
lookup_widget( GTK_WIDGET(button), "network_channel_check" ) ) );
- main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, b_channel );
+ config_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, b_channel );
if( b_channel )
{
char * psz_channel;
i_channel_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(
lookup_widget( GTK_WIDGET(button), "network_channel_port" ) ) );
- main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, psz_channel );
+ config_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, psz_channel );
if( i_channel_port < 65536 )
{
- main_PutIntVariable( INPUT_CHANNEL_PORT_VAR, i_channel_port );
+ config_PutIntVariable( INPUT_CHANNEL_PORT_VAR, i_channel_port );
}
p_intf->p_sys->b_playing = 1;
* gtk_control.c : functions to handle stream control buttons.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_preferences.c,v 1.10 2002/01/02 14:37:42 sam Exp $
+ * $Id: gtk_preferences.c,v 1.11 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
****************************************************************************/
/* macros to create preference box */
-#define ASSIGN_PSZ_ENTRY( var, default, name ) \
+#define ASSIGN_PSZ_ENTRY( var, name ) \
gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data( GTK_OBJECT( \
p_intf->p_sys->p_preferences ), name ) ), \
- main_GetPszVariable( var, default ) )
+ config_GetPszVariable( var ) )
-#define ASSIGN_INT_VALUE( var, default, name ) \
+#define ASSIGN_INT_VALUE( var, name ) \
gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ), \
- main_GetIntVariable( var, default ) )
+ config_GetIntVariable( var ) )
-#define ASSIGN_INT_TOGGLE( var, default, name ) \
+#define ASSIGN_INT_TOGGLE( var, name ) \
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ), \
- main_GetIntVariable( var, default ) )
+ config_GetIntVariable( var ) )
gboolean GtkPreferencesShow( GtkWidget *widget,
GdkEventButton *event,
"p_intf", p_intf );
/* Default path */
- ASSIGN_PSZ_ENTRY( INTF_PATH_VAR, INTF_PATH_DEFAULT,
+ ASSIGN_PSZ_ENTRY( INTF_PATH_VAR,
"preferences_file_path_entry" );
/* Default DVD */
- ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR,DVD_DEVICE,
+ ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR,
"preferences_disc_dvd_entry" );
/* Default VCD */
- ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, VCD_DEVICE,
+ ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR,
"preferences_disc_vcd_entry" );
- /* Default server */
- ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, INPUT_SERVER_DEFAULT,
- "preferences_network_server_entry" );
-
/* Default port */
- ASSIGN_INT_VALUE( INPUT_PORT_VAR, INPUT_PORT_DEFAULT,
+ ASSIGN_INT_VALUE( INPUT_PORT_VAR,
"preferences_network_port_spinbutton" );
- /* Broadcast address */
- ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADDR_VAR, INPUT_BCAST_ADDR_DEFAULT,
- "preferences_network_broadcast_entry" );
-
- /* Broadcast stream by default ? */
- ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR, INPUT_BROADCAST_DEFAULT,
- "preferences_network_broadcast_checkbutton" );
-
/* XXX Protocol */
/* Default interface */
- ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR, INTF_METHOD_DEFAULT,
+ ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR,
"preferences_interface_entry" );
/* Default video output */
- ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR, VOUT_METHOD_DEFAULT,
+ ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR,
"preferences_video_output_entry" );
/* Default output width */
- ASSIGN_INT_VALUE( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT,
+ ASSIGN_INT_VALUE( VOUT_WIDTH_VAR,
"preferences_video_width_spinbutton" );
/* Default output height */
- ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT,
+ ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR,
"preferences_video_height_spinbutton" );
/* XXX Default screen depth */
/* XXX Default gamma */
/* Fullscreen on play */
- ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT,
+ ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR,
"preferences_video_fullscreen_checkbutton" );
/* Grayscale display */
- ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT,
+ ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR,
"preferences_video_grayscale_checkbutton" );
/* Default audio output */
- ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, AOUT_METHOD_DEFAULT,
+ ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR,
"preferences_audio_output_entry" );
-
- /* Default audio device */
- ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, AOUT_DSP_DEFAULT,
- "preferences_audio_device_entry" );
+
/* XXX Default frequency */
/* XXX Default number of channels */
/* Use spdif output ? */
- ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR, AOUT_SPDIF_DEFAULT,
+ ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR,
"preferences_audio_spdif_checkbutton" );
/* Launch playlist on startup */
- ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR, PLAYLIST_STARTUP_DEFAULT,
+ ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR,
"preferences_playlist_startup_checkbutton" );
/* Enqueue drag'n dropped item as default */
- ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR, PLAYLIST_ENQUEUE_DEFAULT,
+ ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR,
"preferences_playlist_enqueue_checkbutton" );
/* Loop on playlist end */
- ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR, PLAYLIST_LOOP_DEFAULT,
+ ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR,
"preferences_playlist_loop_checkbutton" );
/* Verbosity of warning messages */
- ASSIGN_INT_VALUE( INTF_WARNING_VAR, INTF_WARNING_DEFAULT,
+ ASSIGN_INT_VALUE( INTF_WARNING_VAR,
"preferences_misc_messages_spinbutton" );
#undef ASSIGN_PSZ_ENTRY
#undef ASSIGN_INT_VALUE
****************************************************************************/
/* macros to read value frfom preference box */
-#define ASSIGN_PSZ_ENTRY( var, name ) \
- main_PutPszVariable( var, gtk_entry_get_text( \
+#define ASSIGN_PSZ_ENTRY( var, name ) \
+ config_PutPszVariable( var, gtk_entry_get_text( \
GTK_ENTRY( gtk_object_get_data( GTK_OBJECT( p_preferences ), name ) ) ) )
-#define ASSIGN_INT_VALUE( var, name ) \
- main_PutIntVariable( var, gtk_spin_button_get_value_as_int( \
- GTK_SPIN_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
+#define ASSIGN_INT_VALUE( var, name ) \
+ config_PutIntVariable( var, gtk_spin_button_get_value_as_int( \
+ GTK_SPIN_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
name ) ) ) )
-#define ASSIGN_INT_TOGGLE( var, name ) \
- main_PutIntVariable( var, gtk_toggle_button_get_active( \
- GTK_TOGGLE_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
+#define ASSIGN_INT_TOGGLE( var, name ) \
+ config_PutIntVariable( var, gtk_toggle_button_get_active( \
+ GTK_TOGGLE_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
name ) ) ) )
void GtkPreferencesApply( GtkButton * button, gpointer user_data )
/* Default VCD */
ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, "preferences_disc_vcd_entry" );
- /* Default server */
- ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, "preferences_network_server_entry" );
-
/* Default port */
ASSIGN_INT_VALUE( INPUT_PORT_VAR, "preferences_network_port_spinbutton" );
- /* Broadcast address */
- ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADDR_VAR,
- "preferences_network_broadcast_entry" );
-
- /* Broadcast stream by default ? */
- ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR,
- "preferences_network_broadcast_checkbutton" );
-
/* XXX Protocol */
/* Default interface */
/* Default audio output */
ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, "preferences_audio_output_entry" );
- /* Default audio device */
- ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, "preferences_audio_device_entry" );
-
/* XXX Default frequency */
/* XXX Default quality */
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: idctclassic.c,v 1.20 2002/02/15 13:32:53 sam Exp $
+ * $Id: idctclassic.c,v 1.21 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for classic IDCT module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* kde.cpp : KDE plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: kde.cpp,v 1.6 2002/01/02 14:37:42 sam Exp $
+ * $Id: kde.cpp,v 1.7 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*
{
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for KDE module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
source += fDiskDialog->device();
// Select title and chapter
- main_PutIntVariable( INPUT_TITLE_VAR, fDiskDialog->title() );
- main_PutIntVariable( INPUT_CHAPTER_VAR, fDiskDialog->chapter() );
+ config_PutIntVariable( INPUT_TITLE_VAR, fDiskDialog->title() );
+ config_PutIntVariable( INPUT_CHAPTER_VAR, fDiskDialog->chapter() );
// add it to playlist
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, source.latin1() );
* lirc.c : lirc plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: lirc.c,v 1.7 2002/02/21 21:55:40 sam Exp $
+ * $Id: lirc.c,v 1.8 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for lirc module" )
- ADD_COMMENT( "use ~/.lircrc" )
+
MODULE_CONFIG_STOP
MODULE_INIT_START
char *code;
char *c;
+ /* Manage core vlc functions through the callback */
+ p_intf->pf_manage( p_intf );
+
+<<<<<<< lirc.c
+ while( !p_intf->b_die && lirc_nextcode(&code) == 0 )
+=======
while( !p_intf->b_die )
+>>>>>>> 1.7
{
/* Manage core vlc functions through the callback */
p_intf->pf_manage( p_intf );
* xmga.c : X11 MGA plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: xmga.c,v 1.5 2002/02/19 00:50:19 sam Exp $
+ * $Id: xmga.c,v 1.6 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
return( 1 );
}
- /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
- psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
+ /* Open display, unsing the VOUT_DISPLAY_VAR config variable or the DISPLAY
+ * environment variable */
+ psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
p_vout->p_sys->p_display = XOpenDisplay( psz_display );
if( p_vout->p_sys->p_display == NULL ) /* error */
{
- intf_ErrMsg( "vout error: cannot open display %s", psz_display );
+ intf_ErrMsg( "vout error: cannot open display %s",
+ XDisplayName( psz_display ) );
free( p_vout->p_sys );
+ if( psz_display ) free( psz_display );
return( 1 );
}
+ if( psz_display ) free( psz_display );
+
p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
/* Create blank cursor (for mouse cursor autohiding) */
* mpeg_adec.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: mpeg_adec.c,v 1.19 2002/02/19 00:50:19 sam Exp $
+ * $Id: mpeg_adec.c,v 1.20 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
int fifo_type;
int channels;
- if( main_GetIntVariable( AOUT_STEREO_VAR, 0 ) )
+ if( p_main->b_stereo )
{
intf_WarnMsg( 4, "adec info: setting stereo output" );
fifo_type = AOUT_ADEC_STEREO_FIFO;
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ps.c,v 1.12 2002/02/15 13:32:53 sam Exp $
+ * $Id: input_ps.c,v 1.13 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
- if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
- == (p_es->i_id & 0x1F) )
- switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+ if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+ == (p_es->i_id & 0x1F) ||
+ ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+ && !(p_es->i_id & 0x1F) ) )
+ switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
{
- case 0:
- main_PutIntVariable( INPUT_AUDIO_VAR,
- REQUESTED_MPEG );
+ case -1:
case REQUESTED_MPEG:
input_SelectES( p_input, p_es );
}
break;
case AC3_AUDIO_ES:
- if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
- == ((p_es->i_id & 0xF00) >> 8) )
- switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+ if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+ == ((p_es->i_id & 0xF00) >> 8) ||
+ ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+ && !((p_es->i_id & 0xF00) >> 8) ) )
+ switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
{
- case 0:
- main_PutIntVariable( INPUT_AUDIO_VAR,
- REQUESTED_AC3 );
+ case -1:
case REQUESTED_AC3:
input_SelectES( p_input, p_es );
}
break;
case DVD_SPU_ES:
- if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+ if( config_GetIntVariable( INPUT_SUBTITLE_VAR )
== ((p_es->i_id & 0x1F00) >> 8) )
{
input_SelectES( p_input, p_es );
break;
case LPCM_AUDIO_ES:
- if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
- == ((p_es->i_id & 0x1F00) >> 8) )
- switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+ if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+ == ((p_es->i_id & 0x1F00) >> 8) ||
+ ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+ && !((p_es->i_id & 0x1F00) >> 8) ) )
+ switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
{
- case 0:
- main_PutIntVariable( INPUT_AUDIO_VAR,
- REQUESTED_LPCM );
+ case -1:
case REQUESTED_LPCM:
input_SelectES( p_input, p_es );
}
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: video_parser.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: video_parser.c,v 1.15 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
+/* Variable containing the motion compensation method */
+#define MOTION_METHOD_VAR "mpeg_vdec_motion"
+/* Variable containing the IDCT method */
+#define IDCT_METHOD_VAR "mpeg_vdec_idct"
+
MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL)
+ADD_PLUGIN( IDCT_METHOD_VAR, MODULE_CAPABILITY_IDCT, NULL, NULL,
+ "IDCT method", NULL )
+ADD_PLUGIN( MOTION_METHOD_VAR, MODULE_CAPABILITY_MOTION, NULL, NULL,
+ "motion compensation method", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
*****************************************************************************/
static int InitThread( vpar_thread_t *p_vpar )
{
+ char *psz_name;
+
/*
* Choose the best motion compensation module
*/
- p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION,
- main_GetPszVariable( MOTION_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( MOTION_METHOD_VAR );
+ p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( p_vpar->p_motion_module == NULL )
{
/*
* Choose the best IDCT module
*/
- p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT,
- main_GetPszVariable( IDCT_METHOD_VAR, NULL ),
- NULL );
+ psz_name = config_GetPszVariable( IDCT_METHOD_VAR );
+ p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT, psz_name,
+ NULL );
+ if( psz_name ) free( psz_name );
if( p_vpar->p_idct_module == NULL )
{
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_synchro.c,v 1.6 2002/02/19 00:50:19 sam Exp $
+ * $Id: vpar_synchro.c,v 1.7 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
/*****************************************************************************
* Preamble
*****************************************************************************/
+#include <stdlib.h> /* free() */
#include <string.h> /* memcpy(), memset() */
#include <videolan/vlc.h>
*****************************************************************************/
static int SynchroType( void )
{
- char * psz_synchro = main_GetPszVariable( VPAR_SYNCHRO_VAR, NULL );
+ char psz_synchro_tmp[5];
+ char * psz_synchro = config_GetPszVariable( VPAR_SYNCHRO_VAR );
if( psz_synchro == NULL )
{
return VPAR_SYNCHRO_DEFAULT;
}
+ strncpy( psz_synchro_tmp, psz_synchro, 5);
+ free( psz_synchro );
+ psz_synchro = psz_synchro_tmp;
+
switch( *psz_synchro++ )
{
case 'i':
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for QNX RTOS module" )
- ADD_COMMENT( "For now, the QNX RTOS module cannot be configured" )
MODULE_CONFIG_STOP
MODULE_INIT_START
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
p_vout->b_fullscreen =
- main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
+ config_GetIntVariable( VOUT_FULLSCREEN_VAR );
p_vout->p_sys->i_mode =
- main_GetIntVariable( VOUT_NOOVERLAY_VAR, VOUT_NOOVERLAY_DEFAULT ) ?
+ config_GetIntVariable( VOUT_NOOVERLAY_VAR ) ?
MODE_NORMAL_MEM : MODE_VIDEO_OVERLAY;
p_vout->p_sys->dim.w =
- main_GetIntVariable( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT );
+ config_GetIntVariable( VOUT_WIDTH_VAR );
p_vout->p_sys->dim.h =
- main_GetIntVariable( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT );
+ config_GetIntVariable( VOUT_HEIGHT_VAR );
/* init display and create window */
if( QNXInitDisplay( p_vout ) || QNXCreateWnd( p_vout ) )
* qt.cpp : Qt plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: qt.cpp,v 1.6 2001/12/30 07:09:56 sam Exp $
+ * $Id: qt.cpp,v 1.7 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for Qt module" )
- ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* aout_sdl.c : audio sdl functions library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_sdl.c,v 1.25 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_sdl.c,v 1.26 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
p_aout->p_sys->audio_buf = malloc( OVERFLOWLIMIT );
/* Initialize some variables */
- p_aout->psz_device = 0;
desired.freq = p_aout->l_rate;
/* TODO: write conversion beetween AOUT_FORMAT_DEFAULT
* logger.c : file logging plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: logger.c,v 1.3 2002/02/20 05:56:18 sam Exp $
+ * $Id: logger.c,v 1.4 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
static int intf_Open( intf_thread_t *p_intf )
{
- char *psz_filename;
+ char *psz_filename_tmp, *psz_filename;
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
return -1;
}
- psz_filename = main_GetPszVariable( INTF_METHOD_VAR, NULL );
+ if( !(psz_filename = psz_filename_tmp
+ = config_GetPszVariable( INTF_METHOD_VAR )) )
+ {
+ intf_ErrMsg( "intf error: configuration variable %s empty",
+ INTF_METHOD_VAR );
+ return -1;
+ }
while( *psz_filename && *psz_filename != ':' )
{
intf_ErrMsg( "intf error: error opening logfile `%s'", psz_filename );
free( p_intf->p_sys );
intf_MsgUnsub( p_intf->p_sys->p_sub );
+ free( psz_filename_tmp );
return -1;
}
+ free( psz_filename_tmp );
+
LOG_STRING( "-- log plugin started --\n", p_intf->p_sys->p_file );
return 0;
* ncurses.c : NCurses plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: ncurses.c,v 1.11 2002/02/15 13:32:53 sam Exp $
+ * $Id: ncurses.c,v 1.12 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for NCurses module" )
- ADD_COMMENT( "For now, the NCurses module cannot be configured" )
MODULE_CONFIG_STOP
MODULE_INIT_START
#undef area
/* Get requested title - if none try the first title */
- i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+ i_title = config_GetIntVariable( INPUT_TITLE_VAR );
if( i_title <= 0 )
{
i_title = 1;
// p_vcd->i_track = i_title-1;
/* Get requested chapter - if none defaults to first one */
- i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+ i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
if( i_chapter <= 0 )
{
i_chapter = 1;
* waveout.c : Windows waveOut plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: waveout.c,v 1.2 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: waveout.c,v 1.3 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for Windows waveOut module" )
- ADD_COMMENT( "For now, the Windows WaveOut module cannot be configured" )
MODULE_CONFIG_STOP
MODULE_INIT_START
for( i=0; i<NUMBUF; i++)
p_aout->p_sys->waveheader[i].lpData = malloc( 1 );
- p_aout->psz_device = 0;
-
return OpenWaveOutDevice( p_aout );
}
* x11.c : X11 plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: x11.c,v 1.11 2002/02/19 00:50:19 sam Exp $
+ * $Id: x11.c,v 1.12 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for X11 module" )
- ADD_COMMENT( "For now, the X11 module cannot be configured" )
MODULE_CONFIG_STOP
MODULE_INIT_START
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.18 2002/02/20 23:23:53 sam Exp $
+ * $Id: xcommon.c,v 1.19 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
return( 1 );
}
- /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
- psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
+ /* Open display, unsing the VOUT_DISPLAY_VAR config variable or the DISPLAY
+ * environment variable */
+ psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
p_vout->p_sys->p_display = XOpenDisplay( psz_display );
if( p_vout->p_sys->p_display == NULL ) /* error */
{
- intf_ErrMsg( "vout error: cannot open display %s", psz_display );
+ intf_ErrMsg( "vout error: cannot open display %s",
+ XDisplayName( psz_display ) );
free( p_vout->p_sys );
+ if( psz_display ) free( psz_display );
return( 1 );
}
+ if( psz_display ) free( psz_display );
+
p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
#ifdef MODULE_NAME_IS_xvideo
}
i_selected_port = -1;
- i_requested_adaptor = main_GetIntVariable( VOUT_XVADAPTOR_VAR, -1 );
+ i_requested_adaptor = config_GetIntVariable( XVADAPTOR_VAR );
for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor )
{
* xcommon.h: Common X11 and Xvideo video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.h,v 1.1 2001/12/30 07:09:56 sam Exp $
+ * $Id: xcommon.h,v 1.2 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+/*****************************************************************************
+ * Common macros
+ *****************************************************************************/
+#define XVADAPTOR_VAR "xvideo_adaptor"
+
/*****************************************************************************
* Common prototypes
*****************************************************************************/
* xvideo.c : Xvideo plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: xvideo.c,v 1.6 2001/12/30 07:09:56 sam Exp $
+ * $Id: xvideo.c,v 1.7 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
- ADD_WINDOW( "Configuration for xvideo module" )
- ADD_COMMENT( "For now, the xvideo module cannot be configured" )
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_INTEGER ( XVADAPTOR_VAR, -1, NULL, "XVideo adaptor number", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: audio_output.c,v 1.76 2002/02/15 13:32:54 sam Exp $
+ * $Id: audio_output.c,v 1.77 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
}
p_aout->i_latency = 0;
- p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, l_rate );
- p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
- i_channels - 1 );
+ p_aout->l_rate = config_GetIntVariable( AOUT_RATE_VAR );
+ p_aout->i_channels = config_GetIntVariable( AOUT_MONO_VAR ) ? 1 : 2;
intf_WarnMsg( 3, "aout info: thread created, channels %d, rate %d",
p_aout->i_channels, p_aout->l_rate );
/* special setting for ac3 pass-through mode */
/* FIXME is it necessary ? (cf ac3_adec.c) */
- if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) && p_main->b_ac3 )
+ if( config_GetIntVariable( AOUT_SPDIF_VAR ) && p_main->b_ac3 )
{
intf_WarnMsg( 4, "aout info: setting ac3 spdif" );
p_aout->i_format = AOUT_FMT_AC3;
/* Choose the best module */
p_aout->p_module = module_Need( MODULE_CAPABILITY_AOUT,
- main_GetPszVariable( AOUT_METHOD_VAR, NULL ),
+ config_GetPszVariable( AOUT_METHOD_VAR ),
(void *)p_aout );
if( p_aout->p_module == NULL )
}
/* Initialize the volume level */
- p_aout->i_volume = main_GetIntVariable( AOUT_VOLUME_VAR, VOLUME_DEFAULT );
+ p_aout->i_volume = config_GetIntVariable( AOUT_VOLUME_VAR );
p_aout->i_savedvolume = 0;
/* FIXME: maybe it would be cleaner to change SpawnThread prototype
* decoders.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input.c,v 1.175 2002/02/19 00:50:19 sam Exp $
+ * $Id: input.c,v 1.176 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
p_input->stream.control.i_status = PLAYING_S;
p_input->stream.control.i_rate = DEFAULT_RATE;
p_input->stream.control.b_mute = 0;
- p_input->stream.control.b_grayscale = main_GetIntVariable(
- VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT );
- p_input->stream.control.i_smp = main_GetIntVariable(
- VDEC_SMP_VAR, VDEC_SMP_DEFAULT );
+ p_input->stream.control.b_grayscale = config_GetIntVariable(
+ VOUT_GRAYSCALE_VAR );
+ p_input->stream.control.i_smp = config_GetIntVariable( VDEC_SMP_VAR );
intf_WarnMsg( 1, "input: playlist item `%s'", p_input->p_source );
*****************************************************************************/
static int InitThread( input_thread_t * p_input )
{
+ char *psz_name;
+
/* Find appropriate module. */
- p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT,
- main_GetPszVariable( INPUT_METHOD_VAR, NULL ),
- (void *)p_input );
+ psz_name = config_GetPszVariable( INPUT_METHOD_VAR );
+ p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT, psz_name,
+ (void *)p_input );
+ if( psz_name ) free( psz_name );
if( p_input->p_input_module == NULL )
{
intf_ErrMsg( "input error: no suitable input module for `%s'",
/* Check that we got a valid port */
if( i_bind_port == 0 )
{
- i_bind_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
+ i_bind_port = config_GetIntVariable( INPUT_PORT_VAR );
}
intf_WarnMsg( 2, "input: server=%s:%d local=%s:%d",
}
/* Check proxy */
- if( (psz_proxy = main_GetPszVariable( "http_proxy", NULL )) != NULL )
+ if( (psz_proxy = getenv( "http_proxy" )) != NULL )
{
/* http://myproxy.mydomain:myport/ */
int i_proxy_port = 0;
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: input_dec.c,v 1.27 2002/02/19 00:50:19 sam Exp $
+ * $Id: input_dec.c,v 1.28 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
if( p_es->i_type == MPEG1_AUDIO_ES || p_es->i_type == MPEG2_AUDIO_ES )
{
- psz_plugin = main_GetPszVariable( ADEC_MPEG_VAR, NULL );
+ psz_plugin = config_GetPszVariable( ADEC_MPEG_VAR );
}
if( p_es->i_type == AC3_AUDIO_ES )
{
- psz_plugin = main_GetPszVariable( ADEC_AC3_VAR, NULL );
+ psz_plugin = config_GetPszVariable( ADEC_AC3_VAR );
}
/* Get a suitable module */
p_es->p_module = module_Need( MODULE_CAPABILITY_DECODER, psz_plugin,
(void *)&p_es->i_type );
+ if( psz_plugin ) free( psz_plugin );
if( p_es->p_module == NULL )
{
intf_ErrMsg( "input error: no suitable decoder module for type 0x%x",
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: mpeg_system.c,v 1.79 2002/02/19 00:50:19 sam Exp $
+ * $Id: mpeg_system.c,v 1.80 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
p_es->i_cat = AUDIO_ES;
#ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable )
- if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
- == (p_es->i_id & 0x1F) )
- switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+ if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+ == (p_es->i_id & 0x1F) ||
+ ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+ && !(p_es->i_id & 0x1F) ) )
+ switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
{
- case 0:
- main_PutIntVariable( INPUT_CHANNEL_VAR,
- REQUESTED_MPEG );
+ case -1:
case REQUESTED_MPEG:
input_SelectES( p_input, p_es );
}
p_es->i_cat = AUDIO_ES;
#ifdef AUTO_SPAWN
if( !p_input->stream.b_seekable )
- if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
- == ((p_es->i_id & 0xF00) >> 8) )
- switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+ if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+ == ((p_es->i_id & 0xF00) >> 8) ||
+ ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+ && !((p_es->i_id & 0xF00) >> 8)) )
+ switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
{
- case 0:
- main_PutIntVariable( INPUT_CHANNEL_VAR,
- REQUESTED_AC3 );
+ case -1:
case REQUESTED_AC3:
input_SelectES( p_input, p_es );
}
p_es->i_type = DVD_SPU_ES;
p_es->i_cat = SPU_ES;
#ifdef AUTO_SPAWN
- if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+ if( config_GetIntVariable( INPUT_SUBTITLE_VAR )
== ((p_es->i_id & 0x1F00) >> 8) )
{
if( !p_input->stream.b_seekable )
if( p_main->b_audio )
{
/* Default is the first one */
- i_required_audio_es = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+ i_required_audio_es = config_GetIntVariable( INPUT_CHANNEL_VAR );
if( i_required_audio_es < 0 )
{
- main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
i_required_audio_es = 1;
}
}
if( p_main->b_video )
{
/* for spu, default is none */
- i_required_spu_es = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+ i_required_spu_es = config_GetIntVariable( INPUT_SUBTITLE_VAR );
if( i_required_spu_es < 0 )
{
- main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
i_required_spu_es = 0;
}
}
* interface, such as command line.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: interface.c,v 1.89 2002/02/19 00:50:19 sam Exp $
+ * $Id: interface.c,v 1.90 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
intf_thread_t* intf_Create( void )
{
intf_thread_t * p_intf;
+ char *psz_name;
/* Allocate structure */
p_intf = malloc( sizeof( intf_thread_t ) );
}
/* Choose the best module */
- p_intf->p_module = module_Need( MODULE_CAPABILITY_INTF,
- main_GetPszVariable( INTF_METHOD_VAR, NULL ),
- (void *)p_intf );
+ psz_name = config_GetPszVariable( INTF_METHOD_VAR );
+ p_intf->p_module = module_Need( MODULE_CAPABILITY_INTF, psz_name,
+ (void *)p_intf );
+ if( psz_name ) free( psz_name );
if( p_intf->p_module == NULL )
{
intf_ErrMsg( "intf error: no suitable intf module" );
p_main->p_playlist->b_stopped = 0;
p_main->p_playlist->i_mode = PLAYLIST_FORWARD +
- main_GetIntVariable( PLAYLIST_LOOP_VAR,
- PLAYLIST_LOOP_DEFAULT );
+ config_GetIntVariable( PLAYLIST_LOOP_VAR );
intf_WarnMsg( 3, "intf: creating new input thread" );
p_input = input_CreateThread( &p_main->p_playlist->current,
NULL );
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: main.c,v 1.152 2002/02/19 00:50:19 sam Exp $
+ * $Id: main.c,v 1.153 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
+ * Gildas Bazin <gbazin@netcourrier.com>
*
* 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
#include "debug.h"
/*****************************************************************************
- * Command line options constants. If something is changed here, be sure that
- * GetConfiguration and Usage are also changed.
+ * Configuration options for the main program. Each plugin will also separatly
+ * define its own configuration options.
+ * Look into configuration.h if you need to know more about the following
+ * macros.
+ *
+ *****************************************************************************/
+#define BUILTIN
+#define MODULE_NAME main
+#include "modules_inner.h" /* for configuration stuff */
+
+/* Quick usage guide
+MODULE_CONFIG_START
+MODULE_CONFIG_STOP
+ADD_CATEGORY_HINT( text, longtext )
+ADD_SUBCATEGORY_HINT( text, longtext )
+ADD_STRING( option_name, value, p_callback, text, longtext )
+ADD_FILE( option_name, psz_value, p_callback, text, longtext )
+ADD_PLUGIN( option_name, psz_value, i_capability, p_callback, text, longtext )
+ADD_INTEGER( option_name, i_value, p_callback, text, longtext )
+ADD_BOOL( option_name, p_callback, text, longtext )
+*/
+
+MODULE_CONFIG_START
+
+/* Help options */
+ADD_CATEGORY_HINT( "Help Options", NULL )
+ADD_BOOL ( "help", NULL,"print help and exit (or use -h)", NULL )
+ADD_BOOL ( "longhelp", NULL, "print long help version and exit (or use -H)",
+ NULL )
+ADD_BOOL ( "list", NULL, "list available plugins (or use -l)", NULL )
+ADD_STRING ( "pluginhelp", NULL, NULL,"print help on a plugin and exit",NULL )
+ADD_BOOL ( "version", NULL, "output version information and exit", NULL )
+
+/* Interface options */
+ADD_CATEGORY_HINT( "Interface Options", NULL)
+ADD_PLUGIN ( INTF_METHOD_VAR, MODULE_CAPABILITY_INTF, NULL, NULL,
+ "interface method", NULL )
+ADD_INTEGER ( INTF_WARNING_VAR, 0, NULL, "warning level (or use -v)", NULL )
+ADD_BOOL ( INTF_STATS_VAR, NULL, "output statistics", NULL )
+ADD_STRING ( INTF_PATH_VAR, NULL, NULL, "interface default search path", NULL)
+
+/* Audio Options */
+ADD_CATEGORY_HINT( "Audio Options", NULL)
+ADD_BOOL ( AOUT_NOAUDIO_VAR, NULL, "disable audio", NULL )
+ADD_PLUGIN ( AOUT_METHOD_VAR, MODULE_CAPABILITY_AOUT, NULL, NULL,
+ "audio output method", NULL )
+ADD_BOOL ( AOUT_MONO_VAR, NULL, "mono audio", NULL )
+ADD_BOOL ( AOUT_SPDIF_VAR, NULL, "AC3 pass-through mode", NULL )
+ADD_INTEGER ( AOUT_VOLUME_VAR, VOLUME_DEFAULT, NULL, "VLC output volume", NULL)
+ADD_INTEGER ( AOUT_RATE_VAR, 44100, NULL, "VLC output frequency", NULL )
+ADD_INTEGER ( AOUT_DESYNC_VAR, 0, NULL, "Compensate desynchronization of the "
+ "audio (in ms)", NULL )
+
+/* Video options */
+ADD_CATEGORY_HINT( "Video Options", NULL )
+ADD_BOOL ( VOUT_NOVIDEO_VAR, NULL, "disable video", NULL )
+ADD_PLUGIN ( VOUT_METHOD_VAR, MODULE_CAPABILITY_VOUT, NULL, NULL,
+ "video output method", NULL )
+ADD_STRING ( VOUT_DISPLAY_VAR, NULL, NULL, "display string", NULL )
+ADD_INTEGER ( VOUT_WIDTH_VAR, 720, NULL, "display width", NULL )
+ADD_INTEGER ( VOUT_HEIGHT_VAR, 576, NULL, "display height", NULL )
+ADD_BOOL ( VOUT_GRAYSCALE_VAR, NULL, "grayscale output", NULL )
+ADD_BOOL ( VOUT_FULLSCREEN_VAR, NULL, "fullscreen output", NULL )
+ADD_BOOL ( VOUT_NOOVERLAY_VAR, NULL, "disable accelerated display", NULL )
+ADD_PLUGIN ( VOUT_FILTER_VAR, MODULE_CAPABILITY_VOUT, NULL, NULL,
+ "video filter module", NULL )
+ADD_INTEGER ( VOUT_SPUMARGIN_VAR, -1, NULL, "force SPU position", NULL )
+
+/* Input options */
+ADD_CATEGORY_HINT( "Input Options", NULL )
+ADD_STRING ( INPUT_METHOD_VAR, NULL, NULL, "input method", NULL )
+ADD_BOOL ( INPUT_NETWORK_CHANNEL_VAR, NULL, "enable network channel mode",
+ NULL )
+ADD_STRING ( INPUT_CHANNEL_SERVER_VAR, "localhost", NULL,
+ "channel server address", NULL )
+ADD_INTEGER ( INPUT_CHANNEL_PORT_VAR, 6010, NULL, "channel server port", NULL )
+ADD_STRING ( INPUT_IFACE_VAR, "eth0", NULL, "network interface", NULL )
+
+ADD_INTEGER ( INPUT_TITLE_VAR, -1, NULL, "choose title", NULL )
+ADD_INTEGER ( INPUT_CHAPTER_VAR, -1, NULL, "choose chapter", NULL )
+ADD_INTEGER ( INPUT_ANGLE_VAR, -1, NULL, "chosse angle", NULL )
+ADD_INTEGER ( INPUT_AUDIO_VAR, -1, NULL, "choose audio", NULL )
+ADD_INTEGER ( INPUT_CHANNEL_VAR, -1, NULL, "choose channel", NULL )
+ADD_INTEGER ( INPUT_SUBTITLE_VAR, -1, NULL, "choose subtitles", NULL )
+
+ADD_STRING ( INPUT_DVD_DEVICE_VAR, "/dev/dvd", NULL, "DVD device", NULL )
+ADD_STRING ( INPUT_VCD_DEVICE_VAR, "/dev/cdrom", NULL, "VCD device", NULL )
+
+/* Decoder options */
+ADD_CATEGORY_HINT( "Decoders Options", NULL )
+ADD_PLUGIN ( ADEC_MPEG_VAR, MODULE_CAPABILITY_DECODER, NULL, NULL,
+ "choose MPEG audio decoder", NULL )
+ADD_PLUGIN ( ADEC_AC3_VAR, MODULE_CAPABILITY_DECODER, NULL, NULL,
+ "choose AC3 audio decoder", NULL )
+ADD_INTEGER ( VDEC_SMP_VAR, 0, NULL, "use additional processors", NULL )
+ADD_STRING ( VPAR_SYNCHRO_VAR, NULL, NULL, "force synchro algorithm "
+ "{I|I+|IP|IP+|IPB}", NULL )
+
+/* CPU options */
+ADD_CATEGORY_HINT( "CPU Options Options", NULL )
+ADD_BOOL ( NOMMX_VAR, NULL, "disable CPU's MMX support", NULL )
+ADD_BOOL ( NO3DN_VAR, NULL, "disable CPU's 3D Now! support", NULL )
+ADD_BOOL ( NOMMXEXT_VAR, NULL, "disable CPU's MMX EXT support", NULL )
+ADD_BOOL ( NOSSE_VAR, NULL, "disable CPU's SSE support", NULL )
+ADD_BOOL ( NOALTIVEC_VAR, NULL, "disable CPU's AltiVec support", NULL )
+
+/* Playlist options */
+ADD_BOOL ( PLAYLIST_STARTUP_VAR, NULL, "launch playlist on startup", NULL )
+ADD_BOOL ( PLAYLIST_ENQUEUE_VAR, NULL, "enqueue playlist as default", NULL )
+ADD_BOOL ( PLAYLIST_LOOP_VAR, NULL, "loop on playlist end", NULL )
+
+/* Misc options */
+ADD_CATEGORY_HINT( "Miscellaneous Options", NULL )
+ADD_PLUGIN ( MEMCPY_METHOD_VAR, MODULE_CAPABILITY_MEMCPY, NULL, NULL,
+ "memory copy method", NULL )
+
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+ SET_DESCRIPTION( "Main program" )
+ ADD_CAPABILITY( MAIN, 100/*whatever*/ )
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+/*****************************************************************************
+ * End configuration.
*****************************************************************************/
-
-/* Long options return values - note that values corresponding to short options
- * chars, and in general any regular char, should be avoided */
-#define OPT_NOAUDIO 150
-#define OPT_STEREO 151
-#define OPT_MONO 152
-#define OPT_SPDIF 153
-#define OPT_VOLUME 154
-#define OPT_DESYNC 155
-
-#define OPT_NOVIDEO 160
-#define OPT_DISPLAY 161
-#define OPT_WIDTH 162
-#define OPT_HEIGHT 163
-#define OPT_COLOR 164
-#define OPT_FULLSCREEN 165
-#define OPT_NOOVERLAY 166
-#define OPT_XVADAPTOR 167
-#define OPT_SMP 168
-#define OPT_SPUMARGIN 169
-
-#define OPT_CHANNELS 170
-#define OPT_SERVER 171
-#define OPT_PORT 172
-#define OPT_BROADCAST 173
-#define OPT_CHANNELSERVER 174
-
-#define OPT_INPUT 180
-#define OPT_MOTION 181
-#define OPT_IDCT 182
-#define OPT_YUV 183
-#define OPT_DOWNMIX 184
-#define OPT_IMDCT 185
-#define OPT_MEMCPY 186
-#define OPT_FILTER 187
-#define OPT_DVDCSS_METHOD 188
-#define OPT_DVDCSS_VERBOSE 189
-
-#define OPT_SYNCHRO 190
-#define OPT_WARNING 191
-#define OPT_VERSION 192
-#define OPT_STATS 193
-
-#define OPT_MPEG_ADEC 200
-#define OPT_AC3_ADEC 201
-
-#define OPT_NOMMX 210
-#define OPT_NO3DNOW 211
-#define OPT_NOMMXEXT 212
-#define OPT_NOSSE 213
-#define OPT_NOALTIVEC 214
-
-/* Usage fashion */
-#define USAGE 0
-#define SHORT_HELP 1
-#define LONG_HELP 2
-
-/* Long options */
-static const struct option longopts[] =
-{
- /* name, has_arg, flag, val */
-
- /* General/common options */
- { "help", 0, 0, 'h' },
- { "longhelp", 0, 0, 'H' },
- { "version", 0, 0, OPT_VERSION },
-
- /* Interface options */
- { "intf", 1, 0, 'I' },
- { "warning", 1, 0, OPT_WARNING },
- { "stats", 0, 0, OPT_STATS },
-
- /* Audio options */
- { "noaudio", 0, 0, OPT_NOAUDIO },
- { "aout", 1, 0, 'A' },
- { "stereo", 0, 0, OPT_STEREO },
- { "mono", 0, 0, OPT_MONO },
- { "spdif", 0, 0, OPT_SPDIF },
- { "downmix", 1, 0, OPT_DOWNMIX },
- { "imdct", 1, 0, OPT_IMDCT },
- { "volume", 1, 0, OPT_VOLUME },
- { "desync", 1, 0, OPT_DESYNC },
-
- /* Video options */
- { "novideo", 0, 0, OPT_NOVIDEO },
- { "vout", 1, 0, 'V' },
- { "display", 1, 0, OPT_DISPLAY },
- { "width", 1, 0, OPT_WIDTH },
- { "height", 1, 0, OPT_HEIGHT },
- { "grayscale", 0, 0, 'g' },
- { "color", 0, 0, OPT_COLOR },
- { "motion", 1, 0, OPT_MOTION },
- { "idct", 1, 0, OPT_IDCT },
- { "yuv", 1, 0, OPT_YUV },
- { "fullscreen", 0, 0, OPT_FULLSCREEN },
- { "nooverlay", 0, 0, OPT_NOOVERLAY },
- { "xvadaptor", 1, 0, OPT_XVADAPTOR },
- { "smp", 1, 0, OPT_SMP },
- { "spumargin", 1, 0, OPT_SPUMARGIN },
-
- /* DVD options */
- { "dvdtitle", 1, 0, 't' },
- { "dvdchapter", 1, 0, 'T' },
- { "dvdangle", 1, 0, 'u' },
- { "dvdaudio", 1, 0, 'a' },
- { "dvdchannel", 1, 0, 'c' },
- { "dvdsubtitle", 1, 0, 's' },
- { "dvdcss-method", 1, 0, OPT_DVDCSS_METHOD },
- { "dvdcss-verbose", 1, 0, OPT_DVDCSS_VERBOSE },
-
- /* Input options */
- { "input", 1, 0, OPT_INPUT },
- { "channels", 0, 0, OPT_CHANNELS },
- { "channelserver", 1, 0, OPT_CHANNELSERVER },
-
- /* Misc options */
- { "synchro", 1, 0, OPT_SYNCHRO },
- { "memcpy", 1, 0, OPT_MEMCPY },
- { "filter", 1, 0, OPT_FILTER },
-
- /* Decoder options */
- { "mpeg_adec", 1, 0, OPT_MPEG_ADEC },
- { "ac3_adec", 1, 0, OPT_AC3_ADEC },
-
- /* CPU options */
- { "nommx", 0, 0, OPT_NOMMX },
- { "no3dnow", 0, 0, OPT_NO3DNOW },
- { "nommxext", 0, 0, OPT_NOMMXEXT },
- { "nosse", 0, 0, OPT_NOSSE },
- { "noaltivec", 0, 0, OPT_NOALTIVEC },
-
- { 0, 0, 0, 0 }
-};
-
-/* Short options */
-static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:";
/*****************************************************************************
* Global variables - these are the only ones, see main.h and modules.h
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int GetConfiguration ( int *pi_argc, char *ppsz_argv[],
- char *ppsz_env[] );
-static int GetFilenames ( int i_argc, char *ppsz_argv[] );
-static void Usage ( int i_fashion );
-static void Version ( void );
-
-static void InitSignalHandler ( void );
-static void SimpleSignalHandler ( int i_signal );
-static void FatalSignalHandler ( int i_signal );
-static void IllegalSignalHandler ( int i_signal );
-static u32 CPUCapabilities ( void );
-
-static void ShowConsole ( void );
+static int GetConfigurationFromFile ( void ){return 0;};
+static int GetConfigurationFromCmdLine ( int *pi_argc, char *ppsz_argv[],
+ boolean_t b_ignore_errors );
+static int GetFilenames ( int i_argc, char *ppsz_argv[] );
+static void Usage ( const char *psz_module_name );
+static void ListModules ( void );
+static void Version ( void );
+
+static void InitSignalHandler ( void );
+static void SimpleSignalHandler ( int i_signal );
+static void FatalSignalHandler ( int i_signal );
+static void IllegalSignalHandler ( int i_signal );
+static u32 CPUCapabilities ( void );
+
+#ifdef WIN32
+static void ShowConsole ( void );
+#endif
static jmp_buf env;
static int i_illegal;
input_bank_t input_bank;
aout_bank_t aout_bank;
vout_bank_t vout_bank;
+ char *p_tmp;
p_main = &main_data; /* set up the global variables */
p_module_bank = &module_bank;
p_aout_bank = &aout_bank;
p_vout_bank = &vout_bank;
+ p_main->i_warning_level = 0;
+
+
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
/*
* Support for getext
#elif defined( SYS_LINUX )
# ifdef DEBUG
/* Activate malloc checking routines to detect heap corruptions. */
- main_PutIntVariable( "MALLOC_CHECK_", 2 );
+ putenv( "MALLOC_CHECK_=2" );
# endif
#endif
intf_Msg( COPYRIGHT_MESSAGE "\n" );
+
+ /* Get the executable name (similar to the basename command) */
+ p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
+ while( *p_tmp )
+ {
+ if( *p_tmp == '/' ) p_main->psz_arg0 = ++p_tmp;
+ else ++p_tmp;
+ }
+
/*
- * Read configuration
+ * Initialize the module bank and and load the configuration of the main
+ * module. We need to do this at this stage to be able to display a short
+ * help if required by the user. (short help == main module options)
*/
- if( GetConfiguration( &i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */
+ module_InitBank();
+ module_LoadMain();
+
+ if( GetConfigurationFromCmdLine( &i_argc, ppsz_argv, 1 ) )
{
intf_MsgDestroy();
return( errno );
}
+ /* Check for short help option */
+ if( config_GetIntVariable( "help" ) )
+ {
+ Usage( "main" );
+ return( -1 );
+ }
+
+ /* Check for version option */
+ if( config_GetIntVariable( "version" ) )
+ {
+ Version();
+ return( -1 );
+ }
+
/*
- * Redirect the standard output if required by the user, and on Win32 we
- * also open a console to display the debug messages.
+ * Load the builtins and plugins into the module_bank.
+ * We have to do it before GetConfiguration() because this also gets the
+ * list of configuration options exported by each plugin and loads their
+ * default values.
*/
+ module_LoadBuiltins();
+ module_LoadPlugins();
+ intf_WarnMsg( 2, "module: module bank initialized, found %i modules",
+ p_module_bank->i_count );
+
+
+ /* Check for help on plugins */
+ if( (p_tmp = config_GetPszVariable( "pluginhelp" )) )
+ {
+ Usage( p_tmp );
+ free( p_tmp );
+ return( -1 );
+ }
+
+ /* Check for long help option */
+ if( config_GetIntVariable( "longhelp" ) )
+ {
+ Usage( NULL );
+ return( -1 );
+ }
+
+ /* Check for plugin list option */
+ if( config_GetIntVariable( "list" ) )
+ {
+ ListModules();
+ return( -1 );
+ }
+
+ /*
+ * Override default configuration with config file settings
+ */
+ if( GetConfigurationFromFile() )
+ {
+ intf_MsgDestroy();
+ return( errno );
+ }
+
+ /*
+ * Override configuration with command line settings
+ */
+ if( GetConfigurationFromCmdLine( &i_argc, ppsz_argv, 0 ) )
+ {
+ intf_MsgDestroy();
+ return( errno );
+ }
+
+ /* p_main inititalization. FIXME ? */
+ p_main->i_desync = (mtime_t)config_GetIntVariable( AOUT_DESYNC_VAR )
+ * (mtime_t)1000;
+ p_main->b_stats = config_GetIntVariable( INTF_STATS_VAR );
+ p_main->b_audio = !config_GetIntVariable( AOUT_NOAUDIO_VAR );
+ p_main->b_stereo= !config_GetIntVariable( AOUT_MONO_VAR );
+ p_main->b_video = !config_GetIntVariable( VOUT_NOVIDEO_VAR );
+ if( config_GetIntVariable( NOMMX_VAR ) )
+ p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
+ if( config_GetIntVariable( NO3DN_VAR ) )
+ p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
+ if( config_GetIntVariable( NOMMXEXT_VAR ) )
+ p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
+ if( config_GetIntVariable( NOSSE_VAR ) )
+ p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
+ if( config_GetIntVariable( NOALTIVEC_VAR ) )
+ p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
+
+
if( p_main->b_stats )
{
char p_capabilities[200];
GetFilenames( i_argc, ppsz_argv );
/*
- * Initialize module, input, aout and vout banks
+ * Initialize input, aout and vout banks
*/
- module_InitBank();
input_InitBank();
aout_InitBank();
vout_InitBank();
/*
* Initialize shared resources and libraries
*/
- if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) &&
+ if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) &&
network_ChannelCreate() )
{
/* On error during Channels initialization, switch off channels */
intf_ErrMsg( "intf error: channels initialization failed, "
"deactivating channels" );
- main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 0 );
+ config_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 0 );
}
/*
/*
* Go back into channel 0 which is the network
*/
- if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) )
+ if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
{
network_ChannelJoin( COMMON_CHANNEL );
}
return 0;
}
-/*****************************************************************************
- * main_GetIntVariable: get the int value of an environment variable
- *****************************************************************************
- * This function is used to read some default parameters in modules.
- *****************************************************************************/
-int main_GetIntVariable( char *psz_name, int i_default )
-{
- char * psz_env; /* environment value */
- char * psz_end; /* end of parsing index */
- long int i_value; /* value */
-
- psz_env = getenv( psz_name );
- if( psz_env )
- {
- i_value = strtol( psz_env, &psz_end, 0 );
- if( (*psz_env != '\0') && (*psz_end == '\0') )
- {
- return( i_value );
- }
- }
- return( i_default );
-}
-
-/*****************************************************************************
- * main_GetPszVariable: get the string value of an environment variable
- *****************************************************************************
- * This function is used to read some default parameters in modules.
- *****************************************************************************/
-char * main_GetPszVariable( char *psz_name, char *psz_default )
-{
- char *psz_env;
-
- psz_env = getenv( psz_name );
- if( psz_env )
- {
- return( psz_env );
- }
- return( psz_default );
-}
-/*****************************************************************************
- * main_PutPszVariable: set the string value of an environment variable
- *****************************************************************************
- * This function is used to set some default parameters in modules. The use of
- * this function will cause some memory leak: since some systems use the pointer
- * passed to putenv to store the environment string, it can't be freed.
- *****************************************************************************/
-void main_PutPszVariable( char *psz_name, char *psz_value )
-{
- char *psz_env;
-
- psz_env = malloc( strlen(psz_name) + strlen(psz_value) + 2 );
- if( psz_env == NULL )
- {
- intf_ErrMsg( "intf error: cannot create psz_env (%s)",
- strerror(ENOMEM) );
- }
- else
- {
- sprintf( psz_env, "%s=%s", psz_name, psz_value );
- if( putenv( psz_env ) )
- {
- intf_ErrMsg( "intf error: cannot putenv (%s)", strerror(errno) );
- }
- }
-}
+/* following functions are local */
/*****************************************************************************
- * main_PutIntVariable: set the integer value of an environment variable
+ * GetConfigurationFromCmdLine: parse command line
*****************************************************************************
- * This function is used to set some default parameters in modules. The use of
- * this function will cause some memory leak: since some systems use the pointer
- * passed to putenv to store the environment string, it can't be freed.
+ * Parse command line for configuration. If the inline help is requested, the
+ * function Usage() is called and the function returns -1 (causing main() to
+ * exit).
+ * Now that the module_bank has been initialized, we can dynamically
+ * generate the longopts structure used by getops. We have to do it this way
+ * because we don't know (and don't want to know) in advance the configuration
+ * options used (ie. exported) by each module.
*****************************************************************************/
-void main_PutIntVariable( char *psz_name, int i_value )
+static int GetConfigurationFromCmdLine( int *pi_argc, char *ppsz_argv[],
+ boolean_t b_ignore_errors )
{
- char psz_value[ 256 ]; /* buffer for value */
+ int i_cmd, i, i_index, i_longopts_size;
+ module_t *p_module;
+ struct option *p_longopts;
- sprintf( psz_value, "%d", i_value );
- main_PutPszVariable( psz_name, psz_value );
-}
+ /* Short options */
+ const char *psz_shortopts = "hHvl";
-/* following functions are local */
-
-/*****************************************************************************
- * GetConfiguration: parse command line
- *****************************************************************************
- * Parse command line and configuration file for configuration. If the inline
- * help is requested, the function Usage() is called and the function returns
- * -1 (causing main() to exit). The messages interface is initialized at this
- * stage, but most structures are not allocated, so only environment should
- * be used.
- *****************************************************************************/
-static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
-{
- int i_cmd;
- char *p_tmp;
/* Set default configuration and copy arguments */
p_main->i_argc = *pi_argc;
p_main->ppsz_argv = ppsz_argv;
- p_main->ppsz_env = ppsz_env;
-
- p_main->b_audio = 1;
- p_main->b_video = 1;
-
- p_main->i_warning_level = 0;
- p_main->b_stats = 0;
- p_main->i_desync = 0; /* No desynchronization by default */
p_main->p_channel = NULL;
- /* Get the executable name (similar to the basename command) */
- p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
- while( *p_tmp )
- {
- if( *p_tmp == '/' )
- {
- p_main->psz_arg0 = ++p_tmp;
- }
- else
- {
- ++p_tmp;
- }
- }
-
#ifdef SYS_DARWIN
/* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
* is the PSN - process serial number (a unique PID-ish thingie)
}
#endif
- /* Parse command line options */
+
+ /*
+ * Generate the longopts structure used by getopt_long
+ */
+ i_longopts_size = 0;
+ for( p_module = p_module_bank->first ;
+ p_module != NULL ;
+ p_module = p_module->next )
+ {
+ /* count the number of exported configuration options (to allocate
+ * longopts). The i_config_options we use is an approximation of the
+ * real number of options (it also includes markers like: category ...)
+ * but it is enough for our purpose */
+ i_longopts_size += p_module->i_config_options -1;
+ }
+
+ p_longopts = (struct option *)malloc( sizeof(struct option)
+ * (i_longopts_size + 1) );
+ if( p_longopts == NULL )
+ {
+ intf_ErrMsg( "GetConfigurationFromCmdLine error: "
+ "can't allocate p_longopts" );
+ return( -1 );
+ }
+
+ /* Fill the longopts structure */
+ i_index = 0;
+ for( p_module = p_module_bank->first ;
+ p_module != NULL ;
+ p_module = p_module->next )
+ {
+ for( i = 1; i < (p_module->i_config_options -1); i++ )
+ {
+ if( (p_module->p_config[i].i_type == MODULE_CONFIG_ITEM_CATEGORY)||
+ (p_module->p_config[i].i_type ==
+ MODULE_CONFIG_ITEM_SUBCATEGORY)||
+ (p_module->p_config[i].i_type ==
+ MODULE_CONFIG_ITEM_SUBCATEGORY_END) )
+ continue;
+ p_longopts[i_index].name = p_module->p_config[i].psz_name;
+ p_longopts[i_index].has_arg =
+ (p_module->p_config[i].i_type == MODULE_CONFIG_ITEM_BOOL)?
+ no_argument : required_argument;
+ p_longopts[i_index].flag = 0;
+ p_longopts[i_index].val = 0;
+ i_index++;
+ }
+ }
+ /* Close the longopts structure */
+ memset( &p_longopts[i_index], 0, sizeof(struct option) );
+
+
+ /*
+ * Parse the command line options
+ */
opterr = 0;
- while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv,
- psz_shortopts, longopts, 0 ) ) != EOF )
+ optind = 1;
+ while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv, psz_shortopts,
+ p_longopts, &i_index ) ) != EOF )
{
+
+ if( i_cmd == 0 )
+ {
+ /* A long option has been recognized */
+
+ module_config_t *p_config;
+
+ /* Store the configuration option */
+ p_config = config_FindConfig( p_longopts[i_index].name );
+
+ switch( p_config->i_type )
+ {
+ case MODULE_CONFIG_ITEM_STRING:
+ case MODULE_CONFIG_ITEM_FILE:
+ case MODULE_CONFIG_ITEM_PLUGIN:
+ config_PutPszVariable( p_longopts[i_index].name, optarg );
+ break;
+ case MODULE_CONFIG_ITEM_INTEGER:
+ config_PutIntVariable( p_longopts[i_index].name, atoi(optarg));
+ break;
+ case MODULE_CONFIG_ITEM_BOOL:
+ config_PutIntVariable( p_longopts[i_index].name, 1 );
+ break;
+ }
+
+ continue;
+ }
+
+ /* short options handled here for now */
switch( i_cmd )
{
+
/* General/common options */
case 'h': /* -h, --help */
- ShowConsole();
- Usage( SHORT_HELP );
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- intf_Msg( "\nPress the RETURN key to continue..." );
- getchar();
-#endif
- return( -1 );
+ config_PutIntVariable( "help", 1 );
break;
case 'H': /* -H, --longhelp */
- ShowConsole();
- Usage( LONG_HELP );
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- intf_Msg( "\nPress the RETURN key to continue..." );
- getchar();
-#endif
- return( -1 );
+ config_PutIntVariable( "longhelp", 1 );
break;
- case OPT_VERSION: /* --version */
- ShowConsole();
- Version();
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- intf_Msg( "\nPress the RETURN key to continue..." );
- getchar();
-#endif
- return( -1 );
+ case 'l': /* -l, --list */
+ config_PutIntVariable( "list", 1 );
break;
case 'v': /* -v, --verbose */
p_main->i_warning_level++;
break;
- /* Interface warning messages level */
- case 'I': /* -I, --intf */
- main_PutPszVariable( INTF_METHOD_VAR, optarg );
- break;
- case OPT_WARNING: /* --warning */
- intf_ErrMsg( "intf error: `--warning' is deprecated, use `-v'" );
- p_main->i_warning_level = atoi(optarg);
- break;
-
- case OPT_STATS:
- p_main->b_stats = 1;
- break;
-
- /* Audio options */
- case OPT_NOAUDIO: /* --noaudio */
- p_main->b_audio = 0;
- break;
- case 'A': /* -A, --aout */
- main_PutPszVariable( AOUT_METHOD_VAR, optarg );
- break;
- case OPT_STEREO: /* --stereo */
- main_PutIntVariable( AOUT_STEREO_VAR, 1 );
- break;
- case OPT_MONO: /* --mono */
- main_PutIntVariable( AOUT_STEREO_VAR, 0 );
- break;
- case OPT_SPDIF: /* --spdif */
- main_PutIntVariable( AOUT_SPDIF_VAR, 1 );
- break;
- case OPT_DOWNMIX: /* --downmix */
- main_PutPszVariable( DOWNMIX_METHOD_VAR, optarg );
- break;
- case OPT_IMDCT: /* --imdct */
- main_PutPszVariable( IMDCT_METHOD_VAR, optarg );
- break;
- case OPT_VOLUME: /* --volume */
- main_PutIntVariable( AOUT_VOLUME_VAR, atoi(optarg) );
- break;
- case OPT_DESYNC: /* --desync */
- p_main->i_desync = (mtime_t)atoi(optarg) * (mtime_t)1000;
- break;
-
- /* Video options */
- case OPT_NOVIDEO: /* --novideo */
- p_main->b_video = 0;
- break;
- case 'V': /* -V, --vout */
- main_PutPszVariable( VOUT_METHOD_VAR, optarg );
- break;
- case OPT_DISPLAY: /* --display */
- main_PutPszVariable( VOUT_DISPLAY_VAR, optarg );
- break;
- case OPT_WIDTH: /* --width */
- main_PutPszVariable( VOUT_WIDTH_VAR, optarg );
- break;
- case OPT_HEIGHT: /* --height */
- main_PutPszVariable( VOUT_HEIGHT_VAR, optarg );
- break;
- case 'g': /* -g, --grayscale */
- main_PutIntVariable( VOUT_GRAYSCALE_VAR, 1 );
- break;
- case OPT_COLOR: /* --color */
- main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 );
- break;
- case OPT_FULLSCREEN: /* --fullscreen */
- main_PutIntVariable( VOUT_FULLSCREEN_VAR, 1 );
- break;
- case OPT_NOOVERLAY: /* --nooverlay */
- main_PutIntVariable( VOUT_NOOVERLAY_VAR, 1 );
- break;
- case OPT_XVADAPTOR: /* --xvadaptor */
- main_PutIntVariable( VOUT_XVADAPTOR_VAR, atoi(optarg) );
- break;
- case OPT_MOTION: /* --motion */
- main_PutPszVariable( MOTION_METHOD_VAR, optarg );
- break;
- case OPT_IDCT: /* --idct */
- main_PutPszVariable( IDCT_METHOD_VAR, optarg );
- break;
- case OPT_YUV: /* --yuv */
- main_PutPszVariable( YUV_METHOD_VAR, optarg );
- break;
- case OPT_SMP: /* --smp */
- main_PutIntVariable( VDEC_SMP_VAR, atoi(optarg) );
- break;
- case OPT_SPUMARGIN: /* --spumargin */
- main_PutIntVariable( VOUT_SPUMARGIN_VAR, atoi(optarg) );
- break;
-
- /* DVD options */
- case 't': /* --dvdtitle */
- main_PutIntVariable( INPUT_TITLE_VAR, atoi(optarg) );
- break;
- case 'T': /* --dvdchapter */
- main_PutIntVariable( INPUT_CHAPTER_VAR, atoi(optarg) );
- break;
- case 'u': /* --dvdangle */
- main_PutIntVariable( INPUT_ANGLE_VAR, atoi(optarg) );
- break;
- case 'a': /* --dvdaudio */
- if ( ! strcmp(optarg, "ac3") )
- main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_AC3 );
- else if ( ! strcmp(optarg, "lpcm") )
- main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_LPCM );
- else if ( ! strcmp(optarg, "mpeg") )
- main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_MPEG );
- else
- main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_NOAUDIO );
- break;
- case 'c': /* --dvdchannel */
- main_PutIntVariable( INPUT_CHANNEL_VAR, atoi(optarg) );
- break;
- case 's': /* --dvdsubtitle */
- main_PutIntVariable( INPUT_SUBTITLE_VAR, atoi(optarg) );
- break;
- case OPT_DVDCSS_METHOD: /* --dvdcss-method */
- main_PutPszVariable( "DVDCSS_METHOD", optarg );
- break;
- case OPT_DVDCSS_VERBOSE: /* --dvdcss-verbose */
- main_PutPszVariable( "DVDCSS_VERBOSE", optarg );
- break;
-
- /* Input options */
- case OPT_INPUT: /* --input */
- main_PutPszVariable( INPUT_METHOD_VAR, optarg );
- break;
- case OPT_CHANNELS: /* --channels */
- main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 1 );
- break;
- case OPT_CHANNELSERVER: /* --channelserver */
- main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, optarg );
- break;
-
- /* Misc options */
- case OPT_SYNCHRO:
- main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg );
- break;
- case OPT_MEMCPY:
- main_PutPszVariable( MEMCPY_METHOD_VAR, optarg );
- break;
- case OPT_FILTER: /* --filter */
- main_PutPszVariable( VOUT_FILTER_VAR, optarg );
- break;
-
- /* Decoder options */
- case OPT_MPEG_ADEC:
- main_PutPszVariable( ADEC_MPEG_VAR, optarg );
- break;
-
- case OPT_AC3_ADEC:
- main_PutPszVariable( ADEC_AC3_VAR, optarg );
- break;
-
- /* CPU options */
- case OPT_NOMMX:
- p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
- break;
-
- case OPT_NO3DNOW:
- p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
- break;
-
- case OPT_NOMMXEXT:
- p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
- break;
-
- case OPT_NOSSE:
- p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
- break;
-
- case OPT_NOALTIVEC:
- p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
- break;
-
/* Internal error: unknown option */
case '?':
default:
- ShowConsole();
- intf_ErrMsg( "intf error: unknown option `%s'",
- ppsz_argv[optind] );
- Usage( USAGE );
+ if( !b_ignore_errors )
+ {
+ intf_ErrMsg( "intf error: unknown option `%s'",
+ ppsz_argv[optind] );
+ intf_Msg( "Try `%s --help' for more information.\n",
+ p_main->psz_arg0 );
+
#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- intf_Msg( "\nPress the RETURN key to continue..." );
- getchar();
+ intf_Msg( "\nPress the RETURN key to continue..." );
+ getchar();
#endif
- return( EINVAL );
- break;
+ free( p_longopts );
+ return( EINVAL );
+ break;
+ }
}
+
}
if( p_main->i_warning_level < 0 )
p_main->i_warning_level = 0;
}
+ free( p_longopts );
return( 0 );
}
*****************************************************************************
* Print a short inline help. Message interface is initialized at this stage.
*****************************************************************************/
-static void Usage( int i_fashion )
+static void Usage( const char *psz_module_name )
{
+ int i;
+ module_t *p_module;
+ char psz_spaces[30];
+
+ memset( psz_spaces, 32, 30 );
+
+#ifdef WIN32
+ ShowConsole();
+#endif
+
/* Usage */
- intf_Msg( "Usage: %s [options] [parameters] [file]...",
- p_main->psz_arg0 );
+ intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
+ p_main->psz_arg0 );
- if( i_fashion == USAGE )
+ /* Enumerate the config of each module */
+ for( p_module = p_module_bank->first ;
+ p_module != NULL ;
+ p_module = p_module->next )
{
- intf_Msg( "Try `%s --help' for more information.",
- p_main->psz_arg0 );
- return;
+
+ if( psz_module_name && strcmp( psz_module_name, p_module->psz_name ) )
+ continue;
+
+ /* print module name */
+ intf_Msg( "%s configuration:\n", p_module->psz_name );
+
+ for( i = 0; i < (p_module->i_config_options -1); i++ )
+ {
+ int j;
+
+ switch( p_module->p_config[i].i_type )
+ {
+ case MODULE_CONFIG_ITEM_CATEGORY:
+ intf_Msg( " %s", p_module->p_config[i].psz_text );
+ break;
+
+ case MODULE_CONFIG_ITEM_STRING:
+ case MODULE_CONFIG_ITEM_FILE:
+ case MODULE_CONFIG_ITEM_PLUGIN:
+ /* Nasty hack, but right now I'm too tired to think about
+ * a nice solution */
+ j = 25 - strlen( p_module->p_config[i].psz_name )
+ - strlen(" <string>") - 1;
+ if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+ intf_Msg( " --%s <string>%s %s",
+ p_module->p_config[i].psz_name, psz_spaces,
+ p_module->p_config[i].psz_text );
+ psz_spaces[j] = 32;
+ break;
+ case MODULE_CONFIG_ITEM_INTEGER:
+ /* Nasty hack, but right now I'm too tired to think about
+ * a nice solution */
+ j = 25 - strlen( p_module->p_config[i].psz_name )
+ - strlen(" <integer>") - 1;
+ if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+ intf_Msg( " --%s <integer>%s %s",
+ p_module->p_config[i].psz_name, psz_spaces,
+ p_module->p_config[i].psz_text );
+ psz_spaces[j] = 32;
+ break;
+ default:
+ /* Nasty hack, but right now I'm too tired to think about
+ * a nice solution */
+ j = 25 - strlen( p_module->p_config[i].psz_name ) - 1;
+ if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+ intf_Msg( " --%s%s %s",
+ p_module->p_config[i].psz_name, psz_spaces,
+ p_module->p_config[i].psz_text );
+ psz_spaces[j] = 32;
+ break;
+ }
+ }
+
+ /* Yet another nasty hack.
+ * Maybe we could use MODULE_CONFIG_ITEM_END to display tail messages
+ * for each module?? */
+ if( !strcmp( "main", p_module->psz_name ) )
+ intf_Msg( "\nPlaylist items:"
+ "\n *.mpg, *.vob \tPlain MPEG-1/2 files"
+ "\n dvd:<device>[@<raw device>] \tDVD device"
+ "\n vcd:<device> \tVCD device"
+ "\n udpstream:[<server>[:<server port>]][@[<bind address>]"
+ "[:<bind port>]]"
+ "\n \tUDP stream sent by VLS"
+ "\n vlc:loop \tLoop execution of the "
+ "playlist"
+ "\n vlc:pause \tPause execution of "
+ "playlist items"
+ "\n vlc:quit \tQuit VLC" );
+
+ intf_Msg( "" );
+
}
- /* Options */
- intf_Msg( "\nOptions:"
- "\n -I, --intf <module> \tinterface method"
- "\n -v, --verbose \tverbose mode (cumulative)"
- "\n --memcpy <module> \tmemcpy method"
- "\n"
- "\n --noaudio \tdisable audio"
- "\n -A, --aout <module> \taudio output method"
- "\n --stereo, --mono \tstereo/mono audio"
- "\n --spdif \tAC3 pass-through mode"
- "\n --downmix <module> \tAC3 downmix method"
- "\n --imdct <module> \tAC3 IMDCT method"
- "\n --volume [0..1024] \tVLC output volume"
- "\n --desync <time in ms> \tCompensate desynchronization of the audio"
- "\n"
- "\n --novideo \tdisable video"
- "\n -V, --vout <module> \tvideo output method"
- "\n --display <display> \tdisplay string"
- "\n --width <w>, --height <h> \tdisplay dimensions"
- "\n -g, --grayscale \tgrayscale output"
- "\n --fullscreen \tfullscreen output"
- "\n --nooverlay \tdisable accelerated display"
- "\n --xvadaptor <adaptor> \tXVideo adaptor"
- "\n --color \tcolor output"
- "\n --motion <module> \tmotion compensation method"
- "\n --idct <module> \tIDCT method"
- "\n --yuv <module> \tYUV method"
- "\n --synchro <type> \tforce synchro algorithm"
- "\n --smp <number of threads> \tuse several processors"
- "\n --spumargin <m> \tforce SPU position"
- "\n --filter <module> \tvideo filter module"
- "\n"
- "\n -t, --dvdtitle <num> \tchoose DVD title"
- "\n -T, --dvdchapter <num> \tchoose DVD chapter"
- "\n -u, --dvdangle <num> \tchoose DVD angle"
- "\n -a, --dvdaudio <type> \tchoose DVD audio type"
- "\n -c, --dvdchannel <channel> \tchoose DVD audio channel"
- "\n -s, --dvdsubtitle <channel> \tchoose DVD subtitle channel"
- "\n --dvdcss-method <method> \tselect dvdcss decryption method"
- "\n --dvdcss-verbose <level> \tselect dvdcss verbose level"
- "\n"
- "\n --input \tinput method"
- "\n --channels \tenable channels"
- "\n --channelserver <host> \tchannel server address"
- "\n"
- "\n --mpeg_adec <builtin|mad> \tchoose MPEG audio decoder"
- "\n --ac3_adec <builtin|a52> \tchoose AC3 audio decoder"
- "\n"
- "\n --nommx \tdisable CPU's MMX support"
- "\n --no3dnow \tdisable CPU's 3D Now! support"
- "\n --nommxext \tdisable CPU's MMX EXT support"
- "\n --nosse \tdisable CPU's SSE support"
- "\n --noaltivec \tdisable CPU's AltiVec support"
- "\n"
- "\n -h, --help \tprint help and exit"
- "\n -H, --longhelp \tprint long help and exit"
- "\n --version \toutput version information and exit"
- "\n\nPlaylist items:"
- "\n *.mpg, *.vob \tPlain MPEG-1/2 files"
- "\n dvd:<device>[@<raw device>] \tDVD device"
- "\n vcd:<device> \tVCD device"
- "\n udpstream:[<server>[:<server port>]][@[<bind address>][:<bind port>]]"
- "\n \tUDP stream sent by VLS"
- "\n vlc:loop \tLoop execution of the playlist"
- "\n vlc:pause \tPause execution of playlist items"
- "\n vlc:quit \tQuit VLC");
-
- if( i_fashion == SHORT_HELP )
- return;
-
- /* Interface parameters */
- intf_Msg( "\nInterface parameters:"
- "\n " INTF_METHOD_VAR "=<method name> \tinterface method"
- "\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
- "\n " INTF_CHANNELS_VAR "=<filename> \tchannels list"
- "\n " MEMCPY_METHOD_VAR "=<method name> \tmemcpy method" );
-
- /* Audio parameters */
- intf_Msg( "\nAudio parameters:"
- "\n " AOUT_METHOD_VAR "=<method name> \taudio method"
- "\n " AOUT_DSP_VAR "=<filename> \tdsp device path"
- "\n " AOUT_STEREO_VAR "={1|0} \tstereo or mono output"
- "\n " AOUT_SPDIF_VAR "={1|0} \tAC3 pass-through mode"
- "\n " DOWNMIX_METHOD_VAR "=<method name> \tAC3 downmix method"
- "\n " IMDCT_METHOD_VAR "=<method name> \tAC3 IMDCT method"
- "\n " AOUT_VOLUME_VAR "=[0..1024] \tVLC output volume"
- "\n " AOUT_RATE_VAR "=<rate> \toutput rate" );
-
- /* Video parameters */
- intf_Msg( "\nVideo parameters:"
- "\n " VOUT_METHOD_VAR "=<method name> \tdisplay method"
- "\n " VOUT_DISPLAY_VAR "=<display name> \tdisplay used"
- "\n " VOUT_WIDTH_VAR "=<width> \tdisplay width"
- "\n " VOUT_HEIGHT_VAR "=<height> \tdislay height"
- "\n " VOUT_FB_DEV_VAR "=<filename> \tframebuffer device path"
- "\n " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output"
- "\n " VOUT_FULLSCREEN_VAR "={1|0} \tfullscreen"
- "\n " VOUT_NOOVERLAY_VAR "={1|0} \tnooverlay"
- "\n " VOUT_XVADAPTOR_VAR "=<adaptor> \tXVideo adaptor"
- "\n " MOTION_METHOD_VAR "=<method name> \tmotion compensation method"
- "\n " IDCT_METHOD_VAR "=<method name> \tIDCT method"
- "\n " YUV_METHOD_VAR "=<method name> \tYUV method"
- "\n " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB} \tsynchro algorithm"
- "\n " VDEC_SMP_VAR "=<number of threads> \tuse several processors"
- "\n " VOUT_FILTER_VAR "=<method name> \tvideo filter method"
- "\n " VOUT_SPUMARGIN_VAR "=<margin> \tforce SPU margin" );
-
- /* DVD parameters */
- intf_Msg( "\nDVD parameters:"
- "\n " INPUT_DVD_DEVICE_VAR "=<device> \tDVD device"
- "\n " INPUT_TITLE_VAR "=<title> \ttitle number"
- "\n " INPUT_CHAPTER_VAR "=<chapter> \tchapter number"
- "\n " INPUT_ANGLE_VAR "=<angle> \tangle number"
- "\n " INPUT_AUDIO_VAR "={ac3|lpcm|mpeg|off} \taudio type"
- "\n " INPUT_CHANNEL_VAR "=[0-15] \taudio channel"
- "\n " INPUT_SUBTITLE_VAR "=[0-31] \tsubtitle channel" );
-
- /* Input parameters */
- intf_Msg( "\nInput parameters:"
- "\n " INPUT_IFACE_VAR "=<interface> \tnetwork interface"
- "\n " INPUT_CHANNEL_SERVER_VAR "=<hostname> \tchannel server"
- "\n " INPUT_CHANNEL_PORT_VAR "=<port> \tchannel server port" );
-
- /* Decoder parameters */
- intf_Msg( "\nDecoder parameters:"
- "\n " ADEC_MPEG_VAR "=<builtin|mad> \tMPEG audio decoder"
- "\n " ADEC_AC3_VAR "=<builtin|a52> \tAC3 audio decoder" );
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ intf_Msg( "\nPress the RETURN key to continue..." );
+ getchar();
+#endif
+}
+
+/*****************************************************************************
+ * ListModules: list the available modules with their description
+ *****************************************************************************
+ * Print a list of all available modules (builtins and plugins) and a short
+ * description for each one.
+ *****************************************************************************/
+static void ListModules( void )
+{
+ module_t *p_module;
+ char psz_spaces[20];
+
+ memset( psz_spaces, 32, 20 );
+
+#ifdef WIN32
+ ShowConsole();
+#endif
+
+ /* Usage */
+ intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
+ p_main->psz_arg0 );
+
+ intf_Msg( "[plugin] [description]" );
+
+ /* Enumerate each module */
+ for( p_module = p_module_bank->first ;
+ p_module != NULL ;
+ p_module = p_module->next )
+ {
+ int i;
+
+ /* Nasty hack, but right now I'm too tired to think about a nice
+ * solution */
+ i = 20 - strlen( p_module->psz_name ) - 1;
+ if( i < 0 ) i = 0;
+ psz_spaces[i] = 0;
+
+ intf_Msg( " %s%s %s", p_module->psz_name, psz_spaces,
+ p_module->psz_longname );
+
+ psz_spaces[i] = 32;
+
+ }
+
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ intf_Msg( "\nPress the RETURN key to continue..." );
+ getchar();
+#endif
}
/*****************************************************************************
*****************************************************************************/
static void Version( void )
{
+#ifdef WIN32
+ ShowConsole();
+#endif
intf_Msg( VERSION_MESSAGE
"This program comes with NO WARRANTY, to the extent permitted by law.\n"
"You may redistribute it under the terms of the GNU General Public License;\n"
"see the file named COPYING for details.\n"
"Written by the VideoLAN team at Ecole Centrale, Paris." );
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ intf_Msg( "\nPress the RETURN key to continue..." );
+ getchar();
+#endif
}
/*****************************************************************************
/*****************************************************************************
* IllegalSignalHandler: system signal handler
*****************************************************************************
- * This function is called when a illegal instruction signal is received by
+ * This function is called when an illegal instruction signal is received by
* the program. We use this function to test OS and CPU capabilities
*****************************************************************************/
static void IllegalSignalHandler( int i_signal )
*****************************************************************************
* This function is usefull only on Win32.
*****************************************************************************/
+#ifdef WIN32 /* */
static void ShowConsole( void )
{
-#ifdef WIN32 /* */
AllocConsole();
freopen( "CONOUT$", "w", stdout );
freopen( "CONOUT$", "w", stderr );
freopen( "CONIN$", "r", stdin );
-#endif
return;
}
+#endif
--- /dev/null
+/*****************************************************************************
+ * configuration.c management of the modules configuration
+ *****************************************************************************
+ * Copyright (C) 2001 VideoLAN
+ * $Id: configuration.c,v 1.1 2002/02/24 20:51:10 gbazin Exp $
+ *
+ * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+#include <stdlib.h> /* free(), strtol() */
+#include <stdio.h> /* sprintf() */
+#include <string.h> /* strdup() */
+
+#include <videolan/vlc.h>
+
+/* TODO: implement locking for config_PutPszVariable and config_GetPszVariable
+ * because they are not thread safe */
+
+/*****************************************************************************
+ * config_GetIntVariable: get the value of an int variable
+ *****************************************************************************
+ * This function is used to get the value of variables which are internally
+ * represented by an integer (MODULE_CONFIG_ITEM_INTEGER and
+ * MODULE_CONFIG_ITEM_BOOL).
+ *****************************************************************************/
+int config_GetIntVariable( const char *psz_name )
+{
+ module_config_t *p_config;
+
+ p_config = config_FindConfig( psz_name );
+
+ /* sanity checks */
+ if( !p_config )
+ {
+ intf_ErrMsg( "config_GetIntVariable: option %s doesn't exist",
+ psz_name );
+ return -1;
+ }
+ if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
+ {
+ intf_ErrMsg( "config_GetIntVariable: option %s doesn't refer to an int"
+ , psz_name );
+ return -1;
+ }
+
+ return p_config->i_value;
+}
+
+/*****************************************************************************
+ * config_GetPszVariable: get the string value of a string variable
+ *****************************************************************************
+ * This function is used to get the value of variables which are internally
+ * represented by a string (MODULE_CONFIG_ITEM_STRING, MODULE_CONFIG_ITEM_FILE,
+ * and MODULE_CONFIG_ITEM_PLUGIN).
+ *
+ * Important note: remember to free() the returned char* because it a duplicate
+ * of the actual value. It isn't safe to return a pointer to the actual value
+ * as it can be modified at any time.
+ *****************************************************************************/
+char * config_GetPszVariable( const char *psz_name )
+{
+ module_config_t *p_config;
+ char *psz_value = NULL;
+
+ p_config = config_FindConfig( psz_name );
+
+ /* sanity checks */
+ if( !p_config )
+ {
+ intf_ErrMsg( "config_GetPszVariable: option %s doesn't exist",
+ psz_name );
+ return NULL;
+ }
+ if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
+ {
+ intf_ErrMsg( "config_GetPszVariable: option %s doesn't refer to a "
+ "string", psz_name );
+ return NULL;
+ }
+
+ /* return a copy of the string */
+ if( p_config->psz_value ) psz_value = strdup( p_config->psz_value );
+
+ return psz_value;
+}
+
+/*****************************************************************************
+ * config_PutPszVariable: set the string value of a string variable
+ *****************************************************************************
+ * This function is used to set the value of variables which are internally
+ * represented by a string (MODULE_CONFIG_ITEM_STRING, MODULE_CONFIG_ITEM_FILE,
+ * and MODULE_CONFIG_ITEM_PLUGIN).
+ *****************************************************************************/
+void config_PutPszVariable( const char *psz_name, char *psz_value )
+{
+ module_config_t *p_config;
+ char *psz_tmp;
+
+ p_config = config_FindConfig( psz_name );
+
+ /* sanity checks */
+ if( !p_config )
+ {
+ intf_ErrMsg( "config_PutPszVariable: option %s doesn't exist",
+ psz_name );
+ return;
+ }
+ if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
+ {
+ intf_ErrMsg( "config_PutPszVariable: option %s doesn't refer to a "
+ "string", psz_name );
+ return;
+ }
+
+ psz_tmp = p_config->psz_value;
+ if( psz_value ) p_config->psz_value = strdup( psz_value );
+ else p_config->psz_value = NULL;
+
+ /* free old string */
+ if( psz_tmp ) free( psz_tmp );
+
+}
+
+/*****************************************************************************
+ * config_PutIntVariable: set the integer value of an int variable
+ *****************************************************************************
+ * This function is used to set the value of variables which are internally
+ * represented by an integer (MODULE_CONFIG_ITEM_INTEGER and
+ * MODULE_CONFIG_ITEM_BOOL).
+ *****************************************************************************/
+void config_PutIntVariable( const char *psz_name, int i_value )
+{
+ module_config_t *p_config;
+
+ p_config = config_FindConfig( psz_name );
+
+ /* sanity checks */
+ if( !p_config )
+ {
+ intf_ErrMsg( "config_PutIntVariable: option %s doesn't exist",
+ psz_name );
+ return;
+ }
+ if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
+ (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
+ {
+ intf_ErrMsg( "config_PutIntVariable: option %s doesn't refer to an int"
+ , psz_name );
+ return;
+ }
+
+ p_config->i_value = i_value;
+}
+
+/*****************************************************************************
+ * config_FindConfig: find the config structure associated with an option.
+ *****************************************************************************
+ * FIXME: This function really needs to be optimized.
+ *****************************************************************************/
+module_config_t *config_FindConfig( const char *psz_name )
+{
+ module_t *p_module;
+ int i;
+
+ if( !psz_name ) return NULL;
+
+ for( p_module = p_module_bank->first ;
+ p_module != NULL ;
+ p_module = p_module->next )
+ {
+ for( i = 0; i < (p_module->i_config_options -1); i++ )
+ {
+ if( (p_module->p_config[i].i_type ==
+ MODULE_CONFIG_ITEM_CATEGORY)||
+ (p_module->p_config[i].i_type ==
+ MODULE_CONFIG_ITEM_SUBCATEGORY)||
+ (p_module->p_config[i].i_type ==
+ MODULE_CONFIG_ITEM_SUBCATEGORY_END) )
+ continue;
+ if( !strcmp( psz_name, p_module->p_config[i].psz_name ) )
+ return &p_module->p_config[i];
+ }
+ }
+
+ return NULL;
+}
+
+/*****************************************************************************
+ * config_Duplicate: creates a duplicate of a module's configuration data.
+ *****************************************************************************
+ * Unfortunatly we cannot work directly with the module's config data as
+ * this module might be unloaded from memory at any time (remember HideModule).
+ * This is why we need to create an exact copy of the config data.
+ *****************************************************************************/
+module_config_t *config_Duplicate( module_config_t *p_config_orig,
+ int i_config_options )
+{
+ int i;
+ module_config_t *p_config;
+
+ /* allocate memory */
+ p_config = (module_config_t *)malloc( sizeof(module_config_t)
+ * i_config_options );
+ if( p_config == NULL )
+ {
+ intf_ErrMsg( "config_Duplicate error: can't allocate p_config" );
+ return( NULL );
+ }
+
+ for( i = 0; i < i_config_options ; i++ )
+ {
+ p_config[i].i_type = p_config_orig[i].i_type;
+ p_config[i].i_value = p_config_orig[i].i_value;
+ p_config[i].b_dirty = p_config_orig[i].b_dirty;
+ if( p_config_orig[i].psz_name )
+ p_config[i].psz_name = strdup( p_config_orig[i].psz_name );
+ if( p_config_orig[i].psz_text )
+ p_config[i].psz_text = strdup( p_config_orig[i].psz_text );
+ if( p_config_orig[i].psz_longtext )
+ p_config[i].psz_longtext = strdup( p_config_orig[i].psz_longtext );
+ if( p_config_orig[i].psz_value )
+ p_config[i].psz_value = strdup( p_config_orig[i].psz_value );
+
+ /* the callback pointer is only valid when the module is loaded so this
+ * value is set in ActivateModule() and reset in DeactivateModule() */
+ p_config_orig[i].p_callback = NULL;
+ }
+
+ return p_config;
+}
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.53 2002/02/19 00:50:20 sam Exp $
+ * $Id: modules.c,v 1.54 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
# undef HAVE_DYNAMIC_PLUGINS
#endif
+
#include "netutils.h"
#include "interface.h"
static void AllocateAllPlugins ( void );
static int AllocatePluginModule ( char * );
#endif
-static void AllocateAllBuiltins ( void );
static int AllocateBuiltinModule( int ( * ) ( module_t * ),
int ( * ) ( module_t * ),
int ( * ) ( module_t * ) );
/*****************************************************************************
* module_InitBank: create the module bank.
*****************************************************************************
- * This function creates a module bank structure and fills it with the
- * built-in modules, as well as all the plugin modules it can find.
+ * This function creates a module bank structure which will be filled later
+ * on with all the modules found.
*****************************************************************************/
void module_InitBank( void )
{
STORE_SYMBOLS( &symbols );
#endif
- /*
- * Check all the built-in modules
- */
+ return;
+}
+
+/*****************************************************************************
+ * module_LoadMain: load the main program info into the module bank.
+ *****************************************************************************
+ * This function fills the module bank structure with the main module infos.
+ * This is very useful as it will allow us to consider the main program just
+ * as another module, and for instance the configuration options of main will
+ * be available in the module bank structure just as for every other module.
+ *****************************************************************************/
+void module_LoadMain( void )
+{
+ AllocateBuiltinModule( InitModule__MODULE_main,
+ ActivateModule__MODULE_main,
+ DeactivateModule__MODULE_main );
+}
+
+/*****************************************************************************
+ * module_LoadBuiltins: load all modules which we built with.
+ *****************************************************************************
+ * This function fills the module bank structure with the built-in modules.
+ *****************************************************************************/
+void module_LoadBuiltins( void )
+{
intf_WarnMsg( 2, "module: checking built-in modules" );
- AllocateAllBuiltins();
+ ALLOCATE_ALL_BUILTINS();
+}
- /*
- * Check all the plugin modules we can find
- */
+/*****************************************************************************
+ * module_LoadPlugins: load all plugin modules we can find.
+ *****************************************************************************
+ * This function fills the module bank structure with the plugin modules.
+ *****************************************************************************/
+void module_LoadPlugins( void )
+{
#ifdef HAVE_DYNAMIC_PLUGINS
intf_WarnMsg( 2, "module: checking plugin modules" );
AllocateAllPlugins();
#endif
-
- intf_WarnMsg( 2, "module: module bank initialized, found %i modules",
- p_module_bank->i_count );
-
- return;
}
/*****************************************************************************
p_module->is.plugin.handle = handle;
p_module->p_symbols = &symbols;
- /* Initialize the module : fill p_module->psz_name, etc. */
+ /* Initialize the module : fill p_module->psz_name, default config, etc. */
if( CallSymbol( p_module, "InitModule" MODULE_SUFFIX ) != 0 )
{
/* We couldn't call InitModule() */
}
#endif /* HAVE_DYNAMIC_PLUGINS */
-/*****************************************************************************
- * AllocateAllBuiltins: load all modules we were built with.
- *****************************************************************************/
-static void AllocateAllBuiltins( void )
-{
- ALLOCATE_ALL_BUILTINS();
-}
-
/*****************************************************************************
* AllocateBuiltinModule: initialize a built-in module.
*****************************************************************************
ActivateModule__MODULE_ ## NAME, \
DeactivateModule__MODULE_ ## NAME );
-/* Add stuff here */
+/* We also consider the main program as a module (useful for config stuff) */
+int InitModule__MODULE_main( module_t* );
+int ActivateModule__MODULE_main( module_t* );
+int DeactivateModule__MODULE_main( module_t* );
+/* Add stuff here */
* modules_plugin.h : Plugin management functions used by the core application.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules_plugin.h,v 1.10 2002/02/21 23:56:08 sam Exp $
+ * $Id: modules_plugin.h,v 1.11 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
(p_symbols)->p_input_bank = p_input_bank; \
(p_symbols)->p_aout_bank = p_aout_bank; \
(p_symbols)->p_vout_bank = p_vout_bank; \
- (p_symbols)->main_GetIntVariable = main_GetIntVariable; \
- (p_symbols)->main_GetPszVariable = main_GetPszVariable; \
- (p_symbols)->main_PutIntVariable = main_PutIntVariable; \
- (p_symbols)->main_PutPszVariable = main_PutPszVariable; \
+ (p_symbols)->config_GetIntVariable = config_GetIntVariable; \
+ (p_symbols)->config_GetPszVariable = config_GetPszVariable; \
+ (p_symbols)->config_PutIntVariable = config_PutIntVariable; \
+ (p_symbols)->config_PutPszVariable = config_PutPszVariable; \
+ (p_symbols)->config_Duplicate = config_Duplicate; \
+ (p_symbols)->config_FindConfig = config_FindConfig; \
(p_symbols)->intf_MsgSub = intf_MsgSub; \
(p_symbols)->intf_MsgUnsub = intf_MsgUnsub; \
(p_symbols)->intf_Msg = intf_Msg; \
(p_symbols)->DecodeLanguage = DecodeLanguage; \
(p_symbols)->module_Need = module_Need; \
(p_symbols)->module_Unneed = module_Unneed;
-
-
* netutils.c: various network functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id: netutils.c,v 1.56 2002/02/20 23:23:53 sam Exp $
+ * $Id: netutils.c,v 1.57 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr>
struct timeval delay;
fd_set fds;
- if( !main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
- INPUT_NETWORK_CHANNEL_DEFAULT ) )
+ if( !config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
{
intf_ErrMsg( "network: channels disabled, to enable them, use the"
"--channels option" );
}
/* Getting information about the channel server */
- psz_vlcs = main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR,
- INPUT_CHANNEL_SERVER_DEFAULT );
- i_port = main_GetIntVariable( INPUT_CHANNEL_PORT_VAR,
- INPUT_CHANNEL_PORT_DEFAULT );
+ if( !(psz_vlcs = config_GetPszVariable( INPUT_CHANNEL_SERVER_VAR )) )
+ {
+ intf_ErrMsg( "network: configuration variable %s empty",
+ INPUT_CHANNEL_SERVER_VAR );
+ return -1;
+ }
+
+ i_port = config_GetIntVariable( INPUT_CHANNEL_PORT_VAR );
intf_WarnMsg( 5, "network: socket %i, vlcs '%s', port %d",
i_fd, psz_vlcs, i_port );
#else
sa_server.sin_addr.s_addr = inet_addr( psz_vlcs );
#endif
+ free( psz_vlcs );
/* Bind the socket */
if( bind( i_fd, (struct sockaddr*)(&sa_client), sizeof(sa_client) ) )
#if defined( SYS_LINUX )
struct ifreq interface;
int i_ret;
+ char *psz_interface;
/*
* Looking for information about the eth0 interface
*/
interface.ifr_addr.sa_family = AF_INET;
- strcpy( interface.ifr_name,
- main_GetPszVariable( INPUT_IFACE_VAR, INPUT_IFACE_DEFAULT ) );
+ if( !(psz_interface = config_GetPszVariable( INPUT_IFACE_VAR )) )
+ {
+ intf_ErrMsg( "network error: configuration variable %s empty",
+ INPUT_IFACE_VAR );
+ return -1;
+ }
+ strcpy( interface.ifr_name, psz_interface );
+ free( psz_interface );
i_ret = ioctl( i_fd, SIOCGIFHWADDR, &interface );
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.160 2002/02/19 00:50:20 sam Exp $
+ * $Id: video_output.c,v 1.161 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
}
/* Choose the best module */
- psz_plugin = main_GetPszVariable( VOUT_FILTER_VAR, "" );
- if( psz_plugin[0] == '\0' )
+ if( !(psz_plugin = config_GetPszVariable( VOUT_FILTER_VAR )) )
{
- psz_plugin = main_GetPszVariable( VOUT_METHOD_VAR, "" );
+ psz_plugin = config_GetPszVariable( VOUT_METHOD_VAR );
}
/* Initialize thread properties - thread id and locks will be initialized
p_vout->render_time = 10;
/* user requested fullscreen? */
- if( main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT ) )
+ if( config_GetIntVariable( VOUT_FULLSCREEN_VAR ) )
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout->p_module
= module_Need( MODULE_CAPABILITY_VOUT, psz_plugin, (void *)p_vout );
+ if( psz_plugin ) free( psz_plugin );
if( p_vout->p_module == NULL )
{
intf_ErrMsg( "vout error: no suitable vout module" );
* vout_subpictures.c : subpicture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
- * $Id: vout_subpictures.c,v 1.8 2002/02/19 00:50:20 sam Exp $
+ * $Id: vout_subpictures.c,v 1.9 2002/02/24 20:51:10 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
/* If the user requested an SPU margin, we force the position after
* having checked that it was a valid value. */
- i_margin = main_GetIntVariable( VOUT_SPUMARGIN_VAR,
- VOUT_SPUMARGIN_DEFAULT );
+ i_margin = config_GetIntVariable( VOUT_SPUMARGIN_VAR );
if( i_margin >= 0 )
{