[MPlayer-dev-eng] [PATCH] lirc repeat patch

Lev A. Melnikovsky leva at kapitza.ras.ru
Sat Jun 25 00:39:19 CEST 2005


Hi,

   On Tue, 21 Jun 2005 at 10:25pm, Reimar Dцffinger wrote:

>> In reality it works as follows: the lirc library does sends n-1 empty
>> events then 1 informative, then again...
> Why on earth does it send "empty" events the instead of just swallowing
> them??
No idea, it can, so it does...
Probably I'm not the right person to be asked about it.

> Though that kind of functionality might be more appropriate in input.c,
> around line 701. I looks like something like that is already
> half-implemented??
> I don't know, but maybe you can introduce an MP_INPUT_RETRY return
> value (that is sent for such an empty event) and do a continue;
> in that switch statement in input.c. Don't know if you can detect those
> "empty" events easily though.
> But that would be a solution others could maybe profit from as well...
Well, I couldn't imagine that somebody may need such a hook, but if you 
think so, here it goes. The patch adds MP_INPUT_RETRY as suggested. 
Needless to say - it works here. I have also added "default:" branch to 
the switch construct, just in case.

Regards
-- 
                       Leva
-------------- next part --------------
diff -ubrd MPlayer-1.0pre7/input/input.c MPlayer-1.0pre7.new/input/input.c
--- MPlayer-1.0pre7/input/input.c	2005-04-15 18:52:33.000000000 +0400
+++ MPlayer-1.0pre7.new/input/input.c	2005-06-25 02:18:13.000000000 +0400
@@ -702,9 +702,12 @@
       switch(r) {
       case MP_INPUT_ERROR:
       case MP_INPUT_DEAD:
+      default:
 	mp_msg(MSGT_INPUT,MSGL_ERR,"Error while reading cmd fd %d: %s\n",mp_fd->fd,strerror(errno));
       case MP_INPUT_NOTHING:
 	return r;
+      case MP_INPUT_RETRY:
+	    continue;
       }
       // EOF ?
     } else if(r == 0) {
diff -ubrd MPlayer-1.0pre7/input/input.h MPlayer-1.0pre7.new/input/input.h
--- MPlayer-1.0pre7/input/input.h	2005-04-03 18:08:26.000000000 +0400
+++ MPlayer-1.0pre7.new/input/input.h	2005-06-25 02:16:08.000000000 +0400
@@ -112,6 +112,8 @@
 #define MP_INPUT_DEAD -2
 // No input was available
 #define MP_INPUT_NOTHING -3
+// Input will be available if you try again
+#define MP_INPUT_RETRY -4
 
 // For the key's drivers, if possible you can send key up and key down
 // events. Key up is the default, to send a key down you must use the 
diff -ubrd MPlayer-1.0pre7/input/lirc.c MPlayer-1.0pre7.new/input/lirc.c
--- MPlayer-1.0pre7/input/lirc.c	2002-10-24 02:23:12.000000000 +0400
+++ MPlayer-1.0pre7.new/input/lirc.c	2005-06-25 02:07:43.000000000 +0400
@@ -102,7 +102,7 @@
   else if(cmd_buf) // return the first command in the buffer
     return mp_input_lirc_read(fd,dest,s);
   else
-    return MP_INPUT_NOTHING;
+    return MP_INPUT_RETRY;
 
 }
 


More information about the MPlayer-dev-eng mailing list