Commit 7ee2435d authored by Sam Hocevar's avatar Sam Hocevar

* ./include/variables.h, ./src/misc/variables.c: implemented variable

    callbacks.
parent ec8c6318
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.h: variables handling * variables.h: variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: variables.h,v 1.3 2002/10/14 19:04:51 sam Exp $ * $Id: variables.h,v 1.4 2002/10/16 19:39:42 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -21,17 +21,7 @@ ...@@ -21,17 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/* Variable types - probably very incomplete */ typedef struct callback_entry_t callback_entry_t;
#define VLC_VAR_BOOL 0x0100
#define VLC_VAR_INTEGER 0x0200
#define VLC_VAR_STRING 0x0300
#define VLC_VAR_MODULE 0x0301
#define VLC_VAR_FILE 0x0302
#define VLC_VAR_FLOAT 0x0400
#define VLC_VAR_TIME 0x0500
#define VLC_VAR_ADDRESS 0x0600
#define VLC_VAR_COMMAND 0x0700
#define VLC_VAR_MUTEX 0x0800
/***************************************************************************** /*****************************************************************************
* vlc_value_t is the common union for variable values; variable_t is the * vlc_value_t is the common union for variable values; variable_t is the
...@@ -39,18 +29,35 @@ ...@@ -39,18 +29,35 @@
*****************************************************************************/ *****************************************************************************/
struct variable_t struct variable_t
{ {
u32 i_hash; /* The variable's exported value */
char * psz_name; vlc_value_t val;
/* The variable unique name, (almost) unique hashed value, and type */
char * psz_name;
u32 i_hash;
int i_type; int i_type;
vlc_value_t val;
/* Lots of other things that can be added */ /* Lots of other things that can be added */
int i_usage; int i_usage;
vlc_bool_t b_set;
vlc_bool_t b_active; int i_entries;
callback_entry_t * p_entries;
}; };
/*****************************************************************************
* Variable types - probably very incomplete
*****************************************************************************/
#define VLC_VAR_BOOL 0x0100
#define VLC_VAR_INTEGER 0x0200
#define VLC_VAR_STRING 0x0300
#define VLC_VAR_MODULE 0x0301
#define VLC_VAR_FILE 0x0302
#define VLC_VAR_FLOAT 0x0400
#define VLC_VAR_TIME 0x0500
#define VLC_VAR_ADDRESS 0x0600
#define VLC_VAR_COMMAND 0x0700
#define VLC_VAR_MUTEX 0x0800
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -61,18 +68,25 @@ VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) ); ...@@ -61,18 +68,25 @@ VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) );
VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) ); VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) );
VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) ); VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) );
#define var_Create(a,b,c) \ #define var_Create(a,b,c) __var_Create( VLC_OBJECT(a), b, c )
__var_Create( VLC_OBJECT(a), b, c ) #define var_Destroy(a,b) __var_Destroy( VLC_OBJECT(a), b )
#define var_Destroy(a,b) \ #define var_Type(a,b) __var_Type( VLC_OBJECT(a), b )
__var_Destroy( VLC_OBJECT(a), b ) #define var_Set(a,b,c) __var_Set( VLC_OBJECT(a), b, c )
#define var_Get(a,b,c) __var_Get( VLC_OBJECT(a), b, c )
#define var_Type(a,b) \ /*****************************************************************************
__var_Type( VLC_OBJECT(a), b ) * Variable callbacks
*****************************************************************************
#define var_Set(a,b,c) \ * int MyCallback( vlc_object_t *p_this,
__var_Set( VLC_OBJECT(a), b, c ) * char const *psz_variable,
* vlc_value_t oldvalue,
* vlc_value_t newvalue,
* void *p_data);
*****************************************************************************/
VLC_EXPORT( int, __var_AddCallback, ( vlc_object_t *, const char *, vlc_callback_t, void * ) );
VLC_EXPORT( int, __var_DelCallback, ( vlc_object_t *, const char *, vlc_callback_t, void * ) );
#define var_Get(a,b,c) \ #define var_AddCallback(a,b,c,d) __var_AddCallback( VLC_OBJECT(a), b, c, d )
__var_Get( VLC_OBJECT(a), b, c ) #define var_DelCallback(a,b,c,d) __var_DelCallback( VLC_OBJECT(a), b, c, d )
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.30 2002/10/16 15:10:39 sam Exp $ * $Id: vlc_common.h,v 1.31 2002/10/16 19:39:42 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -236,6 +236,15 @@ typedef struct bit_stream_t bit_stream_t; ...@@ -236,6 +236,15 @@ typedef struct bit_stream_t bit_stream_t;
typedef struct network_socket_t network_socket_t; typedef struct network_socket_t network_socket_t;
typedef struct iso639_lang_t iso639_lang_t; typedef struct iso639_lang_t iso639_lang_t;
/*****************************************************************************
* Variable callbacks
*****************************************************************************/
typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
char const *, /* variable name */
vlc_value_t, /* old value */
vlc_value_t, /* new value */
void * ); /* callback data */
/***************************************************************************** /*****************************************************************************
* Plug-in stuff * Plug-in stuff
*****************************************************************************/ *****************************************************************************/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment