1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-23 23:56:20 +00:00

printf to mp_msg

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16856 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reynaldo 2005-10-25 18:45:39 +00:00
parent 97f2d88db0
commit c83813b196

View File

@ -15,6 +15,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include "mp_msg.h"
#include "help_mp.h"
#ifndef JOY_AXIS_DELTA #ifndef JOY_AXIS_DELTA
#define JOY_AXIS_DELTA 500 #define JOY_AXIS_DELTA 500
#endif #endif
@ -35,11 +38,11 @@ int mp_input_joystick_init(char* dev) {
int inited = 0; int inited = 0;
struct js_event ev; struct js_event ev;
printf("Opening joystick device %s\n",dev ? dev : JS_DEV); mp_msg(MSGT_INPUT,MSGL_INFO,MSGTR_INPUT_JOYSTICK_Opening,dev ? dev : JS_DEV);
fd = open( dev ? dev : JS_DEV , O_RDONLY | O_NONBLOCK ); fd = open( dev ? dev : JS_DEV , O_RDONLY | O_NONBLOCK );
if(fd < 0) { if(fd < 0) {
printf("Can't open joystick device %s : %s\n",dev ? dev : JS_DEV,strerror(errno)); mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_CantOpen,dev ? dev : JS_DEV,strerror(errno));
return -1; return -1;
} }
@ -54,7 +57,7 @@ int mp_input_joystick_init(char* dev) {
inited = 1; inited = 1;
break; break;
} }
printf("Error while reading joystick device : %s\n",strerror(errno)); mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
close(fd); close(fd);
return -1; return -1;
} }
@ -62,7 +65,7 @@ int mp_input_joystick_init(char* dev) {
} }
if((unsigned int)l < sizeof(struct js_event)) { if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0) if(l > 0)
printf("Joystick : we loose %d bytes of data\n",l); mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
break; break;
} }
ev.type &= ~JS_EVENT_INIT; ev.type &= ~JS_EVENT_INIT;
@ -87,9 +90,9 @@ int mp_input_joystick_read(int fd) {
else if(errno == EAGAIN) else if(errno == EAGAIN)
return MP_INPUT_NOTHING; return MP_INPUT_NOTHING;
if( r < 0) if( r < 0)
printf("Joystick error while reading joystick device : %s\n",strerror(errno)); mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
else else
printf("Joystick error while reading joystick device : EOF\n"); mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,"EOF");
return MP_INPUT_DEAD; return MP_INPUT_DEAD;
} }
l += r; l += r;
@ -97,12 +100,12 @@ int mp_input_joystick_read(int fd) {
if((unsigned int)l < sizeof(struct js_event)) { if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0) if(l > 0)
printf("Joystick : we loose %d bytes of data\n",l); mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
return MP_INPUT_NOTHING; return MP_INPUT_NOTHING;
} }
if(ev.type & JS_EVENT_INIT) { if(ev.type & JS_EVENT_INIT) {
printf("Joystick : warning init event, we have lost sync with driver\n"); mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnLostSync);
ev.type &= ~JS_EVENT_INIT; ev.type &= ~JS_EVENT_INIT;
if(ev.type == JS_EVENT_BUTTON) { if(ev.type == JS_EVENT_BUTTON) {
int s = (btns >> ev.number) & 1; int s = (btns >> ev.number) & 1;
@ -139,7 +142,7 @@ int mp_input_joystick_read(int fd) {
} else } else
return MP_INPUT_NOTHING; return MP_INPUT_NOTHING;
} else { } else {
printf("Joystick warning unknown event type %d\n",ev.type); mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnUnknownEvent,ev.type);
return MP_INPUT_ERROR; return MP_INPUT_ERROR;
} }