[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[553] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-12 17:37:06
|
Revision: 553 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=553&view=rev Author: nickols_k Date: 2012-12-12 17:36:49 +0000 (Wed, 12 Dec 2012) Log Message: ----------- replace libinput_t* -> libinput_t& Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/dump.h mplayerxp/input2/input.cpp mplayerxp/input2/input.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/demuxer.h mplayerxp/libmpdemux/mpdemux.cpp mplayerxp/libmpdemux/mpdemux.h mplayerxp/libmpstream2/cache2.cpp mplayerxp/libmpstream2/cdd.h mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/s_cdd.cpp mplayerxp/libmpstream2/s_dvdnav.cpp mplayerxp/libmpstream2/s_dvdread.cpp mplayerxp/libmpstream2/s_file.cpp mplayerxp/libmpstream2/s_ftp.cpp mplayerxp/libmpstream2/s_lavc.cpp mplayerxp/libmpstream2/s_network.cpp mplayerxp/libmpstream2/s_null.cpp mplayerxp/libmpstream2/s_oss.cpp mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_tv.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/s_vcdnav.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libmpstream2/stream_internal.h mplayerxp/libmpstream2/tcp.cpp mplayerxp/libmpstream2/tcp.h mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libplaytree/playtreeparser.h 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-12 16:21:04 UTC (rev 552) +++ mplayerxp/dump.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -77,7 +77,7 @@ #define MUX_HAVE_SUBS 0x04 struct dump_priv_t : public Opaque { public: - dump_priv_t() {} + dump_priv_t(libinput_t& l):libinput(l) {} virtual ~dump_priv_t() {} int my_use_pts; @@ -90,7 +90,7 @@ uint64_t vsize,asize,ssize; float timer_corr; /* use common time-base */ float vtimer; - libinput_t* libinput; + libinput_t& libinput; }; /* @@ -116,16 +116,15 @@ return retval; } -void dump_mux_init(Demuxer *demuxer,libinput_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); char stream_dump_name[1024]; /* TODO copy it from demuxer */ if(demuxer->priv) return; - dump_priv_t*priv=new(zeromem) dump_priv_t; + dump_priv_t*priv=new(zeromem) dump_priv_t(libinput); demuxer->priv=priv; - priv->libinput=libinput; /* describe other useless dumps */ priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; if(port) { Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/dump.h 2012-12-12 17:36:49 UTC (rev 553) @@ -7,7 +7,7 @@ namespace mpxp { int dump_parse(const char *param); void dump_stream(Stream *stream); - void dump_mux_init(Demuxer *demuxer,libinput_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); } //namespace Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/input2/input.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -422,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(libinput_t*); -static int mp_input_print_cmd_list(libinput_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" }, @@ -459,10 +459,9 @@ 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(libinput_t*,int key); +static const char* mp_input_get_key_name(libinput_t&,int key); -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; +static MPXP_Rc mp_input_add_cmd_fd(libinput_t& priv,any_t* opaque, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { if(priv.num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd\n"); return MPXP_False; @@ -478,8 +477,7 @@ return MPXP_Ok; } -static void mp_input_rm_cmd_fd(libinput_t* handle,any_t* fd) { - libinput_t& priv = *handle; +static void mp_input_rm_cmd_fd(libinput_t& priv,any_t* fd) { unsigned int i; for(i = 0; i < priv.num_cmd_fd; i++) { @@ -492,8 +490,7 @@ priv.num_cmd_fd--; } -static void mp_input_rm_key_fd(libinput_t* handle,any_t* fd) { - libinput_t& priv = *handle; +static void mp_input_rm_key_fd(libinput_t& priv,any_t* fd) { unsigned int i; for(i = 0; i < priv.num_key_fd; i++) { @@ -505,8 +502,7 @@ priv.num_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; +static MPXP_Rc mp_input_add_key_fd(libinput_t& priv,any_t* opaque, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { if(priv.num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd\n"); return MPXP_False; @@ -740,8 +736,7 @@ } } -void mp_input_add_cmd_filter(libinput_t* handle,mp_input_cmd_filter func,any_t* ctx) { - libinput_t& priv = *handle; +void mp_input_add_cmd_filter(libinput_t& priv,mp_input_cmd_filter func,any_t* ctx) { mp_cmd_filter_t* filter = new(zeromem) mp_cmd_filter_t; filter->filter = func; @@ -772,36 +767,34 @@ return binds[j].cmd; } -mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys) { - libinput_t& priv = *handle; +mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t& priv,int n,int* keys) { 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(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])); + 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(libinput_t* handle,int tim) { - libinput_t& priv = *handle; +static int mp_input_read_key_code(libinput_t& priv,int tim) { int n=0; unsigned i; @@ -811,7 +804,7 @@ // 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); + 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; @@ -828,20 +821,19 @@ 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(libinput_t*handle,int tim) { - libinput_t& priv = *handle; - int code = mp_input_read_key_code(&priv,tim); +static mp_cmd_t* mp_input_read_keys(libinput_t& priv,int tim) { + 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); @@ -849,7 +841,7 @@ 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) { @@ -885,7 +877,7 @@ 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--; @@ -903,7 +895,7 @@ 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); + 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; @@ -920,8 +912,7 @@ return NULL; } -static mp_cmd_t* mp_input_read_cmds(libinput_t* handle) { - libinput_t& priv = *handle; +static mp_cmd_t* mp_input_read_cmds(libinput_t& priv) { int n = 0,got_cmd = 0; unsigned i; mp_cmd_t* ret; @@ -931,7 +922,7 @@ 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); + 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; @@ -958,8 +949,7 @@ return NULL; } -MPXP_Rc mp_input_queue_cmd(libinput_t* handle,mp_cmd_t* cmd) { - libinput_t& priv = *handle; +MPXP_Rc mp_input_queue_cmd(libinput_t& priv,mp_cmd_t* cmd) { 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; @@ -967,8 +957,7 @@ return MPXP_Ok; } -static mp_cmd_t* mp_input_get_queued_cmd(libinput_t* handle,int peek_only) { - libinput_t& priv = *handle; +static mp_cmd_t* mp_input_get_queued_cmd(libinput_t& priv,int peek_only) { mp_cmd_t* ret; if(priv.cmd_queue_length == 0) return NULL; @@ -986,18 +975,17 @@ * \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(libinput_t*handle,int tim, int paused, int peek_only) { - libinput_t& priv = *handle; +mp_cmd_t* mp_input_get_cmd(libinput_t& priv,int tim, int paused, int peek_only) { 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; @@ -1005,7 +993,7 @@ 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; } @@ -1033,7 +1021,7 @@ assert(cmd != NULL); #endif - ret = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); + ret = new(zeromem) mp_cmd_t; memcpy(ret,cmd,sizeof(mp_cmd_t)); if(cmd->name) ret->name = mp_strdup(cmd->name); for(i = 0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { @@ -1043,8 +1031,7 @@ return ret; } -static const char* mp_input_get_key_name(libinput_t* handle,int key) { - libinput_t& priv = *handle; +static const char* mp_input_get_key_name(libinput_t& priv,int key) { unsigned i; for(i = 0; key_names[i].name != NULL; i++) { @@ -1061,7 +1048,7 @@ return priv.key_str; } -static int mp_input_get_key_from_name(char* name) { +static int mp_input_get_key_from_name(const char* name) { int i,ret = 0,len = strlen(name); if(len == 1) { // Direct key code ret = (unsigned char)name[0]; @@ -1076,7 +1063,8 @@ } static int mp_input_get_input_from_name(char* name,int* keys) { - char *end,*ptr; + char *end; + char *ptr; int n=0; ptr = name; @@ -1096,8 +1084,7 @@ return 1; } -static void mp_input_bind_keys(libinput_t* handle,int keys[MP_MAX_KEY_DOWN+1], char* cmd) { - libinput_t& priv = *handle; +static void mp_input_bind_keys(libinput_t& priv,int keys[MP_MAX_KEY_DOWN+1],const char* cmd) { int i = 0,j; mp_cmd_bind_t* _bind = NULL; @@ -1136,8 +1123,7 @@ #define BS_MAX 256 #define SPACE_CHAR " \n\r\t" -static int mp_input_parse_config(libinput_t* handle,const char *file) { - libinput_t& priv = *handle; +static int mp_input_parse_config(libinput_t& priv,const char *file) { int fd; int bs = 0,r,eof = 0,comments = 0; char *iter,*end; @@ -1234,8 +1220,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) { @@ -1260,7 +1246,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++; @@ -1275,31 +1261,30 @@ return 0; } -static void mp_input_init(libinput_t* handle) { - libinput_t& priv = *handle; +static void mp_input_init(libinput_t& priv) { const char* file; file = config_file[0] != '/' ? get_path(config_file) : config_file; if(!file) return; - if(! mp_input_parse_config(handle,file)) { + if(! mp_input_parse_config(priv,file)) { // Try global conf dir file = CONFDIR "/input.conf"; - if(! mp_input_parse_config(handle,file)) MSG_WARN("Falling back on default (hardcoded) input config\n"); + if(! mp_input_parse_config(priv,file)) MSG_WARN("Falling back on default (hardcoded) input config\n"); } #ifdef HAVE_JOYSTICK if(libinput_conf.use_joystick) { 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,17 +1299,16 @@ 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); + 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; 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(libinput_t* handle) { - libinput_t& priv = *handle; +static void mp_input_uninit(libinput_t& priv) { unsigned int i; for(i=0; i < priv.num_key_fd; i++) { @@ -1346,38 +1330,38 @@ if(priv.in_file_fd==0) getch2_disable(); } -libinput_t* mp_input_open(void) { - libinput_t* priv=new(zeromem) libinput_t; - priv->ar_state=-1; - priv->in_file_fd=-1; +libinput_t& mp_input_open() { + libinput_t& priv=*new(zeromem) libinput_t; + priv.ar_state=-1; + priv.in_file_fd=-1; mp_input_init(priv); if(libinput_conf.print_key_list) mp_input_print_key_list(priv); if(libinput_conf.print_cmd_list) mp_input_print_cmd_list(priv); return priv; } -void mp_input_close(libinput_t* handle) { +void mp_input_close(libinput_t& handle) { mp_input_uninit(handle); - delete handle; + delete &handle; } void mp_input_register_options(m_config_t* cfg) { m_config_register_options(cfg,mp_input_opts); } -void mp_input_print_keys(libinput_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(libinput_t*handle) { +static int mp_input_print_key_list(libinput_t& handle) { mp_input_print_keys(handle); exit(0); } -void mp_input_print_binds(libinput_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++) { @@ -1388,7 +1372,7 @@ } } -void mp_input_print_cmds(libinput_t*handle) { +void mp_input_print_cmds(libinput_t& handle) { const mp_cmd_t *cmd; int i,j; const char* type; @@ -1418,13 +1402,13 @@ } } -static int mp_input_print_cmd_list(libinput_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(libinput_t* handle,int tim) { - libinput_t* priv = (libinput_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) { Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/input2/input.h 2012-12-12 17:36:49 UTC (rev 553) @@ -135,34 +135,34 @@ 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 - extern mp_cmd_t* mp_input_get_cmd_from_keys(libinput_t* handle,int n,int* keys); + 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 MPXP_Rc mp_input_queue_cmd(libinput_t& handle,mp_cmd_t* cmd); // 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); + extern mp_cmd_t* mp_input_get_cmd(libinput_t& handle,int time, int paused, int peek_only); extern mp_cmd_t* mp_input_parse_cmd(const char* str); /// 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); + 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); // 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 libinput_t& mp_input_open(); + extern void mp_input_close(libinput_t& handle); - extern void mp_input_print_keys(libinput_t*handle); - extern void mp_input_print_cmds(libinput_t*handle); + 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); + 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); + extern MPXP_Rc mp_input_check_interrupt(libinput_t& handle,int time); } // namespace mpxp #endif Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -47,20 +47,21 @@ struct decvideo_priv_t : public Opaque { public: - decvideo_priv_t(); + decvideo_priv_t(libinput_t&); virtual ~decvideo_priv_t(); sh_video_t* parent; const vd_functions_t* mpvdec; - libinput_t* libinput; + libinput_t& libinput; vd_private_t* ctx; vf_stream_t* vfilter; int vfilter_inited; put_slice_info_t* psi; }; -decvideo_priv_t::decvideo_priv_t() - :psi(new(zeromem) put_slice_info_t) +decvideo_priv_t::decvideo_priv_t(libinput_t& _libinput) + :libinput(_libinput), + psi(new(zeromem) put_slice_info_t) { } @@ -139,11 +140,10 @@ #endif } -video_decoder_t * mpcv_lavc_init(sh_video_t* sh_video,libinput_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; + decvideo_priv_t* priv = new(zeromem) decvideo_priv_t(libinput); priv->parent=sh_video; - priv->libinput=libinput; handle->vd_private=priv; const video_probe_t* vprobe=NULL; /* Use lavc's drivers as last hope */ @@ -168,16 +168,15 @@ return handle; } -video_decoder_t * mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status,libinput_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; const video_probe_t* vprobe=NULL; sh_video->codec=NULL; video_decoder_t* handle=new(zeromem) video_decoder_t; - decvideo_priv_t* priv = new(zeromem) decvideo_priv_t; + decvideo_priv_t* priv = new(zeromem) decvideo_priv_t(libinput); priv->parent=sh_video; - priv->libinput=libinput; handle->vd_private=priv; MP_UNIT("init_video_filters"); Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpcodecs/dec_video.h 2012-12-12 17:36:49 UTC (rev 553) @@ -12,9 +12,9 @@ }; // dec_video.c: -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 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*,libinput_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-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -220,14 +220,14 @@ return ret; } -m_config_t* m_config_new(play_tree_t* pt,libinput_t*libinput) { +m_config_t* m_config_new(play_tree_t* pt,libinput_t&libinput) { m_config_t* config; #ifdef MP_DEBUG assert(pt != NULL); #endif - config = (m_config_t*)mp_calloc(1,sizeof(m_config_t)); + config = new(zeromem) m_config_t(libinput); if(config == NULL) { MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(m_config_t),strerror(errno)); return NULL; @@ -240,7 +240,6 @@ } SET_GLOBAL(config); // We always start with global options config->pt = pt; - config->libinput=libinput; return config; } Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-12 17:36:49 UTC (rev 553) @@ -55,6 +55,9 @@ }; struct m_config { + m_config(libinput_t& _libinput):libinput(_libinput) {} + ~m_config() {} + const config_t** opt_list; config_save_t** config_stack; any_t**dynamics; @@ -67,7 +70,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; - libinput_t* libinput; + libinput_t& libinput; }; struct config_save { @@ -93,7 +96,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,libinput_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-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -434,14 +434,10 @@ return MPXP_Ok; } -Demuxer* Demuxer::open(Stream *vs,int audio_id,int video_id,int dvdsub_id){ +Demuxer* Demuxer::open(Stream *vs,libinput_t& libinput,int audio_id,int video_id,int dvdsub_id){ Stream *as = NULL,*ss = NULL; Demuxer *vd,*ad = NULL,*sd = NULL; int afmt = 0,sfmt = 0; - libinput_t* libinput=NULL; -#ifdef HAVE_STREAMIN - libinput=vs->streaming_strl->libinput; -#endif if(demux_conf.audio_stream) { as = new(zeromem) Stream(); Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-12 17:36:49 UTC (rev 553) @@ -100,7 +100,7 @@ Switch_Subs =3 }; - static Demuxer* open(Stream* stream,int aid,int vid,int sid); + static Demuxer* open(Stream* stream,libinput_t& libinput,int aid,int vid,int sid); virtual MPXP_Rc open(); virtual int demux(Demuxer_Stream* ds); Modified: mplayerxp/libmpdemux/mpdemux.cpp =================================================================== --- mplayerxp/libmpdemux/mpdemux.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpdemux/mpdemux.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -7,7 +7,7 @@ #include "mpdemux.h" #include "demux_msg.h" -int mpdemux_check_interrupt(libinput_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-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpdemux/mpdemux.h 2012-12-12 17:36:49 UTC (rev 553) @@ -1,5 +1,5 @@ #ifndef MPDEMUX_H #define MPDEMUX_H 1 -extern int mpdemux_check_interrupt(libinput_t* libinput,int time); +extern int mpdemux_check_interrupt(libinput_t& libinput,int time); #endif Modified: mplayerxp/libmpstream2/cache2.cpp =================================================================== --- mplayerxp/libmpstream2/cache2.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/cache2.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -499,7 +499,7 @@ /* main interface here! */ -Cached_Stream::Cached_Stream(libinput_t* libinput,int size,int _min,int prefill,Stream::type_e t) +Cached_Stream::Cached_Stream(libinput_t& libinput,int size,int _min,int prefill,Stream::type_e t) :Stream(t) { int ss=sector_size()>1?sector_size():STREAM_BUFFER_SIZE; Modified: mplayerxp/libmpstream2/cdd.h =================================================================== --- mplayerxp/libmpstream2/cdd.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/cdd.h 2012-12-12 17:36:49 UTC (rev 553) @@ -7,6 +7,9 @@ struct libinput_t; struct cddb_data_t { + cddb_data_t(libinput_t& _libinput):libinput(_libinput) {} + ~cddb_data_t() {} + std::string cddb_hello; unsigned long disc_id; unsigned int tracks; @@ -18,7 +21,7 @@ char* xmcd_file; size_t xmcd_file_size; any_t* user_data; - libinput_t* libinput; + libinput_t& libinput; }; struct cd_toc_t { @@ -74,7 +77,7 @@ virtual ~CDD_Interface(); virtual MPXP_Rc open_cdda(const std::string& dev,const std::string& track); - virtual MPXP_Rc open_cddb(libinput_t*,const std::string& dev,const std::string& track); + virtual MPXP_Rc open_cddb(libinput_t&,const std::string& dev,const std::string& track); virtual int read(char *buf,track_t* trackidx); virtual void seek(off_t pos,track_t *trackidx); Modified: mplayerxp/libmpstream2/cddb.cpp =================================================================== --- mplayerxp/libmpstream2/cddb.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/cddb.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -525,12 +525,11 @@ return 0; } -static MPXP_Rc __FASTCALL__ cddb_resolve(libinput_t*libinput,char **xmcd_file) { +static MPXP_Rc __FASTCALL__ cddb_resolve(libinput_t&libinput,char **xmcd_file) { char cddb_cache_dir[] = DEFAULT_CACHE_DIR; char *home_dir = NULL; - cddb_data_t cddb_data; + cddb_data_t cddb_data(libinput); - cddb_data.libinput=libinput; cddb_data.tracks = read_toc(); cddb_data.disc_id = cddb_discid(cddb_data.tracks); cddb_data.anonymous = 1; // Don't send user info by default @@ -733,7 +732,7 @@ return MPXP_Ok; } -MPXP_Rc CDD_Interface::open_cddb(libinput_t *libinput,const std::string& dev, const std::string& track) { +MPXP_Rc CDD_Interface::open_cddb(libinput_t& libinput,const std::string& dev, const std::string& track) { char *xmcd_file = NULL; MPXP_Rc ret; Modified: mplayerxp/libmpstream2/s_cdd.cpp =================================================================== --- mplayerxp/libmpstream2/s_cdd.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_cdd.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -20,7 +20,7 @@ namespace mpxp { class Cdda_Stream_Interface : public Stream_Interface { public: - Cdda_Stream_Interface(libinput_t* libinput); + Cdda_Stream_Interface(libinput_t& libinput); virtual ~Cdda_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -40,7 +40,7 @@ track_t track_idx; }; -Cdda_Stream_Interface::Cdda_Stream_Interface(libinput_t* libinput) +Cdda_Stream_Interface::Cdda_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), priv(new(zeromem) CDD_Interface), track_idx(255) {} @@ -119,7 +119,7 @@ return MPXP_False; } -static Stream_Interface* query_cdda_interface(libinput_t* libinput) { return new(zeromem) Cdda_Stream_Interface(libinput); } +static Stream_Interface* query_cdda_interface(libinput_t& libinput) { return new(zeromem) Cdda_Stream_Interface(libinput); } extern const stream_interface_info_t cdda_stream = { @@ -130,14 +130,14 @@ class Cddb_Stream_Interface : public Cdda_Stream_Interface { public: - Cddb_Stream_Interface(libinput_t* libinput); + Cddb_Stream_Interface(libinput_t& libinput); virtual ~Cddb_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); private: - libinput_t* libinput; + libinput_t& libinput; }; -Cddb_Stream_Interface::Cddb_Stream_Interface(libinput_t*_libinput) +Cddb_Stream_Interface::Cddb_Stream_Interface(libinput_t&_libinput) :Cdda_Stream_Interface(_libinput), libinput(_libinput) {} Cddb_Stream_Interface::~Cddb_Stream_Interface() {} @@ -162,7 +162,7 @@ #endif } -static Stream_Interface* query_cddb_interface(libinput_t* libinput) { return new(zeromem) Cddb_Stream_Interface(libinput); } +static Stream_Interface* query_cddb_interface(libinput_t& libinput) { return new(zeromem) Cddb_Stream_Interface(libinput); } extern const stream_interface_info_t cddb_stream = { "cddb://", Modified: mplayerxp/libmpstream2/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream2/s_dvdnav.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_dvdnav.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -49,7 +49,7 @@ class DvdNav_Stream_Interface : public Stream_Interface { public: - DvdNav_Stream_Interface(libinput_t* libinput); + DvdNav_Stream_Interface(libinput_t& libinput); virtual ~DvdNav_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -93,7 +93,7 @@ float _stream_pts; }; -DvdNav_Stream_Interface::DvdNav_Stream_Interface(libinput_t* libinput) +DvdNav_Stream_Interface::DvdNav_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), hlev(*new(zeromem) dvdnav_highlight_event_t) {} DvdNav_Stream_Interface::~DvdNav_Stream_Interface() { @@ -590,7 +590,7 @@ return MPXP_False; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) DvdNav_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) DvdNav_Stream_Interface(libinput); } extern const stream_interface_info_t dvdnav_stream = { Modified: mplayerxp/libmpstream2/s_dvdread.cpp =================================================================== --- mplayerxp/libmpstream2/s_dvdread.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_dvdread.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -51,7 +51,7 @@ class DvdRead_Stream_Interface : public Stream_Interface { public: - DvdRead_Stream_Interface(libinput_t* libinput); + DvdRead_Stream_Interface(libinput_t& libinput); virtual ~DvdRead_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -112,7 +112,7 @@ off_t _end_pos; }; -DvdRead_Stream_Interface::DvdRead_Stream_Interface(libinput_t* libinput) +DvdRead_Stream_Interface::DvdRead_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), dvd_chapter(1),dvd_angle(1) {} DvdRead_Stream_Interface::~DvdRead_Stream_Interface() {} @@ -780,7 +780,7 @@ return MPXP_False; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) DvdRead_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) DvdRead_Stream_Interface(libinput); } extern const stream_interface_info_t dvdread_stream = { Modified: mplayerxp/libmpstream2/s_file.cpp =================================================================== --- mplayerxp/libmpstream2/s_file.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_file.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -22,7 +22,7 @@ namespace mpxp { class File_Stream_Interface : public Stream_Interface { public: - File_Stream_Interface(libinput_t* libinput); + File_Stream_Interface(libinput_t& libinput); virtual ~File_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -42,7 +42,7 @@ off_t end_pos; }; -File_Stream_Interface::File_Stream_Interface(libinput_t*l) +File_Stream_Interface::File_Stream_Interface(libinput_t&l) :Stream_Interface(l), fd(0),was_open(0),spos(0) {} File_Stream_Interface::~File_Stream_Interface() {} @@ -103,7 +103,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_file_interface(libinput_t* libinput) { return new(zeromem) File_Stream_Interface(libinput); } +static Stream_Interface* query_file_interface(libinput_t& libinput) { return new(zeromem) File_Stream_Interface(libinput); } extern const stream_interface_info_t file_stream = { @@ -114,20 +114,20 @@ class Stdin_Stream_Interface : public File_Stream_Interface { public: - Stdin_Stream_Interface(libinput_t* libinput); + Stdin_Stream_Interface(libinput_t& libinput); virtual ~Stdin_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); }; -Stdin_Stream_Interface::Stdin_Stream_Interface(libinput_t*l):File_Stream_Interface(l) {} +Stdin_Stream_Interface::Stdin_Stream_Interface(libinput_t&l):File_Stream_Interface(l) {} Stdin_Stream_Interface::~Stdin_Stream_Interface() {} MPXP_Rc Stdin_Stream_Interface::open(const std::string& filename,unsigned flags) { UNUSED(filename); return File_Stream_Interface::open("-",flags); } -static Stream_Interface* query_stdin_interface(libinput_t* libinput) { return new(zeromem) Stdin_Stream_Interface(libinput); } +static Stream_Interface* query_stdin_interface(libinput_t& libinput) { return new(zeromem) Stdin_Stream_Interface(libinput); } extern const stream_interface_info_t stdin_stream = { Modified: mplayerxp/libmpstream2/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream2/s_ftp.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_ftp.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -27,7 +27,7 @@ namespace mpxp { class Ftp_Stream_Interface : public Stream_Interface { public: - Ftp_Stream_Interface(libinput_t* libinput); + Ftp_Stream_Interface(libinput_t& libinput); virtual ~Ftp_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -62,7 +62,7 @@ off_t file_len; }; -Ftp_Stream_Interface::Ftp_Stream_Interface(libinput_t* libinput) +Ftp_Stream_Interface::Ftp_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), tcp(libinput,-1) {} Ftp_Stream_Interface::~Ftp_Stream_Interface() { @@ -428,7 +428,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Ftp_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Ftp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t ftp_stream = Modified: mplayerxp/libmpstream2/s_lavc.cpp =================================================================== --- mplayerxp/libmpstream2/s_lavc.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_lavc.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -13,7 +13,7 @@ namespace mpxp { class Lavs_Stream_Interface : public Stream_Interface { public: - Lavs_Stream_Interface(libinput_t* libinput); + Lavs_Stream_Interface(libinput_t& libinput); virtual ~Lavs_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -32,7 +32,7 @@ off_t end_pos; }; -Lavs_Stream_Interface::Lavs_Stream_Interface(libinput_t*libinput) +Lavs_Stream_Interface::Lavs_Stream_Interface(libinput_t&libinput) :Stream_Interface(libinput), ctx(NULL),end_pos(-1) {} Lavs_Stream_Interface::~Lavs_Stream_Interface() { @@ -87,7 +87,7 @@ off_t Lavs_Stream_Interface::sector_size() const { return STREAM_BUFFER_SIZE; } std::string Lavs_Stream_Interface::mime_type() const { return "application/octet-stream"; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Lavs_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Lavs_Stream_Interface(libinput); } extern const stream_interface_info_t lavs_stream = { Modified: mplayerxp/libmpstream2/s_network.cpp =================================================================== --- mplayerxp/libmpstream2/s_network.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_network.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -23,7 +23,7 @@ namespace mpxp { class Network_Stream_Interface : public Stream_Interface { public: - Network_Stream_Interface(libinput_t* libinput); + Network_Stream_Interface(libinput_t& libinput); virtual ~Network_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -43,7 +43,7 @@ networking_t* networking; }; -Network_Stream_Interface::Network_Stream_Interface(libinput_t* libinput) +Network_Stream_Interface::Network_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), tcp(libinput,-1) {} Network_Stream_Interface::~Network_Stream_Interface() { @@ -114,7 +114,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Network_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Network_Stream_Interface(libinput); } extern const stream_interface_info_t network_stream = { Modified: mplayerxp/libmpstream2/s_null.cpp =================================================================== --- mplayerxp/libmpstream2/s_null.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_null.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -10,7 +10,7 @@ namespace mpxp { class Null_Stream_Interface : public Stream_Interface { public: - Null_Stream_Interface(libinput_t* libinput); + Null_Stream_Interface(libinput_t& libinput); virtual ~Null_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -25,7 +25,7 @@ virtual std::string mime_type() const; }; -Null_Stream_Interface::Null_Stream_Interface(libinput_t*libinput):Stream_Interface(libinput) {} +Null_Stream_Interface::Null_Stream_Interface(libinput_t&libinput):Stream_Interface(libinput) {} Null_Stream_Interface::~Null_Stream_Interface() {} MPXP_Rc Null_Stream_Interface::open(const std::string& filename,unsigned flags) { @@ -48,7 +48,7 @@ off_t Null_Stream_Interface::sector_size() const { return 0; } std::string Null_Stream_Interface::mime_type() const { return "application/octet-stream"; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Null_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Null_Stream_Interface(libinput); } extern const stream_interface_info_t null_stream = { Modified: mplayerxp/libmpstream2/s_oss.cpp =================================================================== --- mplayerxp/libmpstream2/s_oss.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_oss.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -30,7 +30,7 @@ namespace mpxp { class Oss_Stream_Interface : public Stream_Interface { public: - Oss_Stream_Interface(libinput_t* libinput); + Oss_Stream_Interface(libinput_t& libinput); virtual ~Oss_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -52,7 +52,7 @@ unsigned _sector_size; }; -Oss_Stream_Interface::Oss_Stream_Interface(libinput_t* libinput) +Oss_Stream_Interface::Oss_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput) {} Oss_Stream_Interface::~Oss_Stream_Interface() {} @@ -272,7 +272,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Oss_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Oss_Stream_Interface(libinput); } extern const stream_interface_info_t oss_stream = { Modified: mplayerxp/libmpstream2/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -29,7 +29,7 @@ namespace mpxp { class Rtsp_Stream_Interface : public Stream_Interface { public: - Rtsp_Stream_Interface(libinput_t* libinput); + Rtsp_Stream_Interface(libinput_t& libinput); virtual ~Rtsp_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -49,7 +49,7 @@ Tcp tcp; }; -Rtsp_Stream_Interface::Rtsp_Stream_Interface(libinput_t* _libinput) +Rtsp_Stream_Interface::Rtsp_Stream_Interface(libinput_t& _libinput) :Stream_Interface(_libinput), tcp(_libinput,-1) {} Rtsp_Stream_Interface::~Rtsp_Stream_Interface() {} @@ -167,7 +167,7 @@ off_t Rtsp_Stream_Interface::sector_size() const { return 1; } std::string Rtsp_Stream_Interface::mime_type() const { return "application/octet-stream"; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Rtsp_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Rtsp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t rtsp_stream = Modified: mplayerxp/libmpstream2/s_tv.cpp =================================================================== --- mplayerxp/libmpstream2/s_tv.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_tv.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -581,7 +581,7 @@ /* fill demux->video and demux->audio */ class Tv_Stream_Interface : public Stream_Interface { public: - Tv_Stream_Interface(libinput_t* libinput); + Tv_Stream_Interface(libinput_t& libinput); virtual ~Tv_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -599,7 +599,7 @@ tvi_handle_t* priv; }; -Tv_Stream_Interface::Tv_Stream_Interface(libinput_t*libinput):Stream_Interface(libinput) {} +Tv_Stream_Interface::Tv_Stream_Interface(libinput_t&libinput):Stream_Interface(libinput) {} Tv_Stream_Interface::~Tv_Stream_Interface() { delete priv; } MPXP_Rc Tv_Stream_Interface::open(const std::string& filename,unsigned flags) @@ -666,7 +666,7 @@ off_t Tv_Stream_Interface::sector_size() const { return 0; } std::string Tv_Stream_Interface::mime_type() const { return "application/octet-stream"; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Tv_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Tv_Stream_Interface(libinput); } extern const stream_interface_info_t tv_stream = { Modified: mplayerxp/libmpstream2/s_udp.cpp =================================================================== --- mplayerxp/libmpstream2/s_udp.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_udp.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -28,7 +28,7 @@ namespace mpxp { class Udp_Stream_Interface : public Stream_Interface { public: - Udp_Stream_Interface(libinput_t* libinput); + Udp_Stream_Interface(libinput_t& libinput); virtual ~Udp_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -49,7 +49,7 @@ Tcp tcp; }; -Udp_Stream_Interface::Udp_Stream_Interface(libinput_t* libinput) +Udp_Stream_Interface::Udp_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput), udp(-1), tcp(libinput,-1) {} @@ -122,7 +122,7 @@ off_t Udp_Stream_Interface::sector_size() const { return 1; } std::string Udp_Stream_Interface::mime_type() const { return "application/octet-stream"; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) Udp_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) Udp_Stream_Interface(libinput); } /* "reuse a bit of code from ftplib written by Thomas Pfau", */ extern const stream_interface_info_t rtsp_stream = Modified: mplayerxp/libmpstream2/s_vcdnav.cpp =================================================================== --- mplayerxp/libmpstream2/s_vcdnav.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/s_vcdnav.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -31,7 +31,7 @@ class VcdNav_Stream_Interface : public Stream_Interface { public: - VcdNav_Stream_Interface(libinput_t* libinput); + VcdNav_Stream_Interface(libinput_t& libinput); virtual ~VcdNav_Stream_Interface(); virtual MPXP_Rc open(const std::string& filename,unsigned flags); @@ -64,7 +64,7 @@ lsn_t vcd_sector_lsn; }; -VcdNav_Stream_Interface::VcdNav_Stream_Interface(libinput_t* libinput) +VcdNav_Stream_Interface::VcdNav_Stream_Interface(libinput_t& libinput) :Stream_Interface(libinput) {} VcdNav_Stream_Interface::~VcdNav_Stream_Interface() { vcdinfo_close(fd); @@ -269,7 +269,7 @@ return MPXP_Unknown; } -static Stream_Interface* query_interface(libinput_t* libinput) { return new(zeromem) VcdNav_Stream_Interface(libinput); } +static Stream_Interface* query_interface(libinput_t& libinput) { return new(zeromem) VcdNav_Stream_Interface(libinput); } extern const stream_interface_info_t vcdnav_stream = { Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/stream.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -119,7 +119,7 @@ int Stream::eof() const { return _eof; } void Stream::eof(int e) { if(!e) reset(); _eof = e; } -MPXP_Rc Stream::open(libinput_t*libinput,const std::string& filename,int* ff) +MPXP_Rc Stream::open(libinput_t&libinput,const std::string& filename,int* ff) { unsigned i,done; unsigned mrl_len; Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/stream.h 2012-12-12 17:36:49 UTC (rev 553) @@ -58,7 +58,7 @@ static void print_drivers(); - virtual MPXP_Rc open(libinput_t*libinput,const std::string& filename,int* file_format); + virtual MPXP_Rc open(libinput_t&libinput,const std::string& filename,int* file_format); virtual int read(any_t* mem,int total); virtual off_t seek(off_t off); virtual int skip(off_t len); @@ -131,7 +131,7 @@ struct Cached_Stream : public Stream { public: - Cached_Stream(libinput_t* libinput,int size,int _min,int prefill,Stream::type_e type=Stream::Type_Unknown); + Cached_Stream(libinput_t& libinput,int size,int _min,int prefill,Stream::type_e type=Stream::Type_Unknown); virtual ~Cached_Stream(); virtual int read(any_t* mem,int total); Modified: mplayerxp/libmpstream2/stream_internal.h =================================================================== --- mplayerxp/libmpstream2/stream_internal.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/stream_internal.h 2012-12-12 17:36:49 UTC (rev 553) @@ -11,7 +11,7 @@ /** Stream-driver interface */ class Stream_Interface : public Opaque { public: - Stream_Interface(libinput_t*) {} + Stream_Interface(libinput_t&) {} virtual ~Stream_Interface() {} /** Opens stream with given name * @param libinput points libinput2 @@ -68,7 +68,7 @@ struct stream_interface_info_t { const char* mrl; /**< MRL of stream driver */ const char* descr; /**< description of the driver */ - Stream_Interface* (*query_interface)(libinput_t*); + Stream_Interface* (*query_interface)(libinput_t&); }; } // namespace mpxp #endif Modified: mplayerxp/libmpstream2/tcp.cpp =================================================================== --- mplayerxp/libmpstream2/tcp.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/tcp.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -225,7 +225,7 @@ } } -Tcp::Tcp(libinput_t* _libinput,const std::string& host,int port,tcp_af_e af) +Tcp::Tcp(libinput_t& _libinput,const std::string& host,int port,tcp_af_e af) :_fd(-1), _error(Tcp::Err_None), libinput(_libinput) @@ -233,7 +233,7 @@ open(host,port,af); } -Tcp::Tcp(libinput_t* _libinput,net_fd_t fd) +Tcp::Tcp(libinput_t& _libinput,net_fd_t fd) :_fd(fd), _error(Tcp::Err_None), libinput(_libinput) @@ -267,5 +267,5 @@ int Tcp::write(const uint8_t* buf,unsigned len,int flags) const { return ::send(_fd,buf,len,flags); } int Tcp::established() const { return _fd > 0; } Tcp::tcp_error_e Tcp::error() const { return _error; } -libinput_t* Tcp::get_libinput() const { return libinput; } +libinput_t& Tcp::get_libinput() const { return libinput; } } // namespace mpxp Modified: mplayerxp/libmpstream2/tcp.h =================================================================== --- mplayerxp/libmpstream2/tcp.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libmpstream2/tcp.h 2012-12-12 17:36:49 UTC (rev 553) @@ -39,8 +39,8 @@ Err_Port =-1, /* unable to connect to a particular port */ Err_None =0 /* no error */ }; - Tcp(libinput_t* libinput,net_fd_t fd); - Tcp(libinput_t* libinput,const std::string& host,int port,tcp_af_e af=Tcp::IP4); + Tcp(libinput_t& libinput,net_fd_t fd); + Tcp(libinput_t& libinput,const std::string& host,int port,tcp_af_e af=Tcp::IP4); virtual ~Tcp(); Tcp& operator=(Tcp& other); @@ -49,7 +49,7 @@ virtual int established() const; virtual int has_data(int timeout) const; virtual tcp_error_e error() const; - virtual libinput_t* get_libinput() const; + virtual libinput_t& get_libinput() const; virtual void open(const std::string& host,int port,tcp_af_e af=Tcp::IP4); virtual int read(uint8_t* buf,unsigned len,int flags=0); @@ -58,7 +58,7 @@ private: net_fd_t _fd; tcp_error_e _error; - libinput_t* libinput; + libinput_t& libinput; }; } // namespace mpxp #endif /* TCP_H */ Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -324,7 +324,7 @@ MSG_V("Adding file %s to element entry\n",href.c_str()); } -play_tree_t* ASX_Parser::entryref(libinput_t* libinput,const char* buffer,ASX_Attrib& _attribs) const { +play_tree_t* ASX_Parser::entryref(libinput_t& libinput,const char* buffer,ASX_Attrib& _attribs) const { play_tree_t* pt; std::string href; Stream* stream; @@ -386,7 +386,7 @@ return pt_ref; } -play_tree_t* ASX_Parser::repeat(libinput_t*libinput,const char* buffer,ASX_Attrib& _attribs) { +play_tree_t* ASX_Parser::repeat(libinput_t&libinput,const char* buffer,ASX_Attrib& _attribs) { ASX_Element element; play_tree_t *pt_repeat, *list=NULL, *pt_entry; std::string count; @@ -444,7 +444,7 @@ return pt_repeat; } -play_tree_t* ASX_Parser::build_tree(libinput_t*libinput,const char* buffer,int deep) { +play_tree_t* ASX_Parser::build_tree(libinput_t&libinput,const char* buffer,int deep) { ASX_Element asx_element,element; int r; play_tree_t *asx,*pt_entry,*list = NULL; Modified: mplayerxp/libplaytree/asxparser.h =================================================================== --- mplayerxp/libplaytree/asxparser.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libplaytree/asxparser.h 2012-12-12 17:36:49 UTC (rev 553) @@ -51,7 +51,7 @@ ASX_Parser(); virtual ~ASX_Parser(); - static play_tree_t* build_tree(libinput_t* libinput,const char* buffer, int ref); + static play_tree_t* build_tree(libinput_t& libinput,const char* buffer, int ref); virtual int parse_attribs(const char* buffer,ASX_Attrib& _attribs) const; /* @@ -60,12 +60,12 @@ virtual int get_element(const char** _buffer,ASX_Element& _attribs); int get_line() const { return line; } private: - play_tree_t* repeat(libinput_t*libinput,const char* buffer,ASX_Attrib& _attribs); + play_tree_t* repeat(libinput_t&libinput,const char* buffer,ASX_Attrib& _attribs); void warning_attrib_required(const char *elem, const char *attr) const; void warning_body_parse_error(const char *elem) const; void param(ASX_Attrib& attribs, play_tree_t* pt) const; void ref(ASX_Attrib& attribs, play_tree_t* pt) const; - play_tree_t* entryref(libinput_t* libinput,const char* buffer,ASX_Attrib& _attribs) const; + play_tree_t* entryref(libinput_t& libinput,const char* buffer,ASX_Attrib& _attribs) const; play_tree_t* entry(const char* buffer,ASX_Attrib& _attribs); int line; // Curent line Modified: mplayerxp/libplaytree/playtree.h =================================================================== --- mplayerxp/libplaytree/playtree.h 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libplaytree/playtree.h 2012-12-12 17:36:49 UTC (rev 553) @@ -167,11 +167,11 @@ char* play_tree_iter_get_file(play_tree_iter_t* iter, int d); -play_tree_t* parse_playtree(libinput_t* libinput,Stream * stream); +play_tree_t* parse_playtree(libinput_t& libinput,Stream * stream); play_tree_t* play_tree_cleanup(play_tree_t* pt); -play_tree_t* parse_playlist_file(libinput_t*libinput,const char* file); +play_tree_t* parse_playlist_file(libinput_t&libinput,const char* file); /// \defgroup PtAPI Playtree highlevel API /// \ingroup Playtree Modified: mplayerxp/libplaytree/playtreeparser.cpp =================================================================== --- mplayerxp/libplaytree/playtreeparser.cpp 2012-12-12 16:21:04 UTC (rev 552) +++ mplayerxp/libplaytree/playtreeparser.cpp 2012-12-12 17:36:49 UTC (rev 553) @@ -120,7 +120,7 @@ } -static play_tree_t* parse_asx(libinput_t* libinput,play_tree_parser_t* p) { +static play_tree_t* parse_asx(libinput_t& libinput,play_tree_parser_t* p) { int comments = 0,get_line = 1; char* line = NULL; @@ -340,7 +340,7 @@ retur... [truncated message content] |