[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[351] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-13 06:22:35
|
Revision: 351 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=351&view=rev Author: nickols_k Date: 2012-11-13 06:22:26 +0000 (Tue, 13 Nov 2012) Log Message: ----------- initial QoS protection for input2 Modified Paths: -------------- mplayerxp/configure mplayerxp/input2/input.c mplayerxp/input2/input.h mplayerxp/mplayerxp.c Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-13 05:37:16 UTC (rev 350) +++ mplayerxp/configure 2012-11-13 06:22:26 UTC (rev 351) @@ -756,7 +756,42 @@ enabled joystick && test linux || disable joystick print_config HAVE_ mp_config.h mp_config.mak joystick +# pseudo-ramdom names +cat > $TMPC << EOF +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +int main(void) { + srand(time(0)); + printf("%u %u %u %u %u %u %u %u %u %u\n" + ,rand(),rand(),rand(),rand(),rand(),rand(),rand(),rand(),rand(),rand()); } +EOF +cc_check || die "Canot generate pseudo-random numbers" +rnd_arr=`$TMPO` + +rnd0=`echo $rnd_arr | cut -d ' ' -f 1` +rnd1=`echo $rnd_arr | cut -d ' ' -f 2` +rnd2=`echo $rnd_arr | cut -d ' ' -f 3` +rnd3=`echo $rnd_arr | cut -d ' ' -f 4` +rnd4=`echo $rnd_arr | cut -d ' ' -f 5` +rnd5=`echo $rnd_arr | cut -d ' ' -f 6` +rnd6=`echo $rnd_arr | cut -d ' ' -f 7` +rnd7=`echo $rnd_arr | cut -d ' ' -f 8` +rnd8=`echo $rnd_arr | cut -d ' ' -f 9` +rnd9=`echo $rnd_arr | cut -d ' ' -f 10` + +crnd0=$(($rnd0 % 255)) +crnd1=$(($rnd1 % 255)) +crnd2=$(($rnd2 % 255)) +crnd3=$(($rnd3 % 255)) +crnd4=$(($rnd4 % 255)) +crnd5=$(($rnd5 % 255)) +crnd6=$(($rnd6 % 255)) +crnd7=$(($rnd7 % 255)) +crnd8=$(($rnd8 % 255)) +crnd9=$(($rnd9 % 255)) + ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF @@ -778,6 +813,17 @@ # OPTFLAGS = -O3 $profile $debug $gcov $march $mcpu -pipe -fomit-frame-pointer -ffast-math OPTFLAGS = $CFLAGS DEBUG = -DDEBUG +#-- Compile-time random numbers +RND_NUMBER0 = $rnd0 +RND_NUMBER1 = $rnd1 +RND_NUMBER2 = $rnd2 +RND_NUMBER3 = $rnd3 +RND_NUMBER4 = $rnd4 +RND_NUMBER5 = $rnd5 +RND_NUMBER6 = $rnd6 +RND_NUMBER7 = $rnd7 +RND_NUMBER8 = $rnd8 +RND_NUMBER9 = $rnd9 # --- HAZARDOUS STUFF @@ -935,6 +981,52 @@ /* Removes warning about unused arguments */ # define UNUSED(x) ((any_t)(x)) +/* Compile-time random numbers */ +#define RND_CHAR0 $crnd0 +#define RND_CHAR1 $crnd1 +#define RND_CHAR2 $crnd2 +#define RND_CHAR3 $crnd3 +#define RND_CHAR4 $crnd4 +#define RND_CHAR5 $crnd5 +#define RND_CHAR6 $crnd6 +#define RND_CHAR7 $crnd7 +#define RND_CHAR8 $crnd8 +#define RND_CHAR9 $crnd9 + +#define RND_NUMBER0 $rnd0 +#define RND_NUMBER1 $rnd1 +#define RND_NUMBER2 $rnd2 +#define RND_NUMBER3 $rnd3 +#define RND_NUMBER4 $rnd4 +#define RND_NUMBER5 $rnd5 +#define RND_NUMBER6 $rnd6 +#define RND_NUMBER7 $rnd7 +#define RND_NUMBER8 $rnd8 +#define RND_NUMBER9 $rnd9 + +#define RND_STR0 "$rnd0" +#define RND_STR1 "$rnd1" +#define RND_STR2 "$rnd2" +#define RND_STR3 "$rnd3" +#define RND_STR4 "$rnd4" +#define RND_STR5 "$rnd5" +#define RND_STR6 "$rnd6" +#define RND_STR7 "$rnd7" +#define RND_STR8 "$rnd8" +#define RND_STR9 "$rnd9" + + +#define RND_RENAME0(a) a ## $rnd0 +#define RND_RENAME1(a) a ## $rnd1 +#define RND_RENAME2(a) a ## $rnd2 +#define RND_RENAME3(a) a ## $rnd3 +#define RND_RENAME4(a) a ## $rnd4 +#define RND_RENAME5(a) a ## $rnd5 +#define RND_RENAME6(a) a ## $rnd6 +#define RND_RENAME7(a) a ## $rnd7 +#define RND_RENAME8(a) a ## $rnd8 +#define RND_RENAME9(a) a ## $rnd9 + #endif /* MPXP_CONFIG_H */ EOF Modified: mplayerxp/input2/input.c =================================================================== --- mplayerxp/input2/input.c 2012-11-13 05:37:16 UTC (rev 350) +++ mplayerxp/input2/input.c 2012-11-13 06:22:26 UTC (rev 351) @@ -1,5 +1,3 @@ -#include "mp_config.h" - #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -53,6 +51,22 @@ #define CMD_QUEUE_SIZE 100 +typedef int (*mp_key_func_t)(any_t* ctx); // These functions should return the key code or one of the error code +typedef int (*mp_cmd_func_t)(any_t* ctx,char* dest,int size); // These functions should act like read but they must use our error code (if needed ;-) +typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver + + +typedef struct mp_cmd_bind { + int input[MP_MAX_KEY_DOWN+1]; + char* cmd; +} mp_cmd_bind_t; + +typedef struct mp_key_name { + int key; + char* name; +} mp_key_name_t; + + typedef struct mp_input_fd { any_t* opaque; any_t* read_func; @@ -76,6 +90,8 @@ mp_cmd_bind_t* cmd_binds; mp_cmd_filter_t* cmd_filters; + char antiviral_hole[RND_CHAR1]; + mp_input_fd_t key_fds[MP_MAX_KEY_FD]; unsigned int num_key_fd; mp_input_fd_t cmd_fds[MP_MAX_CMD_FD]; @@ -403,6 +419,7 @@ // Callback to allow the menu filter to grab the incoming keys void (*mp_input_key_cb)(int code) = NULL; +static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // This create a copy of a command (used by the auto repeat stuff) static int mp_input_print_key_list(any_t*,const config_t* cfg); static int mp_input_print_cmd_list(any_t*,const config_t* cfg); @@ -1001,7 +1018,7 @@ mp_free(cmd); } -mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd) { +static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd) { mp_cmd_t* ret; int i; #ifdef MP_DEBUG @@ -1322,7 +1339,7 @@ if(priv->in_file_fd==0) getch2_disable(); } -any_t* mp_input_open(void) { +any_t* RND_RENAME0(mp_input_open)(void) { priv_t* priv; priv=mp_mallocz(sizeof(priv_t)); priv->ar_state=-1; Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-11-13 05:37:16 UTC (rev 350) +++ mplayerxp/input2/input.h 2012-11-13 06:22:26 UTC (rev 351) @@ -1,6 +1,6 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 - +#include "mp_config.h" #include "xmpcore/xmp_enums.h" // All commands id @@ -94,6 +94,7 @@ MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed MP_INPUT_NOTHING =-3 // No input were avaible }; + // For the keys drivers, if possible you can send key up and key down // events. Key up is the default, to send a key down you must or the key // code with MP_KEY_DOWN @@ -122,25 +123,10 @@ mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; } mp_cmd_t; - -typedef struct mp_cmd_bind { - int input[MP_MAX_KEY_DOWN+1]; - char* cmd; -} mp_cmd_bind_t; - -typedef struct mp_key_name { - int key; - char* name; -} mp_key_name_t; - // These typedefs are for the drivers. They are the functions used to retrive // the next key code or command. -typedef int (*mp_key_func_t)(any_t* ctx); // These functions should return the key code or one of the error code -typedef int (*mp_cmd_func_t)(any_t* ctx,char* dest,int size); // These functions should act like read but they must use our error code (if needed ;-) -typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // Should return 1 if the command was processed - extern void (*mp_input_key_cb)(int code); // Set this to grab all incoming key code extern mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys); @@ -158,16 +144,12 @@ /// These filter allow you to process the command before mplayer /// If a filter return a true value mp_input_get_cmd will return NULL extern void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter, any_t* ctx); - // After getting a command from mp_input_get_cmd you need to mp_free it using this // function extern void mp_cmd_free(mp_cmd_t* cmd); -// This create a copy of a command (used by the auto repeat stuff) -extern mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); - // When you create a new driver you should add it in this 2 functions. -extern any_t* mp_input_open(void); +extern any_t* RND_RENAME0(mp_input_open)(void); extern void mp_input_close(any_t* handle); // Interruptible usleep: (used by libmpdemux) @@ -175,5 +157,6 @@ extern void mp_input_print_keys(any_t*handle); extern void mp_input_print_cmds(any_t*handle); + extern void mp_input_print_binds(any_t*handle); #endif Modified: mplayerxp/mplayerxp.c =================================================================== --- mplayerxp/mplayerxp.c 2012-11-13 05:37:16 UTC (rev 350) +++ mplayerxp/mplayerxp.c 2012-11-13 06:22:26 UTC (rev 351) @@ -818,7 +818,7 @@ #endif /* Init input system */ MP_UNIT("init_input"); - priv->libinput=mp_input_open(); + priv->libinput=RND_RENAME0(mp_input_open)(); priv->inited_flags|=INITED_INPUT; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |