[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[511] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-05 11:42:45
|
Revision: 511 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=511&view=rev Author: nickols_k Date: 2012-12-05 11:42:31 +0000 (Wed, 05 Dec 2012) Log Message: ----------- include input2 into namespace mpxp Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/dump.h mplayerxp/input2/input.cpp mplayerxp/input2/input.h mplayerxp/input2/joystick.cpp mplayerxp/input2/joystick.h mplayerxp/input2/lirc.cpp mplayerxp/input2/lirc.h mplayerxp/input2/mouse.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/mpdemux.cpp mplayerxp/libmpdemux/mpdemux.h mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/asf_streaming.h mplayerxp/libmpstream/cache2.cpp mplayerxp/libmpstream/cdd.h mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/s_cdd.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/s_dvdread.cpp mplayerxp/libmpstream/s_file.cpp mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_lavc.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_null.cpp mplayerxp/libmpstream/s_oss.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_tv.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/s_vcdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libmpstream/stream.h mplayerxp/libmpstream/stream_internal.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libplaytree/playtreeparser.h mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_internal.h mplayerxp/postproc/vf_menu.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/dump.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -89,7 +89,7 @@ uint64_t vsize,asize,ssize; float timer_corr; /* use common time-base */ float vtimer; - any_t* libinput; + libinput_t* libinput; }; void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp) @@ -119,7 +119,7 @@ return retval; } -void dump_mux_init(Demuxer *demuxer,any_t* libinput) +void dump_mux_init(Demuxer *demuxer,libinput_t* libinput) { sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(demuxer->video->sh); Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/dump.h 2012-12-05 11:42:31 UTC (rev 511) @@ -7,7 +7,7 @@ namespace mpxp { int dump_parse(const char *param); void dump_stream(stream_t *stream); - void dump_mux_init(Demuxer *demuxer,any_t*libinput); + void dump_mux_init(Demuxer *demuxer,libinput_t*libinput); void dump_mux(Demuxer *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames); void dump_mux_close(Demuxer *demuxer); void __FASTCALL__ dump_stream_event_handler(stream_t *s,const stream_packet_t*sp); Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/input.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -35,6 +35,8 @@ #include "joystick.h" #include "osdep/getch2.h" +namespace mpxp { + #ifndef MP_MAX_KEY_FD #define MP_MAX_KEY_FD 10 #endif @@ -56,18 +58,17 @@ typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver -typedef struct mp_cmd_bind { +struct mp_cmd_bind_t { int input[MP_MAX_KEY_DOWN+1]; const char* cmd; -} mp_cmd_bind_t; +}; -typedef struct mp_key_name { +struct mp_key_name_t { int key; const char* name; -} mp_key_name_t; +}; - -typedef struct mp_input_fd { +struct mp_input_fd_t { any_t* opaque; union { mp_key_func_t key_func; @@ -78,17 +79,15 @@ // This fields are for the cmd fds char* buffer; int pos,size; -} mp_input_fd_t; +}; -typedef struct mp_cmd_filter_st mp_cmd_filter_t; - -struct mp_cmd_filter_st { +struct mp_cmd_filter_t { mp_input_cmd_filter filter; any_t* ctx; mp_cmd_filter_t* next; }; -typedef struct priv_s { +struct libinput_t { char antiviral_hole[RND_CHAR1]; // These are the user defined binds mp_cmd_bind_t* cmd_binds; @@ -111,15 +110,15 @@ int in_file_fd; int tim; //for getch2 char key_str[12]; -}priv_t; +}; -typedef struct input_conf_s { +struct input_conf_t { int use_joystick,use_lirc,use_lircc; unsigned ar_delay,ar_rate; const char* js_dev; const char* in_file; int print_key_list,print_cmd_list; -}input_conf_t; +}; static input_conf_t libinput_conf = { 1, 1, 1, 100, 8, "/dev/input/js0", NULL, 0, 0 }; /// This array defines all know commands. @@ -423,8 +422,8 @@ void (*mp_input_key_cb)(int code) = NULL; static mp_cmd_t* mp_cmd_clone(mp_cmd_t* cmd); // This create a copy of a command (used by the auto repeat stuff) -static int mp_input_print_key_list(any_t*); -static int mp_input_print_cmd_list(any_t*); +static int mp_input_print_key_list(libinput_t*); +static int mp_input_print_cmd_list(libinput_t*); static const config_t joystick_conf[] = { { "on", &libinput_conf.use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, @@ -460,65 +459,65 @@ static int mp_input_default_key_func(any_t* fd); static int mp_input_default_cmd_func(any_t* fd,char* buf, int l); -static const char* mp_input_get_key_name(any_t*,int key); +static const char* mp_input_get_key_name(libinput_t*,int key); -static MPXP_Rc mp_input_add_cmd_fd(any_t* handle,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_cmd_fd == MP_MAX_CMD_FD) { +static MPXP_Rc mp_input_add_cmd_fd(libinput_t* handle,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { + libinput_t& priv = *handle; + if(priv.num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd\n"); return MPXP_False; } - memset(&priv->cmd_fds[priv->num_cmd_fd],0,sizeof(mp_input_fd_t)); - priv->cmd_fds[priv->num_cmd_fd].opaque = opaque; - priv->cmd_fds[priv->num_cmd_fd].read.cmd_func = read_func ? read_func : mp_input_default_cmd_func; - priv->cmd_fds[priv->num_cmd_fd].close_func = close_func; - if(!sel) priv->cmd_fds[priv->num_cmd_fd].flags = MP_FD_NO_SELECT; - priv->num_cmd_fd++; + memset(&priv.cmd_fds[priv.num_cmd_fd],0,sizeof(mp_input_fd_t)); + priv.cmd_fds[priv.num_cmd_fd].opaque = opaque; + priv.cmd_fds[priv.num_cmd_fd].read.cmd_func = read_func ? read_func : mp_input_default_cmd_func; + priv.cmd_fds[priv.num_cmd_fd].close_func = close_func; + if(!sel) priv.cmd_fds[priv.num_cmd_fd].flags = MP_FD_NO_SELECT; + priv.num_cmd_fd++; return MPXP_Ok; } -static void mp_input_rm_cmd_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_rm_cmd_fd(libinput_t* handle,any_t* fd) { + libinput_t& priv = *handle; unsigned int i; - for(i = 0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].opaque == fd) break; + for(i = 0; i < priv.num_cmd_fd; i++) { + if(priv.cmd_fds[i].opaque == fd) break; } - if(i == priv->num_cmd_fd) return; - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); - if(priv->cmd_fds[i].buffer) delete priv->cmd_fds[i].buffer; - if(i + 1 < priv->num_cmd_fd) memmove(&priv->cmd_fds[i],&priv->cmd_fds[i+1],(priv->num_cmd_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_cmd_fd--; + if(i == priv.num_cmd_fd) return; + if(priv.cmd_fds[i].close_func) priv.cmd_fds[i].close_func(priv.cmd_fds[i].opaque); + if(priv.cmd_fds[i].buffer) delete priv.cmd_fds[i].buffer; + if(i + 1 < priv.num_cmd_fd) memmove(&priv.cmd_fds[i],&priv.cmd_fds[i+1],(priv.num_cmd_fd-i-1)*sizeof(mp_input_fd_t)); + priv.num_cmd_fd--; } -static void mp_input_rm_key_fd(any_t* handle,any_t* fd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_rm_key_fd(libinput_t* handle,any_t* fd) { + libinput_t& priv = *handle; unsigned int i; - for(i = 0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].opaque == fd) break; + for(i = 0; i < priv.num_key_fd; i++) { + if(priv.key_fds[i].opaque == fd) break; } - if(i == priv->num_key_fd) return; - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); - if(i + 1 < priv->num_key_fd) memmove(&priv->key_fds[i],&priv->key_fds[i+1],(priv->num_key_fd-i-1)*sizeof(mp_input_fd_t)); - priv->num_key_fd--; + if(i == priv.num_key_fd) return; + if(priv.key_fds[i].close_func) priv.key_fds[i].close_func(priv.key_fds[i].opaque); + if(i + 1 < priv.num_key_fd) memmove(&priv.key_fds[i],&priv.key_fds[i+1],(priv.num_key_fd-i-1)*sizeof(mp_input_fd_t)); + priv.num_key_fd--; } -static MPXP_Rc mp_input_add_key_fd(any_t* handle,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { - priv_t* priv = (priv_t*)handle; - if(priv->num_key_fd == MP_MAX_KEY_FD) { +static MPXP_Rc mp_input_add_key_fd(libinput_t* handle,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { + libinput_t& priv = *handle; + if(priv.num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd\n"); return MPXP_False; } - memset(&priv->key_fds[priv->num_key_fd],0,sizeof(mp_input_fd_t)); - priv->key_fds[priv->num_key_fd].opaque = opaque; - priv->key_fds[priv->num_key_fd].read.key_func = read_func ? read_func : mp_input_default_key_func; - priv->key_fds[priv->num_key_fd].close_func = close_func; - if(!sel) priv->key_fds[priv->num_key_fd].flags |= MP_FD_NO_SELECT; - priv->num_key_fd++; + memset(&priv.key_fds[priv.num_key_fd],0,sizeof(mp_input_fd_t)); + priv.key_fds[priv.num_key_fd].opaque = opaque; + priv.key_fds[priv.num_key_fd].read.key_func = read_func ? read_func : mp_input_default_key_func; + priv.key_fds[priv.num_key_fd].close_func = close_func; + if(!sel) priv.key_fds[priv.num_key_fd].flags |= MP_FD_NO_SELECT; + priv.num_key_fd++; return MPXP_Ok; } @@ -638,17 +637,17 @@ } static int mp_input_default_key_func(any_t* fd) { - priv_t* priv = (priv_t*)fd; + libinput_t& priv = *reinterpret_cast<libinput_t*>(fd); int r,code=0; unsigned int l; l = 0; - if(priv->in_file_fd == 0) { // stdin is handled by getch2 - code = getch2(priv->tim); + if(priv.in_file_fd == 0) { // stdin is handled by getch2 + code = getch2(priv.tim); if(code < 0) code = MP_INPUT_NOTHING; } else { - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); + fcntl(priv.in_file_fd,F_SETFL,fcntl(priv.in_file_fd,F_GETFL)|O_NONBLOCK); while(l < sizeof(int)) { - r = read(priv->in_file_fd,(&code)+l,sizeof(int)-l); + r = read(priv.in_file_fd,(&code)+l,sizeof(int)-l); if(r <= 0) break; l +=r; } @@ -726,10 +725,10 @@ } static int mp_input_default_cmd_func(any_t* fd,char* buf, int l) { - priv_t* priv=(priv_t*)fd; - fcntl(priv->in_file_fd,F_SETFL,fcntl(priv->in_file_fd,F_GETFL)|O_NONBLOCK); + libinput_t& priv=*reinterpret_cast<libinput_t*>(fd); + fcntl(priv.in_file_fd,F_SETFL,fcntl(priv.in_file_fd,F_GETFL)|O_NONBLOCK); while(1) { - int r = read(priv->in_file_fd,buf,l); + int r = read(priv.in_file_fd,buf,l); // Error ? if(r < 0) { if(errno == EINTR) continue; @@ -741,15 +740,15 @@ } } -void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter func, any_t* ctx) { - priv_t* priv = (priv_t*)handle; +void mp_input_add_cmd_filter(libinput_t* handle,mp_input_cmd_filter func,any_t* ctx) { + libinput_t& priv = *handle; mp_cmd_filter_t* filter = new(zeromem) mp_cmd_filter_t; filter->filter = func; filter->ctx = ctx; - filter->next = priv->cmd_filters; - priv->cmd_filters = filter; - fill_false_pointers(priv->antiviral_hole,offsetof(priv_t,cmd_binds)-offsetof(priv_t,antiviral_hole)); + filter->next = priv.cmd_filters; + priv.cmd_filters = filter; + fill_false_pointers(priv.antiviral_hole,offsetof(libinput_t,cmd_binds)-offsetof(libinput_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { @@ -773,76 +772,76 @@ return binds[j].cmd; } -mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys) { - priv_t* priv = (priv_t*)handle; +mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys) { + libinput_t& priv = *handle; const char* cmd = NULL; mp_cmd_t* ret; - if(priv->cmd_binds) cmd = mp_input_find_bind_for_key(priv->cmd_binds,n,keys); + if(priv.cmd_binds) cmd = mp_input_find_bind_for_key(priv.cmd_binds,n,keys); if(cmd == NULL) cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys); if(cmd == NULL) { - MSG_WARN("No bind found for key %s",mp_input_get_key_name(priv,keys[0])); + MSG_WARN("No bind found for key %s",mp_input_get_key_name(&priv,keys[0])); if(n > 1) { int s; - for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(priv,keys[s])); + for(s=1; s < n; s++) MSG_WARN("-%s",mp_input_get_key_name(&priv,keys[s])); } MSG_WARN(" \n"); return NULL; } ret = mp_input_parse_cmd(cmd); if(!ret) { - MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(priv,priv->key_down[0])); - if(priv->num_key_down > 1) { + MSG_ERR("Invalid command for binded key %s",mp_input_get_key_name(&priv,priv.key_down[0])); + if(priv.num_key_down > 1) { unsigned int s; - for(s=1; s < priv->num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(priv,priv->key_down[s])); + for(s=1; s < priv.num_key_down; s++) MSG_ERR("-%s",mp_input_get_key_name(&priv,priv.key_down[s])); } MSG_ERR(" : %s \n",cmd); } return ret; } -static int mp_input_read_key_code(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; +static int mp_input_read_key_code(libinput_t* handle,int tim) { + libinput_t& priv = *handle; int n=0; unsigned i; - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; + if(priv.num_key_fd == 0) return MP_INPUT_NOTHING; // Remove fd marked as dead and build the fd_set // n == number of fd's to be select() checked - for(i = 0; (unsigned int)i < priv->num_key_fd; i++) { - if( (priv->key_fds[i].flags & MP_FD_DEAD) ) { - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); + for(i = 0; (unsigned int)i < priv.num_key_fd; i++) { + if( (priv.key_fds[i].flags & MP_FD_DEAD) ) { + mp_input_rm_key_fd(&priv,priv.key_fds[i].opaque); i--; continue; - } else if(priv->key_fds[i].flags & MP_FD_NO_SELECT) continue; + } else if(priv.key_fds[i].flags & MP_FD_NO_SELECT) continue; n++; } - if(priv->num_key_fd == 0) return MP_INPUT_NOTHING; - for(i = 0; i < priv->num_key_fd; i++) { + if(priv.num_key_fd == 0) return MP_INPUT_NOTHING; + for(i = 0; i < priv.num_key_fd; i++) { int code = -1; - priv->tim = tim; - code = ((mp_key_func_t)priv->key_fds[i].read.key_func)(priv->key_fds[i].opaque); + priv.tim = tim; + code = ((mp_key_func_t)priv.key_fds[i].read.key_func)(priv.key_fds[i].opaque); if(code >= 0) return code; if(code == MP_INPUT_ERROR) MSG_ERR("Error on key input fd\n"); else if(code == MP_INPUT_DEAD) { MSG_ERR("Dead key input on fd\n"); - mp_input_rm_key_fd(priv,priv->key_fds[i].opaque); + mp_input_rm_key_fd(&priv,priv.key_fds[i].opaque); } } return MP_INPUT_NOTHING; } -static mp_cmd_t* mp_input_read_keys(any_t*handle,int tim) { - priv_t* priv = (priv_t*)handle; - int code = mp_input_read_key_code(priv,tim); +static mp_cmd_t* mp_input_read_keys(libinput_t*handle,int tim) { + libinput_t& priv = *handle; + int code = mp_input_read_key_code(&priv,tim); unsigned int j; mp_cmd_t* ret; if(mp_input_key_cb) { - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(&priv,0) ) { if(code & MP_KEY_DOWN) continue; code &= ~(MP_KEY_DOWN|MP_NO_REPEAT_KEY); mp_input_key_cb(code); @@ -850,103 +849,103 @@ return NULL; } - for( ; code >= 0 ; code = mp_input_read_key_code(priv,0) ) { + for( ; code >= 0 ; code = mp_input_read_key_code(&priv,0) ) { // key pushed if(code & MP_KEY_DOWN) { - if(priv->num_key_down > MP_MAX_KEY_DOWN) { + if(priv.num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } code &= ~MP_KEY_DOWN; // Check if we don't already have this key as pushed - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) + for(j = 0; j < priv.num_key_down; j++) { + if(priv.key_down[j] == code) break; } - if(j != priv->num_key_down) continue; - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = GetTimer(); - priv->ar_state = 0; + if(j != priv.num_key_down) continue; + priv.key_down[priv.num_key_down] = code; + priv.num_key_down++; + priv.last_key_down = GetTimer(); + priv.ar_state = 0; continue; } // key released // Check if the key is in the down key, driver which can't send push event // send only release event - for(j = 0; j < priv->num_key_down; j++) { - if(priv->key_down[j] == code) break; + for(j = 0; j < priv.num_key_down; j++) { + if(priv.key_down[j] == code) break; } - if(j == priv->num_key_down) { // key was not in the down keys : add it - if(priv->num_key_down > MP_MAX_KEY_DOWN) { + if(j == priv.num_key_down) { // key was not in the down keys : add it + if(priv.num_key_down > MP_MAX_KEY_DOWN) { MSG_ERR("Too much key down at the same time\n"); continue; } - priv->key_down[priv->num_key_down] = code; - priv->num_key_down++; - priv->last_key_down = 1; + priv.key_down[priv.num_key_down] = code; + priv.num_key_down++; + priv.last_key_down = 1; } // We ignore key from last combination - ret = priv->last_key_down ? mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down):NULL; + ret = priv.last_key_down ? mp_input_get_cmd_from_keys(&priv,priv.num_key_down,priv.key_down):NULL; // Remove the key - if(j+1 < priv->num_key_down) memmove(&priv->key_down[j],&priv->key_down[j+1],(priv->num_key_down-(j+1))*sizeof(int)); - priv->num_key_down--; - priv->last_key_down = 0; - priv->ar_state = -1; - if(priv->ar_cmd) { - mp_cmd_free(priv->ar_cmd); - priv->ar_cmd = NULL; + if(j+1 < priv.num_key_down) memmove(&priv.key_down[j],&priv.key_down[j+1],(priv.num_key_down-(j+1))*sizeof(int)); + priv.num_key_down--; + priv.last_key_down = 0; + priv.ar_state = -1; + if(priv.ar_cmd) { + mp_cmd_free(priv.ar_cmd); + priv.ar_cmd = NULL; } if(ret) return ret; } // No input : autorepeat ? - if(libinput_conf.ar_rate > 0 && priv->ar_state >=0 && priv->num_key_down > 0 && !(priv->key_down[priv->num_key_down-1]&MP_NO_REPEAT_KEY)) { + if(libinput_conf.ar_rate > 0 && priv.ar_state >=0 && priv.num_key_down > 0 && !(priv.key_down[priv.num_key_down-1]&MP_NO_REPEAT_KEY)) { unsigned int t = GetTimer(); // First time : wait delay - if(priv->ar_state == 0 && (t - priv->last_key_down) >= libinput_conf.ar_delay*1000) { - priv->ar_cmd = mp_input_get_cmd_from_keys(priv,priv->num_key_down,priv->key_down); - if(!priv->ar_cmd) { - priv->ar_state = -1; + if(priv.ar_state == 0 && (t - priv.last_key_down) >= libinput_conf.ar_delay*1000) { + priv.ar_cmd = mp_input_get_cmd_from_keys(&priv,priv.num_key_down,priv.key_down); + if(!priv.ar_cmd) { + priv.ar_state = -1; return NULL; } - priv->ar_state = 1; - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); + priv.ar_state = 1; + priv.last_ar = t; + return mp_cmd_clone(priv.ar_cmd); // Then send rate / sec event - } else if(priv->ar_state == 1 && (t -priv->last_ar) >= 1000000/libinput_conf.ar_rate) { - priv->last_ar = t; - return mp_cmd_clone(priv->ar_cmd); + } else if(priv.ar_state == 1 && (t -priv.last_ar) >= 1000000/libinput_conf.ar_rate) { + priv.last_ar = t; + return mp_cmd_clone(priv.ar_cmd); } } return NULL; } -static mp_cmd_t* mp_input_read_cmds(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static mp_cmd_t* mp_input_read_cmds(libinput_t* handle) { + libinput_t& priv = *handle; int n = 0,got_cmd = 0; unsigned i; mp_cmd_t* ret; static int last_loop = 0; - if(priv->num_cmd_fd == 0) return NULL; + if(priv.num_cmd_fd == 0) return NULL; - for(i = 0; (unsigned int)i < priv->num_cmd_fd ; i++) { - if(priv->cmd_fds[i].flags&MP_FD_EOF) { - mp_input_rm_cmd_fd(priv,priv->cmd_fds[i].opaque); + for(i = 0; (unsigned int)i < priv.num_cmd_fd ; i++) { + if(priv.cmd_fds[i].flags&MP_FD_EOF) { + mp_input_rm_cmd_fd(&priv,priv.cmd_fds[i].opaque); i--; continue; - } else if(priv->cmd_fds[i].flags & MP_FD_NO_SELECT) continue; - if(priv->cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; + } else if(priv.cmd_fds[i].flags & MP_FD_NO_SELECT) continue; + if(priv.cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; n++; } - if(priv->num_cmd_fd == 0) return NULL; - for(i = 0; i < priv->num_cmd_fd; i++) { + if(priv.num_cmd_fd == 0) return NULL; + for(i = 0; i < priv.num_cmd_fd; i++) { int r = 0; char* cmd; - r = mp_input_read_cmd(&priv->cmd_fds[i],&cmd); + r = mp_input_read_cmd(&priv.cmd_fds[i],&cmd); if(r < 0) { if(r == MP_INPUT_ERROR) MSG_ERR("Error on cmd fd\n"); - else if(r == MP_INPUT_DEAD) priv->cmd_fds[i].flags |= MP_FD_DEAD; + else if(r == MP_INPUT_DEAD) priv.cmd_fds[i].flags |= MP_FD_DEAD; continue; } ret = mp_input_parse_cmd(cmd); @@ -959,26 +958,26 @@ return NULL; } -MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd) { - priv_t* priv = (priv_t*)handle; - if(priv->cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; - priv->cmd_queue[priv->cmd_queue_end] = cmd; - priv->cmd_queue_end = (priv->cmd_queue_end + 1) % CMD_QUEUE_SIZE; - priv->cmd_queue_length++; +MPXP_Rc mp_input_queue_cmd(libinput_t* handle,mp_cmd_t* cmd) { + libinput_t& priv = *handle; + if(priv.cmd_queue_length >= CMD_QUEUE_SIZE) return MPXP_False; + priv.cmd_queue[priv.cmd_queue_end] = cmd; + priv.cmd_queue_end = (priv.cmd_queue_end + 1) % CMD_QUEUE_SIZE; + priv.cmd_queue_length++; return MPXP_Ok; } -static mp_cmd_t* mp_input_get_queued_cmd(any_t* handle,int peek_only) { - priv_t* priv = (priv_t*)handle; +static mp_cmd_t* mp_input_get_queued_cmd(libinput_t* handle,int peek_only) { + libinput_t& priv = *handle; mp_cmd_t* ret; - if(priv->cmd_queue_length == 0) return NULL; + if(priv.cmd_queue_length == 0) return NULL; - ret = priv->cmd_queue[priv->cmd_queue_start]; + ret = priv.cmd_queue[priv.cmd_queue_start]; if (!peek_only) { - priv->cmd_queue_length--; - priv->cmd_queue_start = (priv->cmd_queue_start + 1) % CMD_QUEUE_SIZE; + priv.cmd_queue_length--; + priv.cmd_queue_start = (priv.cmd_queue_start + 1) % CMD_QUEUE_SIZE; } return ret; } @@ -987,26 +986,26 @@ * \param peek_only when set, the returned command stays in the queue. * Do not mp_free the returned cmd whe you set this! */ -mp_cmd_t* mp_input_get_cmd(any_t*handle,int tim, int paused, int peek_only) { - priv_t* priv = (priv_t*)handle; +mp_cmd_t* mp_input_get_cmd(libinput_t*handle,int tim, int paused, int peek_only) { + libinput_t& priv = *handle; mp_cmd_t* ret = NULL; mp_cmd_filter_t* cf; int from_queue; from_queue = 1; - ret = mp_input_get_queued_cmd(priv,peek_only); + ret = mp_input_get_queued_cmd(&priv,peek_only); if(!ret) { from_queue = 0; - ret = mp_input_read_keys(priv,tim); - if(!ret) ret = mp_input_read_cmds(priv); + ret = mp_input_read_keys(&priv,tim); + if(!ret) ret = mp_input_read_cmds(&priv); } if(!ret) return NULL; - for(cf = priv->cmd_filters ; cf ; cf = cf->next) { + for(cf = priv.cmd_filters ; cf ; cf = cf->next) { if(cf->filter(ret,paused,cf->ctx)) return NULL; } - if (!from_queue && peek_only) mp_input_queue_cmd(priv,ret); + if (!from_queue && peek_only) mp_input_queue_cmd(&priv,ret); return ret; } @@ -1044,8 +1043,8 @@ return ret; } -static const char* mp_input_get_key_name(any_t* handle,int key) { - priv_t* priv = (priv_t*)handle; +static const char* mp_input_get_key_name(libinput_t* handle,int key) { + libinput_t& priv = *handle; unsigned i; for(i = 0; key_names[i].name != NULL; i++) { @@ -1053,13 +1052,13 @@ } if(isascii(key)) { - snprintf(priv->key_str,12,"%c",(char)key); - return priv->key_str; + snprintf(priv.key_str,12,"%c",(char)key); + return priv.key_str; } // Print the hex key code - snprintf(priv->key_str,12,"%#-8x",key); - return priv->key_str; + snprintf(priv.key_str,12,"%#-8x",key); + return priv.key_str; } static int mp_input_get_key_from_name(char* name) { @@ -1097,8 +1096,8 @@ return 1; } -static void mp_input_bind_keys(any_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { - priv_t* priv = (priv_t*)handle; +static void mp_input_bind_keys(libinput_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { + libinput_t& priv = *handle; int i = 0,j; mp_cmd_bind_t* _bind = NULL; @@ -1107,20 +1106,20 @@ assert(cmd != NULL); #endif - if(priv->cmd_binds) { - for(i = 0; priv->cmd_binds[i].cmd != NULL ; i++) { - for(j = 0 ; priv->cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; - if(keys[j] == 0 && priv->cmd_binds[i].input[j] == 0 ) { - _bind = &priv->cmd_binds[i]; + if(priv.cmd_binds) { + for(i = 0; priv.cmd_binds[i].cmd != NULL ; i++) { + for(j = 0 ; priv.cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; + if(keys[j] == 0 && priv.cmd_binds[i].input[j] == 0 ) { + _bind = &priv.cmd_binds[i]; break; } } } if(!_bind) { - priv->cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv->cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); - memset(&priv->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); - _bind = &priv->cmd_binds[i]; + priv.cmd_binds = (mp_cmd_bind_t*)mp_realloc(priv.cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); + memset(&priv.cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); + _bind = &priv.cmd_binds[i]; } if(_bind->cmd) delete _bind->cmd; _bind->cmd = mp_strdup(cmd); @@ -1137,8 +1136,8 @@ #define BS_MAX 256 #define SPACE_CHAR " \n\r\t" -static int mp_input_parse_config(any_t* handle,const char *file) { - priv_t* priv = (priv_t*)handle; +static int mp_input_parse_config(libinput_t* handle,const char *file) { + libinput_t& priv = *handle; int fd; int bs = 0,r,eof = 0,comments = 0; char *iter,*end; @@ -1175,7 +1174,7 @@ // Empty buffer : return if(bs <= 1) { MSG_INFO("Input config file %s parsed : %d binds\n",file,n_binds); - if(binds) priv->cmd_binds = binds; + if(binds) priv.cmd_binds = binds; close(fd); return 1; } @@ -1235,8 +1234,8 @@ // Found new line if(iter[0] == '\n' || iter[0] == '\r') { int i; - MSG_ERR("No command found for key %s" ,mp_input_get_key_name(priv,keys[0])); - for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(priv,keys[i])); + MSG_ERR("No command found for key %s" ,mp_input_get_key_name(&priv,keys[0])); + for(i = 1; keys[i] != 0 ; i++) MSG_ERR("-%s",mp_input_get_key_name(&priv,keys[i])); MSG_ERR("\n"); keys[0] = 0; if(iter > buffer) { @@ -1261,7 +1260,7 @@ strncpy(cmd,iter,end-iter); cmd[end-iter] = '\0'; //printf("Set bind %d => %s\n",keys[0],cmd); - mp_input_bind_keys(priv,keys,cmd); + mp_input_bind_keys(&priv,keys,cmd); n_binds++; keys[0] = 0; end++; @@ -1276,8 +1275,8 @@ return 0; } -static void mp_input_init(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static void mp_input_init(libinput_t* handle) { + libinput_t& priv = *handle; const char* file; file = config_file[0] != '/' ? get_path(config_file) : config_file; @@ -1293,14 +1292,14 @@ any_t* joystick_fd; joystick_fd = mp_input_joystick_open(libinput_conf.js_dev); if(!joystick_fd) MSG_ERR("Can't init input joystick with using: %s\n",libinput_conf.js_dev); - else mp_input_add_key_fd(priv,joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)mp_input_joystick_close); + else mp_input_add_key_fd(&priv,joystick_fd,1,mp_input_joystick_read,(mp_close_func_t)mp_input_joystick_close); } #endif #ifdef HAVE_LIRC if(libinput_conf.use_lirc) { any_t* lirc_fd = mp_input_lirc_open(); - if(lirc_fd) mp_input_add_cmd_fd(priv,lirc_fd,0,mp_input_lirc_read_cmd,mp_input_lirc_close); + if(lirc_fd) mp_input_add_cmd_fd(&priv,lirc_fd,0,mp_input_lirc_read_cmd,mp_input_lirc_close); } #endif @@ -1314,41 +1313,41 @@ struct stat st; if(stat(libinput_conf.in_file,&st)) MSG_ERR("Can't stat %s: %s\n",libinput_conf.in_file,strerror(errno)); else { - priv->in_file_fd = open(libinput_conf.in_file,(S_ISFIFO(st.st_mode)?O_RDWR:O_RDONLY)|O_NONBLOCK); - if(priv->in_file_fd >= 0) mp_input_add_cmd_fd(priv,priv,1,NULL,(mp_close_func_t)close); + priv.in_file_fd = open(libinput_conf.in_file,(S_ISFIFO(st.st_mode)?O_RDWR:O_RDONLY)|O_NONBLOCK); + if(priv.in_file_fd >= 0) mp_input_add_cmd_fd(&priv,&priv,1,NULL,(mp_close_func_t)close); else MSG_ERR("Can't open %s: %s\n",libinput_conf.in_file,strerror(errno)); } } - priv->in_file_fd = 0; + priv.in_file_fd = 0; getch2_enable(); // prepare stdin for hotkeys... - mp_input_add_key_fd(priv,priv,1,NULL,(mp_close_func_t)close); + mp_input_add_key_fd(&priv,&priv,1,NULL,(mp_close_func_t)close); } -static void mp_input_uninit(any_t* handle) { - priv_t* priv = (priv_t*)handle; +static void mp_input_uninit(libinput_t* handle) { + libinput_t& priv = *handle; unsigned int i; - for(i=0; i < priv->num_key_fd; i++) { - if(priv->key_fds[i].close_func) priv->key_fds[i].close_func(priv->key_fds[i].opaque); + for(i=0; i < priv.num_key_fd; i++) { + if(priv.key_fds[i].close_func) priv.key_fds[i].close_func(priv.key_fds[i].opaque); } - for(i=0; i < priv->num_cmd_fd; i++) { - if(priv->cmd_fds[i].close_func) priv->cmd_fds[i].close_func(priv->cmd_fds[i].opaque); + for(i=0; i < priv.num_cmd_fd; i++) { + if(priv.cmd_fds[i].close_func) priv.cmd_fds[i].close_func(priv.cmd_fds[i].opaque); } - if(priv->cmd_binds) { + if(priv.cmd_binds) { for(i=0;;i++) { - if(priv->cmd_binds[i].cmd != NULL) delete priv->cmd_binds[i].cmd; + if(priv.cmd_binds[i].cmd != NULL) delete priv.cmd_binds[i].cmd; else break; } - delete priv->cmd_binds; - priv->cmd_binds=NULL; + delete priv.cmd_binds; + priv.cmd_binds=NULL; } - if(priv->in_file_fd==0) getch2_disable(); + if(priv.in_file_fd==0) getch2_disable(); } -any_t* mp_input_open(void) { - priv_t* priv=new(zeromem) priv_t; +libinput_t* mp_input_open(void) { + libinput_t* priv=new(zeromem) libinput_t; priv->ar_state=-1; priv->in_file_fd=-1; mp_input_init(priv); @@ -1357,7 +1356,7 @@ return priv; } -void mp_input_close(any_t* handle) { +void mp_input_close(libinput_t* handle) { mp_input_uninit(handle); delete handle; } @@ -1366,19 +1365,19 @@ m_config_register_options(cfg,mp_input_opts); } -void mp_input_print_keys(any_t*handle) { +void mp_input_print_keys(libinput_t*handle) { unsigned i; UNUSED(handle); MSG_INFO("List of available KEYS:\n"); for(i= 0; key_names[i].name != NULL ; i++) MSG_INFO("%s\n",key_names[i].name); } -static int mp_input_print_key_list(any_t*handle) { +static int mp_input_print_key_list(libinput_t*handle) { mp_input_print_keys(handle); exit(0); } -void mp_input_print_binds(any_t*handle) { +void mp_input_print_binds(libinput_t*handle) { unsigned i,j; MSG_INFO("List of available key bindings:\n"); for(i=0; def_cmd_binds[i].cmd != NULL ; i++) { @@ -1389,7 +1388,7 @@ } } -void mp_input_print_cmds(any_t*handle) { +void mp_input_print_cmds(libinput_t*handle) { const mp_cmd_t *cmd; int i,j; const char* type; @@ -1419,13 +1418,13 @@ } } -static int mp_input_print_cmd_list(any_t*handle) { +static int mp_input_print_cmd_list(libinput_t*handle) { mp_input_print_cmds(handle); exit(0); } -MPXP_Rc mp_input_check_interrupt(any_t* handle,int tim) { - priv_t* priv = (priv_t*)handle; +MPXP_Rc mp_input_check_interrupt(libinput_t* handle,int tim) { + libinput_t* priv = (libinput_t*)handle; mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(handle,tim,0,1)) == NULL) return MPXP_False; switch(cmd->id) { @@ -1442,3 +1441,5 @@ mp_cmd_free(cmd); return MPXP_False; } + +} // namespace mpxp Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/input.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,161 +1,168 @@ #ifndef INPUT_H_INCLUDED #define INPUT_H_INCLUDED 1 #include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; + #include "xmpcore/xmp_enums.h" -// All commands id -enum { - MP_CMD_SEEK =0, - MP_CMD_RESERVED_0 =1, - MP_CMD_QUIT =2, - MP_CMD_PAUSE =3, - MP_CMD_SOFT_QUIT =4, - MP_CMD_PLAY_TREE_STEP =5, - MP_CMD_PLAY_TREE_UP_STEP =6, - MP_CMD_PLAY_ALT_SRC_STEP =7, - MP_CMD_RESERVED_1 =8, - MP_CMD_OSD =9, - MP_CMD_VOLUME =10, - MP_CMD_RESERVED_2 =11, - MP_CMD_CONTRAST =12, - MP_CMD_BRIGHTNESS =13, - MP_CMD_HUE =14, - MP_CMD_SATURATION =15, - MP_CMD_FRAMEDROPPING =16, - MP_CMD_TV_STEP_CHANNEL =17, - MP_CMD_TV_STEP_NORM =18, - MP_CMD_TV_STEP_CHANNEL_LIST =19, - MP_CMD_VO_FULLSCREEN =20, - MP_CMD_SUB_POS =21, - MP_CMD_DVDNAV =22, - MP_CMD_VO_SCREENSHOT =23, - MP_CMD_PANSCAN =24, - MP_CMD_MUTE =25, - MP_CMD_LOADFILE =26, - MP_CMD_LOADLIST =27, - MP_CMD_VF_CHANGE_RECTANGLE =28, - MP_CMD_GAMMA =29, - MP_CMD_SUB_VISIBILITY =30, - MP_CMD_VOBSUB_LANG =31, - MP_CMD_MENU =32, - MP_CMD_SET_MENU =33, - MP_CMD_GET_TIME_LENGTH =34, - MP_CMD_GET_PERCENT_POS =35, - MP_CMD_SUB_STEP =36, - MP_CMD_TV_SET_CHANNEL =37, +namespace mpxp { + // All commands id + enum { + MP_CMD_SEEK =0, + MP_CMD_RESERVED_0 =1, + MP_CMD_QUIT =2, + MP_CMD_PAUSE =3, + MP_CMD_SOFT_QUIT =4, + MP_CMD_PLAY_TREE_STEP =5, + MP_CMD_PLAY_TREE_UP_STEP=6, + MP_CMD_PLAY_ALT_SRC_STEP=7, + MP_CMD_RESERVED_1 =8, + MP_CMD_OSD =9, + MP_CMD_VOLUME =10, + MP_CMD_RESERVED_2 =11, + MP_CMD_CONTRAST =12, + MP_CMD_BRIGHTNESS =13, + MP_CMD_HUE =14, + MP_CMD_SATURATION =15, + MP_CMD_FRAMEDROPPING =16, + MP_CMD_TV_STEP_CHANNEL =17, + MP_CMD_TV_STEP_NORM =18, + MP_CMD_TV_STEP_CHANNEL_LIST=19, + MP_CMD_VO_FULLSCREEN =20, + MP_CMD_SUB_POS =21, + MP_CMD_DVDNAV =22, + MP_CMD_VO_SCREENSHOT =23, + MP_CMD_PANSCAN =24, + MP_CMD_MUTE =25, + MP_CMD_LOADFILE =26, + MP_CMD_LOADLIST =27, + MP_CMD_VF_CHANGE_RECTANGLE=28, + MP_CMD_GAMMA =29, + MP_CMD_SUB_VISIBILITY =30, + MP_CMD_VOBSUB_LANG =31, + MP_CMD_MENU =32, + MP_CMD_SET_MENU =33, + MP_CMD_GET_TIME_LENGTH =34, + MP_CMD_GET_PERCENT_POS =35, + MP_CMD_SUB_STEP =36, + MP_CMD_TV_SET_CHANNEL =37, #ifdef USE_EDL - MP_CMD_EDL_MARK =38, + MP_CMD_EDL_MARK =38, #endif - MP_CMD_SUB_ALIGNMENT =39, - MP_CMD_TV_LAST_CHANNEL =40, - MP_CMD_OSD_SHOW_TEXT =41, - MP_CMD_TV_STEP_CHANNEL_UP =42, - MP_CMD_TV_STEP_CHANNEL_DOWN =43, + MP_CMD_SUB_ALIGNMENT =39, + MP_CMD_TV_LAST_CHANNEL =40, + MP_CMD_OSD_SHOW_TEXT =41, + MP_CMD_TV_STEP_CHANNEL_UP=42, + MP_CMD_TV_STEP_CHANNEL_DOWN=43, - MP_CMD_SPEED_INCR =44, - MP_CMD_SPEED_MULT =45, - MP_CMD_SPEED_SET =46, + MP_CMD_SPEED_INCR =44, + MP_CMD_SPEED_MULT =45, + MP_CMD_SPEED_SET =46, - MP_CMD_SWITCH_AUDIO =47, - MP_CMD_SWITCH_VIDEO =48, - MP_CMD_SWITCH_SUB =49, + MP_CMD_SWITCH_AUDIO =47, + MP_CMD_SWITCH_VIDEO =48, + MP_CMD_SWITCH_SUB =49, - MP_CMD_FRAME_STEP =56, + MP_CMD_FRAME_STEP =56, - MP_CMD_DVDNAV_EVENT =6000, + MP_CMD_DVDNAV_EVENT =6000, /// Console command - MP_CMD_CHELP =7000, - MP_CMD_CEXIT =7001, - MP_CMD_CHIDE =7002, - MP_CMD_CRUN =7003 -}; + MP_CMD_CHELP =7000, + MP_CMD_CEXIT =7001, + MP_CMD_CHIDE =7002, + MP_CMD_CRUN =7003 + }; -enum { - MP_CMD_DVDNAV_UP =1, - MP_CMD_DVDNAV_DOWN =2, - MP_CMD_DVDNAV_LEFT =3, - MP_CMD_DVDNAV_RIGHT =4, - MP_CMD_DVDNAV_MENU =5, - MP_CMD_DVDNAV_SELECT=6, -}; -enum { + enum { + MP_CMD_DVDNAV_UP =1, + MP_CMD_DVDNAV_DOWN =2, + MP_CMD_DVDNAV_LEFT =3, + MP_CMD_DVDNAV_RIGHT =4, + MP_CMD_DVDNAV_MENU =5, + MP_CMD_DVDNAV_SELECT =6, + }; + enum { // The args types - MP_CMD_ARG_INT =0, - MP_CMD_ARG_FLOAT =1, - MP_CMD_ARG_STRING =2, - MP_CMD_ARG_VOID =3, + MP_CMD_ARG_INT =0, + MP_CMD_ARG_FLOAT=1, + MP_CMD_ARG_STRING=2, + MP_CMD_ARG_VOID =3, - MP_CMD_MAX_ARGS =10 -}; + MP_CMD_MAX_ARGS =10 + }; // Error codes for the drivers -enum { - MP_INPUT_ERROR =-1,// An error occured but we can continue - MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed - MP_INPUT_NOTHING =-3 // No input were avaible -}; + enum { + MP_INPUT_ERROR =-1,// An error occured but we can continue + MP_INPUT_DEAD =-2,// A fatal error occured, this driver should be removed + MP_INPUT_NOTHING =-3 // No input were avaible + }; // For the keys drivers, if possible you can send key up and key down // events. Key up is the default, to send a key down you must or the key // code with MP_KEY_DOWN -enum { - MP_KEY_DOWN =(1<<29), - MP_NO_REPEAT_KEY =(1<<28), // Use this when the key shouldn't be auto-repeated (like mouse buttons) - MP_MAX_KEY_DOWN =32 -}; + enum { + MP_KEY_DOWN =(1<<29), + MP_NO_REPEAT_KEY =(1<<28), // Use this when the key shouldn't be auto-repeated (like mouse buttons) + MP_MAX_KEY_DOWN =32 + }; -typedef union mp_cmd_arg_value { - int i; - float f; - char* s; - any_t* v; -} mp_cmd_arg_value_t; + union mp_cmd_arg_value_t { + int i; + float f; + char* s; + any_t* v; + }; -typedef struct mp_cmd_arg { - int type; - mp_cmd_arg_value_t v; -} mp_cmd_arg_t; + struct mp_cmd_arg_t { + int type; + mp_cmd_arg_value_t v; + }; -typedef struct mp_cmd { - int id; - const char* name; - int nargs; - mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; -} mp_cmd_t; + struct mp_cmd_t { + int id; + const char* name; + int nargs; + mp_cmd_arg_t args[MP_CMD_MAX_ARGS]; + }; -// These typedefs are for the drivers. They are the functions used to retrive -// the next key code or command. + struct libinput_t; -typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // Should return 1 if the command was processed -extern void (*mp_input_key_cb)(int code); // Set this to grab all incoming key code + // These typedefs are for the drivers. They are the functions used to retrive + // the next key code or command. -extern mp_cmd_t* mp_input_get_cmd_from_keys(any_t* handle,int n,int* keys); -// This function can be used to reput a command in the system. It's used by libmpdemux -// when it perform a blocking operation to resend the command it received to the main -// loop. -extern MPXP_Rc mp_input_queue_cmd(any_t* handle,mp_cmd_t* cmd); + typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // Should return 1 if the command was processed + extern void (*mp_input_key_cb)(int code); // Set this to grab all incoming key code -// This function retrive the next avaible command waiting no more than time msec. -// If pause is true, the next input will always return a pause command. -extern mp_cmd_t* mp_input_get_cmd(any_t*handle,int time, int paused, int peek_only); + extern mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys); + // This function can be used to reput a command in the system. It's used by libmpdemux + // when it perform a blocking operation to resend the command it received to the main + // loop. + extern MPXP_Rc mp_input_queue_cmd(libinput_t* handle,mp_cmd_t* cmd); -extern mp_cmd_t* mp_input_parse_cmd(const char* str); + // This function retrive the next avaible command waiting no more than time msec. + // If pause is true, the next input will always return a pause command. + extern mp_cmd_t* mp_input_get_cmd(libinput_t*handle,int time, int paused, int peek_only); -/// These filter allow you to process the command before mplayer -/// If a filter return a true value mp_input_get_cmd will return NULL -extern void mp_input_add_cmd_filter(any_t* handle,mp_input_cmd_filter, any_t* ctx); -// After getting a command from mp_input_get_cmd you need to mp_free it using this -// function -extern void mp_cmd_free(mp_cmd_t* cmd); + extern mp_cmd_t* mp_input_parse_cmd(const char* str); -// When you create a new driver you should add it in this 2 functions. -extern any_t* mp_input_open(void); -extern void mp_input_close(any_t* handle); + /// These filter allow you to process the command before mplayer + /// If a filter return a true value mp_input_get_cmd will return NULL + extern void mp_input_add_cmd_filter(libinput_t* handle,mp_input_cmd_filter, any_t* ctx); + // After getting a command from mp_input_get_cmd you need to mp_free it using this + // function + extern void mp_cmd_free(mp_cmd_t* cmd); -extern void mp_input_print_keys(any_t*handle); -extern void mp_input_print_cmds(any_t*handle); + // When you create a new driver you should add it in this 2 functions. + extern libinput_t* mp_input_open(void); + extern void mp_input_close(libinput_t* handle); -extern void mp_input_print_binds(any_t*handle); -// Interruptible usleep: (used by libmpdemux) -extern MPXP_Rc mp_input_check_interrupt(any_t* handle,int time); + extern void mp_input_print_keys(libinput_t*handle); + extern void mp_input_print_cmds(libinput_t*handle); + + extern void mp_input_print_binds(libinput_t*handle); + // Interruptible usleep: (used by libmpdemux) + extern MPXP_Rc mp_input_check_interrupt(libinput_t* handle,int time); +} // namespace mpxp #endif Modified: mplayerxp/input2/joystick.cpp =================================================================== --- mplayerxp/input2/joystick.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/joystick.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -25,13 +25,15 @@ #include <linux/joystick.h> +#include "in_msg.h" + +namespace mpxp { typedef struct priv_s { int axis[10]; int btns; int fd; }priv_t; -#include "in_msg.h" any_t* mp_input_joystick_open(const char* dev) { int l=0; @@ -76,18 +78,18 @@ } void mp_input_joystick_close(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t* priv = reinterpret_cast<priv_t*>(ctx); close(priv->fd); delete priv; } int mp_input_joystick_read(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t& priv = *reinterpret_cast<priv_t*>(ctx); struct js_event ev; int l=0; while((unsigned int)l < sizeof(struct js_event)) { - int r = read(priv->fd,&ev+l,sizeof(struct js_event)-l); + int r = read(priv.fd,&ev+l,sizeof(struct js_event)-l); if(r <= 0) { if(errno == EINTR) continue; else if(errno == EAGAIN) return MP_INPUT_NOTHING; @@ -107,34 +109,34 @@ MSG_WARN("Joystick : warning init event, we have lost sync with driver\n"); ev.type &= ~JS_EVENT_INIT; if(ev.type == JS_EVENT_BUTTON) { - int s = (priv->btns >> ev.number) & 1; + int s = (priv.btns >> ev.number) & 1; if(s == ev.value) // State is the same : ignore return MP_INPUT_NOTHING; } if(ev.type == JS_EVENT_AXIS) { - if( (priv->axis[ev.number] == 1 && ev.value > JOY_AXIS_DELTA) || - (priv->axis[ev.number] == -1 && ev.value < -JOY_AXIS_DELTA) || - (priv->axis[ev.number] == 0 && ev.value >= -JOY_AXIS_DELTA && ev.value <= JOY_AXIS_DELTA)) + if( (priv.axis[ev.number] == 1 && ev.value > JOY_AXIS_DELTA) || + (priv.axis[ev.number] == -1 && ev.value < -JOY_AXIS_DELTA) || + (priv.axis[ev.number] == 0 && ev.value >= -JOY_AXIS_DELTA && ev.value <= JOY_AXIS_DELTA)) // State is the same : ignore return MP_INPUT_NOTHING; } } if(ev.type & JS_EVENT_BUTTON) { - priv->btns &= ~(1 << ev.number); - priv->btns |= (ev.value << ev.number); + priv.btns &= ~(1 << ev.number); + priv.btns |= (ev.value << ev.number); if(ev.value == 1) return ((JOY_BTN0+ev.number) | MP_KEY_DOWN); else return (JOY_BTN0+ev.number); } else if(ev.type & JS_EVENT_AXIS) { - if(ev.value < -JOY_AXIS_DELTA && priv->axis[ev.number] != -1) { - priv->axis[ev.number] = -1; + if(ev.value < -JOY_AXIS_DELTA && priv.axis[ev.number] != -1) { + priv.axis[ev.number] = -1; return (JOY_AXIS0_MINUS+(2*ev.number)) | MP_KEY_DOWN; - } else if(ev.value > JOY_AXIS_DELTA && priv->axis[ev.number] != 1) { - priv->axis[ev.number] = 1; + } else if(ev.value > JOY_AXIS_DELTA && priv.axis[ev.number] != 1) { + priv.axis[ev.number] = 1; return (JOY_AXIS0_PLUS+(2*ev.number)) | MP_KEY_DOWN; - } else if(ev.value <= JOY_AXIS_DELTA && ev.value >= -JOY_AXIS_DELTA && priv->axis[ev.number] != 0) { - int r = priv->axis[ev.number] == 1 ? JOY_AXIS0_PLUS+(2*ev.number) : JOY_AXIS0_MINUS+(2*ev.number); - priv->axis[ev.number] = 0; + } else if(ev.value <= JOY_AXIS_DELTA && ev.value >= -JOY_AXIS_DELTA && priv.axis[ev.number] != 0) { + int r = priv.axis[ev.number] == 1 ? JOY_AXIS0_PLUS+(2*ev.number) : JOY_AXIS0_MINUS+(2*ev.number); + priv.axis[ev.number] = 0; return r; } else return MP_INPUT_NOTHING; @@ -144,8 +146,11 @@ } return MP_INPUT_NOTHING; } +} // namespace mpxp #else +namespace mpxp { any_t* mp_input_joystick_open(const char* dev) { UNUNSED(dev); return NULL; } void mp_input_joystick_close(any_t* ctx) { UNUSED(ctx); } int mp_input_joystick_read(any_t* ctx) { UNUSED(ctx); return MP_INPUT_NOTHING; } +} // namespace mpxp #endif Modified: mplayerxp/input2/joystick.h =================================================================== --- mplayerxp/input2/joystick.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/joystick.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,44 +1,46 @@ #ifndef JOYSTICK_H_INCLUDED #define JOYSTICK_H_INCLUDED 1 -enum { - JOY_BASE =(0x100+128), - JOY_AXIS0_PLUS =(JOY_BASE+0), - JOY_AXIS0_MINUS =(JOY_BASE+1), - JOY_AXIS1_PLUS =(JOY_BASE+2), - JOY_AXIS1_MINUS =(JOY_BASE+3), - JOY_AXIS2_PLUS =(JOY_BASE+4), - JOY_AXIS2_MINUS =(JOY_BASE+5), - JOY_AXIS3_PLUS =(JOY_BASE+6), - JOY_AXIS3_MINUS =(JOY_BASE+7), - JOY_AXIS4_PLUS =(JOY_BASE+8), - JOY_AXIS4_MINUS =(JOY_BASE+9), - JOY_AXIS5_PLUS =(JOY_BASE+10), - JOY_AXIS5_MINUS =(JOY_BASE+11), - JOY_AXIS6_PLUS =(JOY_BASE+12), - JOY_AXIS6_MINUS =(JOY_BASE+13), - JOY_AXIS7_PLUS =(JOY_BASE+14), - JOY_AXIS7_MINUS =(JOY_BASE+15), - JOY_AXIS8_PLUS =(JOY_BASE+16), - JOY_AXIS8_MINUS =(JOY_BASE+17), - JOY_AXIS9_PLUS =(JOY_BASE+18), - JOY_AXIS9_MINUS =(JOY_BASE+19) -}; -enum { - JOY_BTN_BASE=((0x100+148)|(1<<28)), - JOY_BTN0 =(JOY_BTN_BASE+0), - JOY_BTN1 =(JOY_BTN_BASE+1), - JOY_BTN2 =(JOY_BTN_BASE+2), - JOY_BTN3 =(JOY_BTN_BASE+3), - JOY_BTN4 =(JOY_BTN_BASE+4), - JOY_BTN5 =(JOY_BTN_BASE+5), - JOY_BTN6 =(JOY_BTN_BASE+6), - JOY_BTN7 =(JOY_BTN_BASE+7), - JOY_BTN8 =(JOY_BTN_BASE+8), - JOY_BTN9 =(JOY_BTN_BASE+9) -}; +namespace mpxp { + enum { + JOY_BASE =(0x100+128), + JOY_AXIS0_PLUS =(JOY_BASE+0), + JOY_AXIS0_MINUS =(JOY_BASE+1), + JOY_AXIS1_PLUS =(JOY_BASE+2), + JOY_AXIS1_MINUS =(JOY_BASE+3), + JOY_AXIS2_PLUS =(JOY_BASE+4), + JOY_AXIS2_MINUS =(JOY_BASE+5), + JOY_AXIS3_PLUS =(JOY_BASE+6), + JOY_AXIS3_MINUS =(JOY_BASE+7), + JOY_AXIS4_PLUS =(JOY_BASE+8), + JOY_AXIS4_MINUS =(JOY_BASE+9), + JOY_AXIS5_PLUS =(JOY_BASE+10), + JOY_AXIS5_MINUS =(JOY_BASE+11), + JOY_AXIS6_PLUS =(JOY_BASE+12), + JOY_AXIS6_MINUS =(JOY_BASE+13), + JOY_AXIS7_PLUS =(JOY_BASE+14), + JOY_AXIS7_MINUS =(JOY_BASE+15), + JOY_AXIS8_PLUS =(JOY_BASE+16), + JOY_AXIS8_MINUS =(JOY_BASE+17), + JOY_AXIS9_PLUS =(JOY_BASE+18), + JOY_AXIS9_MINUS =(JOY_BASE+19) + }; + enum { + JOY_BTN_BASE =((0x100+148)|(1<<28)), + JOY_BTN0 =(JOY_BTN_BASE+0), + JOY_BTN1 =(JOY_BTN_BASE+1), + JOY_BTN2 =(JOY_BTN_BASE+2), + JOY_BTN3 =(JOY_BTN_BASE+3), + JOY_BTN4 =(JOY_BTN_BASE+4), + JOY_BTN5 =(JOY_BTN_BASE+5), + JOY_BTN6 =(JOY_BTN_BASE+6), + JOY_BTN7 =(JOY_BTN_BASE+7), + JOY_BTN8 =(JOY_BTN_BASE+8), + JOY_BTN9 =(JOY_BTN_BASE+9) + }; -extern any_t* mp_input_joystick_open(const char* dev); -extern void mp_input_joystick_close(any_t* ctx); -extern int mp_input_joystick_read(any_t* ctx); + extern any_t* mp_input_joystick_open(const char* dev); + extern void mp_input_joystick_close(any_t* ctx); + extern int mp_input_joystick_read(any_t* ctx); +} // namespace mpxp #endif Modified: mplayerxp/input2/lirc.cpp =================================================================== --- mplayerxp/input2/lirc.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/lirc.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -17,6 +17,7 @@ #include "input.h" #include "in_msg.h" +namespace mpxp { static struct lirc_config *lirc_config; char *lirc_configfile; @@ -46,27 +47,27 @@ } int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s) { - priv_t* priv = (priv_t*)ctx; + priv_t& priv = *reinterpret_cast<priv_t*>(ctx); fd_set fds; struct timeval tv; int r,cl = 0; char *code = NULL,*c = NULL; // We have something in the buffer return it - if(priv->cmd_buf != NULL) { - int l = strlen(priv->cmd_buf), w = l > s ? s : l; - memcpy(dest,priv->cmd_buf,w); + if(priv.cmd_buf != NULL) { + int l = strlen(priv.cmd_buf), w = l > s ? s : l; + memcpy(dest,priv.cmd_buf,w); l -= w; - if(l > 0) memmove(priv->cmd_buf,&priv->cmd_buf[w],l+1); + if(l > 0) memmove(priv.cmd_buf,&priv.cmd_buf[w],l+1); else { - delete priv->cmd_buf; - priv->cmd_buf = NULL; + delete priv.cmd_buf; + priv.cmd_buf = NULL; } return w; } // Nothing in the buffer, pool the lirc fd FD_ZERO(&fds); - FD_SET(priv->lirc_sock,&fds); + FD_SET(priv.lirc_sock,&fds); memset(&tv,0,sizeof(tv)); while((r = select(1,&fds,NULL,NULL,&tv)) <= 0) { if(r < 0) { @@ -88,23 +89,23 @@ while((r = lirc_code2char(lirc_config,code,&c))==0 && c!=NULL) { int l = strlen(c); if(l <= 0) continue; - priv->cmd_buf = (char *)mp_realloc(priv->cmd_buf,cl+l+2); - memcpy(&priv->cmd_buf[cl],c,l); + priv.cmd_buf = (char *)mp_realloc(priv.cmd_buf,cl+l+2); + memcpy(&priv.cmd_buf[cl],c,l); cl += l+1; - priv->cmd_buf[cl-1] = '\n'; - priv->cmd_buf[cl] = '\0'; + priv.cmd_buf[cl-1] = '\n'; + priv.cmd_buf[cl] = '\0'; } delete code; if(r < 0) return MP_INPUT_DEAD; - else if(priv->cmd_buf) // return the first command in the buffer - return mp_input_lirc_read_cmd(priv,dest,s); + else if(priv.cmd_buf) // return the first command in the buffer + return mp_input_lirc_read_cmd(&priv,dest,s); else return MP_INPUT_NOTHING; } void mp_input_lirc_close(any_t* ctx) { - priv_t* priv = (priv_t*)ctx; + priv_t* priv = reinterpret_cast<priv_t*>(ctx); if(priv->cmd_buf) { delete priv->cmd_buf; priv->cmd_buf = NULL; @@ -113,5 +114,5 @@ lirc_deinit(); delete priv; } - +}// namespace mpxp #endif Modified: mplayerxp/input2/lirc.h =================================================================== --- mplayerxp/input2/lirc.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/lirc.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,7 +1,8 @@ #ifndef __LIRC_H_INCLUDED #define __LIRC_H_INCLUDED 1 - -extern any_t* mp_input_lirc_open(void); -extern int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s); -extern void mp_input_lirc_close(any_t* ctx); +namespace mpxp { + extern any_t* mp_input_lirc_open(void); + extern int mp_input_lirc_read_cmd(any_t* ctx,char* dest, int s); + extern void mp_input_lirc_close(any_t* ctx); +} // namespace mpxp #endif Modified: mplayerxp/input2/mouse.h =================================================================== --- mplayerxp/input2/mouse.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/input2/mouse.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,30 +1,31 @@ #ifndef MOUSE_H_INCLUDED #define MOUSE_H_INCLUDED 1 - -enum { - MOUSE_BASE=((0x100+256)|MP_NO_REPEAT_KEY), - MOUSE_BTN0=(MOUSE_BASE+0), - MOUSE_BTN1=(MOUSE_BASE+1), - MOUSE_BTN2=(MOUSE_BASE+2), - MOUSE_BTN3=(MOUSE_BASE+3), - MOUSE_BTN4=(MOUSE_BASE+4), - MOUSE_BTN5=(MOUSE_BASE+5), - MOUSE_BTN6=(MOUSE_BASE+6), - MOUSE_BTN7=(MOUSE_BASE+7), - MOUSE_BTN8=(MOUSE_BASE+8), - MOUSE_BTN9=(MOUSE_BASE+9) -}; -enum { - MOUSE_BASE_DBL=(0x300|MP_NO_REPEAT_KEY), - MOUSE_BTN0_DBL=(MOUSE_BASE_DBL+0), - MOUSE_BTN1_DBL=(MOUSE_BASE_DBL+1), - MOUSE_BTN2_DBL=(MOUSE_BASE_DBL+2), - MOUSE_BTN3_DBL=(MOUSE_BASE_DBL+3), - MOUSE_BTN4_DBL=(MOUSE_BASE_DBL+4), - MOUSE_BTN5_DBL=(MOUSE_BASE_DBL+5), - MOUSE_BTN6_DBL=(MOUSE_BASE_DBL+6), - MOUSE_BTN7_DBL=(MOUSE_BASE_DBL+7), - MOUSE_BTN8_DBL=(MOUSE_BASE_DBL+8), - MOUSE_BTN9_DBL=(MOUSE_BASE_DBL+9) -}; +namespace mpxp { + enum { + MOUSE_BASE=((0x100+256)|MP_NO_REPEAT_KEY), + MOUSE_BTN0=(MOUSE_BASE+0), + MOUSE_BTN1=(MOUSE_BASE+1), + MOUSE_BTN2=(MOUSE_BASE+2), + MOUSE_BTN3=(MOUSE_BASE+3), + MOUSE_BTN4=(MOUSE_BASE+4), + MOUSE_BTN5=(MOUSE_BASE+5), + MOUSE_BTN6=(MOUSE_BASE+6), + MOUSE_BTN7=(MOUSE_BASE+7), + MOUSE_BTN8=(MOUSE_BASE+8), + MOUSE_BTN9=(MOUSE_BASE+9) + }; + enum { + MOUSE_BASE_DBL=(0x300|MP_NO_REPEAT_KEY), + MOUSE_BTN0_DBL=(MOUSE_BASE_DBL+0), + MOUSE_BTN1_DBL=(MOUSE_BASE_DBL+1), + MOUSE_BTN2_DBL=(MOUSE_BASE_DBL+2), + MOUSE_BTN3_DBL=(MOUSE_BASE_DBL+3), + MOUSE_BTN4_DBL=(MOUSE_BASE_DBL+4), + MOUSE_BTN5_DBL=(MOUSE_BASE_DBL+5), + MOUSE_BTN6_DBL=(MOUSE_BASE_DBL+6), + MOUSE_BTN7_DBL=(MOUSE_BASE_DBL+7), + MOUSE_BTN8_DBL=(MOUSE_BASE_DBL+8), + MOUSE_BTN9_DBL=(MOUSE_BASE_DBL+9) + }; +} // namespace mpxp #endif \ No newline at end of file Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -52,7 +52,7 @@ sh_video_t* parent; const vd_functions_t* mpvdec; - any_t* libinput; + libinput_t* libinput; vd_private_t* ctx; vf_stream_t* vfilter; int vfilter_inited; @@ -139,7 +139,7 @@ #endif } -video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,any_t* libinput) { +video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,libinput_t* libinput) { video_decoder_t* handle=new(zeromem) video_decoder_t; decvideo_priv_t* priv = new(zeromem) decvideo_priv_t; priv->parent=sh_video; @@ -164,7 +164,7 @@ return handle; } -video_decoder_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,any_t*libinput){ +video_decoder_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,libinput_t*libinput){ UNUSED(codecname); UNUSED(status); int done=0; Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpcodecs/dec_video.h 2012-12-05 11:42:31 UTC (rev 511) @@ -5,14 +5,18 @@ #include "libmpstream/stream.h" #include "libmpdemux/stheader.h" +namespace mpxp { + struct libinput_t; +} + struct video_decoder_t { any_t* vd_private; }; // dec_video.c: -extern video_decoder_t* __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,any_t*libinput); +extern video_decoder_t* __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status,libinput_t*libinput); extern void __FASTCALL__ mpcv_uninit(video_decoder_t *handle); -extern video_decoder_t* __FASTCALL__ mpcv_lavc_init(sh_video_t*,any_t* libinput); +extern video_decoder_t* __FASTCALL__ mpcv_lavc_init(sh_video_t*,libinput_t* libinput); extern int __FASTCALL__ mpcv_decode(video_decoder_t *handle,const enc_frame_t* frame); extern MPXP_Rc __FASTCALL__ mpcv_get_quality_max(video_decoder_t *handle,unsigned *qual); Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -220,7 +220,7 @@ return ret; } -m_config_t* m_config_new(play_tree_t* pt,any_t*libinput) { +m_config_t* m_config_new(play_tree_t* pt,libinput_t*libinput) { m_config_t* config; #ifdef MP_DEBUG Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-05 11:42:31 UTC (rev 511) @@ -5,6 +5,10 @@ #define __CFG_PARSER_H 1 #include "xmpcore/xmp_enums.h" +namespace mpxp { + struct libinput_t; +} + /* config types */ enum { CONF_TYPE_FLAG =0, @@ -63,7 +67,7 @@ play_tree_t* last_entry; // last added entry play_tree_t* last_parent; // if last_entry is NULL we must create child of this int recursion_depth; - any_t* libinput; + libinput_t* libinput; }; struct config_save { @@ -89,7 +93,7 @@ */ MPXP_Rc m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); -m_config_t* m_config_new(play_tree_t* pt,any_t*libinput); +m_config_t* m_config_new(play_tree_t* pt,libinput_t*libinput); void m_config_free(m_config_t* config); Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -15,6 +15,7 @@ #include "libmpsub/subreader.h" #include "libmpconf/cfgparser.h" +#include "input2/input.h" #include "osdep/fastmemcpy.h" #include "libvo/sub.h" #include "libao2/afmt.h" @@ -367,7 +368,7 @@ stream_t *as = NULL,*ss = NULL; Demuxer *vd,*ad = NULL,*sd = NULL; int afmt = 0,sfmt = 0; - any_t* libinput=NULL; + libinput_t* libinput=NULL; #ifdef HAVE_STREAMIN libinput=vs->streaming_strl->libinput; #endif Modified: mplayerxp/libmpdemux/mpdemux.cpp =================================================================== --- mplayerxp/libmpdemux/mpdemux.cpp 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/mpdemux.cpp 2012-12-05 11:42:31 UTC (rev 511) @@ -7,7 +7,7 @@ #include "mpdemux.h" #include "demux_msg.h" -int mpdemux_check_interrupt(any_t* libinput,int _time) { +int mpdemux_check_interrupt(libinput_t* libinput,int _time) { mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(libinput,_time,0,1)) == NULL) return 0; Modified: mplayerxp/libmpdemux/mpdemux.h =================================================================== --- mplayerxp/libmpdemux/mpdemux.h 2012-12-05 09:25:22 UTC (rev 510) +++ mplayerxp/libmpdemux/mpdemux.h 2012-12-05 11:42:31 UTC (rev 511) @@ -1,5 +1,5 @@ #ifndef MPDEMUX_H #define MPDEMUX_H 1 -extern int mpdemux_check_interrupt(any_t* libinput,int time); +extern int mpdemux_check_interrupt(libinput_t* libinput,int time); #endif Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream... [truncated message content] |