changeset 5197:f0e3dcefb7af

Commentting session
author albeu
date Tue, 19 Mar 2002 13:29:28 +0000
parents aed5971d73a8
children a528f6c891b5
files input/input.h
diffstat 1 files changed, 39 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.h	Tue Mar 19 13:28:45 2002 +0000
+++ b/input/input.h	Tue Mar 19 13:29:28 2002 +0000
@@ -1,6 +1,7 @@
 
 #ifdef HAVE_NEW_INPUT
 
+// All commands id
 #define MP_CMD_SEEK   0
 #define MP_CMD_AUDIO_DELAY 1
 #define MP_CMD_QUIT 2
@@ -35,18 +36,29 @@
 #define MP_CMD_GUI_FULLSCREEN   5008
 #define MP_CMD_GUI_SKINBROWSER  5009
 
+// The args types
 #define MP_CMD_ARG_INT 0
 #define MP_CMD_ARG_FLOAT 1
 #define MP_CMD_ARG_STRING 2
 
+#ifndef MP_CMD_MAX_ARGS
 #define MP_CMD_MAX_ARGS 10
+#endif
+
+// Error codes for the drivers
 
+// An error occured but we can continue
 #define MP_INPUT_ERROR -1
+// A fatal error occured, this driver should be removed
 #define MP_INPUT_DEAD -2
+// No input were avaible
 #define MP_INPUT_NOTHING -3
 
+// 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
 #define MP_KEY_DOWN (1<<29)
-// Key up is the default
+// Use this when the key shouldn't be auto-repeated (like mouse buttons)
 #define MP_NO_REPEAT_KEY (1<<28)
 
 #ifndef MP_MAX_KEY_DOWN
@@ -82,34 +94,60 @@
   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.
+
+// These functions should return the key code or one of the error code
 typedef int (*mp_key_func_t)(int fd);
+// These functions should act like read
 typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
+// These are used to close the driver
 typedef void (*mp_close_func_t)(int fd);
 
+// This function add a new key driver.
+// The first arg is a file descriptor (use a negative value if you don't use any fd)
+// The second arg tell if we use select on the fd to know if something is avaible.
+// The third arg is optional. If null a default function wich read an int from the
+// fd will be used.
+// The last arg can be NULL if nothing is needed to close the driver. The close
+// function can be used
 int
 mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
 
+// This remove a cmd driver, you usally don't need to use it
 void
 mp_input_rm_cmd_fd(int fd);
 
+// The args are the sames as for the keys drivers. If you don't use any valid fd you MUST
+// give a read_func.
 int
 mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
 
+// As for the cmd one you usally don't need this function
 void
 mp_input_rm_key_fd(int fd);
 
+// This function can be used to reput a command in the system. It's used by libmpdemux
+// when it perform a blocking operation to resend the command it received to the main
+// loop.
 int
 mp_input_queue_cmd(mp_cmd_t* cmd);
 
+// This function retrive the next avaible command waiting no more than time msec.
+// If pause is true, the next input will always return a pause command.
 mp_cmd_t*
 mp_input_get_cmd(int time, int paused);
 
+// After getting a command from mp_input_get_cmd you need to free it using this
+// function
 void
 mp_cmd_free(mp_cmd_t* cmd);
 
+// This create a copy of a command (used by the auto repeat stuff)
 mp_cmd_t*
 mp_cmd_clone(mp_cmd_t* cmd);
 
+// When you create a new driver you should add it in this 2 functions.
 void
 mp_input_init(void);