Mercurial > mplayer.hg
annotate fifo.c @ 9376:a07c2838fd28
Translation from Zorg ( Krzysztof Materka )
author | eyck |
---|---|
date | Sun, 09 Feb 2003 19:49:55 +0000 |
parents | 44198b2f42db |
children | 0397b461f0fb |
rev | line source |
---|---|
113 | 1 |
2 // keyboard: | |
3 static int keyb_fifo_put=-1; | |
4 static int keyb_fifo_get=-1; | |
5 | |
6 static void make_pipe(int* pr,int* pw){ | |
7 int temp[2]; | |
8 if(pipe(temp)!=0) printf("Cannot make PIPE!\n"); | |
9 *pr=temp[0]; | |
10 *pw=temp[1]; | |
11 } | |
12 | |
13 void mplayer_put_key(int code){ | |
14 fd_set rfds; | |
15 struct timeval tv; | |
16 | |
17 /* Watch stdin (fd 0) to see when it has input. */ | |
18 FD_ZERO(&rfds); | |
19 FD_SET(keyb_fifo_put, &rfds); | |
20 tv.tv_sec = 0; | |
21 tv.tv_usec = 0; | |
22 | |
23 //retval = select(keyb_fifo_put+1, &rfds, NULL, NULL, &tv); | |
3014
16576e05b93a
Profiling fix by Artur Skawina <skawina@geocities.com>
atmos4
parents:
113
diff
changeset
|
24 if(select(keyb_fifo_put+1, NULL, &rfds, NULL, &tv)>0){ |
113 | 25 write(keyb_fifo_put,&code,4); |
26 // printf("*** key event %d sent ***\n",code); | |
27 } else { | |
28 // printf("*** key event dropped (FIFO is full) ***\n"); | |
29 } | |
30 } |