[MPlayer-dev-eng] [PATCH] A new input interface

Arpi arpi at thot.banki.hu
Sat Jan 26 01:59:17 CET 2002


Hi,

> With this patch I wanted to reach the following goals :
> 	Be able to configure the meaning of the keys.
> 	Join the keyboard handeling and the slave mode (wich is very poor)
> 	Be able to easly add new control system (joystick, network, etc)
> Not all is here, the keys meaning are still hardcoded but it will be easy
> to add a config file wich store this.
> There is currently two drawbacks, it's slower (more computation),
> and there is (now) no lirc support.
> For the good side the slave mode have now acces to all what you can do 
> with the keys (and a little more), and it will be easy to add new commands.
> For the supported command look in input.c.
> To try it, don't forget to define HAVE_NEW_INPUT in your config.h
> As usal comment are welcome.
As usual, here are my comments:
ok, nice, commitable, but...

1. remove indent changes, like:

 #ifndef USE_LIBVO2
-            video_out->check_events();
+       video_out->check_events();
 #endif
 #ifdef HAVE_NEW_GUI
-             if(use_gui){
-               EventHandling();
-               if(mplShMem->Playing!=2 || (rel_seek_secs || abs_seek_pos))
-                 { gui_pause_flag=1; break; } // end of pause or seek
-             }
+       if(use_gui){
+         EventHandling();
+         if(mplShMem->Playing!=2 || (rel_seek_secs || abs_seek_pos))
+           { gui_pause_flag=1; break; } // end of pause or seek
+       }
 #endif

2. why don't put arg. type into your struct, and pass it parsed in the cmd
struct (like cmd->arg_int)? sscanf()'s at every case: looks ugly and also
redundant:
+       int v;
+       int n = sscanf(cmd->args,"%d",&v);
+       if(n < 1) {
+         printf("\n%s : bad argument %s\n",cmd->name,cmd->args);
+         break;
+       }

all of these could be done at input.c, similar way to config/cmdlien parser.
(it does string->int/float/etc, range checking for us)


A'rpi / Astral & ESP-team

--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu



More information about the MPlayer-dev-eng mailing list