Mercurial > mplayer.hg
changeset 16855:5f83daf94eb2
printf to mp_msg
author | reynaldo |
---|---|
date | Tue, 25 Oct 2005 18:45:39 +0000 |
parents | 3898e1089a29 |
children | d222ea8f2cb4 |
files | input/joystick.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/input/joystick.c Tue Oct 25 17:28:10 2005 +0000 +++ b/input/joystick.c Tue Oct 25 18:45:39 2005 +0000 @@ -15,6 +15,9 @@ #include <fcntl.h> #include <errno.h> +#include "mp_msg.h" +#include "help_mp.h" + #ifndef JOY_AXIS_DELTA #define JOY_AXIS_DELTA 500 #endif @@ -35,11 +38,11 @@ int inited = 0; 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 ); 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; } @@ -54,7 +57,7 @@ inited = 1; 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); return -1; } @@ -62,7 +65,7 @@ } if((unsigned int)l < sizeof(struct js_event)) { 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; } ev.type &= ~JS_EVENT_INIT; @@ -87,9 +90,9 @@ else if(errno == EAGAIN) return MP_INPUT_NOTHING; 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 - printf("Joystick error while reading joystick device : EOF\n"); + mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,"EOF"); return MP_INPUT_DEAD; } l += r; @@ -97,12 +100,12 @@ if((unsigned int)l < sizeof(struct js_event)) { 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; } 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; if(ev.type == JS_EVENT_BUTTON) { int s = (btns >> ev.number) & 1; @@ -139,7 +142,7 @@ } else return MP_INPUT_NOTHING; } 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; }