mplayerxp-cvslog Mailing List for MplayerXP-mplayer with extra performance (Page 5)
Brought to you by:
olov
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(53) |
Apr
(142) |
May
(129) |
Jun
(160) |
Jul
(102) |
Aug
(14) |
Sep
(50) |
Oct
(27) |
Nov
(52) |
Dec
(41) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(136) |
Feb
(170) |
Mar
(103) |
Apr
(102) |
May
(44) |
Jun
(25) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
(1) |
Nov
|
Dec
(4) |
2004 |
Jan
|
Feb
(21) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
(160) |
Nov
(63) |
Dec
(5) |
2005 |
Jan
(10) |
Feb
(14) |
Mar
(18) |
Apr
(74) |
May
(72) |
Jun
(22) |
Jul
(28) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(91) |
Feb
(71) |
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
(3) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(9) |
Dec
(26) |
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
(17) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(134) |
Dec
(72) |
2008 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
(1) |
Oct
(21) |
Nov
(41) |
Dec
(12) |
2009 |
Jan
(57) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(25) |
Oct
(1) |
Nov
(46) |
Dec
(59) |
2010 |
Jan
(84) |
Feb
(5) |
Mar
|
Apr
(2) |
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(122) |
Nov
(223) |
Dec
(132) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(13) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <nic...@us...> - 2012-12-13 13:52:46
|
Revision: 558 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=558&view=rev Author: nickols_k Date: 2012-12-13 13:52:35 +0000 (Thu, 13 Dec 2012) Log Message: ----------- use m_config_t& instead of m_config_t* + constantization Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpstream2/cdd.h mplayerxp/libmpstream2/cdda.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/playtree.cpp mplayerxp/libplaytree/playtree.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/xmpcore/xmp_context.cpp Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/input2/input.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -1345,7 +1345,7 @@ delete &handle; } -void mp_input_register_options(m_config_t* cfg) { +void mp_input_register_options(m_config_t& cfg) { m_config_register_options(cfg,mp_input_opts); } Modified: mplayerxp/libmpcodecs/ad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpcodecs/ad.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -66,7 +66,7 @@ static unsigned int nddrivers=sizeof(mpcodecs_ad_drivers)/sizeof(ad_functions_t*); -void libmpcodecs_ad_register_options(m_config_t* cfg) +void libmpcodecs_ad_register_options(m_config_t& cfg) { unsigned i; for(i=0;i<nddrivers;i++) { Modified: mplayerxp/libmpcodecs/vd.cpp =================================================================== --- mplayerxp/libmpcodecs/vd.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpcodecs/vd.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -73,7 +73,7 @@ }; static unsigned int nddrivers=sizeof(mpcodecs_vd_drivers)/sizeof(vd_functions_t*); -void libmpcodecs_vd_register_options(m_config_t* cfg) +void libmpcodecs_vd_register_options(m_config_t& cfg) { unsigned i; for(i=0;i<nddrivers;i++) { Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -25,12 +25,6 @@ #define CONFIG_GLOBAL (1<<0) #define CONFIG_RUNNING (1<<1) -#define SET_GLOBAL(c) (c->flags |= CONFIG_GLOBAL) -#define UNSET_GLOBAL(c) (c->flags &= (!CONFIG_GLOBAL)) -#define IS_GLOBAL(c) (c->flags & CONFIG_GLOBAL) -#define SET_RUNNING(c) (c->flags |= CONFIG_RUNNING) -#define IS_RUNNING(c) (c->flags & CONFIG_RUNNING) - #define MAX_RECURSION_DEPTH 8 #ifdef MP_DEBUG @@ -39,21 +33,28 @@ #include "mplayerxp.h" #include "cfgparser.h" +#include "libplaytree/playtree.h" #define MSGT_CLASS MSGT_CFGPARSER #include "mp_msg.h" +inline void SET_GLOBAL(m_config_t& c) { c.flags |= CONFIG_GLOBAL; } +inline void UNSET_GLOBAL(m_config_t& c) { c.flags &= (!CONFIG_GLOBAL); } +inline int IS_GLOBAL(const m_config_t& c) { return c.flags & CONFIG_GLOBAL; } +inline void SET_RUNNING(m_config_t& c) { c.flags |= CONFIG_RUNNING; } +inline int IS_RUNNING(const m_config_t& c) { return c.flags & CONFIG_RUNNING; } + typedef int (*cfg_func_arg_param_t)(const config_t *,const char *,const char *); typedef int (*cfg_func_param_t)(const config_t *,const char *); typedef int (*cfg_func_t)(const config_t *); static void -m_config_save_option(m_config_t* config,const config_t* conf,const char* opt,const char *param) { +m_config_save_option(m_config_t& config,const config_t* conf,const char* opt,const char *param) { config_save_t* save; int sl=0; #ifdef MP_DEBUG assert(config != NULL); - assert(config->cs_level >= 0); + assert(config.cs_level >= 0); assert(conf != NULL); assert(opt != NULL); assert( ! (conf->flags & CONF_NOSAVE)); @@ -69,7 +70,7 @@ MSG_DBG2("Saving option %s\n",opt); - save = config->config_stack[config->cs_level]; + save = config.config_stack[config.cs_level]; if(save) { for(sl = 0; save[sl].opt != NULL; sl++){ @@ -108,17 +109,17 @@ MSG_ERR("Should never append in m_config_save_option : conf->type=%d\n",conf->type); } - config->config_stack[config->cs_level] = save; + config.config_stack[config.cs_level] = save; } -static int m_config_revert_option(m_config_t* config, config_save_t* save) { +static int m_config_revert_option(m_config_t& config, config_save_t* save) { const char* arg = NULL; config_save_t* iter=NULL; int i=-1; #ifdef MP_DEBUG assert(config != NULL); - assert(config->cs_level >= 0); + assert(config.cs_level >= 0); assert(save != NULL); #endif @@ -139,10 +140,10 @@ *((char**)save->opt->p) = reinterpret_cast<char*>(save->param.as_pointer); break; case CONF_TYPE_INCLUDE : - if(config->cs_level > 0) { - for(i = config->cs_level - 1 ; i >= 0 ; i--){ - if(config->config_stack[i] == NULL) continue; - for(iter = config->config_stack[i]; iter != NULL && iter->opt != NULL ; iter++) { + if(config.cs_level > 0) { + for(i = config.cs_level - 1 ; i >= 0 ; i--){ + if(config.config_stack[i] == NULL) continue; + for(iter = config.config_stack[i]; iter != NULL && iter->opt != NULL ; iter++) { if(iter->opt == save->opt && ((save->param.as_pointer == NULL || iter->param.as_pointer == NULL) || strcasecmp((const char *)save->param.as_pointer,(const char *)iter->param.as_pointer) == 0) && (save->opt_name == NULL || @@ -174,80 +175,68 @@ return 1; } -void m_config_push(m_config_t* config) { +void m_config_push(m_config_t& config) { #ifdef MP_DEBUG assert(config != NULL); - assert(config->cs_level >= 0); + assert(config.cs_level >= 0); #endif - config->cs_level++; - config->config_stack = (config_save_t**)mp_realloc(config->config_stack ,sizeof(config_save_t*)*(config->cs_level+1)); - if(config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*(config->cs_level+1),strerror(errno)); - config->cs_level = -1; + config.cs_level++; + config.config_stack = (config_save_t**)mp_realloc(config.config_stack ,sizeof(config_save_t*)*(config.cs_level+1)); + if(config.config_stack == NULL) { + MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*(config.cs_level+1),strerror(errno)); + config.cs_level = -1; return; } - config->config_stack[config->cs_level] = NULL; - MSG_DBG2("Config pushed level=%d\n",config->cs_level); + config.config_stack[config.cs_level] = NULL; + MSG_DBG2("Config pushed level=%d\n",config.cs_level); } -int m_config_pop(m_config_t* config) { +int m_config_pop(m_config_t& config) { int i,ret= 1; config_save_t* cs; #ifdef MP_DEBUG assert(config != NULL); - //assert(config->cs_level > 0); + //assert(config.cs_level > 0); #endif - if(config->config_stack[config->cs_level] != NULL) { - cs = config->config_stack[config->cs_level]; + if(config.config_stack[config.cs_level] != NULL) { + cs = config.config_stack[config.cs_level]; for(i=0; cs[i].opt != NULL ; i++ ) { if (m_config_revert_option(config,&cs[i]) < 0) ret = -1; } - delete config->config_stack[config->cs_level]; + delete config.config_stack[config.cs_level]; } - config->config_stack = (config_save_t**)mp_realloc(config->config_stack ,sizeof(config_save_t*)*config->cs_level); - config->cs_level--; - if(config->cs_level > 0 && config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*config->cs_level,strerror(errno)); - config->cs_level = -1; + config.config_stack = (config_save_t**)mp_realloc(config.config_stack ,sizeof(config_save_t*)*config.cs_level); + config.cs_level--; + if(config.cs_level > 0 && config.config_stack == NULL) { + MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*)*config.cs_level,strerror(errno)); + config.cs_level = -1; return -1; } - MSG_DBG2("Config poped level=%d\n",config->cs_level); + MSG_DBG2("Config poped level=%d\n",config.cs_level); return ret; } -m_config_t* m_config_new(play_tree_t* pt,libinput_t&libinput) { - m_config_t* config; - +m_config_t& m_config_new(play_tree_t* pt,libinput_t&libinput) { #ifdef MP_DEBUG assert(pt != NULL); #endif - - 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; - } - config->config_stack = (config_save_t**)mp_calloc(1,sizeof(config_save_t*)); - if(config->config_stack == NULL) { - MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(config_save_t*),strerror(errno)); - delete config; - return NULL; - } + m_config_t& config = *new(zeromem) m_config_t(libinput); + config.config_stack = (config_save_t**)mp_calloc(1,sizeof(config_save_t*)); SET_GLOBAL(config); // We always start with global options - config->pt = pt; + config.pt = pt; return config; } -static void m_config_add_dynamic(m_config_t *conf,any_t*ptr) { - if(!conf->dynasize) conf->dynamics = (any_t**)mp_malloc(sizeof(any_t*)); - else conf->dynamics = (any_t**)mp_realloc(conf->dynamics,(conf->dynasize+1)*sizeof(any_t*)); - conf->dynamics[conf->dynasize] = ptr; - conf->dynasize++; +static void m_config_add_dynamic(m_config_t& conf,any_t*ptr) { + if(!conf.dynasize) conf.dynamics = (any_t**)mp_malloc(sizeof(any_t*)); + else conf.dynamics = (any_t**)mp_realloc(conf.dynamics,(conf.dynasize+1)*sizeof(any_t*)); + conf.dynamics[conf.dynasize] = ptr; + conf.dynasize++; } void m_config_free(m_config_t* config) { @@ -264,36 +253,36 @@ } -static int init_conf(m_config_t *config, int mode) +static int init_conf(m_config_t& config, int mode) { #ifdef MP_DEBUG assert(config != NULL); - assert(config->pt != NULL); - assert(config->last_entry == NULL || config->last_entry->parent == config->pt); + assert(config.pt != NULL); + assert(config.last_entry == NULL || config.last_entry->parent == config.pt); if (mode != COMMAND_LINE && mode != CONFIG_FILE) { MSG_ERR( "init_conf: wrong mode!\n"); return -1; } #endif - config->parser_mode = mode; - config->dynamics=NULL; - config->dynasize=0; + config.parser_mode = mode; + config.dynamics=NULL; + config.dynasize=0; return 1; } -static int config_is_entry_option(m_config_t *config,const char *opt,const char *param) { +static int config_is_entry_option(m_config_t& config,const char *opt,const char *param) { play_tree_t* entry = NULL; #ifdef MP_DEBUG - assert(config->pt != NULL); + assert(config.pt != NULL); #endif if(strcasecmp(opt,"playlist") == 0) { // We handle playlist here if(!param) return ERR_MISSING_PARAM; - entry = parse_playlist_file(config->libinput,param); + entry = parse_playlist_file(config.libinput,param); if(!entry) { MSG_ERR( "Playlist parsing failed: %s\n",param); return 1; @@ -301,25 +290,25 @@ } if(entry) { - if(config->last_entry) - play_tree_append_entry(config->last_entry,entry); + if(config.last_entry) + play_tree_append_entry(config.last_entry,entry); else - play_tree_set_child(config->pt,entry); - config->last_entry = entry; - if(config->parser_mode == COMMAND_LINE) + play_tree_set_child(config.pt,entry); + config.last_entry = entry; + if(config.parser_mode == COMMAND_LINE) UNSET_GLOBAL(config); return 1; } else return 0; } -static MPXP_Rc cfg_include(m_config_t* conf,const char *filename){ +static MPXP_Rc cfg_include(m_config_t& conf,const char *filename){ return m_config_parse_config_file(conf, filename); } static int cfg_inc_int(int value){ return ++value; } -static int config_read_option(m_config_t *config,const config_t** conf_list,const char *opt,const char *param) +static int config_read_option(m_config_t& config,const config_t** conf_list,const char *opt,const char *param) { int i=0,nconf = 0; long tmp_int; @@ -356,12 +345,12 @@ MSG_DBG3( "read_option: name='%s' p=%p type=%d\n", conf[i].name, conf[i].p, conf[i].type); - if (conf[i].flags & CONF_NOCFG && config->parser_mode == CONFIG_FILE) { + if (conf[i].flags & CONF_NOCFG && config.parser_mode == CONFIG_FILE) { MSG_ERR( "this option can only be used on command line:\n", opt); ret = ERR_NOT_AN_OPTION; goto out; } - if (conf[i].flags & CONF_NOCMD && config->parser_mode == COMMAND_LINE) { + if (conf[i].flags & CONF_NOCMD && config.parser_mode == COMMAND_LINE) { MSG_ERR( "this option can only be used in config file:\n", opt); ret = ERR_NOT_AN_OPTION; goto out; @@ -379,7 +368,7 @@ switch (conf[i].type) { case CONF_TYPE_FLAG: /* flags need a parameter in config file */ - if (config->parser_mode == CONFIG_FILE) { + if (config.parser_mode == CONFIG_FILE) { if (!strcasecmp(param, "yes") || /* any other language? */ !strcasecmp(param, "ja") || !strcasecmp(param, "si") || @@ -531,7 +520,7 @@ sublist[0] = subconf; for (subconf_optnr = 0; subconf[subconf_optnr].name != NULL; subconf_optnr++) /* NOTHING */; - config->sub_conf = opt; + config.sub_conf = opt; token = strtok(p, (char *)&(":")); while(token) { @@ -561,7 +550,7 @@ } token = strtok(NULL, (char *)&(":")); } - config->sub_conf = NULL; + config.sub_conf = NULL; delete subparam; delete subopt; delete p; @@ -578,14 +567,14 @@ } out: if(ret >= 0 && ! IS_RUNNING(config) && ! IS_GLOBAL(config) && ! (conf[i].flags & CONF_GLOBAL) && conf[i].type != CONF_TYPE_SUBCONFIG ) { - play_tree_t* dest = config->last_entry ? config->last_entry : config->last_parent; + play_tree_t* dest = config.last_entry ? config.last_entry : config.last_parent; char* o; #ifdef MP_DEBUG assert(dest != NULL); #endif - if(config->sub_conf) { - o = new char [(strlen(config->sub_conf) + 1 + strlen(opt) + 1)]; - sprintf(o,"%s:%s",config->sub_conf,opt); + if(config.sub_conf) { + o = new char [(strlen(config.sub_conf) + 1 + strlen(opt) + 1)]; + sprintf(o,"%s:%s",config.sub_conf,opt); } else o =mp_strdup(opt); @@ -603,18 +592,18 @@ goto out; } -static const config_t* m_config_find_option(const config_t **list,const char *name); +static const config_t* m_config_find_option(const config_t**list,const char *name); -int m_config_set_option(m_config_t *config,const char *opt,const char *param) { +int m_config_set_option(m_config_t& config,const char *opt,const char *param) { const char *e; - const config_t **clist=config->opt_list; + const config_t**clist=config.opt_list; #ifdef MP_DEBUG assert(config != NULL); - assert(config->opt_list != NULL); + assert(config.opt_list != NULL); assert(opt != NULL); #endif MSG_DBG2( "Setting option %s=%s\n",opt,param); - clist = config->opt_list; + clist = config.opt_list; #if 1 if(strchr(opt,'.')) { int flg,ret; @@ -639,10 +628,10 @@ MSG_DBG2("switching next subconf=%s\n",subconf->name); } }while(1); - flg=config->flags; - config->flags|=CONFIG_GLOBAL; + flg=config.flags; + config.flags|=CONFIG_GLOBAL; ret=config_read_option(config,olist,opt,param); - config->flags=flg; + config.flags=flg; return ret; } #endif @@ -667,10 +656,10 @@ return ret; } - return config_read_option(config,config->opt_list,opt,param); + return config_read_option(config,config.opt_list,opt,param); } -MPXP_Rc m_config_parse_config_file(m_config_t *config,const char *conffile) +MPXP_Rc m_config_parse_config_file(m_config_t& config,const char *conffile) { #define PRINT_LINENUM MSG_ERR("%s(%d): ", conffile, line_num) #define MAX_LINE_LEN 1000 @@ -693,9 +682,9 @@ assert(config != NULL); // assert(conf_list != NULL); #endif - if (++config->recursion_depth > 1) MSG_INFO("Reading config file: %s", conffile); + if (++config.recursion_depth > 1) MSG_INFO("Reading config file: %s", conffile); - if (config->recursion_depth > MAX_RECURSION_DEPTH) { + if (config.recursion_depth > MAX_RECURSION_DEPTH) { MSG_FATAL(": too deep 'include'. check your configfiles\n"); ret = MPXP_False; goto out; @@ -713,12 +702,12 @@ } if ((fp = fopen(conffile, "r")) == NULL) { - if (config->recursion_depth > 1) MSG_ERR(": %s\n", strerror(errno)); + if (config.recursion_depth > 1) MSG_ERR(": %s\n", strerror(errno)); delete line; ret = MPXP_Ok; goto out; } - if (config->recursion_depth > 1) MSG_FATAL("\n"); + if (config.recursion_depth > 1) MSG_FATAL("\n"); while (fgets(line, MAX_LINE_LEN, fp)) { if (errors >= 16) { @@ -854,11 +843,11 @@ delete line; fclose(fp); out: - --config->recursion_depth; + --config.recursion_depth; return ret; } -MPXP_Rc m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) +MPXP_Rc m_config_parse_command_line(m_config_t& config, int argc, char **argv, char **envp) { int i; int tmp; @@ -868,16 +857,16 @@ #ifdef MP_DEBUG assert(config != NULL); - assert(config->pt != NULL); + assert(config.pt != NULL); assert(argv != NULL); assert(envp != NULL); assert(argc >= 1); #endif if (init_conf(config, COMMAND_LINE) == -1) return MPXP_False; - if(config->last_parent == NULL) config->last_parent = config->pt; + if(config.last_parent == NULL) config.last_parent = config.pt; /* in order to work recursion detection properly in parse_config_file */ - ++config->recursion_depth; + ++config.recursion_depth; for (i = 1; i < argc; i++) { //next: @@ -902,23 +891,23 @@ if((opt[0] == '{') && (opt[1] == '\0')) { play_tree_t* entry = play_tree_new(); UNSET_GLOBAL(config); - if(config->last_entry == NULL) { - play_tree_set_child(config->last_parent,entry); + if(config.last_entry == NULL) { + play_tree_set_child(config.last_parent,entry); } else { - play_tree_append_entry(config->last_entry,entry); - config->last_entry = NULL; + play_tree_append_entry(config.last_entry,entry); + config.last_entry = NULL; } - config->last_parent = entry; + config.last_parent = entry; continue; } if((opt[0] == '}') && (opt[1] == '\0')) { - if( ! config->last_parent || ! config->last_parent->parent) { + if( ! config.last_parent || ! config.last_parent->parent) { MSG_ERR( "too much }-\n"); goto err_out; } - config->last_entry = config->last_parent; - config->last_parent = config->last_entry->parent; + config.last_entry = config.last_parent; + config.last_parent = config.last_entry->parent; continue; } @@ -973,14 +962,14 @@ if(strcasecmp(argv[i],"-") == 0) m_config_set_option(config,"use-stdin",NULL); /* opt is not an option -> treat it as a filename */ UNSET_GLOBAL(config); // We start entry specific options - if(config->last_entry == NULL) play_tree_set_child(config->last_parent,entry); - else play_tree_append_entry(config->last_entry,entry); - config->last_entry = entry; + if(config.last_entry == NULL) play_tree_set_child(config.last_parent,entry); + else play_tree_append_entry(config.last_entry,entry); + config.last_entry = entry; } } - --config->recursion_depth; - if(config->last_parent != config->pt) MSG_ERR("Missing }- ?\n"); + --config.recursion_depth; + if(config.last_parent != config.pt) MSG_ERR("Missing }- ?\n"); UNSET_GLOBAL(config); SET_RUNNING(config); return MPXP_Ok; @@ -989,14 +978,14 @@ MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); #endif err_out: - --config->recursion_depth; + --config.recursion_depth; MSG_ERR( "command line: %s\n", argv[i]); return MPXP_False; } -int m_config_register_options(m_config_t *config,const config_t *args) { +int m_config_register_options(m_config_t& config,const config_t *args) { int list_len = 0; - const config_t** conf_list = config->opt_list; + const config_t** conf_list = config.opt_list; #ifdef MP_DEBUG assert(config != NULL); @@ -1016,7 +1005,7 @@ conf_list[list_len] = args; conf_list[list_len+1] = NULL; - config->opt_list = conf_list; + config.opt_list = conf_list; return 1; } @@ -1036,7 +1025,7 @@ return NULL; } -const config_t* m_config_get_option(m_config_t const*config,const char* arg) { +const config_t* m_config_get_option(const m_config_t& config,const char* arg) { const char *e; const config_t **conf_list; const config_t* cl[] = { NULL, NULL }; @@ -1057,11 +1046,11 @@ conf_list = cl; delete s; } else - conf_list = config->opt_list; + conf_list = config.opt_list; return m_config_find_option(conf_list,arg); } -any_t* m_config_get_option_ptr(m_config_t const*config,const char* arg) { +any_t* m_config_get_option_ptr(const m_config_t& config,const char* arg) { const config_t* conf; #ifdef MP_DEBUG @@ -1074,7 +1063,7 @@ return conf->p; } -int m_config_get_int (m_config_t const *config,const char* arg,int* err_ret) { +int m_config_get_int (const m_config_t& config,const char* arg,int* err_ret) { int *ret; #ifdef MP_DEBUG @@ -1093,7 +1082,7 @@ return (*ret); } -float m_config_get_float (m_config_t const *config,const char* arg,int* err_ret) { +float m_config_get_float (const m_config_t& config,const char* arg,int* err_ret) { float *ret; #ifdef MP_DEBUG @@ -1112,9 +1101,10 @@ return (*ret); } -#define AS_INT(c) (*((int*)c->p)) +inline int AS_INT(const config_t* c) { return *((int*)c->p); } +inline void AS_INT(const config_t* c,int val) { *((int*)c->p)=val; } -int m_config_set_int(m_config_t *config,const char* arg,int val) { +int m_config_set_int(m_config_t& config,const char* arg,int val) { const config_t* opt; #ifdef MP_DEBUG @@ -1133,12 +1123,12 @@ return ERR_OUT_OF_RANGE; m_config_save_option(config,opt,arg,NULL); - AS_INT(opt) = val; + AS_INT(opt,val); return 1; } -int m_config_set_float(m_config_t *config,const char* arg,float val) { +int m_config_set_float(m_config_t& config,const char* arg,float val) { const config_t* opt; #ifdef MP_DEBUG @@ -1163,7 +1153,7 @@ } -int m_config_switch_flag(m_config_t *config,const char* opt) { +int m_config_switch_flag(m_config_t& config,const char* opt) { const config_t *conf; #ifdef MP_DEBUG @@ -1173,14 +1163,14 @@ conf = m_config_get_option(config,opt); if(!conf || conf->type != CONF_TYPE_FLAG) return 0; - if( AS_INT(conf) == conf->min) AS_INT(conf) = conf->max; - else if(AS_INT(conf) == conf->max) AS_INT(conf) = conf->min; + if( AS_INT(conf) == conf->min) AS_INT(conf,conf->max); + else if(AS_INT(conf) == conf->max) AS_INT(conf,conf->min); else return 0; return 1; } -int m_config_set_flag(m_config_t* config,const char* opt, int state) { +int m_config_set_flag(m_config_t& config,const char* opt, int state) { const config_t *conf; #ifdef MP_DEBUG @@ -1190,30 +1180,26 @@ conf = m_config_get_option(config,opt); if(!conf || conf->type != CONF_TYPE_FLAG) return 0; - if(state) AS_INT(conf) = conf->max; - else AS_INT(conf) = conf->min; + if(state) AS_INT(conf,conf->max); + else AS_INT(conf,conf->min); return 1; } -int m_config_get_flag(m_config_t const *config,const char* opt) { - const config_t *conf; +int m_config_get_flag(const m_config_t& config,const char* opt) { #ifdef MP_DEBUG assert(config != NULL); assert(opt != NULL); #endif - conf = m_config_get_option(config,opt); + const config_t* conf = m_config_get_option(config,opt); if(!conf || conf->type != CONF_TYPE_FLAG) return -1; - if(AS_INT(conf) == conf->max) - return 1; - else if(AS_INT(conf) == conf->min) - return 0; - else - return -1; + if(AS_INT(conf) == conf->max) return 1; + else if(AS_INT(conf) == conf->min) return 0; + return -1; } -int m_config_is_option_set(m_config_t const*config,const char* arg) { +int m_config_is_option_set(const m_config_t& config,const char* arg) { const config_t* opt; config_save_t* save; int l,i; @@ -1228,8 +1214,8 @@ if(!opt) return -1; - for(l = config->cs_level ; l >= 0 ; l--) { - save = config->config_stack[l]; + for(l = config.cs_level ; l >= 0 ; l--) { + save = config.config_stack[l]; if(!save) continue; for(i = 0 ; save[i].opt != NULL ; i++) { @@ -1330,12 +1316,12 @@ }; } -void m_config_show_options(const m_config_t *args) { +void m_config_show_options(const m_config_t& args) { unsigned j; const config_t *opts; j=0; MSG_INFO("List of available command-line options:\n"); - while((opts=args->opt_list[j])!=NULL) { + while((opts=args.opt_list[j])!=NULL) { __m_config_show_options(2,NULL,opts); j++; }; Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-13 13:52:35 UTC (rev 558) @@ -8,7 +8,7 @@ namespace mpxp { struct libinput_t; } - +struct play_tree_t; /* config types */ enum { CONF_TYPE_FLAG =0, @@ -40,8 +40,6 @@ typedef struct m_config m_config_t; typedef struct config_save config_save_t; -#include "libplaytree/playtree.h" - struct config_t { const char *name; any_t* const p; @@ -86,31 +84,31 @@ * 0 if can't open configfile * 1 on success */ -MPXP_Rc m_config_parse_config_file(m_config_t *config,const char *conffile); +MPXP_Rc m_config_parse_config_file(m_config_t& config,const char *conffile); /* parse_command_line returns: * -1 on error (invalid option...) * 1 otherwise */ -MPXP_Rc m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); +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); -void m_config_push(m_config_t* config); +void m_config_push(m_config_t& config); /* * Return 0 on error 1 on success */ -int m_config_pop(m_config_t* config); +int m_config_pop(m_config_t& config); /* * Return 0 on error 1 on success */ -int m_config_register_options(m_config_t *config,const config_t *args); +int m_config_register_options(m_config_t& config,const config_t *args); -void m_config_show_options(const m_config_t* args); +void m_config_show_options(const m_config_t& args); /* * For all the following function when it's a subconfig option @@ -120,55 +118,55 @@ /** Return 1 on sucess 0 on failure **/ -int m_config_set_option(m_config_t *config,const char *opt,const char *param); +int m_config_set_option(m_config_t& config,const char *opt,const char *param); /** Get the config struct defining an option * @return NULL on error **/ -const config_t* m_config_get_option(m_config_t const *config,const char* arg); +const config_t* m_config_get_option(const m_config_t& config,const char* arg); /** Get the p field of the struct defining an option * @return NULL on error **/ -any_t* m_config_get_option_ptr(m_config_t const *config,const char* arg); +any_t* m_config_get_option_ptr(const m_config_t& config,const char* arg); /** Tell is an option is alredy set or not * @return -1 one error (requested option arg exist) otherwise 0 or 1 **/ -int m_config_is_option_set(m_config_t const*config,const char* arg); +int m_config_is_option_set(const m_config_t& config,const char* arg); /** Return 0 on error 1 on success **/ -int m_config_switch_flag(m_config_t *config,const char* opt); +int m_config_switch_flag(m_config_t& config,const char* opt); /** Return 0 on error 1 on success **/ -int m_config_set_flag(m_config_t *config,const char* opt, int max); +int m_config_set_flag(m_config_t& config,const char* opt, int max); /** Return the value of a flag (O or 1) and -1 on error **/ -int m_config_get_flag(m_config_t const *config,const char* opt); +int m_config_get_flag(const m_config_t& config,const char* opt); /** Set the value of an int option * @return 0 on error 1 on success **/ -int m_config_set_int(m_config_t *config,const char* arg,int val); +int m_config_set_int(m_config_t& config,const char* arg,int val); /** Get the value of an int option * @param err_ret If it is not NULL it's set to 1 on error * @return the option value or -1 on error **/ -int m_config_get_int (m_config_t const *config,const char* arg,int* err_ret); +int m_config_get_int (const m_config_t&,const char* arg,int* err_ret); /** Set the value of a float option * @return 0 on error 1 on success **/ -int m_config_set_float(m_config_t *config,const char* arg,float val); +int m_config_set_float(m_config_t& config,const char* arg,float val); /** Get the value of a float option * @param err_ret If it is not NULL it's set to 1 on error * @return the option value or -1 on error **/ -float m_config_get_float (m_config_t const *config,const char* arg,int* err_ret); +float m_config_get_float (const m_config_t&,const char* arg,int* err_ret); #endif /* __CONFIG_H */ Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -119,7 +119,7 @@ const demuxer_driver_t* driver; /**< driver associated with this demuxer */ }; -void libmpdemux_register_options(m_config_t* cfg) +void libmpdemux_register_options(m_config_t& cfg) { unsigned i; for(i=0;ddrivers[i];i++) { @@ -469,7 +469,7 @@ delete ad; ad = NULL; } else if(ad->audio->sh && ((sh_audio_t*)ad->audio->sh)->wtag == 0x55) // MP3 - m_config_set_flag(mpxp_context().mconfig,"mp3.hr-seek",1); // Enable high res seeking + m_config_set_flag(*mpxp_context().mconfig,"mp3.hr-seek",1); // Enable high res seeking } if(ss) { sd = new(zeromem) Demuxer(ss,-2,-2,dvdsub_id); @@ -534,7 +534,7 @@ { NULL, NULL, 0, 0, 0, 0, NULL} }; -void demuxer_register_options(m_config_t* cfg) { +void demuxer_register_options(m_config_t& cfg) { m_config_register_options(cfg,demuxer_opts); } Modified: mplayerxp/libmpstream2/cdd.h =================================================================== --- mplayerxp/libmpstream2/cdd.h 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpstream2/cdd.h 2012-12-13 13:52:35 UTC (rev 558) @@ -100,6 +100,6 @@ lsn_t end_sector; }; - void cdda_register_options(m_config_t* cfg); + void cdda_register_options(m_config_t& cfg); } // namespace mpxp #endif // __CDD_H__ Modified: mplayerxp/libmpstream2/cdda.cpp =================================================================== --- mplayerxp/libmpstream2/cdda.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libmpstream2/cdda.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -33,7 +33,7 @@ { NULL,NULL, 0, 0, 0, 0, NULL} }; -void cdda_register_options(m_config_t* cfg) { +void cdda_register_options(m_config_t& cfg) { m_config_register_options(cfg,cdda_conf); } Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -299,7 +299,7 @@ return; } val = cattribs.get("VALUE"); - if(m_config_get_option(mpxp_context().mconfig,name.c_str()) == NULL) { + if(m_config_get_option(*mpxp_context().mconfig,name.c_str()) == NULL) { MSG_WARN("Found unknow param in asx: %s",name.c_str()); if(!val.empty())MSG_WARN("=%s\n",val.c_str()); else MSG_WARN("\n"); Modified: mplayerxp/libplaytree/playtree.cpp =================================================================== --- mplayerxp/libplaytree/playtree.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libplaytree/playtree.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -442,7 +442,7 @@ play_tree_t* pt; #ifdef MP_DEBUG assert(iter != NULL); - assert(iter->config != NULL); + assert(*iter->config != NULL); assert(iter->tree != NULL); #endif @@ -450,7 +450,7 @@ // We always push a config because we can set some option // while playing - m_config_push(iter->config); + m_config_push(*iter->config); if(pt->params == NULL) return; @@ -458,7 +458,7 @@ for(n = 0; pt->params[n].name != NULL ; n++) { int e; - if((e = m_config_set_option(iter->config,pt->params[n].name,pt->params[n].value)) < 0) { + if((e = m_config_set_option(*iter->config,pt->params[n].name,pt->params[n].value)) < 0) { MSG_ERR("Error %d while setting option '%s' with value '%s'\n",e, pt->params[n].name,pt->params[n].value); } @@ -470,7 +470,7 @@ } play_tree_iter_t* -play_tree_iter_new(play_tree_t* pt,m_config_t* config) { +play_tree_iter_new(play_tree_t* pt,m_config_t& config) { play_tree_iter_t* iter; #ifdef MP_DEBUG @@ -485,7 +485,7 @@ if(! iter) return NULL; iter->root = pt; iter->tree = NULL; - iter->config = config; + iter->config = &config; if(pt->parent) iter->loop = pt->parent->loop; @@ -562,7 +562,7 @@ if(iter->config && iter->entry_pushed > 0) { iter->entry_pushed = 0; - m_config_pop(iter->config); + m_config_pop(*iter->config); } if(iter->tree->parent && (iter->tree->parent->flags & PLAY_TREE_RND)) @@ -712,7 +712,7 @@ // Pop subtree params if(iter->config) { - m_config_pop(iter->config); + m_config_pop(*iter->config); if(iter->mode == PLAY_TREE_ITER_RND) iter->tree->flags |= PLAY_TREE_RND_PLAYED; } @@ -759,9 +759,9 @@ // This is used as a file name for vcd/tv/dvd char playtree_ret_filename[256]; -char* +const char* play_tree_iter_get_file(play_tree_iter_t* iter, int d) { - char* entry; + const char* entry; #ifdef MP_DEBUG assert(iter != NULL); assert(iter->tree->child == NULL); @@ -794,22 +794,23 @@ case PLAY_TREE_ENTRY_DVD : if(strlen(entry) == 0) entry = "1"; if(iter->config) - m_config_set_option(iter->config,"dvd",entry); + m_config_set_option(*iter->config,"dvd",entry); snprintf(playtree_ret_filename,255,"DVD title %s",entry); return playtree_ret_filename; case PLAY_TREE_ENTRY_VCD : if(strlen(entry) == 0) entry = "1"; if(iter->config) - m_config_set_option(iter->config,"vcd",entry); + m_config_set_option(*iter->config,"vcd",entry); snprintf(playtree_ret_filename,255,"vcd://%s",entry); return playtree_ret_filename; case PLAY_TREE_ENTRY_TV : { if(strlen(entry) != 0) { - char *s,*e, *val = (char*)mp_malloc(strlen(entry) + 11 + 1); + char *s,*val = (char*)mp_malloc(strlen(entry) + 11 + 1); + const char* e; sprintf(val,"on:channel=%s",entry); if(iter->config) - m_config_set_option(iter->config,"tv",val); + m_config_set_option(*iter->config,"tv",val); s = playtree_ret_filename + sprintf(playtree_ret_filename,"TV channel "); e = strchr(entry,':'); if(!e) strncpy(s,entry,255-11); @@ -822,7 +823,7 @@ return playtree_ret_filename; } else { if(iter->config) - m_config_set_option(iter->config,"tv","on"); + m_config_set_option(*iter->config,"tv","on"); return "TV"; } } @@ -895,7 +896,7 @@ // HIGH Level API, by Fabian Franz (mp...@fa...) // -play_tree_iter_t* pt_iter_create(play_tree_t** ppt, m_config_t* config) +play_tree_iter_t* pt_iter_create(play_tree_t** ppt, m_config_t& config) { play_tree_iter_t* r=NULL; #ifdef MP_DEBUG @@ -925,10 +926,10 @@ } } -char* pt_iter_get_file(play_tree_iter_t* iter, int d) +const char* pt_iter_get_file(play_tree_iter_t* iter, int d) { int i=0; - char* r; + const char* r; if (iter==NULL) return NULL; Modified: mplayerxp/libplaytree/playtree.h =================================================================== --- mplayerxp/libplaytree/playtree.h 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/libplaytree/playtree.h 2012-12-13 13:52:35 UTC (rev 558) @@ -37,10 +37,6 @@ /// \defgroup Playtree ///@{ -typedef struct play_tree play_tree_t; -typedef struct play_tree_iter play_tree_iter_t; -typedef struct play_tree_param play_tree_param_t; - #include "libmpconf/cfgparser.h" #if 0 @@ -55,12 +51,12 @@ } #endif -struct play_tree_param { +struct play_tree_param_t { char* name; char* value; }; -struct play_tree { +struct play_tree_t { play_tree_t* parent; play_tree_t* child; play_tree_t* next; @@ -74,18 +70,18 @@ int flags; }; -struct play_tree_iter { - play_tree_t* root; // Iter root tree - play_tree_t* tree; // Current tree - m_config_t* config; - int loop; // Looping status - int file; - int num_files; - int entry_pushed; - int mode; +struct play_tree_iter_t { + play_tree_t* root; // Iter root tree + play_tree_t* tree; // Current tree + m_config_t* config; + int loop; // Looping status + int file; + int num_files; + int entry_pushed; + int mode; - int* status_stack; // loop/valid stack to save/revert status when we go up/down - int stack_size; // status stack size + int* status_stack; // loop/valid stack to save/revert status when we go up/down + int stack_size; // status stack size }; play_tree_t* play_tree_new(void); @@ -145,7 +141,7 @@ /// Iterator play_tree_iter_t* -play_tree_iter_new(play_tree_t* pt, m_config_t* config); +play_tree_iter_new(play_tree_t* pt, m_config_t& config); play_tree_iter_t* play_tree_iter_new_copy(play_tree_iter_t const* old); @@ -165,7 +161,7 @@ int // Enter a node child list play_tree_iter_down_step(play_tree_iter_t* iter, int d,int with_nodes); -char* play_tree_iter_get_file(play_tree_iter_t* iter, int d); +const char* play_tree_iter_get_file(play_tree_iter_t* iter, int d); play_tree_t* parse_playtree(libinput_t& libinput,Stream * stream); @@ -186,11 +182,11 @@ void pt_iter_destroy(play_tree_iter_t** iter); /// Gets the next available file in the direction (d=-1 || d=+1). -char* pt_iter_get_file(play_tree_iter_t* iter, int d); +const char* pt_iter_get_file(play_tree_iter_t* iter, int d); // Two Macros that implement forward and backward direction. -static inline char* pt_iter_get_next_file(play_tree_iter_t* iter) { return pt_iter_get_file(iter, 1); } -static inline char* pt_iter_get_prev_file(play_tree_iter_t* iter) { return pt_iter_get_file(iter, -1); } +static inline const char* pt_iter_get_next_file(play_tree_iter_t* iter) { return pt_iter_get_file(iter, 1); } +static inline const char* pt_iter_get_prev_file(play_tree_iter_t* iter) { return pt_iter_get_file(iter, -1); } /// Inserts entry into the playtree. void pt_iter_insert_entry(play_tree_iter_t* iter, play_tree_t* entry); Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/mplayerxp.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -38,6 +38,7 @@ #include "libmpdemux/demuxer.h" #include "libmpconf/codec-cfg.h" +#include "libplaytree/playtree.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" @@ -426,7 +427,7 @@ //"nosound=nein" "\n"; -void parse_cfgfiles( m_config_t* conf ) +void parse_cfgfiles( m_config_t& conf ) { char *conffile; int conffile_fd; @@ -604,7 +605,7 @@ void show_long_help(void) { MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; - m_config_show_options(mpxp_context().mconfig); + m_config_show_options(*mpxp_context().mconfig); mp_input_print_binds(MPXPSys.libinput()); Stream::print_drivers(); mpxp_context().video().output->print_help(); @@ -1633,7 +1634,7 @@ int stream_dump_type=0; input_state_t input_state = { 0, 0, 0 }; char *ao_subdevice; - char* filename=NULL; //"MI2-Trailer.avi"; + const char* filename=NULL; //"MI2-Trailer.avi"; int file_format=Demuxer::Type_UNKNOWN; // movie info: @@ -1666,13 +1667,14 @@ MPXPSys.playtree = play_tree_new(); - mpxp_context().mconfig = m_config_new(MPXPSys.playtree,MPXPSys.libinput()); - m_config_register_options(mpxp_context().mconfig,mplayer_opts); + m_config_t& m_config=m_config_new(MPXPSys.playtree,MPXPSys.libinput()); + mpxp_context().mconfig = &m_config; + m_config_register_options(m_config,mplayer_opts); // TODO : add something to let modules register their options - mp_register_options(mpxp_context().mconfig); - parse_cfgfiles(mpxp_context().mconfig); + mp_register_options(m_config); + parse_cfgfiles(m_config); - if(m_config_parse_command_line(mpxp_context().mconfig, argc, argv, envp)!=MPXP_Ok) + if(m_config_parse_command_line(m_config, argc, argv, envp)!=MPXP_Ok) exit_player("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { @@ -1695,7 +1697,7 @@ MPXPSys.playtree = play_tree_cleanup(MPXPSys.playtree); if(MPXPSys.playtree) { - playtree_iter = play_tree_iter_new(MPXPSys.playtree,mpxp_context().mconfig); + playtree_iter = play_tree_iter_new(MPXPSys.playtree,m_config); if(playtree_iter) { if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(playtree_iter); Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/mplayerxp.h 2012-12-13 13:52:35 UTC (rev 558) @@ -17,6 +17,7 @@ struct audio_decoder_t; struct video_decoder_t; +struct play_tree_iter_t; namespace mpxp { /* List of all modules which require protection by pin-code */ enum { @@ -225,7 +226,7 @@ void mplayer_put_key(int code); - void mp_register_options(m_config_t* cfg); + void mp_register_options(m_config_t& cfg); extern play_tree_iter_t* playtree_iter; } Modified: mplayerxp/xmpcore/xmp_context.cpp =================================================================== --- mplayerxp/xmpcore/xmp_context.cpp 2012-12-13 11:45:25 UTC (rev 557) +++ mplayerxp/xmpcore/xmp_context.cpp 2012-12-13 13:52:35 UTC (rev 558) @@ -272,17 +272,17 @@ const config_t* mplayer_opts=mplayer_options; } // namespace mpxp -extern void libmpcodecs_ad_register_options(m_config_t* cfg); -extern void libmpcodecs_vd_register_options(m_config_t* cfg); +extern void libmpcodecs_ad_register_options(m_config_t& cfg); +extern void libmpcodecs_vd_register_options(m_config_t& cfg); namespace mpxp { #ifdef HAVE_LIBCDIO -extern void cdda_register_options(m_config_t* cfg); +extern void cdda_register_options(m_config_t& cfg); #endif -extern void mp_input_register_options(m_config_t* cfg); -extern void libmpdemux_register_options(m_config_t* cfg); -extern void demuxer_register_options(m_config_t* cfg); -void mp_register_options(m_config_t* cfg) +extern void mp_input_register_options(m_config_t& cfg); +extern void libmpdemux_register_options(m_config_t& cfg); +extern void demuxer_register_options(m_config_t& cfg); +void mp_register_options(m_config_t& cfg) { mp_input_register_options(cfg); libmpdemux_register_options(cfg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-13 11:45:35
|
Revision: 557 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=557&view=rev Author: nickols_k Date: 2012-12-13 11:45:25 +0000 (Thu, 13 Dec 2012) Log Message: ----------- split mplayer_opts from mplayerxp.cpp Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpconf/cfgparser.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/af.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/xmpcore/Makefile Added Paths: ----------- mplayerxp/xmpcore/xmp_context.cpp mplayerxp/xmpcore/xmp_context.h Removed Paths: ------------- mplayerxp/cfg-mplayerxp.h mplayerxp/mp-opt-reg.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/Makefile 2012-12-13 11:45:25 UTC (rev 557) @@ -21,7 +21,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mplayerxp.cpp mp-opt-reg.cpp dump.cpp mp_msg.cpp +SRCS = mplayerxp.cpp dump.cpp mp_msg.cpp OBJS = $(SRCS:.cpp=.o) Deleted: mplayerxp/cfg-mplayerxp.h =================================================================== --- mplayerxp/cfg-mplayerxp.h 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/cfg-mplayerxp.h 2012-12-13 11:45:25 UTC (rev 557) @@ -1,266 +0,0 @@ -/* - * config for cfgparser - */ - -extern const char *oss_mixer_device; -#ifdef HAVE_SDL -//extern char *sdl_driver; -extern int sdl_noxv; -extern int sdl_forcexv; -extern int sdl_forcegl; -//extern char *sdl_adriver; -#endif - -extern af_cfg_t af_cfg; // Configuration for audio filters -extern vf_cfg_t vf_cfg; // Configuration for audio filters - -static const config_t xpcore_config[]={ - {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, UINT_MAX, "specifies number cpus to use for playback"}, - {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, - {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, - {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, - {"xp_buffs", &vo_conf.xp_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, - {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, - {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, - {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, - {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, - {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, - {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, - {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_INT, CONF_RANGE, 0, 3, "debugs malloc() calls in MPlayerXP"}, - {"max-trace", &mp_conf.max_trace, CONF_TYPE_INT, CONF_RANGE, 1, 1024, "maximal number of backtrace stack"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -#ifdef HAVE_STREAMING -static const config_t net_config[]={ - {"ipv4", &net_conf.prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, "forces mplayerxp to use IPv4 protocol over network"}, -#ifdef HAVE_AF_INET6 - {"ipv6", &net_conf.prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, "forces mplayerxp to use IPv6 protocol over network"}, -#else - {"ipv6", "MPlayerXP was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, -#endif /* HAVE_AF_INET6 */ - {"ipv4-only-proxy", &net_conf.ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, "skip the proxy for IPv6 addresses"}, - {"user", &net_conf.username, CONF_TYPE_STRING, 0, 0, 0, "specifies username for HTTP authentication"}, - {"passwd", &net_conf.password, CONF_TYPE_STRING, 0, 0, 0, "specifies password for HTTP authentication"}, - {"bandwidth", &net_conf.bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, "specifies the maximum bandwidth for network streaming"}, - {"user-agent", &net_conf.useragent, CONF_TYPE_STRING, 0, 0, 0, "specifies string as user agent for HTTP streaming"}, - {"cookies", &net_conf.cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, "send cookies when making HTTP requests"}, - {"cookies-file", &net_conf.cookies_file, CONF_TYPE_STRING, 0, 0, 0, "Read HTTP cookies from file"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -static const config_t cpu_config[]={ - {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SIMD extensions of CPU"}, - {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SIMD extensions of CPU"}, - {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX extensions of CPU"}, - {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX extensions of CPU"}, - {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX2 extensions of CPU"}, - {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX2 extensions of CPU"}, - {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow! extensions of CPU"}, - {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow! extensions of CPU"}, - {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow-2! extensions of CPU"}, - {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow-2! extensions of CPU"}, - {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE extensions of CPU"}, - {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE extensions of CPU"}, - {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE2 extensions of CPU"}, - {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE2 extensions of CPU"}, - {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE3 extensions of CPU"}, - {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE3 extensions of CPU"}, - {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSSE3 extensions of CPU"}, - {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSSE3 extensions of CPU"}, - {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE41 extensions of CPU"}, - {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE41 extensions of CPU"}, - {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE42 extensions of CPU"}, - {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE42 extensions of CPU"}, - {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AES extensions of CPU"}, - {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AES extensions of CPU"}, - {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AVX extensions of CPU"}, - {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AVX extensions of CPU"}, - {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, "enables using of FMA extensions of CPU"}, - {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, "disables using of FMA extensions of CPU"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -static const config_t osd_config[]={ - {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , "specifies initial mode of the OSD"}, -#ifdef USE_OSD - {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, "specifies an alternative directory of font.desc location"}, - {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, "specifies resampling of alphamap of the font"}, - {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, "specifies align position of SPU (DVD-VOBsub) subtitles"}, - {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies antialiasing/scaling mode for SPU"}, - {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, "specifies variance parameter of gaussian for -spuaa"}, -#endif - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t veq_config[]={ - {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies brightness-level for output image"}, - {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies saturation-level for output image"}, - {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies contrast-level for output image"}, - {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies hue of gamma-correction for output image"}, - {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of red component for output image"}, - {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of green component for output image"}, - {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of blue component for output image"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - - -static const config_t avsync_config[]={ - {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, -/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, - {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, "disables frame dropping"}, - {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, "use PTS-based method of A/V synchronization"}, - {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, "use BPS-based method of A/V synchronization"}, - {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files"}, - {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files"}, - {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files without PTS changing"}, - {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files without PTS changing"}, - {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, "recalc PTS of frames as they were added to the buffer"}, - {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, "keep original PTS of each frame"}, - {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, "enables high quality software timers for A/V synchronization"}, -#ifdef HAVE_RTC - {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, - {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, -#endif - {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, "forces frame rate (if value is wrong in the header)"}, - {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, "forces video hardware to wait VSYNC signal before frame switching"}, - {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, "disables video hardware to wait VSYNC signal before frame switching"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t subtitle_config[]={ - {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, - {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, - {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the VobSub files that are to be used for subtitle"}, - {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies the VobSub subtitle id"}, -#ifdef USE_SUB - {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the subtitle file"}, -#ifdef USE_ICONV - {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, "specifies codepage of subtitles"}, -#endif - {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, "specifies frame/sec rate of subtitle file"}, - {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, "disable autodetection of vobsub for textsubs if vobsub found"}, - {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UNICODE"}, - {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, - {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UTF8"}, - {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, - {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, "specifies vertical shift of subtitles"}, -#endif - {"cc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, - {"nocc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, - {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "selects subtitle channel"}, - {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, - {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, "specifies .ifo file for DVD subtitles"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -#ifdef HAVE_X11 -static const config_t x11_config[]={ - {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, -#ifdef HAVE_XINERAMA - {"xinerama", &vo_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, -#endif - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; -#endif - -static const config_t audio_config[]={ - {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, "enables audio-steam playback"}, - {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, "disables audio-stream playback"}, - {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, "select audio-mixer device"}, - {"channels", &mp_conf.ao_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, - {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, "specifies Hz for audio playback"}, - {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-audio stream as two-letter country code(s)"}, - {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects audio channel"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t video_config[]={ - {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, - {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, - {"width", &vo_conf.image_width, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, - {"height", &vo_conf.image_height, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, - {"zoom", &vo_conf.image_zoom, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, - {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, - {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, - {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, - {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, "render movie to the user-defined window's geometry"}, - {"monitorpixelaspect", &mp_conf.monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, - {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, "enables video-mode changing during playback"}, - {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, "disables video-mode changing during playback"}, - {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, "fullscreen playback"}, - {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, "windowed playback"}, - {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, "enables workaround for some fullscreen related problems"}, - {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, "flip output image upside-down"}, - {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, "render output image as is"}, - {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, "use different color depth than autodetect"}, - {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, - {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, "disables using of bus-mastering"}, - {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects video channel"}, - {"pp", &mp_conf.npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, -#ifdef HAVE_PNG - {"z", &mp_conf.z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, -#endif -#ifdef HAVE_SDL - {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, "disable XVideo hardware acceleration for SDL"}, - {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, - {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, -#endif - {"eq",(any_t*)&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - -static const config_t playback_config[]={ - {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, "seek to given byte position before playback"}, - {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, "seek to given time position before playback"}, - {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, "loops movie playback given number of times. 0 means forever"}, - {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, "disable loop of playback"}, - {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, "play files in random order"}, - {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, "play files in regular order"}, - {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, "specifies playlist (1 file/row or Winamp or ASX format)"}, - {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, "play given number of frames and exit"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, -}; - - -static const config_t mplayer_opts[]={ - /* name, pointer, type, flags, min, max, help */ - {"include", NULL, CONF_TYPE_INCLUDE, CONF_NOSAVE, 0, 0, ""}, /* this don't need anymore to be the first!!! */ - -//---------------------- libao/libvo/mplayer options ------------------------ - {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, "select video output driver and optinaly device"}, - {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, "select audio output driver and optinaly device"}, - {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects audio filter"}, - {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects video filter"}, - {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoders family"}, - {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoders family"}, - {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoder"}, - {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoder"}, -/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, "verbose output"}, - {"v", &mp_conf.verbose, CONF_TYPE_INC, 0, 0, 0, "verbose output (more -v means more verbosity)"}, - {"msgfilter", &mp_conf.msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, - - {"core", (any_t*)&xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, - {"play", (any_t*)&playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, - {"audio", (any_t*)&audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, - {"video", (any_t*)&video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, - {"sub", (any_t*)&subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, -#ifdef HAVE_X11 - {"x", (any_t*)&x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, -#endif - {"osd", (any_t*)&osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, - {"sync", (any_t*)&avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - {"cpu", (any_t*)&cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, -#endif -// ------------------------- stream options -------------------- -#ifdef HAVE_STREAMING - { "net", (any_t*)&net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, -#endif -// ------------------------- codec/pp options -------------------- - {NULL, NULL, 0, 0, 0, 0, NULL} -}; Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/libmpconf/cfgparser.h 2012-12-13 11:45:25 UTC (rev 557) @@ -37,15 +37,12 @@ CONF_GLOBAL =(1<<4), CONF_NOSAVE =(1<<5) }; -typedef struct config config_t; typedef struct m_config m_config_t; typedef struct config_save config_save_t; #include "libplaytree/playtree.h" -typedef void (*cfg_default_func_t)(config_t *,const char*); - -struct config { +struct config_t { const char *name; any_t* const p; unsigned int type; @@ -53,6 +50,7 @@ float min,max; const char *help; }; +typedef void (*cfg_default_func_t)(config_t*,const char*); struct m_config { m_config(libinput_t& _libinput):libinput(_libinput) {} Deleted: mplayerxp/mp-opt-reg.cpp =================================================================== --- mplayerxp/mp-opt-reg.cpp 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/mp-opt-reg.cpp 2012-12-13 11:45:25 UTC (rev 557) @@ -1,33 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <stdlib.h> -#include <stdio.h> - -#include "libmpstream2/stream.h" -#include "libmpconf/cfgparser.h" - - -extern void libmpcodecs_ad_register_options(m_config_t* cfg); -extern void libmpcodecs_vd_register_options(m_config_t* cfg); - -namespace mpxp { -#ifdef HAVE_LIBCDIO -extern void cdda_register_options(m_config_t* cfg); -#endif -extern void mp_input_register_options(m_config_t* cfg); -extern void libmpdemux_register_options(m_config_t* cfg); -extern void demuxer_register_options(m_config_t* cfg); -void mp_register_options(m_config_t* cfg) -{ - mp_input_register_options(cfg); - libmpdemux_register_options(cfg); - demuxer_register_options(cfg); -#ifdef HAVE_LIBCDIO - cdda_register_options(cfg); -#endif - libmpcodecs_ad_register_options(cfg); - libmpcodecs_vd_register_options(cfg); -} - -} // namespace mpxp Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/mplayerxp.cpp 2012-12-13 11:45:25 UTC (rev 557) @@ -35,25 +35,18 @@ #include "help_mp.h" #include "libmpstream2/stream.h" -#include "libmpstream2/network.h" #include "libmpdemux/demuxer.h" -#include "libmpconf/cfgparser.h" #include "libmpconf/codec-cfg.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" -#ifdef USE_SUB -#include "libmpsub/subreader.h" -#endif #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" #include "libvo2/video_out.h" - #include "libao2/audio_out.h" -#include "libao2/afmt.h" #include "osdep/get_path.h" #include "osdep/cpudetect.h" @@ -70,6 +63,7 @@ #include "xmpcore/xmp_core.h" #include "xmpcore/xmp_vplayer.h" #include "xmpcore/xmp_adecoder.h" +#include "xmpcore/xmp_context.h" #include "xmpcore/PointerProtector.h" #include "dump.h" @@ -78,31 +72,9 @@ Private data **************************************************************************/ static volatile char antiviral_hole1[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -typedef struct x86_features_s { - int simd; - int mmx; - int mmx2; - int _3dnow; - int _3dnow2; - int sse; - int sse2; - int sse3; - int ssse3; - int sse41; - int sse42; - int aes; - int avx; - int fma; -}x86_features_t; -static x86_features_t x86; -#endif -} -#include "cfg-mplayerxp.h" /************************************************************************** Config file **************************************************************************/ -namespace mpxp { enum { INITED_VO =0x00000001, INITED_AO =0x00000002, @@ -296,7 +268,7 @@ static void mpxp_init_structs(void) { #if defined( ARCH_X86 ) || defined(ARCH_X86_64) - memset(&x86,-1,sizeof(x86_features_t)); + memset(&mp_conf.x86,-1,sizeof(x86_features_t)); #endif } @@ -510,20 +482,20 @@ { GetCpuCaps(&gCpuCaps); - if(x86.simd) { - if(x86.mmx != -1) gCpuCaps.hasMMX=x86.mmx; - if(x86.mmx2 != -1) gCpuCaps.hasMMX2=x86.mmx2; - if(x86._3dnow != -1) gCpuCaps.has3DNow=x86._3dnow; - if(x86._3dnow2 != -1) gCpuCaps.has3DNowExt=x86._3dnow2; - if(x86.sse != -1) gCpuCaps.hasSSE=x86.sse; - if(x86.sse2 != -1) gCpuCaps.hasSSE2=x86.sse2; - if(x86.sse3 != -1) gCpuCaps.hasSSE2=x86.sse3; - if(x86.ssse3 != -1) gCpuCaps.hasSSSE3=x86.ssse3; - if(x86.sse41 != -1) gCpuCaps.hasSSE41=x86.sse41; - if(x86.sse42 != -1) gCpuCaps.hasSSE42=x86.sse42; - if(x86.aes != -1) gCpuCaps.hasAES=x86.aes; - if(x86.avx != -1) gCpuCaps.hasAVX=x86.avx; - if(x86.fma != -1) gCpuCaps.hasFMA=x86.fma; + if(mp_conf.x86.simd) { + if(mp_conf.x86.mmx != -1) gCpuCaps.hasMMX=mp_conf.x86.mmx; + if(mp_conf.x86.mmx2 != -1) gCpuCaps.hasMMX2=mp_conf.x86.mmx2; + if(mp_conf.x86._3dnow != -1) gCpuCaps.has3DNow=mp_conf.x86._3dnow; + if(mp_conf.x86._3dnow2 != -1) gCpuCaps.has3DNowExt=mp_conf.x86._3dnow2; + if(mp_conf.x86.sse != -1) gCpuCaps.hasSSE=mp_conf.x86.sse; + if(mp_conf.x86.sse2 != -1) gCpuCaps.hasSSE2=mp_conf.x86.sse2; + if(mp_conf.x86.sse3 != -1) gCpuCaps.hasSSE2=mp_conf.x86.sse3; + if(mp_conf.x86.ssse3 != -1) gCpuCaps.hasSSSE3=mp_conf.x86.ssse3; + if(mp_conf.x86.sse41 != -1) gCpuCaps.hasSSE41=mp_conf.x86.sse41; + if(mp_conf.x86.sse42 != -1) gCpuCaps.hasSSE42=mp_conf.x86.sse42; + if(mp_conf.x86.aes != -1) gCpuCaps.hasAES=mp_conf.x86.aes; + if(mp_conf.x86.avx != -1) gCpuCaps.hasAVX=mp_conf.x86.avx; + if(mp_conf.x86.fma != -1) gCpuCaps.hasFMA=mp_conf.x86.fma; } else { gCpuCaps.hasMMX= gCpuCaps.hasMMX2= Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/mplayerxp.h 2012-12-13 11:45:25 UTC (rev 557) @@ -32,6 +32,25 @@ Module_MPContext }; +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + struct x86_features_t { + int simd; + int mmx; + int mmx2; + int _3dnow; + int _3dnow2; + int sse; + int sse2; + int sse3; + int ssse3; + int sse41; + int sse42; + int aes; + int avx; + int fma; + }; +#endif + struct MP_Config { MP_Config(); ~MP_Config() {} @@ -98,6 +117,9 @@ unsigned ao_channels; int z_compression; float monitor_pixel_aspect; +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + x86_features_t x86; +#endif }; extern MP_Config mp_conf; Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/postproc/af.h 2012-12-13 11:45:25 UTC (rev 557) @@ -73,6 +73,7 @@ char* list; /* list of names of filters that are added to filter list during first initialization of stream */ }; +extern af_cfg_t af_cfg; // Configuration for audio filters struct af_instance_t; // Current audio stream Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/postproc/vf.cpp 2012-12-13 11:45:25 UTC (rev 557) @@ -456,7 +456,6 @@ } } -extern vf_cfg_t vf_cfg; vf_instance_t* __FASTCALL__ vf_init_filter(libinput_t& libinput,const vf_conf_t* conf) { char *vf_last=NULL,*vf_name=vf_cfg.list; @@ -759,4 +758,5 @@ vf_instance_t* first=s->first; return first->info->name; } +vf_cfg_t vf_cfg; } // namespace mpxp Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/postproc/vf.h 2012-12-13 11:45:25 UTC (rev 557) @@ -38,6 +38,7 @@ char* list; /* list of names of filters that are added to filter list during first initialization of stream */ }; + extern vf_cfg_t vf_cfg; // Configuration for audio filters struct vf_conf_t { unsigned w; Modified: mplayerxp/xmpcore/Makefile =================================================================== --- mplayerxp/xmpcore/Makefile 2012-12-13 10:49:20 UTC (rev 556) +++ mplayerxp/xmpcore/Makefile 2012-12-13 11:45:25 UTC (rev 557) @@ -2,7 +2,13 @@ LIBNAME = libxmpcore.a -SRCS=xmp_core.cpp xmp_aplayer.cpp xmp_vplayer.cpp xmp_vdecoder.cpp xmp_adecoder.cpp +SRCS=xmp_context.cpp \ + xmp_core.cpp \ + xmp_aplayer.cpp \ + xmp_vplayer.cpp \ + xmp_vdecoder.cpp \ + xmp_adecoder.cpp + SRCS+=sig_hand.cpp mp_image.cpp mp_aframe.cpp OBJS=$(SRCS:.cpp=.o) Added: mplayerxp/xmpcore/xmp_context.cpp =================================================================== --- mplayerxp/xmpcore/xmp_context.cpp (rev 0) +++ mplayerxp/xmpcore/xmp_context.cpp 2012-12-13 11:45:25 UTC (rev 557) @@ -0,0 +1,297 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; + +#include "mplayerxp.h" +#include "xmp_context.h" +#include "libmpconf/cfgparser.h" +#include "postproc/af.h" +#include "postproc/vf.h" +#include "libmpsub/spudec.h" +#include "libmpstream2/network.h" + +extern const char *oss_mixer_device; +#ifdef HAVE_SDL +//extern char *sdl_driver; +extern int sdl_noxv; +extern int sdl_forcexv; +extern int sdl_forcegl; +//extern char *sdl_adriver; +#endif + +namespace mpxp { +static const config_t xpcore_config[]={ + {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, UINT_MAX, "specifies number cpus to use for playback"}, + {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, + {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, + {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, + {"xp_buffs", &vo_conf.xp_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, + {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, + {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, + {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, + {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, + {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, + {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, + {"malloc-debug", &mp_conf.malloc_debug, CONF_TYPE_INT, CONF_RANGE, 0, 3, "debugs malloc() calls in MPlayerXP"}, + {"max-trace", &mp_conf.max_trace, CONF_TYPE_INT, CONF_RANGE, 1, 1024, "maximal number of backtrace stack"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +#ifdef HAVE_STREAMING +static const config_t net_config[]={ + {"ipv4", &net_conf.prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, "forces mplayerxp to use IPv4 protocol over network"}, +#ifdef HAVE_AF_INET6 + {"ipv6", &net_conf.prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, "forces mplayerxp to use IPv6 protocol over network"}, +#else + {"ipv6", "MPlayerXP was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, +#endif /* HAVE_AF_INET6 */ + {"ipv4-only-proxy", &net_conf.ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, "skip the proxy for IPv6 addresses"}, + {"user", &net_conf.username, CONF_TYPE_STRING, 0, 0, 0, "specifies username for HTTP authentication"}, + {"passwd", &net_conf.password, CONF_TYPE_STRING, 0, 0, 0, "specifies password for HTTP authentication"}, + {"bandwidth", &net_conf.bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, "specifies the maximum bandwidth for network streaming"}, + {"user-agent", &net_conf.useragent, CONF_TYPE_STRING, 0, 0, 0, "specifies string as user agent for HTTP streaming"}, + {"cookies", &net_conf.cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, "send cookies when making HTTP requests"}, + {"cookies-file", &net_conf.cookies_file, CONF_TYPE_STRING, 0, 0, 0, "Read HTTP cookies from file"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) +static const config_t cpu_config[]={ + {"simd", &mp_conf.x86.simd, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SIMD extensions of CPU"}, + {"nosimd", &mp_conf.x86.simd, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SIMD extensions of CPU"}, + {"mmx", &mp_conf.x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX extensions of CPU"}, + {"nommx", &mp_conf.x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX extensions of CPU"}, + {"mmx2", &mp_conf.x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX2 extensions of CPU"}, + {"nommx2", &mp_conf.x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX2 extensions of CPU"}, + {"3dnow", &mp_conf.x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow! extensions of CPU"}, + {"no3dnow", &mp_conf.x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow! extensions of CPU"}, + {"3dnow2", &mp_conf.x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow-2! extensions of CPU"}, + {"no3dnow2", &mp_conf.x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow-2! extensions of CPU"}, + {"sse", &mp_conf.x86.sse, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE extensions of CPU"}, + {"nosse", &mp_conf.x86.sse, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE extensions of CPU"}, + {"sse2", &mp_conf.x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE2 extensions of CPU"}, + {"nosse2", &mp_conf.x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE2 extensions of CPU"}, + {"sse3", &mp_conf.x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE3 extensions of CPU"}, + {"nosse3", &mp_conf.x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE3 extensions of CPU"}, + {"ssse3", &mp_conf.x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSSE3 extensions of CPU"}, + {"nossse3", &mp_conf.x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSSE3 extensions of CPU"}, + {"sse41", &mp_conf.x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE41 extensions of CPU"}, + {"nosse41", &mp_conf.x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE41 extensions of CPU"}, + {"sse42", &mp_conf.x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE42 extensions of CPU"}, + {"nosse42", &mp_conf.x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE42 extensions of CPU"}, + {"aes", &mp_conf.x86.aes, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AES extensions of CPU"}, + {"noaes", &mp_conf.x86.aes, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AES extensions of CPU"}, + {"avx", &mp_conf.x86.avx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AVX extensions of CPU"}, + {"noavx", &mp_conf.x86.avx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AVX extensions of CPU"}, + {"fma", &mp_conf.x86.fma, CONF_TYPE_FLAG, 0, 0, 1, "enables using of FMA extensions of CPU"}, + {"nofma", &mp_conf.x86.fma, CONF_TYPE_FLAG, 0, 1, 0, "disables using of FMA extensions of CPU"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +static const config_t osd_config[]={ + {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , "specifies initial mode of the OSD"}, +#ifdef USE_OSD + {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, "specifies an alternative directory of font.desc location"}, + {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, "specifies resampling of alphamap of the font"}, + {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, "specifies align position of SPU (DVD-VOBsub) subtitles"}, + {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies antialiasing/scaling mode for SPU"}, + {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, "specifies variance parameter of gaussian for -spuaa"}, +#endif + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t veq_config[]={ + {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies brightness-level for output image"}, + {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies saturation-level for output image"}, + {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies contrast-level for output image"}, + {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies hue of gamma-correction for output image"}, + {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of red component for output image"}, + {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of green component for output image"}, + {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of blue component for output image"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + + +static const config_t avsync_config[]={ + {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, +/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, + {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, "disables frame dropping"}, + {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, "use PTS-based method of A/V synchronization"}, + {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, "use BPS-based method of A/V synchronization"}, + {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files"}, + {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files"}, + {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files without PTS changing"}, + {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files without PTS changing"}, + {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, "recalc PTS of frames as they were added to the buffer"}, + {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, "keep original PTS of each frame"}, + {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, "enables high quality software timers for A/V synchronization"}, +#ifdef HAVE_RTC + {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, +#endif + {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, "forces frame rate (if value is wrong in the header)"}, + {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, "forces video hardware to wait VSYNC signal before frame switching"}, + {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, "disables video hardware to wait VSYNC signal before frame switching"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t subtitle_config[]={ + {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, + {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, + {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the VobSub files that are to be used for subtitle"}, + {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies the VobSub subtitle id"}, +#ifdef USE_SUB + {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the subtitle file"}, +#ifdef USE_ICONV + {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, "specifies codepage of subtitles"}, +#endif + {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, "specifies frame/sec rate of subtitle file"}, + {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, "disable autodetection of vobsub for textsubs if vobsub found"}, + {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UNICODE"}, + {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, + {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UTF8"}, + {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, + {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, "specifies vertical shift of subtitles"}, +#endif + {"cc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, + {"nocc", &mp_conf.subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, + {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "selects subtitle channel"}, + {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, + {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, "specifies .ifo file for DVD subtitles"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +#ifdef HAVE_X11 +static const config_t x11_config[]={ + {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, +#ifdef HAVE_XINERAMA + {"xinerama", &vo_conf.xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, +#endif + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; +#endif + +static const config_t audio_config[]={ + {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, "enables audio-steam playback"}, + {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, "disables audio-stream playback"}, + {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, "select audio-mixer device"}, + {"channels", &mp_conf.ao_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, + {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, "specifies Hz for audio playback"}, + {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-audio stream as two-letter country code(s)"}, + {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects audio channel"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t video_config[]={ + {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, + {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, + {"width", &vo_conf.image_width, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, + {"height", &vo_conf.image_height, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, + {"zoom", &vo_conf.image_zoom, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, + {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, + {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, + {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, + {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, "render movie to the user-defined window's geometry"}, + {"monitorpixelaspect", &mp_conf.monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, + {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, "enables video-mode changing during playback"}, + {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, "disables video-mode changing during playback"}, + {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, "fullscreen playback"}, + {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, "windowed playback"}, + {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, "enables workaround for some fullscreen related problems"}, + {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, "flip output image upside-down"}, + {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, "render output image as is"}, + {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, "use different color depth than autodetect"}, + {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, "enables using of bus-mastering (if it available for given OS/videocard)"}, + {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, + {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, "disables using of bus-mastering"}, + {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects video channel"}, + {"pp", &mp_conf.npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, +#ifdef HAVE_PNG + {"z", &mp_conf.z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, +#endif +#ifdef HAVE_SDL + {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, "disable XVideo hardware acceleration for SDL"}, + {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, + {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, +#endif + {"eq",(any_t*)&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t playback_config[]={ + {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, "seek to given byte position before playback"}, + {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, "seek to given time position before playback"}, + {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, "loops movie playback given number of times. 0 means forever"}, + {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, "disable loop of playback"}, + {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, "play files in random order"}, + {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, "play files in regular order"}, + {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, "specifies playlist (1 file/row or Winamp or ASX format)"}, + {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, "play given number of frames and exit"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, +}; + +static const config_t mplayer_options[]={ + /* name, pointer, type, flags, min, max, help */ + {"include", NULL, CONF_TYPE_INCLUDE, CONF_NOSAVE, 0, 0, ""}, /* this don't need anymore to be the first!!! */ + +//---------------------- libao/libvo/mplayer options ------------------------ + {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, "select video output driver and optinaly device"}, + {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, "select audio output driver and optinaly device"}, + {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects audio filter"}, + {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects video filter"}, + {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoders family"}, + {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoders family"}, + {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoder"}, + {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoder"}, +/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, "verbose output"}, + {"v", &mp_conf.verbose, CONF_TYPE_INC, 0, 0, 0, "verbose output (more -v means more verbosity)"}, + {"msgfilter", &mp_conf.msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, + + {"core", (any_t*)&xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, + {"play", (any_t*)&playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, + {"audio", (any_t*)&audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, + {"video", (any_t*)&video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, + {"sub", (any_t*)&subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, +#ifdef HAVE_X11 + {"x", (any_t*)&x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, +#endif + {"osd", (any_t*)&osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, + {"sync", (any_t*)&avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + {"cpu", (any_t*)&cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, +#endif +// ------------------------- stream options -------------------- +#ifdef HAVE_STREAMING + { "net", (any_t*)&net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, +#endif +// ------------------------- codec/pp options -------------------- + {NULL, NULL, 0, 0, 0, 0, NULL} +}; +const config_t* mplayer_opts=mplayer_options; + +} // namespace mpxp +extern void libmpcodecs_ad_register_options(m_config_t* cfg); +extern void libmpcodecs_vd_register_options(m_config_t* cfg); + +namespace mpxp { +#ifdef HAVE_LIBCDIO +extern void cdda_register_options(m_config_t* cfg); +#endif +extern void mp_input_register_options(m_config_t* cfg); +extern void libmpdemux_register_options(m_config_t* cfg); +extern void demuxer_register_options(m_config_t* cfg); +void mp_register_options(m_config_t* cfg) +{ + mp_input_register_options(cfg); + libmpdemux_register_options(cfg); + demuxer_register_options(cfg); +#ifdef HAVE_LIBCDIO + cdda_register_options(cfg); +#endif + libmpcodecs_ad_register_options(cfg); + libmpcodecs_vd_register_options(cfg); +} + +} // namespace mpxp Property changes on: mplayerxp/xmpcore/xmp_context.cpp ___________________________________________________________________ Added: svn:eol-style + native Copied: mplayerxp/xmpcore/xmp_context.h (from rev 555, mplayerxp/cfg-mplayerxp.h) =================================================================== --- mplayerxp/xmpcore/xmp_context.h (rev 0) +++ mplayerxp/xmpcore/xmp_context.h 2012-12-13 11:45:25 UTC (rev 557) @@ -0,0 +1,9 @@ +#ifndef _XMP_CONTEXT_H_INCLUDED +#define _XMP_CONTEXT_H_INCLUDED 1 + +struct config_t; +namespace mpxp { + extern const config_t* mplayer_opts; +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-13 10:49:26
|
Revision: 556 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=556&view=rev Author: nickols_k Date: 2012-12-13 10:49:20 +0000 (Thu, 13 Dec 2012) Log Message: ----------- anti-illegal patch cleanups: project compiled with -g3 lost >1MB of size. 119760K -> 118266K Modified Paths: -------------- mplayerxp/libmpstream2/s_rtsp.cpp mplayerxp/libmpstream2/s_udp.cpp mplayerxp/libmpstream2/stream.h mplayerxp/mplayerxp.cpp Modified: mplayerxp/libmpstream2/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-13 09:34:32 UTC (rev 555) +++ mplayerxp/libmpstream2/s_rtsp.cpp 2012-12-13 10:49:20 UTC (rev 556) @@ -22,6 +22,7 @@ #include "help_mp.h" #include "url.h" #include "tcp.h" +#include "network.h" #include "librtsp/rtsp.h" #include "librtsp/rtsp_session.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream2/s_udp.cpp =================================================================== --- mplayerxp/libmpstream2/s_udp.cpp 2012-12-13 09:34:32 UTC (rev 555) +++ mplayerxp/libmpstream2/s_udp.cpp 2012-12-13 10:49:20 UTC (rev 556) @@ -21,6 +21,7 @@ #include "stream_internal.h" #include "help_mp.h" #include "tcp.h" +#include "network.h" #include "udp.h" #include "url.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-13 09:34:32 UTC (rev 555) +++ mplayerxp/libmpstream2/stream.h 2012-12-13 10:49:20 UTC (rev 556) @@ -10,9 +10,6 @@ #include <string.h> #include "xmpcore/xmp_enums.h" -#ifdef HAVE_STREAMING -#include "network.h" -#endif struct networking_t; namespace mpxp { @@ -59,11 +56,12 @@ static void print_drivers(); virtual MPXP_Rc open(libinput_t&libinput,const std::string& filename,int* file_format); + virtual void close(); + virtual int read(any_t* mem,int total); virtual off_t seek(off_t off); virtual int skip(off_t len); virtual off_t tell() const; - virtual void close(); virtual MPXP_Rc ctrl(unsigned cmd,any_t* param); virtual void reset(); Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-13 09:34:32 UTC (rev 555) +++ mplayerxp/mplayerxp.cpp 2012-12-13 10:49:20 UTC (rev 556) @@ -35,6 +35,7 @@ #include "help_mp.h" #include "libmpstream2/stream.h" +#include "libmpstream2/network.h" #include "libmpdemux/demuxer.h" #include "libmpconf/cfgparser.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-13 09:34:40
|
Revision: 555 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=555&view=rev Author: nickols_k Date: 2012-12-13 09:34:32 +0000 (Thu, 13 Dec 2012) Log Message: ----------- use more object-oriented programming in HTTP_Header + infinite.loop-- Modified Paths: -------------- mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpstream2/asf_streaming.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/http.cpp mplayerxp/libmpstream2/http.h mplayerxp/libmpstream2/network.cpp Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-13 09:34:32 UTC (rev 555) @@ -366,6 +366,7 @@ unsigned i=0; while(mime_type_table[i].driver!=&demux_null) { if(name==mime_type_table[i].mime_type) return mime_type_table[i].driver; + i++; } return &demux_null; } Modified: mplayerxp/libmpstream2/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpstream2/asf_streaming.cpp 2012-12-13 09:34:32 UTC (rev 555) @@ -583,7 +583,7 @@ // Common header for all requests. http_hdr->set_field("Accept: */*" ); http_hdr->set_field("User-Agent: NSPlayer/4.1.0.3856" ); - http_hdr->add_basic_authentication(url->username, url->password ); + http_hdr->add_basic_authentication(url->username?url->username:"", url->password?url->password:"" ); // Check if we are using a proxy if( !strcasecmp( url->protocol, "http_proxy" ) ) { @@ -721,7 +721,7 @@ HTTP_Header *http_hdr=NULL; URL *url = networking->url; asf_http_networking_t *asf_http_ctrl; - char buffer[BUFFER_SIZE]; + uint8_t buffer[BUFFER_SIZE]; int i, ret; int done; int auth_retry = 0; @@ -762,7 +762,7 @@ delete http_hdr; http_hdr = new(zeromem) HTTP_Header; do { - i = tcp.read((uint8_t*)buffer, BUFFER_SIZE); + i = tcp.read(buffer, BUFFER_SIZE); if( i<=0 ) { perror("read"); delete http_hdr; Modified: mplayerxp/libmpstream2/cookies.cpp =================================================================== --- mplayerxp/libmpstream2/cookies.cpp 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpstream2/cookies.cpp 2012-12-13 09:34:32 UTC (rev 555) @@ -221,7 +221,7 @@ } /* Take an HTTP_header_t, and insert the correct headers. The cookie files are read if necessary. */ -void HTTP_Header::cookies_set(const char *domain, const char *url) +void HTTP_Header::cookies_set(const std::string& domain, const std::string& url) { int found_cookies = 0; struct cookie_list_type *cookies[MAX_COOKIES]; @@ -230,7 +230,7 @@ const char *path; char *buf; - path = strchr(url, '/'); + path = strchr(url.c_str(), '/'); if (!path) path = ""; @@ -243,7 +243,7 @@ /* Find which cookies we want, removing duplicates. Cookies with the longest domain, then longest path take priority */ while (list) { /* Check the cookie domain and path. Also, we never send "secure" cookies. These should only be sent over HTTPS. */ - if ((right_hand_strcmp(list->domain, domain) == 0) + if ((right_hand_strcmp(list->domain, domain.c_str()) == 0) && (left_hand_strcmp(list->path, path) == 0) && !list->secure) { int replacing = 0; for (i = 0; i < found_cookies; i++) { Modified: mplayerxp/libmpstream2/http.cpp =================================================================== --- mplayerxp/libmpstream2/http.cpp 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpstream2/http.cpp 2012-12-13 09:34:32 UTC (rev 555) @@ -21,18 +21,17 @@ namespace mpxp { HTTP_Header::HTTP_Header() {} HTTP_Header::~HTTP_Header() { - if( reason_phrase!=NULL ) delete reason_phrase ; if( buffer!=NULL ) delete buffer ; } -int HTTP_Header::response_append(const char *response, int length ) { - if( response==NULL || length<0 ) return -1; +int HTTP_Header::response_append(const uint8_t* response, size_t length ) { + if( response==NULL) return -1; if( (unsigned)length > std::numeric_limits<size_t>::max() - buffer_size - 1) { MSG_FATAL("Bad size in memory (re)allocation\n"); return -1; } - buffer = (char*)mp_realloc( buffer, buffer_size+length+1 ); + buffer = (uint8_t*)mp_realloc( buffer, buffer_size+length+1 ); if(buffer ==NULL ) { MSG_FATAL("Memory allocation failed\n"); return -1; @@ -46,8 +45,8 @@ int HTTP_Header::is_header_entire() const { if( buffer==NULL ) return 0; // empty - if( strstr(buffer, "\r\n\r\n")==NULL && - strstr(buffer, "\n\n")==NULL ) return 0; + if( strstr((char*)buffer, "\r\n\r\n")==NULL && + strstr((char*)buffer, "\n\n")==NULL ) return 0; return 1; } @@ -59,13 +58,13 @@ if( is_parsed ) return 0; // Get the protocol - hdr_ptr = strstr( buffer, " " ); + hdr_ptr = strstr( (char*)buffer, " " ); if( hdr_ptr==NULL ) { MSG_FATAL("Malformed answer. No space separator found.\n"); return -1; } - len = hdr_ptr-buffer; - protocol.assign(buffer,len); + len = hdr_ptr-(char*)buffer; + protocol.assign((char*)buffer,len); std::string sstr=protocol.substr(0,4); std::transform(sstr.begin(), sstr.end(),sstr.begin(), ::toupper); if(sstr=="HTTP") { @@ -89,32 +88,28 @@ return -1; } len = ptr-hdr_ptr; - reason_phrase = new char[len+1]; - if( reason_phrase==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - strncpy( reason_phrase, hdr_ptr, len ); + reason_phrase.assign(hdr_ptr, len); if( reason_phrase[len-1]=='\r' ) { len--; + reason_phrase.resize(len); } reason_phrase[len]='\0'; // Set the position of the header separator: \r\n\r\n hdr_sep_len = 4; - ptr = strstr( buffer, "\r\n\r\n" ); + ptr = strstr( (char*)buffer, "\r\n\r\n" ); if( ptr==NULL ) { - ptr = strstr( buffer, "\n\n" ); + ptr = strstr( (char*)buffer, "\n\n" ); if( ptr==NULL ) { MSG_ERR("Header may be incomplete. No CRLF CRLF found.\n"); return -1; } hdr_sep_len = 2; } - pos_hdr_sep = ptr-buffer; + pos_hdr_sep = ptr-(char*)buffer; // Point to the first line after the method line. - hdr_ptr = strstr( buffer, "\n" )+1; + hdr_ptr = strstr( (char*)buffer, "\n" )+1; do { ptr = hdr_ptr; while( *ptr!='\r' && *ptr!='\n' ) ptr++; @@ -129,14 +124,13 @@ field[len]='\0'; set_field( field ); hdr_ptr = ptr+((*ptr=='\r')?2:1); - } while( hdr_ptr<(buffer+pos_hdr_sep) ); + } while( hdr_ptr<((char*)buffer+pos_hdr_sep) ); if( field!=NULL ) delete field ; if( pos_hdr_sep+hdr_sep_len<buffer_size ) { // Response has data! - body = buffer+pos_hdr_sep+hdr_sep_len; - body_size = buffer_size-(pos_hdr_sep+hdr_sep_len); + body.assign((char*)buffer+pos_hdr_sep+hdr_sep_len,buffer_size-(pos_hdr_sep+hdr_sep_len)); } is_parsed = 1; @@ -159,15 +153,15 @@ // Add the CRLF len += 2; // Add the body - if( body!=NULL ) { - len += body_size; + if( !body.empty() ) { + len += body.length(); } // Free the buffer if it was previously used if( buffer!=NULL ) { delete buffer ; buffer = NULL; } - buffer = new char [len+1]; + buffer = new uint8_t [len+1]; if( buffer==NULL ) { MSG_FATAL("Memory allocation failed\n"); return NULL; @@ -175,21 +169,21 @@ buffer_size = len; //*** Building the request - ptr = buffer; + ptr = (char*)buffer; // Add the method line ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", method.c_str(),uri.c_str(), http_minor_version ); // Add the field for(unsigned i=0;i<sz;i++) ptr += sprintf( ptr, "%s\r\n", fields[i].c_str()); ptr += sprintf( ptr, "\r\n" ); // Add the body - if( body!=NULL ) { - memcpy( ptr, body, body_size ); + if( !body.empty()) { + memcpy( ptr, body.c_str(), body.size()); } - return buffer; + return (char *)buffer; } -const char* HTTP_Header::get_field(const char *field_name ) { +const char* HTTP_Header::get_field(const std::string& field_name ) { search_pos=0; field_search=field_name; return get_next_field(); @@ -215,36 +209,34 @@ return NULL; } -void HTTP_Header::set_field(const char *field_name ) { - if( field_name==NULL ) return; +void HTTP_Header::set_field(const std::string& field_name ) { + if(field_name.empty()) return; fields.push_back(field_name); } -void HTTP_Header::set_method( const char *_method ) { - if( _method==NULL ) return; +void HTTP_Header::set_method( const std::string& _method ) { method=_method; } -void HTTP_Header::set_uri(const char *_uri ) { - if(_uri==NULL ) return; +void HTTP_Header::set_uri(const std::string& _uri ) { uri=_uri; } -int HTTP_Header::add_basic_authentication( const char *username, const char *password ) { +int HTTP_Header::add_basic_authentication( const std::string& username, const std::string& password ) { char *auth=NULL, *usr_pass=NULL, *b64_usr_pass=NULL; int encoded_len, pass_len=0, out_len; int res = -1; - if( username==NULL ) return -1; + if( username.empty() ) return -1; - if( password!=NULL ) pass_len = strlen(password); + if( !password.empty() ) pass_len = password.length(); - usr_pass = new char [strlen(username)+pass_len+2]; + usr_pass = new char [username.length()+pass_len+2]; if( usr_pass==NULL ) { MSG_FATAL("Memory allocation failed\n"); goto out; } - sprintf( usr_pass, "%s:%s", username, (password==NULL)?"":password ); + sprintf( usr_pass, "%s:%s", username.c_str(), password.c_str() ); // Base 64 encode with at least 33% more data than the original size encoded_len = strlen(usr_pass)*2; @@ -280,8 +272,7 @@ } void HTTP_Header::erase_body() { - body=NULL; - body_size=0; + body.clear(); } void HTTP_Header::debug_hdr( ) { @@ -300,8 +291,8 @@ ,uri.c_str() ,method.c_str() ,status_code - ,reason_phrase - ,body_size ); + ,reason_phrase.c_str() + ,body.length() ); MSG_V("Fields:\n"); std::vector<std::string>::size_type sz = fields.size(); Modified: mplayerxp/libmpstream2/http.h =================================================================== --- mplayerxp/libmpstream2/http.h 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpstream2/http.h 2012-12-13 09:34:32 UTC (rev 555) @@ -10,6 +10,7 @@ #include <string> #include <vector> +#include <stdint.h> namespace mpxp { class HTTP_Header : public Opaque { @@ -17,33 +18,33 @@ HTTP_Header(); virtual ~HTTP_Header(); - virtual int response_append(const char *data, int length ); + virtual int response_append(const uint8_t* data,size_t length); virtual int response_parse(); virtual int is_header_entire() const; virtual const char* build_request(); - virtual const char* get_field(const char *field_name ); + virtual const char* get_field(const std::string& field_name ); virtual const char* get_next_field(); - virtual void set_field(const char *field_name ); - virtual void set_method(const char *method ); - virtual void set_uri(const char *uri ); - virtual int add_basic_authentication(const char *username, const char *password ); + virtual void set_field(const std::string& field_name ); + virtual void set_method(const std::string& method ); + virtual void set_uri(const std::string& uri ); + virtual int add_basic_authentication(const std::string& username, const std::string& password ); virtual void debug_hdr(); - virtual void cookies_set(const char *hostname, const char *url); + virtual void cookies_set(const std::string& hostname, const std::string& url); - const char* get_reason_phrase() const { return reason_phrase; } + const char* get_reason_phrase() const { return reason_phrase.c_str(); } const char* get_protocol() const { return protocol.c_str(); } unsigned get_status() const { return status_code; } - const char* get_body() const { return body; } - size_t get_body_size() const { return body_size; } + const char* get_body() const { return body.c_str(); } + size_t get_body_size() const { return body.length(); } virtual void erase_body(); - const char* get_buffer() const { return buffer; } + const uint8_t* get_buffer() const { return buffer; } size_t get_buffer_size() const { return buffer_size; } private: std::string protocol; std::string method; std::string uri; - char* reason_phrase; + std::string reason_phrase; unsigned int http_minor_version; // Field variables std::vector<std::string> fields; @@ -51,11 +52,10 @@ std::vector<std::string>::size_type search_pos; // Body variables unsigned int status_code; - char* body; - size_t body_size; + std::string body; unsigned int is_parsed; - char* buffer; - size_t buffer_size; + uint8_t* buffer; + unsigned buffer_size; }; extern int base64_encode(const any_t*enc, int encLen, char *out, int outMax); Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-13 07:22:44 UTC (rev 554) +++ mplayerxp/libmpstream2/network.cpp 2012-12-13 09:34:32 UTC (rev 555) @@ -171,7 +171,7 @@ if (net_conf.cookies_enabled) http_hdr.cookies_set( server_url->hostname, server_url->url ); http_hdr.set_field( "Connection: closed"); - http_hdr.add_basic_authentication( url->username, url->password ); + http_hdr.add_basic_authentication( url->username?url->username:"", url->password?url->password:""); if( http_hdr.build_request( )==NULL ) { goto err_out; } @@ -207,13 +207,13 @@ HTTP_Header* http_read_response( Tcp& tcp ) { HTTP_Header* http_hdr = new(zeromem) HTTP_Header; - char response[BUFFER_SIZE]; + uint8_t response[BUFFER_SIZE]; int i; if( http_hdr==NULL ) return NULL; do { - i = tcp.read((uint8_t*)response, BUFFER_SIZE); + i = tcp.read(response, BUFFER_SIZE); if( i<0 ) { MSG_ERR("Read failed\n"); delete http_hdr; @@ -224,7 +224,7 @@ delete http_hdr; return NULL; } - http_hdr->response_append(response, i ); + http_hdr->response_append(response,i); } while( !http_hdr->is_header_entire() ); http_hdr->response_parse(); return http_hdr; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-13 07:22:51
|
Revision: 554 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=554&view=rev Author: nickols_k Date: 2012-12-13 07:22:44 +0000 (Thu, 13 Dec 2012) Log Message: ----------- cleanups + constantization Modified Paths: -------------- mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_struct.h mplayerxp/mplayerxp.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/libmenu/menu_pt.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf.cpp Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -1410,7 +1410,7 @@ {"end", M_ST_OFF(m_span_t,end), MCONF_TYPE_INT, M_OPT_MIN , 1 ,0, NULL}, { NULL, NULL, 0, 0, 0, 0, NULL } }; -static const struct m_struct_st m_span_opts = { +static const struct m_struct_t m_span_opts = { "m_span", sizeof(m_span_t), &m_span_params_dflts, Modified: mplayerxp/libmpconf/m_option.h =================================================================== --- mplayerxp/libmpconf/m_option.h 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/libmpconf/m_option.h 2012-12-13 07:22:44 UTC (rev 554) @@ -12,7 +12,7 @@ /// \ingroup OptionTypes typedef struct m_option_type m_option_type_t; typedef struct m_option m_option_t; -struct m_struct_st; +struct m_struct_t; /// \defgroup OptionTypes Options types /// \ingroup Options @@ -74,8 +74,8 @@ /// Extra definition needed for \ref m_option_type_obj_presets options. typedef struct { - struct m_struct_st* in_desc; /// Description of the struct holding the presets. - struct m_struct_st* out_desc; /// Description of the struct that should be set by the presets. + struct m_struct_t* in_desc; /// Description of the struct holding the presets. + struct m_struct_t* out_desc; /// Description of the struct that should be set by the presets. any_t* presets; /// Pointer to an array of structs defining the various presets. any_t* name_off; /// Offset of the preset's name inside the in_struct. } m_obj_presets_t; @@ -98,7 +98,7 @@ #endif /// Extra definition needed for \ref m_option_type_obj_params options. typedef struct { - const struct m_struct_st* desc; /// Field descriptions. + const struct m_struct_t* desc; /// Field descriptions. char separator; /// Field separator to use. } m_obj_params_t; Modified: mplayerxp/libmpconf/m_struct.h =================================================================== --- mplayerxp/libmpconf/m_struct.h 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/libmpconf/m_struct.h 2012-12-13 07:22:44 UTC (rev 554) @@ -11,7 +11,7 @@ struct m_option; /// Struct definition -typedef struct m_struct_st { +struct m_struct_t { const char* name; /// For error messages and debugging unsigned int size; /// size of the whole struct const any_t* defaults; /// Pointer to a struct filled with the default settings @@ -20,7 +20,7 @@ * of the member in the struct (use M_ST_OFF macro for this). */ const struct m_option* fields; -} m_struct_t; +}; // From glib.h (modified ;-) Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/mplayerxp.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -29,7 +29,6 @@ #include "mplayerxp.h" #include "xmpcore/sig_hand.h" -#include "postproc/swscale.h" #include "postproc/af.h" #include "postproc/vf.h" #define HELP_MP_DEFINE_STATIC @@ -37,12 +36,9 @@ #include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpdemux/parse_es.h" #include "libmpconf/cfgparser.h" #include "libmpconf/codec-cfg.h" -#include "libmpconf/m_struct.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" @@ -55,15 +51,13 @@ #include "libvo2/video_out.h" -#include "libvo2/sub.h" #include "libao2/audio_out.h" #include "libao2/afmt.h" -#include "osdep/keycodes.h" -#include "osdep/shmem.h" #include "osdep/get_path.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" +#include "osdep/timer.h" #include "nls/nls.h" #include "postproc/libmenu/menu.h" @@ -75,8 +69,6 @@ #include "xmpcore/xmp_core.h" #include "xmpcore/xmp_vplayer.h" #include "xmpcore/xmp_adecoder.h" -#include "osdep/timer.h" -#include "osdep/getch2.h" #include "xmpcore/PointerProtector.h" #include "dump.h" @@ -302,7 +294,6 @@ } static void mpxp_init_structs(void) { - mpxp_context().engine().MPXPSys = new(zeromem) MPXPSystem; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); #endif @@ -902,7 +893,7 @@ unsigned i; // check video_out driver name: MP_UNIT("vo_init"); - vo_inited = (mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:"")!=NULL)?1:0; + vo_inited = (mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:"")==MPXP_Ok)?1:0; if(!vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,mp_conf.video_driver?mp_conf.video_driver:"?"); @@ -1685,19 +1676,21 @@ secure_keys=ptr_protector.protect(new(zeromem) MPXPSecureKeys(10)); mpxp_init_structs(); - MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + mpxp_context().video().output=new(zeromem) Video_Output; init_signal_handling(); xmp_init(); xmp_register_main(exit_sighandler); - MPXPSys.init_keyboard_fifo(); - mpxp_print_init(mp_conf.verbose+MSGL_STATUS); MSG_INFO("%s",banner_text); - /* Test for cpu capabilities (and corresponding OS support) for optimizing */ + /* currently it's lowest point of MPXPSystem initialization */ + mpxp_context().engine().MPXPSys = new(zeromem) MPXPSystem; + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + MPXPSys.init_keyboard_fifo(); + MPXPSys.playtree = play_tree_new(); mpxp_context().mconfig = m_config_new(MPXPSys.playtree,MPXPSys.libinput()); @@ -1724,10 +1717,6 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) get_mmx_optimizations(); #endif - if(!sws_init()) { - MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); - exit_player(MSGTR_Exit_quit); - } if(mp_conf.shuffle_playback) MPXPSys.playtree->flags|=PLAY_TREE_RND; else MPXPSys.playtree->flags&=~PLAY_TREE_RND; Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -94,7 +94,7 @@ menu_list = (menu_def_t*)mp_realloc(menu_list,(menu_count+2)*sizeof(menu_def_t)); menu_list[menu_count].name = mp_strdup(name.c_str()); menu_list[menu_count].type = minfo; - menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st); + menu_list[menu_count].cfg = m_struct_alloc(minfo->priv_st); menu_list[menu_count].args = mp_strdup(element.body().c_str()); std::map<std::string,std::string,ASX_Attrib::stricomp>::iterator it; std::map<std::string,std::string,ASX_Attrib::stricomp>& _map = element.attribs().map(); @@ -104,7 +104,7 @@ ssecond=(*it).second; if(strcasecmp(sfirst.c_str(),"name") == 0) continue; // Setup the attribs - if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,mp_strdup(sfirst.c_str()),mp_strdup(ssecond.c_str()))) + if(!m_struct_set(minfo->priv_st,menu_list[menu_count].cfg,mp_strdup(sfirst.c_str()),mp_strdup(ssecond.c_str()))) MSG_WARN("[libmenu] Bad attrib: %s %s %s %i\n" ,sfirst.c_str(),ssecond.c_str(),name.c_str(),parser.get_line()); } @@ -171,7 +171,7 @@ int i; for(i = 0 ; menu_list && menu_list[i].name ; i++) { delete menu_list[i].name; - m_struct_free(&menu_list[i].type->priv_st,menu_list[i].cfg); + m_struct_free(menu_list[i].type->priv_st,menu_list[i].cfg); if(menu_list[i].args) delete menu_list[i].args; } delete menu_list; @@ -228,7 +228,7 @@ return NULL; } m = new(zeromem) menu_t(libinput); - m->priv_st = &(menu_list[i].type->priv_st); + m->priv_st = menu_list[i].type->priv_st; m->priv = (menu_priv_s*)m_struct_copy(m->priv_st,menu_list[i].cfg); m->ctx = menu_ctx; if(menu_list[i].type->mopen(m,menu_list[i].args)) Modified: mplayerxp/postproc/libmenu/menu.h =================================================================== --- mplayerxp/postproc/libmenu/menu.h 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu.h 2012-12-13 07:22:44 UTC (rev 554) @@ -6,6 +6,7 @@ } struct menu_priv_s; +struct m_struct_t; struct menu_t { menu_t(libinput_t& _libinput):libinput(_libinput) {} @@ -16,7 +17,7 @@ void (*read_cmd)(menu_t* menu,int cmd); void (*read_key)(menu_t* menu,int cmd); void (*close)(menu_t* menu); - m_struct_t* priv_st; + const m_struct_t* priv_st; struct menu_priv_s* priv; int show; // Draw it ? int cl; // Close request (user sent a close cmd or @@ -29,7 +30,7 @@ const char *name; const char *author; const char *comment; - m_struct_t priv_st; // Config struct definition + const m_struct_t* priv_st; // Config struct definition // cfg is a config struct as defined in cfg_st, it may be used as a priv struct // cfg is filled from the attributs found in the cfg file // the args param hold the content of the balise in the cfg file (if any) Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -162,16 +162,19 @@ return 1; } +static const m_struct_t m_priv = +{ + "cmdlist_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_cmdlist = { "Command list menu", "cmdlist", "Albeu", "", - { - "cmdlist_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, open_cmdlist }; Modified: mplayerxp/postproc/libmenu/menu_console.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -484,16 +484,19 @@ return 1; } +static const m_struct_t m_priv = +{ + "console_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_console = { "MPlayer console", "console", "Albeu", "", - { - "console_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, openMenu, }; Modified: mplayerxp/postproc/libmenu/menu_filesel.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -44,12 +44,12 @@ char* dir; // current dir /// Cfg fields char* path; - char* title; - char* file_action; - char* dir_action; + const char* title; + const char* file_action; + const char* dir_action; int auto_close; char** actions; - char* filter; + const char* filter; }; static struct menu_priv_s cfg_dflt = { @@ -86,14 +86,15 @@ delete entry; } -static char* replace_path(char* title , char* dir) { - char *p = strstr(title,"%p"); +static const char* replace_path(const char* title,const char* dir) { + const char *p = strstr(title,"%p"); if(p) { int tl = strlen(title); int dl = strlen(dir); int t1l = p-title; int l = tl - 2 + dl; - char *r, *n, *d = dir; + char *r, *n; + const char *d = dir; char term = *(p-1); do { @@ -116,7 +117,7 @@ typedef int (*kill_warn)(const any_t*, const any_t*); -static int mylstat(char *dir, char *file,struct stat* st) { +static int mylstat(const char *dir,const char *file,struct stat* st) { int l = strlen(dir) + strlen(file); char s[l+2]; sprintf(s,"%s/%s",dir,file); @@ -182,7 +183,7 @@ } } -static int open_dir(menu_t* menu,char* args) { +static int open_dir(menu_t* menu,const char* args) { char **namelist, **tp; struct dirent *dp; struct stat st; @@ -201,7 +202,7 @@ mpriv->dir = mp_strdup(args); if(mpriv->p.title && mpriv->p.title != mpriv->title && mpriv->p.title != cfg_dflt.p.title) delete mpriv->p.title; - p = strstr(mpriv->title,"%p"); + p = strstr(const_cast<char*>(mpriv->title),"%p"); mpriv->p.title = replace_path(mpriv->title,mpriv->dir); @@ -309,7 +310,7 @@ if(mpriv->dir_action) { int fname_len = strlen(mpriv->dir) + strlen(mpriv->p.current->p.txt) + 1; char filename[fname_len]; - char* str; + const char* str; sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt); str = replace_path(mpriv->dir_action,filename); c = mp_input_parse_cmd(str); @@ -343,7 +344,7 @@ } else { // Files int fname_len = strlen(mpriv->dir) + strlen(mpriv->p.current->p.txt) + 1; char filename[fname_len]; - char *str; + const char *str; sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt); str = replace_path(mpriv->file_action,filename); c = mp_input_parse_cmd(str); @@ -359,7 +360,7 @@ case MENU_CMD_ACTION: { int fname_len = strlen(mpriv->dir) + strlen(mpriv->p.current->p.txt) + 1; char filename[fname_len]; - char *str; + const char *str; sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt); str = replace_path(action, filename); mp_input_queue_cmd(menu->libinput,mp_input_parse_cmd(str)); @@ -450,16 +451,19 @@ return r; } +static struct m_struct_t m_priv = +{ + "fs_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_filesel = { "File seletor menu", "filesel", "Albeu", "", - { - "fs_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, open_fs }; Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -256,16 +256,19 @@ return parse_args(menu,args); } +static const m_struct_t m_priv = +{ + "pref_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_pref = { "Preferences menu", "pref", "Albeu", "", - { - "pref_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, openMenu }; Modified: mplayerxp/postproc/libmenu/menu_pt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -31,7 +31,7 @@ struct menu_priv_s { menu_list_priv_t p; - char* title; + const char* title; }; static struct menu_priv_s cfg_dflt = { @@ -141,16 +141,19 @@ return 1; } +static const m_struct_t m_priv = +{ + "pt_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_pt = { "Playtree menu", "pt", "Albeu", "", - { - "pt_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, op }; Modified: mplayerxp/postproc/libmenu/menu_txt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -187,16 +187,19 @@ return 1; } +static const m_struct_t m_priv = +{ + "txt_cfg", + sizeof(struct menu_priv_s), + &cfg_dflt, + cfg_fields +}; + extern const menu_info_t menu_info_txt = { "Text file viewer", "txt", "Albeu", "", - { - "txt_cfg", - sizeof(struct menu_priv_s), - &cfg_dflt, - cfg_fields - }, + &m_priv, open_txt, }; Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-12 17:36:49 UTC (rev 553) +++ mplayerxp/postproc/vf.cpp 2012-12-13 07:22:44 UTC (rev 554) @@ -14,6 +14,7 @@ #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" +#include "swscale.h" #include "osdep/fastmemcpy.h" #include "libmpconf/codec-cfg.h" @@ -677,6 +678,10 @@ } vf_stream_t* vf_init(libinput_t& libinput,const vf_conf_t* conf) { + if(!sws_init()) { + MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); + exit_player(MSGTR_Exit_quit); + } vf_stream_t* s = new(zeromem) vf_stream_t(libinput); vf_instance_t* first; s->first=first=vf_init_filter(libinput,conf); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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] |
From: <nic...@us...> - 2012-12-12 16:21:14
|
Revision: 552 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=552&view=rev Author: nickols_k Date: 2012-12-12 16:21:04 +0000 (Wed, 12 Dec 2012) Log Message: ----------- new: class ASX_Element + minor redesign & segault-- Modified Paths: -------------- mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_param.cpp Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-12 15:33:11 UTC (rev 551) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-12 16:21:04 UTC (rev 552) @@ -24,8 +24,8 @@ ASX_Parser::ASX_Parser() {} ASX_Parser::~ASX_Parser() { if(ret_stack) delete ret_stack; } -int ASX_Parser::parse_attribs(char* buffer,ASX_Attrib& _attribs) const { - char *ptr1, *ptr2, *ptr3; +int ASX_Parser::parse_attribs(const char* buffer,ASX_Attrib& _attribs) const { + const char *ptr1, *ptr2, *ptr3; int n_attrib = 0; char *attrib, *val; @@ -75,8 +75,7 @@ /* * Return -1 on error, 0 when nothing is found, 1 on sucess */ -int ASX_Parser::get_element(const char** _buffer, char** _element, - char** _body,ASX_Attrib& _attribs) { +int ASX_Parser::get_element(const char** _buffer, ASX_Element& _element) { const char *ptr1,*ptr2, *ptr3, *ptr4; char *cattribs = NULL; char *element = NULL, *body = NULL; @@ -85,13 +84,12 @@ int n_attrib = 0; int body_line = 0,attrib_line,ret_line,in = 0; - if(_buffer == NULL || _element == NULL || _body == NULL) { + if(_buffer == NULL) { MSG_ERR("At line %d : asx_get_element called with invalid value",line); return -1; } - _attribs.clear(); - *_body = *_element = NULL; + _element.clear(); buffer = *_buffer; if(buffer == NULL) return 0; @@ -267,7 +265,7 @@ if(cattribs) { line = attrib_line; - n_attrib = parse_attribs(cattribs,_attribs); + n_attrib = parse_attribs(cattribs,_element.attribs()); delete cattribs; if(n_attrib < 0) { MSG_WARN("At line %d : error while parsing element %s attributes",line,element); @@ -275,10 +273,10 @@ delete body; return -1; } - } else _attribs.clear(); + } else _element.attribs().clear(); - *_element = element; - *_body = body; + _element.name(element?element:""); + _element.body(body?body:""); last_body = body; ret_stack_size++; @@ -326,7 +324,7 @@ MSG_V("Adding file %s to element entry\n",href.c_str()); } -play_tree_t* ASX_Parser::entryref(libinput_t* libinput,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; @@ -362,8 +360,7 @@ } play_tree_t* ASX_Parser::entry(const char* buffer,ASX_Attrib& _attribs) { - char *celement,*body; - ASX_Attrib cattribs; + ASX_Element element; int r,nref=0; play_tree_t *pt_ref; UNUSED(_attribs); @@ -371,17 +368,16 @@ pt_ref = play_tree_new(); while(buffer && buffer[0] != '\0') { - r = get_element(&buffer,&celement,&body,cattribs); + r = get_element(&buffer,element); if(r < 0) { warning_body_parse_error("ENTRY"); return NULL; } else if (r == 0) break; // No more element - if(strcasecmp(celement,"REF") == 0) { - ref(cattribs,pt_ref); - MSG_DBG2("Adding element %s to entry\n",celement); + if(strcasecmp(element.name().c_str(),"REF") == 0) { + ref(element.attribs(),pt_ref); + MSG_DBG2("Adding element %s to entry\n",element.name().c_str()); nref++; - } else MSG_DBG2("Ignoring element %s\n",celement); - if(body) delete body; + } else MSG_DBG2("Ignoring element %s\n",element.name().c_str()); } if(nref <= 0) { play_tree_free(pt_ref,1); @@ -391,8 +387,7 @@ } play_tree_t* ASX_Parser::repeat(libinput_t*libinput,const char* buffer,ASX_Attrib& _attribs) { - char *element,*body; - ASX_Attrib cattribs; + ASX_Element element; play_tree_t *pt_repeat, *list=NULL, *pt_entry; std::string count; int r; @@ -410,36 +405,35 @@ } while(buffer && buffer[0] != '\0') { - r = get_element(&buffer,&element,&body,cattribs); + r = get_element(&buffer,element); if(r < 0) { warning_body_parse_error("REPEAT"); return NULL; } else if (r == 0) break; // No more element - if(strcasecmp(element,"ENTRY") == 0) { - pt_entry = entry(body,cattribs); + if(strcasecmp(element.name().c_str(),"ENTRY") == 0) { + pt_entry = entry(element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to repeat\n",element); + MSG_DBG2("Adding element %s to repeat\n",element.name().c_str()); } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - pt_entry = entryref(libinput,body,cattribs); + } else if(strcasecmp(element.name().c_str(),"ENTRYREF") == 0) { + pt_entry = entryref(libinput,element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to repeat\n",element); + MSG_DBG2("Adding element %s to repeat\n",element.name().c_str()); } - } else if(strcasecmp(element,"REPEAT") == 0) { - pt_entry = repeat(libinput,body,cattribs); + } else if(strcasecmp(element.name().c_str(),"REPEAT") == 0) { + pt_entry = repeat(libinput,element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to repeat\n",element); + MSG_DBG2("Adding element %s to repeat\n",element.name().c_str()); } - } else if(strcasecmp(element,"PARAM") == 0) { - param(cattribs,pt_repeat); - } else MSG_DBG2("Ignoring element %s\n",element); - if(body) delete body; + } else if(strcasecmp(element.name().c_str(),"PARAM") == 0) { + param(element.attribs(),pt_repeat); + } else MSG_DBG2("Ignoring element %s\n",element.name().c_str()); } if(!list) { @@ -451,8 +445,7 @@ } play_tree_t* ASX_Parser::build_tree(libinput_t*libinput,const char* buffer,int deep) { - char *element,*asx_body,*body; - ASX_Attrib asx_attribs,attribs; + ASX_Element asx_element,element; int r; play_tree_t *asx,*pt_entry,*list = NULL; ASX_Parser& parser = *new(zeromem) ASX_Parser; @@ -460,7 +453,7 @@ parser.line = 1; parser.deep = deep; - r = parser.get_element(&buffer,&element,&asx_body,asx_attribs); + r = parser.get_element(&buffer,asx_element); if(r < 0) { MSG_ERR("At line %d : Syntax error ???",parser.line); delete &parser; @@ -471,54 +464,51 @@ return NULL; } - if(strcasecmp(element,"ASX") != 0) { - MSG_ERR("first element isn't ASX, it's %s\n",element); - if(body) delete body; + if(strcasecmp(element.name().c_str(),"ASX") != 0) { + MSG_ERR("first element isn't ASX, it's %s\n",element.name().c_str()); delete &parser; return NULL; } - if(!asx_body) { + if(asx_element.body().empty()) { MSG_ERR("ASX element is empty"); delete &parser; return NULL; } asx = play_tree_new(); - buffer = asx_body; + buffer = asx_element.body().c_str(); while(buffer && buffer[0] != '\0') { - r = parser.get_element(&buffer,&element,&body,attribs); + r = parser.get_element(&buffer,element); if(r < 0) { parser.warning_body_parse_error("ASX"); delete &parser; return NULL; } else if (r == 0) break; // No more element - if(strcasecmp(element,"ENTRY") == 0) { - pt_entry = parser.entry(body,attribs); + if(strcasecmp(element.name().c_str(),"ENTRY") == 0) { + pt_entry = parser.entry(element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to asx\n",element); + MSG_DBG2("Adding element %s to asx\n",element.name().c_str()); } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - pt_entry = parser.entryref(libinput,body,attribs); + } else if(strcasecmp(element.name().c_str(),"ENTRYREF") == 0) { + pt_entry = parser.entryref(libinput,element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to asx\n",element); + MSG_DBG2("Adding element %s to asx\n",element.name().c_str()); } - } else if(strcasecmp(element,"REPEAT") == 0) { - pt_entry = parser.repeat(libinput,body,attribs); + } else if(strcasecmp(element.name().c_str(),"REPEAT") == 0) { + pt_entry = parser.repeat(libinput,element.body().c_str(),element.attribs()); if(pt_entry) { if(!list) list = pt_entry; else play_tree_append_entry(list,pt_entry); - MSG_DBG2("Adding element %s to asx\n",element); + MSG_DBG2("Adding element %s to asx\n",element.name().c_str()); } - } else MSG_DBG2("Ignoring element %s\n",element); - if(body) delete body; + } else MSG_DBG2("Ignoring element %s\n",element.name().c_str()); } - delete asx_body; delete &parser; if(!list) { Modified: mplayerxp/libplaytree/asxparser.h =================================================================== --- mplayerxp/libplaytree/asxparser.h 2012-12-12 15:33:11 UTC (rev 551) +++ mplayerxp/libplaytree/asxparser.h 2012-12-12 16:21:04 UTC (rev 552) @@ -28,6 +28,24 @@ std::map<std::string,std::string,ASX_Attrib::stricomp> _attrib; }; + class ASX_Element { + public: + ASX_Element() {} + ~ASX_Element() {} + + const std::string& name(const std::string& s) { return _name=s; } + const std::string& body(const std::string& s) { return _body=s; } + ASX_Attrib& attribs(ASX_Attrib& a) { return _attribs=a; } + const std::string& name() const { return _name; } + const std::string& body() const { return _body; } + ASX_Attrib& attribs() { return _attribs; } + void clear() { name(""); body(""); attribs().clear(); } + private: + std::string _name; + std::string _body; + ASX_Attrib _attribs; + }; + class ASX_Parser : public Opaque { public: ASX_Parser(); @@ -35,19 +53,19 @@ static play_tree_t* build_tree(libinput_t* libinput,const char* buffer, int ref); - virtual int parse_attribs(char* buffer,ASX_Attrib& _attribs) const; + virtual int parse_attribs(const char* buffer,ASX_Attrib& _attribs) const; /* * Return -1 on error, 0 when nothing is found, 1 on sucess */ - virtual int get_element(const char** _buffer,char** _element,char** _body,ASX_Attrib& _attribs); + 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); - void warning_attrib_required(const char *e, const char *a) const; - void warning_body_parse_error(const char *e) const; + 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,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/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 15:33:11 UTC (rev 551) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 16:21:04 UTC (rev 552) @@ -59,15 +59,14 @@ static int menu_parse_config(const char* buffer) { - char *element,*body; std::string name; - ASX_Attrib attribs; + ASX_Element element; menu_info_t* minfo = NULL; int r,i; ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&buffer,&element,&body,attribs); + r = parser.get_element(&buffer,element); if(r < 0) { MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); delete &parser; @@ -77,17 +76,15 @@ return 1; } // Has it a name ? - name = attribs.get("name"); + name = element.attribs().get("name"); if(name.empty()) { MSG_WARN("[libmenu] Menu definitions need a name attrib: %i\n",parser.get_line()); - delete element; - if(body) delete body; continue; } // Try to find this menu type in our list for(i = 0, minfo = NULL ; menu_info_list[i] ; i++) { - if(strcasecmp(element,menu_info_list[i]->name) == 0) { + if(strcasecmp(element.name().c_str(),menu_info_list[i]->name) == 0) { minfo = menu_info_list[i]; break; } @@ -98,9 +95,9 @@ menu_list[menu_count].name = mp_strdup(name.c_str()); menu_list[menu_count].type = minfo; menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st); - menu_list[menu_count].args = body; + menu_list[menu_count].args = mp_strdup(element.body().c_str()); std::map<std::string,std::string,ASX_Attrib::stricomp>::iterator it; - std::map<std::string,std::string,ASX_Attrib::stricomp>& _map = attribs.map(); + std::map<std::string,std::string,ASX_Attrib::stricomp>& _map = element.attribs().map(); for(it=_map.begin();it!=_map.end();it++) { std::string sfirst,ssecond; sfirst=(*it).first; @@ -114,11 +111,8 @@ menu_count++; memset(&menu_list[menu_count],0,sizeof(menu_def_t)); } else { - MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element,parser.get_line()); - if(body) delete body; + MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element.name().c_str(),parser.get_line()); } - - delete element; } delete &parser; return 0; @@ -212,6 +206,10 @@ menu_t* m; int i; + if(menu_list == NULL) { + MSG_WARN("[libmenu] Menu was not initialized\n"); + return NULL; + } if(name == NULL) { MSG_WARN("[libmenu] Name of menu was not specified\n"); return NULL; @@ -286,6 +284,8 @@ int c = utf8_get_char((const char**)&txt); render_one_glyph(mpxp_context().video().output->font, c); } +#else + UNUSED(txt); #endif } Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 15:33:11 UTC (rev 551) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 16:21:04 UTC (rev 552) @@ -109,15 +109,14 @@ } static int parse_args(menu_t* menu,const char* args) { - char *element,*body; - ASX_Attrib attribs; + ASX_Element element; std::string name; list_entry_t* m = NULL; int r; ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&args,&element,&body,attribs); + r = parser.get_element(&args,element); if(r < 0) { MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); delete &parser; @@ -129,23 +128,18 @@ return m ? 1 : 0; } // Has it a name ? - name = attribs.get("name"); + name = element.attribs().get("name"); if(name.empty()) { MSG_WARN("[libmenu] ListMenu entry definitions need a name: %i\n",parser.get_line()); - delete element; - if(body) delete body; continue; } m = new(zeromem) struct list_entry_s; m->p.txt = mp_strdup(name.c_str()); - m->ok = mp_strdup(attribs.get("ok").c_str()); - m->cancel = mp_strdup(attribs.get("cancel").c_str()); - m->left = mp_strdup(attribs.get("left").c_str()); - m->right = mp_strdup(attribs.get("right").c_str()); + m->ok = mp_strdup(element.attribs().get("ok").c_str()); + m->cancel = mp_strdup(element.attribs().get("cancel").c_str()); + m->left = mp_strdup(element.attribs().get("left").c_str()); + m->right = mp_strdup(element.attribs().get("right").c_str()); menu_list_add_entry(menu,m); - - delete element; - if(body) delete body; } delete &parser; return -1; Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 15:33:11 UTC (rev 551) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 16:21:04 UTC (rev 552) @@ -92,8 +92,7 @@ } static int parse_args(menu_t* menu,const char* args) { - char *element,*body; - ASX_Attrib attribs; + ASX_Element element; std::string name,txt; list_entry_t* m = NULL; int r; @@ -101,7 +100,7 @@ ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&args,&element,&body,attribs); + r = parser.get_element(&args,element); if(r < 0) { MSG_ERR("[libmenu] Syntax error at line: %s\n",parser.get_line()); delete &parser; @@ -115,44 +114,40 @@ menu_list_add_entry(menu,m); return 1; } - if(!strcmp(element,"menu")) { - name = attribs.get("menu"); + if(!strcasecmp(element.name().c_str(),"menu")) { + name = element.attribs().get("menu"); if(name.empty()) { MSG_WARN("[libmenu] Submenu definition need a menu attribut\n"); - goto next_element; + continue; } m = new(zeromem) struct list_entry_s; m->menu = mp_strdup(name.c_str()); - m->p.txt = mp_strdup(attribs.get("name").c_str()); + m->p.txt = mp_strdup(element.attribs().get("name").c_str()); if(!m->p.txt) m->p.txt = mp_strdup(m->menu); menu_list_add_entry(menu,m); - goto next_element; + continue; } - name = attribs.get("property"); + name = element.attribs().get("property"); opt = NULL; if(!name.empty() && mp_property_do(name.c_str(),M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) { MSG_WARN("[libmenu] Invalid property: %s %i\n", name.c_str(),parser.get_line()); - goto next_element; + continue; } - txt = attribs.get("txt"); + txt = element.attribs().get("txt"); if(name.empty() || txt.empty()) { MSG_WARN("[libmenu] PrefMenu entry definitions need: %i\n",parser.get_line()); - goto next_element; + continue; } m = new(zeromem) struct list_entry_s; m->opt = opt; m->txt = mp_strdup(txt.c_str()); m->prop = mp_strdup(name.c_str()); - m->name = mp_strdup(attribs.get("name").c_str()); + m->name = mp_strdup(element.attribs().get("name").c_str()); if(!m->name) m->name = mp_strdup(opt ? opt->name : "-"); entry_set_text(menu,m); menu_list_add_entry(menu,m); - - next_element: - delete element; - if(body) delete body; } delete &parser; return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-12 15:33:23
|
Revision: 551 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=551&view=rev Author: nickols_k Date: 2012-12-12 15:33:11 +0000 (Wed, 12 Dec 2012) Log Message: ----------- use const std::string& in mp_msg Modified Paths: -------------- mplayerxp/mp_msg.cpp mplayerxp/mp_msg.h Modified: mplayerxp/mp_msg.cpp =================================================================== --- mplayerxp/mp_msg.cpp 2012-12-12 15:25:16 UTC (rev 550) +++ mplayerxp/mp_msg.cpp 2012-12-12 15:33:11 UTC (rev 551) @@ -83,7 +83,7 @@ "POSTPR" }; -int mpxp_printf( unsigned x, const char *format, ... ){ +int mpxp_printf( unsigned x, const std::string& format, ... ){ /* TODO: more useful usage of module_id */ int rc=0; char* sbuf=new char[0xFFFFF]; @@ -112,7 +112,7 @@ } va_list va; va_start(va, format); - ssize=vsprintf(sbuf,format, va); + ssize=vsprintf(sbuf,format.c_str(), va); va_end(va); if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { char *obuf; @@ -121,7 +121,7 @@ delete obuf; } else rc=fputs(sbuf,stderr); - if(format[strlen(format)-1]=='\n') was_eol=1; + if(format[format.length()-1]=='\n') was_eol=1; else was_eol=0; fflush(stderr); // if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); Modified: mplayerxp/mp_msg.h =================================================================== --- mplayerxp/mp_msg.h 2012-12-12 15:25:16 UTC (rev 550) +++ mplayerxp/mp_msg.h 2012-12-12 15:33:11 UTC (rev 551) @@ -2,6 +2,8 @@ #define __MP_MSG_H 1 #include "mplayerxp.h" +#include <string> + /* TODO: more highlighted levels */ #ifndef MSGT_CLASS #define MSGT_CLASS MSGT_CPLAYER @@ -55,51 +57,51 @@ void mpxp_print_init(int verbose); void mpxp_print_uninit(void); void mpxp_print_flush(void); - int mpxp_printf( unsigned x, const char *format, ... ); + int mpxp_printf( unsigned x, const std::string& format, ... ); - inline int mpxp_print_dummy(const char* args,...) { + inline int mpxp_print_dummy(const std::string& args,...) { UNUSED(args); return 0; } #ifdef __va_arg_pack /* requires gcc-4.3.x */ -__always_inline int MSG_INFO(const char* args,...) { +__always_inline int MSG_INFO(const std::string& args,...) { return mpxp_printf((MSGL_INFO<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_FATAL(const char* args,...) { +__always_inline int MSG_FATAL(const std::string& args,...) { return mpxp_printf((MSGL_FATAL<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_WARN(const char* args,...) { +__always_inline int MSG_WARN(const std::string& args,...) { return mpxp_printf((MSGL_WARN<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_ERR(const char* args,...) { +__always_inline int MSG_ERR(const std::string& args,...) { return mpxp_printf((MSGL_ERR<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_OK(const char* args,...) { +__always_inline int MSG_OK(const std::string& args,...) { return mpxp_printf((MSGL_OK<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_HINT(const char* args,...) { +__always_inline int MSG_HINT(const std::string& args,...) { return mpxp_printf((MSGL_HINT<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_STATUS(const char* args,...) { +__always_inline int MSG_STATUS(const std::string& args,...) { return mpxp_printf((MSGL_STATUS<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()); } -__always_inline int MSG_V(const char* args,...) { +__always_inline int MSG_V(const std::string& args,...) { return mp_conf.verbose ? mpxp_printf((MSGL_V<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()): 0; } -__always_inline int MSG_DBG2(const char* args,...) { +__always_inline int MSG_DBG2(const std::string& args,...) { return mp_conf.verbose>1 ? mpxp_printf((MSGL_DBG2<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()): 0; } -__always_inline int MSG_DBG3(const char* args,...) { +__always_inline int MSG_DBG3(const std::string& args,...) { return mp_conf.verbose>2 ? mpxp_printf((MSGL_DBG3<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()): 0; } -__always_inline int MSG_DBG4(const char* args,...) { +__always_inline int MSG_DBG4(const std::string& args,...) { return mp_conf.verbose>3 ? mpxp_printf((MSGL_DBG4<<28)|(MSGT_CLASS&0x0FFFFFFF),args,__va_arg_pack ()): 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-12 15:25:29
|
Revision: 550 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=550&view=rev Author: nickols_k Date: 2012-12-12 15:25:16 +0000 (Wed, 12 Dec 2012) Log Message: ----------- use class ASX_Attrib instead of char*** in ASX_Parser + memory leak-- Modified Paths: -------------- mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_property.cpp mplayerxp/libmpconf/m_property.h mplayerxp/libmpconf/m_struct.cpp mplayerxp/libmpconf/m_struct.h mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/vf_menu.cpp Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -41,7 +41,7 @@ // Default function that just does a memcpy -static void copy_opt(const m_option_t* opt,any_t* dst,any_t* src) { +static void copy_opt(const m_option_t* opt,any_t* dst,const any_t* src) { if(dst && src) memcpy(dst,src,opt->type->size); } @@ -77,7 +77,7 @@ #define VAL(x) (*(int*)(x)) -static int parse_flag(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_flag(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { if (src == M_CONFIG_FILE) { if(!param) return M_OPT_MISSING_PARAM; if (!strcasecmp(param, "yes") || /* any other language? */ @@ -115,7 +115,7 @@ } } -static char* print_flag(const m_option_t* opt, any_t* val) { +static char* print_flag(const m_option_t* opt,const any_t* val) { if(VAL(val) == opt->min) return mp_strdup("no"); else @@ -137,7 +137,7 @@ // Integer -static int parse_int(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_int(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { long tmp_int; char *endptr; src = 0; @@ -168,7 +168,7 @@ return 1; } -static char* print_int(const m_option_t* opt, any_t* val) { +static char* print_int(const m_option_t* opt,const any_t* val) { opt = NULL; return dup_printf("%d",VAL(val)); } @@ -191,7 +191,7 @@ #undef VAL #define VAL(x) (*(double*)(x)) -static int parse_double(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_double(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { double tmp_float; char* endptr; src = 0; @@ -240,7 +240,7 @@ return 1; } -static char* print_double(const m_option_t* opt, any_t* val) { +static char* print_double(const m_option_t* opt,const any_t* val) { opt = NULL; return dup_printf("%f",VAL(val)); } @@ -261,14 +261,14 @@ #undef VAL #define VAL(x) (*(float*)(x)) -static int parse_float(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_float(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { double tmp; int r= parse_double(opt, name, param, &tmp, src); if(r==1 && dst) VAL(dst) = tmp; return r; } -static char* print_float(const m_option_t* opt, any_t* val) { +static char* print_float(const m_option_t* opt,const any_t* val) { opt = NULL; return dup_printf("%f",VAL(val)); } @@ -290,7 +290,8 @@ #undef VAL #define VAL(x) (*(off_t*)(x)) -static int parse_position(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_position(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { + UNUSED(src); off_t tmp_off; char dummy; @@ -320,7 +321,7 @@ return 1; } -static char* print_position(const m_option_t* opt, any_t* val) { +static char* print_position(const m_option_t* opt,const any_t* val) { UNUSED(opt); return dup_printf("%d",(int64_t)VAL(val)); } @@ -344,7 +345,7 @@ #undef VAL #define VAL(x) (*(char**)(x)) -static int parse_str(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_str(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { UNUSED(src); UNUSED(name); UNUSED(opt); @@ -374,13 +375,13 @@ } -static char* print_str(const m_option_t* opt, any_t* val) { +static char* print_str(const m_option_t* opt,const any_t* val) { UNUSED(opt); UNUSED(val); return (val && VAL(val) && strlen(VAL(val)) > 0) ? mp_strdup(VAL(val)) : NULL; } -static void copy_str(const m_option_t* opt,any_t* dst, any_t* src) { +static void copy_str(const m_option_t* opt,any_t* dst,const any_t* src) { UNUSED(opt); if(dst && src) { #ifndef NO_FREE @@ -390,7 +391,7 @@ } } -static void free_str(any_t* src) { +static void free_str(const any_t* src) { if(src && VAL(src)){ #ifndef NO_FREE delete VAL(src); //FIXME!!! @@ -424,7 +425,7 @@ #define OP_DEL 3 #define OP_CLR 4 -static void free_str_list(any_t* dst) { +static void free_str_list(const any_t* dst) { char** d; int i; @@ -440,7 +441,7 @@ VAL(dst) = NULL; } -static int str_list_add(char** add, int n,any_t* dst,int pre) { +static int str_list_add(const char** add, int n,any_t* dst,int pre) { char** lst = VAL(dst); int ln; @@ -465,7 +466,7 @@ return 1; } -static int str_list_del(char** del, int n,any_t* dst) { +static int str_list_del(char** del, int n,const any_t* dst) { char **lst,*ep,**d; int i,ln,s; long idx; @@ -516,8 +517,20 @@ return 1; } +static const char *get_nextsep(const char *ptr, char sep) { + const char *last_ptr = ptr; + for(;;){ + ptr = strchr(ptr, sep); + if(ptr && ptr>last_ptr && ptr[-1]=='\\'){ + ptr++; + }else + break; + } + return ptr; +} + static char *get_nextsep(char *ptr, char sep, int modify) { - char *last_ptr = ptr; + const char *last_ptr = ptr; for(;;){ ptr = strchr(ptr, sep); if(ptr && ptr>last_ptr && ptr[-1]=='\\'){ @@ -529,10 +542,11 @@ return ptr; } -static int parse_str_list(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_str_list(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { int n = 0,len = strlen(opt->name); char *str; - char *ptr = param, *last_ptr, **res; + const char *ptr = param; + char *last_ptr, **res; int op = OP_NONE; UNUSED(src); @@ -563,7 +577,7 @@ while(ptr[0] != '\0') { - ptr = get_nextsep(ptr, LIST_SEPARATOR, 0); + ptr = get_nextsep(ptr, LIST_SEPARATOR); if(!ptr) { n++; break; @@ -584,8 +598,8 @@ n = 0; while(1) { - last_ptr = ptr; - ptr = get_nextsep(ptr, LIST_SEPARATOR, 1); + last_ptr = const_cast<char*>(ptr); + ptr = get_nextsep(last_ptr, LIST_SEPARATOR, 1); if(!ptr) { res[n] = mp_strdup(last_ptr); n++; @@ -603,9 +617,9 @@ switch(op) { case OP_ADD: - return str_list_add(res,n,dst,0); + return str_list_add(const_cast<const char**>(res),n,dst,0); case OP_PRE: - return str_list_add(res,n,dst,1); + return str_list_add(const_cast<const char**>(res),n,dst,1); case OP_DEL: return str_list_del(res,n,dst); } @@ -617,7 +631,7 @@ return 1; } -static void copy_str_list(const m_option_t* opt,any_t* dst, any_t* src) { +static void copy_str_list(const m_option_t* opt,any_t* dst,const any_t* src) { int n; char **d,**s; UNUSED(opt); @@ -642,7 +656,7 @@ VAL(dst) = d; } -static char* print_str_list(const m_option_t* opt, any_t* src) { +static char* print_str_list(const m_option_t* opt,const any_t* src) { char **lst = NULL; char *ret = NULL,*last = NULL; int i; @@ -698,7 +712,7 @@ /////////////////// Print -static int parse_print(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_print(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { UNUSED(src); UNUSED(dst); UNUSED(param); @@ -757,7 +771,7 @@ #undef VAL #define VAL(x) (*(char***)(x)) -static int parse_subconf(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_subconf(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { char *subparam; char *subopt; int nr = 0,i,r; @@ -798,7 +812,7 @@ } else if (p[0] == '%') { p = &p[1]; optlen = (int)strtol(p, (char**)&p, 0); - if (!p || p[0] != '%' || (optlen > strlen(p) - 1)) { + if (!p || p[0] != '%' || (unsigned(optlen) > strlen(p) - 1)) { MSG_ERR("Invalid length %i for '%s'\n", optlen, subopt); return M_OPT_INVALID; } @@ -929,7 +943,7 @@ { NULL, 0 } }; -static int parse_imgfmt(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_imgfmt(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { uint32_t fmt = 0; int i; UNUSED(src); @@ -1011,7 +1025,7 @@ { NULL, 0 } }; -static int parse_afmt(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_afmt(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { uint32_t fmt = 0; int i; UNUSED(src); @@ -1075,7 +1089,7 @@ return -1e100; } -static int parse_time(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) +static int parse_time(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { double time; UNUSED(src); @@ -1112,7 +1126,7 @@ // Time or size (-endpos) -static int parse_time_size(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +static int parse_time_size(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { m_time_size_t ts; char unit[4]; double end_at; @@ -1344,7 +1358,7 @@ } static int parse_obj_params(const m_option_t* opt,const char *name, - char *param, any_t* dst, int src) { + const char *param, any_t* dst, int src) { char** opts; int r; m_obj_params_t* p = reinterpret_cast<m_obj_params_t*>(opt->priv); @@ -1456,9 +1470,9 @@ return 1; } -static void free_obj_settings_list(any_t* dst); +static void free_obj_settings_list(const any_t* dst); -static int obj_settings_list_del(const char *opt_name,char *param,any_t* dst, int src) { +static int obj_settings_list_del(const char *opt_name,const char *param,any_t* dst, int src) { char** str_list = NULL; int r,i,idx_max = 0; const char* rem_id = "_removed_marker_"; @@ -1517,7 +1531,7 @@ } static int parse_obj_settings_list(const m_option_t* opt,const char *name, - char *param, any_t* dst, int src) { + const char *param, any_t* dst, int src) { int n = 0,r,len = strlen(opt->name); char *str; char *ptr, *last_ptr; @@ -1654,7 +1668,7 @@ return 1; } -static void free_obj_settings_list(any_t* dst) { +static void free_obj_settings_list(const any_t* dst) { int n; m_obj_settings_t *d; @@ -1671,7 +1685,7 @@ VAL(dst) = NULL; } -static void copy_obj_settings_list(const m_option_t* opt,any_t* dst, any_t* src) { +static void copy_obj_settings_list(const m_option_t* opt,any_t* dst,const any_t* src) { m_obj_settings_t *d,*s; int n; UNUSED(opt); @@ -1712,7 +1726,7 @@ }; static int parse_obj_presets(const m_option_t* opt,const char *name, - char *param, any_t* dst, int src) { + const char *param, any_t* dst, int src) { m_obj_presets_t* obj_p = (m_obj_presets_t*)opt->priv; m_struct_t *in_desc,*out_desc; int s,i; @@ -1785,7 +1799,7 @@ #ifdef HAVE_STREAMING static int parse_custom_url(const m_option_t* opt,const char *name, - char *url, any_t* dst, int src) { + const char *url, any_t* dst, int src) { int pos1, pos2, r, v6addr = 0; char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL; m_struct_t* desc = reinterpret_cast<m_struct_t*>(opt->priv); @@ -1796,7 +1810,7 @@ } // extract the protocol - ptr1 = strstr(url, "://"); + ptr1 = strstr(const_cast<char*>(url), "://"); if( ptr1==NULL ) { // Filename only if(m_option_list_find(desc->fields,"filename")) { Modified: mplayerxp/libmpconf/m_option.h =================================================================== --- mplayerxp/libmpconf/m_option.h 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_option.h 2012-12-12 15:25:16 UTC (rev 550) @@ -161,7 +161,7 @@ * \return On error a negative value is returned, on success the number of arguments * consumed. For details see \ref OptionParserReturn. */ - int (*parse)(const m_option_t* opt,const char *name, char *param, any_t* dst, int src); + int (*parse)(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src); /// Print back a value in string form. /** \param opt The option to print. @@ -169,7 +169,7 @@ * \return An allocated string containing the text value or (any_t*)-1 * on error. */ - char* (*print)(const m_option_t* opt, any_t* val); + char* (*print)(const m_option_t* opt,const any_t* val); /** \name * These functions are called to save/set/restore the status of the @@ -184,21 +184,21 @@ * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*save)(const m_option_t* opt,any_t* dst, any_t* src); + void (*save)(const m_option_t* opt,any_t* dst,const any_t* src); /// Set the value in the program (dst) from a save slot. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*set)(const m_option_t* opt,any_t* dst, any_t* src); + void (*set)(const m_option_t* opt,any_t* dst,const any_t* src); /// Copy the data between two save slots. If NULL and size is > 0 a memcpy will be used. /** \param opt The option to copy. * \param dst Pointer to the destination memory. * \param src Pointer to the source memory. */ - void (*copy)(const m_option_t* opt,any_t* dst, any_t* src); + void (*copy)(const m_option_t* opt,any_t* dst,const any_t* src); //@} /// Free the data allocated for a save slot. @@ -206,7 +206,7 @@ * \param dst Pointer to the data, usually a pointer that should be freed and * set to NULL. */ - void (*mp_free)(any_t* dst); + void (*mp_free)(const any_t* dst); }; ///@} @@ -354,13 +354,13 @@ /// Helper to parse options, see \ref m_option_type::parse. inline static int -m_option_parse(const m_option_t* opt,const char *name, char *param, any_t* dst, int src) { +m_option_parse(const m_option_t* opt,const char *name,const char *param, any_t* dst, int src) { return opt->type->parse(opt,name,param,dst,src); } /// Helper to print options, see \ref m_option_type::print. inline static char* -m_option_print(const m_option_t* opt, any_t* val_ptr) { +m_option_print(const m_option_t* opt,const any_t* val_ptr) { if(opt->type->print) return opt->type->print(opt,val_ptr); else @@ -369,21 +369,21 @@ /// Helper around \ref m_option_type::save. inline static void -m_option_save(const m_option_t* opt,any_t* dst, any_t* src) { +m_option_save(const m_option_t* opt,any_t* dst,const any_t* src) { if(opt->type->save) opt->type->save(opt,dst,src); } /// Helper around \ref m_option_type::set. inline static void -m_option_set(const m_option_t* opt,any_t* dst, any_t* src) { +m_option_set(const m_option_t* opt,any_t* dst,const any_t* src) { if(opt->type->set) opt->type->set(opt,dst,src); } /// Helper around \ref m_option_type::copy. inline static void -m_option_copy(const m_option_t* opt,any_t* dst, any_t* src) { +m_option_copy(const m_option_t* opt,any_t* dst,const any_t* src) { if(opt->type->copy) opt->type->copy(opt,dst,src); else if(opt->type->size > 0) @@ -392,7 +392,7 @@ /// Helper around \ref m_option_type::mp_free. inline static void -m_option_free(const m_option_t* opt,any_t* dst) { +m_option_free(const m_option_t* opt,const any_t* dst) { if(opt->type->mp_free) opt->type->mp_free(dst); } Modified: mplayerxp/libmpconf/m_property.cpp =================================================================== --- mplayerxp/libmpconf/m_property.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_property.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -99,10 +99,10 @@ return do_action(prop_list,name,action,arg,ctx); } -char* m_properties_expand_string(m_option_t* prop_list,char* str, any_t*ctx) { +char* m_properties_expand_string(m_option_t* prop_list,const char* str, any_t*ctx) { int l,fr=0,pos=0,size=strlen(str)+512; - char *e,*ret = new char [size], num_val; - const char* p=NULL; + char *ret = new char [size], num_val; + const char* e,*p=NULL; int skip = 0, lvl = 0, skip_lvl = 0; while(str[0]) { Modified: mplayerxp/libmpconf/m_property.h =================================================================== --- mplayerxp/libmpconf/m_property.h 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_property.h 2012-12-12 15:25:16 UTC (rev 550) @@ -103,7 +103,7 @@ * \param str The string to expand. * \return The newly allocated expanded string. */ -char* m_properties_expand_string(m_option_t* prop_list,char* str, any_t*ctx); +char* m_properties_expand_string(m_option_t* prop_list,const char* str, any_t*ctx); // Helpers to use MPlayer's properties Modified: mplayerxp/libmpconf/m_struct.cpp =================================================================== --- mplayerxp/libmpconf/m_struct.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_struct.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -52,7 +52,7 @@ } int -m_struct_set(const m_struct_t* st, any_t* obj,const char* field, char* param) { +m_struct_set(const m_struct_t* st, any_t* obj,const char* field,const char* param) { const m_option_t* f = m_struct_get_field(st,field); if(!f) { Modified: mplayerxp/libmpconf/m_struct.h =================================================================== --- mplayerxp/libmpconf/m_struct.h 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libmpconf/m_struct.h 2012-12-12 15:25:16 UTC (rev 550) @@ -67,7 +67,7 @@ * \return 0 on error, 1 on success. */ int -m_struct_set(const m_struct_t* st, any_t* obj,const char* field, char* param); +m_struct_set(const m_struct_t* st, any_t* obj,const char* field,const char* param); /// Reset a field (or all if field == NULL) to defaults. /** \param st Struct definition. Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -16,139 +16,17 @@ #define MSGT_CLASS MSGT_PLAYTREE #include "mp_msg.h" -////// List utils namespace mpxp { -static void __FASTCALL__ asx_list_add(any_t* list_ptr,any_t* entry){ - any_t** list = *(any_t***)list_ptr; - int c = 0; - if(list != NULL) - for( ; list[c] != NULL; c++) ; - - list = (any_t**)mp_realloc(list,sizeof(any_t*)*(c+2)); - - list[c] = entry; - list[c+1] = NULL; - - *(any_t***)list_ptr = list; -} - - -static void __FASTCALL__ asx_list_remove(any_t* list_ptr,any_t* entry,ASX_FreeFunc free_func) { - any_t** list = *(any_t***)list_ptr; - int c,e = -1; - - if(list == NULL) return; - - for(c = 0 ; list[c] != NULL; c++){ - if(list[c] == entry) e = c; - } - - if(e == -1) return; // Not found - - if(free_func != NULL) free_func(list[e]); - - if(c == 1) { // Only one entry, we drop all - delete list; - *(any_t**)list_ptr = NULL; - return; - } - - if(c > e) // If c==e the memmove is not needed - memmove(list+e,list+e+1,(c-e)*sizeof(any_t*)); - - list = (any_t**)mp_realloc(list,(c-1)*sizeof(any_t*)); - list[c-1] = NULL; - - *(any_t***)list_ptr = list; -} - -void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func) { - any_t** ptr = *(any_t***)list_ptr; - if(ptr == NULL) return; - if(free_func != NULL) { - for( ; *ptr != NULL ; ptr++) - free_func(*ptr); - } - delete *(any_t**)list_ptr; - *(any_t**)list_ptr = NULL; -} - -/////// Attribs utils - -char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs) { - char** ptr; - - if(attrib == NULL || attribs == NULL) return NULL; - for(ptr = attribs; ptr[0] != NULL; ptr += 2){ - if(strcasecmp(ptr[0],attrib) == 0) return mp_strdup(ptr[1]); - } - return NULL; -} - -int __FASTCALL__ asx_attrib_to_enum(const char* val,const char** valid_vals) { - const char** ptr; - int r = 0; - - if(valid_vals == NULL || val == NULL) return -2; - for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) { - if(strcasecmp(val,ptr[0]) == 0) return r; - r++; - } - return -1; -} - -void ASX_Parser::warning_attrib_invalid(char* elem, char* attrib, - const char** valid_vals,char* val) const -{ - char *str,*vals; - const char **ptr; - int len; - - if(valid_vals == NULL || valid_vals[0] == NULL) return; - - len = strlen(valid_vals[0]) + 1; - for(ptr = valid_vals+1 ; ptr[0] != NULL; ptr++) { - len += strlen(ptr[0]); - len += ((ptr[1] == NULL) ? 4 : 2); - } - str = vals = new char[len]; - vals += sprintf(vals,"%s",valid_vals[0]); - for(ptr = valid_vals + 1 ; ptr[0] != NULL ; ptr++) { - if(ptr[1] == NULL) vals += sprintf(vals," or %s",ptr[0]); - else vals += sprintf(vals,", %s",ptr[0]); - } - MSG_ERR("at line %d : attribute %s of element %s is invalid (%s). Valid values are %s", - line,attrib,elem,val,str); - delete str; -} - -int ASX_Parser::get_yes_no_attrib(char* element, char* attrib,char** cattribs,int def) const { - char* val = asx_get_attrib(attrib,cattribs); - const char* valids[] = { "NO", "YES", NULL }; - int r; - - if(val == NULL) return def; - r = asx_attrib_to_enum(val,valids); - - if(r < 0) { - warning_attrib_invalid(element,attrib,valids,val); - r = def; - } - delete val; - return r; -} - void ASX_Parser::warning_attrib_required(const char *e, const char *a) const { MSG_WARN("At line %d : element %s don't have the required attribute %s",line,e,a); } void ASX_Parser::warning_body_parse_error(const char *e) const { MSG_WARN("At line %d : error while parsing %s body",line,e); } ASX_Parser::ASX_Parser() {} ASX_Parser::~ASX_Parser() { if(ret_stack) delete ret_stack; } -int ASX_Parser::parse_attribs(char* buffer,char*** _attribs) const { +int ASX_Parser::parse_attribs(char* buffer,ASX_Attrib& _attribs) const { char *ptr1, *ptr2, *ptr3; int n_attrib = 0; - char **cattribs = NULL; char *attrib, *val; ptr1 = buffer; @@ -177,7 +55,7 @@ ptr1++; ptr2 = strchr(ptr1,'"'); if (ptr2 == NULL) { - MSG_WARN("At line %d : value of attribute %s isn't finished",line,attrib); + MSG_WARN("At line %d : value of attribute %s isn't finished\n",line,attrib); delete attrib; break; } @@ -186,16 +64,11 @@ val[ptr2-ptr1] = '\0'; n_attrib++; - cattribs = (char**)mp_realloc(cattribs,(2*n_attrib+1)*sizeof(char*)); - cattribs[n_attrib*2-2] = attrib; - cattribs[n_attrib*2-1] = val; + _attribs.set(attrib,val); ptr1 = ptr2+1; } pa_end: - if(n_attrib > 0) - cattribs[n_attrib*2-0] = NULL; - *_attribs = cattribs; return n_attrib; } @@ -203,7 +76,7 @@ * Return -1 on error, 0 when nothing is found, 1 on sucess */ int ASX_Parser::get_element(const char** _buffer, char** _element, - char** _body,char*** _attribs) { + char** _body,ASX_Attrib& _attribs) { const char *ptr1,*ptr2, *ptr3, *ptr4; char *cattribs = NULL; char *element = NULL, *body = NULL; @@ -212,13 +85,13 @@ int n_attrib = 0; int body_line = 0,attrib_line,ret_line,in = 0; - if(_buffer == NULL || _element == NULL || _body == NULL || _attribs == NULL) { + if(_buffer == NULL || _element == NULL || _body == NULL) { MSG_ERR("At line %d : asx_get_element called with invalid value",line); return -1; } + _attribs.clear(); *_body = *_element = NULL; - *_attribs = NULL; buffer = *_buffer; if(buffer == NULL) return 0; @@ -402,8 +275,7 @@ delete body; return -1; } - } else - *_attribs = NULL; + } else _attribs.clear(); *_element = element; *_body = body; @@ -420,48 +292,43 @@ return 1; } -void ASX_Parser::param(char** cattribs, play_tree_t* pt) const { - const char *name,*val; +void ASX_Parser::param(ASX_Attrib& cattribs, play_tree_t* pt) const { + std::string name,val; - name = asx_get_attrib("NAME",cattribs); - if(!name) { + name = cattribs.get("NAME"); + if(name.empty()) { warning_attrib_required("PARAM" ,"NAME" ); return; } - val = asx_get_attrib("VALUE",cattribs); - if(m_config_get_option(mpxp_context().mconfig,name) == NULL) { - MSG_WARN("Found unknow param in asx: %s",name); - if(val) MSG_WARN("=%s\n",val); - else MSG_WARN("\n"); + val = cattribs.get("VALUE"); + if(m_config_get_option(mpxp_context().mconfig,name.c_str()) == NULL) { + MSG_WARN("Found unknow param in asx: %s",name.c_str()); + if(!val.empty())MSG_WARN("=%s\n",val.c_str()); + else MSG_WARN("\n"); return; } - play_tree_set_param(pt,name,val); + play_tree_set_param(pt,mp_strdup(name.c_str()),mp_strdup(val.c_str())); } -void ASX_Parser::ref(char** cattribs, play_tree_t* pt) const { - char *href; +void ASX_Parser::ref(ASX_Attrib& cattribs, play_tree_t* pt) const { + std::string href; - href = asx_get_attrib("HREF",cattribs); - if(href == NULL) { + href = cattribs.get("HREF"); + if(href.empty()) { warning_attrib_required("REF" ,"HREF" ); return; } // replace http my mmshttp to avoid infinite loops - if (strncmp(href, "http://", 7) == 0) { - char *newref = new char [3 + strlen(href) + 1]; - strcpy(newref, "mms"); - strcpy(newref + 3, href); - delete href; - href = newref; + if (href.substr(0,7)=="http://") { + href = "mms"+href; } - play_tree_add_file(pt,href); - MSG_V("Adding file %s to element entry\n",href); - delete href; + play_tree_add_file(pt,mp_strdup(href.c_str())); + MSG_V("Adding file %s to element entry\n",href.c_str()); } -play_tree_t* ASX_Parser::entryref(libinput_t* libinput,char* buffer,char** _attribs) const { +play_tree_t* ASX_Parser::entryref(libinput_t* libinput,char* buffer,ASX_Attrib& _attribs) const { play_tree_t* pt; - char *href; + std::string href; Stream* stream; play_tree_parser_t* ptp; int f; @@ -469,23 +336,23 @@ if(deep > 0) return NULL; - href = asx_get_attrib("HREF",_attribs); - if(href == NULL) { + href = _attribs.get("HREF"); + if(href.empty()) { warning_attrib_required("ENTRYREF" ,"HREF" ); return NULL; } stream=new(zeromem) Stream; if(stream->open(libinput,href,&f)!=MPXP_Ok) { - MSG_WARN("Can't open playlist %s\n",href); + MSG_WARN("Can't open playlist %s\n",href.c_str()); delete stream; return NULL; } if(!(stream->type() & Stream::Type_Text)) { - MSG_WARN("URL %s dont point to a playlist\n",href); + MSG_WARN("URL %s dont point to a playlist\n",href.c_str()); delete stream; return NULL; } - MSG_V("Adding playlist %s to element entryref\n",href); + MSG_V("Adding playlist %s to element entryref\n",href.c_str()); ptp = play_tree_parser_new(stream,deep+1); pt = play_tree_parser_get_play_tree(libinput,ptp); play_tree_parser_free(ptp); @@ -494,8 +361,9 @@ return pt; } -play_tree_t* ASX_Parser::entry(const char* buffer,char** _attribs) { - char *celement,*body,**cattribs; +play_tree_t* ASX_Parser::entry(const char* buffer,ASX_Attrib& _attribs) { + char *celement,*body; + ASX_Attrib cattribs; int r,nref=0; play_tree_t *pt_ref; UNUSED(_attribs); @@ -503,7 +371,7 @@ pt_ref = play_tree_new(); while(buffer && buffer[0] != '\0') { - r = get_element(&buffer,&celement,&body,&cattribs); + r = get_element(&buffer,&celement,&body,cattribs); if(r < 0) { warning_body_parse_error("ENTRY"); return NULL; @@ -514,7 +382,6 @@ nref++; } else MSG_DBG2("Ignoring element %s\n",celement); if(body) delete body; - asx_free_attribs(cattribs); } if(nref <= 0) { play_tree_free(pt_ref,1); @@ -523,27 +390,27 @@ return pt_ref; } -play_tree_t* ASX_Parser::repeat(libinput_t*libinput,const char* buffer,char** _attribs) { - char *element,*body,**cattribs; +play_tree_t* ASX_Parser::repeat(libinput_t*libinput,const char* buffer,ASX_Attrib& _attribs) { + char *element,*body; + ASX_Attrib cattribs; play_tree_t *pt_repeat, *list=NULL, *pt_entry; - char* count; + std::string count; int r; pt_repeat = play_tree_new(); - count = asx_get_attrib("COUNT",_attribs); - if(count == NULL) { + count = _attribs.get("COUNT"); + if(count.empty()) { MSG_DBG2("Setting element repeat loop to infinit\n"); pt_repeat->loop = -1; // Infinit } else { - pt_repeat->loop = atoi(count); - delete count; + pt_repeat->loop = ::atoi(count.c_str()); if(pt_repeat->loop == 0) pt_repeat->loop = 1; MSG_DBG2("Setting element repeat loop to %d\n",pt_repeat->loop); } while(buffer && buffer[0] != '\0') { - r = get_element(&buffer,&element,&body,&cattribs); + r = get_element(&buffer,&element,&body,cattribs); if(r < 0) { warning_body_parse_error("REPEAT"); return NULL; @@ -573,7 +440,6 @@ param(cattribs,pt_repeat); } else MSG_DBG2("Ignoring element %s\n",element); if(body) delete body; - asx_free_attribs(cattribs); } if(!list) { @@ -585,7 +451,8 @@ } play_tree_t* ASX_Parser::build_tree(libinput_t*libinput,const char* buffer,int deep) { - char *element,*asx_body,**asx_attribs,*body, **attribs; + char *element,*asx_body,*body; + ASX_Attrib asx_attribs,attribs; int r; play_tree_t *asx,*pt_entry,*list = NULL; ASX_Parser& parser = *new(zeromem) ASX_Parser; @@ -593,7 +460,7 @@ parser.line = 1; parser.deep = deep; - r = parser.get_element(&buffer,&element,&asx_body,&asx_attribs); + r = parser.get_element(&buffer,&element,&asx_body,asx_attribs); if(r < 0) { MSG_ERR("At line %d : Syntax error ???",parser.line); delete &parser; @@ -606,7 +473,6 @@ if(strcasecmp(element,"ASX") != 0) { MSG_ERR("first element isn't ASX, it's %s\n",element); - asx_free_attribs(asx_attribs); if(body) delete body; delete &parser; return NULL; @@ -614,7 +480,6 @@ if(!asx_body) { MSG_ERR("ASX element is empty"); - asx_free_attribs(asx_attribs); delete &parser; return NULL; } @@ -622,7 +487,7 @@ asx = play_tree_new(); buffer = asx_body; while(buffer && buffer[0] != '\0') { - r = parser.get_element(&buffer,&element,&body,&attribs); + r = parser.get_element(&buffer,&element,&body,attribs); if(r < 0) { parser.warning_body_parse_error("ASX"); delete &parser; @@ -651,11 +516,9 @@ } } else MSG_DBG2("Ignoring element %s\n",element); if(body) delete body; - asx_free_attribs(attribs); } delete asx_body; - asx_free_attribs(asx_attribs); delete &parser; if(!list) { Modified: mplayerxp/libplaytree/asxparser.h =================================================================== --- mplayerxp/libplaytree/asxparser.h 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/libplaytree/asxparser.h 2012-12-12 15:25:16 UTC (rev 550) @@ -1,17 +1,33 @@ #ifndef ASXPARSER_H #define ASXPARSER_H 1 - #include "osdep/mplib.h" #include "playtree.h" - using namespace mpxp; +#include <string> +#include <map> + namespace mpxp { struct ASX_LineSave_t { const char* buffer; int line; }; + class ASX_Attrib { + public: + ASX_Attrib() {} + ~ASX_Attrib() {} + + struct stricomp { int operator() (const std::string& lhs, const std::string& rhs) const { return strcasecmp(lhs.c_str(),rhs.c_str()); }}; + + std::string get(const std::string& key) { return _attrib[key]; } + void set(const std::string& key,const std::string& value) { _attrib[key]=value; } + void clear() { _attrib.clear(); } + std::map<std::string,std::string,ASX_Attrib::stricomp>& map() { return _attrib; } + private: + std::map<std::string,std::string,ASX_Attrib::stricomp> _attrib; + }; + class ASX_Parser : public Opaque { public: ASX_Parser(); @@ -19,42 +35,26 @@ static play_tree_t* build_tree(libinput_t* libinput,const char* buffer, int ref); - virtual int parse_attribs(char* buffer,char*** _attribs) const; + virtual int parse_attribs(char* buffer,ASX_Attrib& _attribs) const; /* * Return -1 on error, 0 when nothing is found, 1 on sucess */ - virtual int get_element(const char** _buffer,char** _element,char** _body,char*** _attribs); + virtual int get_element(const char** _buffer,char** _element,char** _body,ASX_Attrib& _attribs); int get_line() const { return line; } private: - play_tree_t* repeat(libinput_t*libinput,const char* buffer,char** _attribs); - void warning_attrib_invalid(char* elem, char* attrib,const char** valid_vals,char* val) const; + play_tree_t* repeat(libinput_t*libinput,const char* buffer,ASX_Attrib& _attribs); void warning_attrib_required(const char *e, const char *a) const; void warning_body_parse_error(const char *e) const; - int get_yes_no_attrib(char* element, char* attrib,char** attribs,int def) const; - void param(char** attribs, play_tree_t* pt) const; - void ref(char** attribs, play_tree_t* pt) const; - play_tree_t* entryref(libinput_t* libinput,char* buffer,char** _attribs) const; - play_tree_t* entry(const char* buffer,char** _attribs); + 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,char* buffer,ASX_Attrib& _attribs) const; + play_tree_t* entry(const char* buffer,ASX_Attrib& _attribs); int line; // Curent line ASX_LineSave_t* ret_stack; int ret_stack_size; char* last_body; int deep; -}; - -/////// Attribs utils - -extern char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs); - -extern int __FASTCALL__ asx_attrib_to_enum(const char* val,char** valid_vals); - -////// List utils - -typedef void (* __FASTCALL__ ASX_FreeFunc)(any_t* arg); - -extern void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func); - -static inline void asx_free_attribs(any_t*a) { asx_list_free(&a,mp_free); } + }; } // namespace mpxp #endif Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -47,10 +47,10 @@ }; typedef struct menu_def_st { - char* name; + const char* name; menu_info_t* type; any_t* cfg; - char* args; + const char* args; } menu_def_t; static struct MPContext *menu_ctx = NULL; @@ -59,13 +59,15 @@ static int menu_parse_config(const char* buffer) { - char *element,*body, **attribs, *name; + char *element,*body; + std::string name; + ASX_Attrib attribs; menu_info_t* minfo = NULL; int r,i; ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&buffer,&element,&body,&attribs); + r = parser.get_element(&buffer,&element,&body,attribs); if(r < 0) { MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); delete &parser; @@ -75,12 +77,11 @@ return 1; } // Has it a name ? - name = asx_get_attrib("name",attribs); - if(!name) { + name = attribs.get("name"); + if(name.empty()) { MSG_WARN("[libmenu] Menu definitions need a name attrib: %i\n",parser.get_line()); delete element; if(body) delete body; - asx_free_attribs(attribs); continue; } @@ -93,28 +94,31 @@ } // Got it : add this to our list if(minfo) { - menu_list = (menu_def_t*)mp_realloc(menu_list,(menu_count+2)*sizeof(menu_def_t)); - menu_list[menu_count].name = name; - menu_list[menu_count].type = minfo; - menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st); - menu_list[menu_count].args = body; - // Setup the attribs - for(i = 0 ; attribs[2*i] ; i++) { - if(strcasecmp(attribs[2*i],"name") == 0) continue; - if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1])) - MSG_WARN("[libmenu] Bad attrib: %s %s %s %i\n",attribs[2*i],attribs[2*i+1], - name,parser.get_line()); - } - menu_count++; - memset(&menu_list[menu_count],0,sizeof(menu_def_t)); + menu_list = (menu_def_t*)mp_realloc(menu_list,(menu_count+2)*sizeof(menu_def_t)); + menu_list[menu_count].name = mp_strdup(name.c_str()); + menu_list[menu_count].type = minfo; + menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st); + menu_list[menu_count].args = body; + std::map<std::string,std::string,ASX_Attrib::stricomp>::iterator it; + std::map<std::string,std::string,ASX_Attrib::stricomp>& _map = attribs.map(); + for(it=_map.begin();it!=_map.end();it++) { + std::string sfirst,ssecond; + sfirst=(*it).first; + ssecond=(*it).second; + if(strcasecmp(sfirst.c_str(),"name") == 0) continue; + // Setup the attribs + if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,mp_strdup(sfirst.c_str()),mp_strdup(ssecond.c_str()))) + MSG_WARN("[libmenu] Bad attrib: %s %s %s %i\n" + ,sfirst.c_str(),ssecond.c_str(),name.c_str(),parser.get_line()); + } + menu_count++; + memset(&menu_list[menu_count],0,sizeof(menu_def_t)); } else { - MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element,parser.get_line()); - delete name; - if(body) delete body; + MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element,parser.get_line()); + if(body) delete body; } delete element; - asx_free_attribs(attribs); } delete &parser; return 0; @@ -169,7 +173,7 @@ } // Destroy all this stuff -void menu_unint(void) { +void menu_uninit(void) { int i; for(i = 0 ; menu_list && menu_list[i].name ; i++) { delete menu_list[i].name; @@ -219,8 +223,7 @@ return NULL; } for(i = 0 ; menu_list[i].name != NULL ; i++) { - if(strcmp(name,menu_list[i].name) == 0) - break; + if(strcmp(name,menu_list[i].name) == 0) break; } if(menu_list[i].name == NULL) { MSG_WARN("[libmenu] Menu not found: %s\n",name); Modified: mplayerxp/postproc/libmenu/menu.h =================================================================== --- mplayerxp/postproc/libmenu/menu.h 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/postproc/libmenu/menu.h 2012-12-12 15:25:16 UTC (rev 550) @@ -45,7 +45,7 @@ }; /// Global init/uninit int menu_init(struct MPContext *mpctx,const char* cfg_file); -void menu_unint(void); +void menu_uninit(void); /// Open a menu defined in the config file menu_t* menu_open(const char *name,libinput_t*libinput); Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -27,10 +27,10 @@ struct list_entry_s { struct list_entry p; - char* ok; - char* cancel; - char* left; - char* right; + const char* ok; + const char* cancel; + const char* left; + const char* right; }; struct menu_priv_s { @@ -109,13 +109,15 @@ } static int parse_args(menu_t* menu,const char* args) { - char *element,*body, **attribs, *name; + char *element,*body; + ASX_Attrib attribs; + std::string name; list_entry_t* m = NULL; int r; ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&args,&element,&body,&attribs); + r = parser.get_element(&args,&element,&body,attribs); if(r < 0) { MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); delete &parser; @@ -127,25 +129,23 @@ return m ? 1 : 0; } // Has it a name ? - name = asx_get_attrib("name",attribs); - if(!name) { + name = attribs.get("name"); + if(name.empty()) { MSG_WARN("[libmenu] ListMenu entry definitions need a name: %i\n",parser.get_line()); delete element; if(body) delete body; - asx_free_attribs(attribs); continue; } m = new(zeromem) struct list_entry_s; - m->p.txt = name; - m->ok = asx_get_attrib("ok",attribs); - m->cancel = asx_get_attrib("cancel",attribs); - m->left = asx_get_attrib("left",attribs); - m->right = asx_get_attrib("right",attribs); + m->p.txt = mp_strdup(name.c_str()); + m->ok = mp_strdup(attribs.get("ok").c_str()); + m->cancel = mp_strdup(attribs.get("cancel").c_str()); + m->left = mp_strdup(attribs.get("left").c_str()); + m->right = mp_strdup(attribs.get("right").c_str()); menu_list_add_entry(menu,m); delete element; if(body) delete body; - asx_free_attribs(attribs); } delete &parser; return -1; Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -30,11 +30,11 @@ struct list_entry_s { struct list_entry p; - char* name; - char* txt; - char* prop; + const char* name; + const char* txt; + const char* prop; m_option_t* opt; - char* menu; + const char* menu; }; struct menu_priv_s { @@ -65,7 +65,7 @@ #define mpriv (menu->priv) static void entry_set_text(menu_t* menu, list_entry_t* e) { - const char* val = e->txt ? m_properties_expand_string(reinterpret_cast<m_option_t*>(e->prop), e->txt, menu->ctx) : + const char* val = e->txt ? m_properties_expand_string(e->opt, e->txt, menu->ctx) : mp_property_print(e->prop, menu->ctx); int l,edit = (mpriv->edit && e == mpriv->p.current); if(!val || !val[0]) { @@ -92,14 +92,16 @@ } static int parse_args(menu_t* menu,const char* args) { - char *element,*body, **attribs, *name, *txt; + char *element,*body; + ASX_Attrib attribs; + std::string name,txt; list_entry_t* m = NULL; int r; m_option_t* opt; ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = parser.get_element(&args,&element,&body,&attribs); + r = parser.get_element(&args,&element,&body,attribs); if(r < 0) { MSG_ERR("[libmenu] Syntax error at line: %s\n",parser.get_line()); delete &parser; @@ -114,38 +116,36 @@ return 1; } if(!strcmp(element,"menu")) { - name = asx_get_attrib("menu",attribs); - if(!name) { + name = attribs.get("menu"); + if(name.empty()) { MSG_WARN("[libmenu] Submenu definition need a menu attribut\n"); goto next_element; } m = new(zeromem) struct list_entry_s; - m->menu = name; - name = NULL; // we want to keep it - m->p.txt = asx_get_attrib("name",attribs); + m->menu = mp_strdup(name.c_str()); + m->p.txt = mp_strdup(attribs.get("name").c_str()); if(!m->p.txt) m->p.txt = mp_strdup(m->menu); menu_list_add_entry(menu,m); goto next_element; } - name = asx_get_attrib("property",attribs); + name = attribs.get("property"); opt = NULL; - if(name && mp_property_do(name,M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) { + if(!name.empty() && mp_property_do(name.c_str(),M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) { MSG_WARN("[libmenu] Invalid property: %s %i\n", - name,parser.get_line()); + name.c_str(),parser.get_line()); goto next_element; } - txt = asx_get_attrib("txt",attribs); - if(!(name || txt)) { + txt = attribs.get("txt"); + if(name.empty() || txt.empty()) { MSG_WARN("[libmenu] PrefMenu entry definitions need: %i\n",parser.get_line()); - if(txt) { delete txt; txt = NULL; } goto next_element; } m = new(zeromem) struct list_entry_s; m->opt = opt; - m->txt = txt; txt = NULL; - m->prop = name; name = NULL; - m->name = asx_get_attrib("name",attribs); + m->txt = mp_strdup(txt.c_str()); + m->prop = mp_strdup(name.c_str()); + m->name = mp_strdup(attribs.get("name").c_str()); if(!m->name) m->name = mp_strdup(opt ? opt->name : "-"); entry_set_text(menu,m); menu_list_add_entry(menu,m); @@ -153,8 +153,6 @@ next_element: delete element; if(body) delete body; - if(name) delete name; - asx_free_attribs(attribs); } delete &parser; return -1; Modified: mplayerxp/postproc/vf_menu.cpp =================================================================== --- mplayerxp/postproc/vf_menu.cpp 2012-12-12 12:24:11 UTC (rev 549) +++ mplayerxp/postproc/vf_menu.cpp 2012-12-12 15:25:16 UTC (rev 550) @@ -218,6 +218,7 @@ free_mp_image(pause_mpi); pause_mpi = NULL; } + menu_uninit(); } static int __FASTCALL__ vf_config(vf_instance_t* vf, int width, int height, int d_width, int d_height, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-12 12:24:22
|
Revision: 549 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=549&view=rev Author: nickols_k Date: 2012-12-12 12:24:11 +0000 (Wed, 12 Dec 2012) Log Message: ----------- segfault-- Modified Paths: -------------- mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_vo2.cpp Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-12 09:30:03 UTC (rev 548) +++ mplayerxp/postproc/vf.cpp 2012-12-12 12:24:11 UTC (rev 549) @@ -324,7 +324,7 @@ } vf_instance_t* __FASTCALL__ vf_open_filter(vf_instance_t* next,const char *name,const char *args,libinput_t*libinput,const vf_conf_t* conf){ - if(strcmp(name,"vo")) { + if(strcmp(name,"vo2")) { MSG_V("Open video filter: [%s] <%ux%u %s>\n", name,conf->w,conf->h,vo_format_name(conf->fourcc)); } if(next) check_pin("vfilter",next->pin,VF_PIN); @@ -463,7 +463,7 @@ char *arg; vf_instance_t* vfi=NULL,*vfi_prev=NULL,*vfi_first; // sh_video=sh; - vfi=vf_open_filter(NULL,"vo",NULL,libinput,conf); + vfi=vf_open_filter(NULL,"vo2",NULL,libinput,conf); vfi_prev=vfi; if(vf_name) while(vf_name!=vf_last){ @@ -680,8 +680,13 @@ vf_stream_t* vf_init(libinput_t* libinput,const vf_conf_t* conf) { vf_stream_t* s = new(zeromem) vf_stream_t; s->libinput=libinput; - s->first=vf_init_filter(libinput,conf); - s->first->parent=s; + vf_instance_t* first; + s->first=first=vf_init_filter(libinput,conf); + first->parent=s; + while(first->next) { + first=first->next; + first->parent=s; + } return s; } Modified: mplayerxp/postproc/vf_vo2.cpp =================================================================== --- mplayerxp/postproc/vf_vo2.cpp 2012-12-12 09:30:03 UTC (rev 548) +++ mplayerxp/postproc/vf_vo2.cpp 2012-12-12 12:24:11 UTC (rev 549) @@ -158,7 +158,7 @@ extern const vf_info_t vf_info_vo2 = { "libvo2 wrapper", - "vo", + "vo2", "A'rpi", "for internal use", VF_FLAGS_THREADS|VF_FLAGS_SLICES, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-12 09:30:14
|
Revision: 548 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=548&view=rev Author: nickols_k Date: 2012-12-12 09:30:03 +0000 (Wed, 12 Dec 2012) Log Message: ----------- constantization Modified Paths: -------------- mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-12 09:07:39 UTC (rev 547) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-12 09:30:03 UTC (rev 548) @@ -99,7 +99,7 @@ } void ASX_Parser::warning_attrib_invalid(char* elem, char* attrib, - const char** valid_vals,char* val) + const char** valid_vals,char* val) const { char *str,*vals; const char **ptr; @@ -123,7 +123,7 @@ delete str; } -int ASX_Parser::get_yes_no_attrib(char* element, char* attrib,char** cattribs,int def) { +int ASX_Parser::get_yes_no_attrib(char* element, char* attrib,char** cattribs,int def) const { char* val = asx_get_attrib(attrib,cattribs); const char* valids[] = { "NO", "YES", NULL }; int r; @@ -139,13 +139,13 @@ return r; } -void ASX_Parser::warning_attrib_required(const char *e, const char *a) { MSG_WARN("At line %d : element %s don't have the required attribute %s",line,e,a); } -void ASX_Parser::warning_body_parse_error(const char *e) { MSG_WARN("At line %d : error while parsing %s body",line,e); } +void ASX_Parser::warning_attrib_required(const char *e, const char *a) const { MSG_WARN("At line %d : element %s don't have the required attribute %s",line,e,a); } +void ASX_Parser::warning_body_parse_error(const char *e) const { MSG_WARN("At line %d : error while parsing %s body",line,e); } ASX_Parser::ASX_Parser() {} ASX_Parser::~ASX_Parser() { if(ret_stack) delete ret_stack; } -int ASX_Parser::parse_attribs(char* buffer,char*** _attribs) { +int ASX_Parser::parse_attribs(char* buffer,char*** _attribs) const { char *ptr1, *ptr2, *ptr3; int n_attrib = 0; char **cattribs = NULL; @@ -420,7 +420,7 @@ return 1; } -void ASX_Parser::param(char** cattribs, play_tree_t* pt) { +void ASX_Parser::param(char** cattribs, play_tree_t* pt) const { const char *name,*val; name = asx_get_attrib("NAME",cattribs); @@ -438,7 +438,7 @@ play_tree_set_param(pt,name,val); } -void ASX_Parser::ref(char** cattribs, play_tree_t* pt) { +void ASX_Parser::ref(char** cattribs, play_tree_t* pt) const { char *href; href = asx_get_attrib("HREF",cattribs); @@ -459,7 +459,7 @@ delete href; } -play_tree_t* ASX_Parser::entryref(libinput_t* libinput,char* buffer,char** _attribs) { +play_tree_t* ASX_Parser::entryref(libinput_t* libinput,char* buffer,char** _attribs) const { play_tree_t* pt; char *href; Stream* stream; Modified: mplayerxp/libplaytree/asxparser.h =================================================================== --- mplayerxp/libplaytree/asxparser.h 2012-12-12 09:07:39 UTC (rev 547) +++ mplayerxp/libplaytree/asxparser.h 2012-12-12 09:30:03 UTC (rev 548) @@ -19,7 +19,7 @@ static play_tree_t* build_tree(libinput_t* libinput,const char* buffer, int ref); - virtual int parse_attribs(char* buffer,char*** _attribs); + virtual int parse_attribs(char* buffer,char*** _attribs) const; /* * Return -1 on error, 0 when nothing is found, 1 on sucess */ @@ -27,13 +27,13 @@ int get_line() const { return line; } private: play_tree_t* repeat(libinput_t*libinput,const char* buffer,char** _attribs); - void warning_attrib_invalid(char* elem, char* attrib,const char** valid_vals,char* val); - void warning_attrib_required(const char *e, const char *a); - void warning_body_parse_error(const char *e); - int get_yes_no_attrib(char* element, char* attrib,char** attribs,int def); - void param(char** attribs, play_tree_t* pt); - void ref(char** attribs, play_tree_t* pt); - play_tree_t* entryref(libinput_t* libinput,char* buffer,char** _attribs); + void warning_attrib_invalid(char* elem, char* attrib,const char** valid_vals,char* val) const; + void warning_attrib_required(const char *e, const char *a) const; + void warning_body_parse_error(const char *e) const; + int get_yes_no_attrib(char* element, char* attrib,char** attribs,int def) const; + void param(char** attribs, play_tree_t* pt) const; + void ref(char** attribs, play_tree_t* pt) const; + play_tree_t* entryref(libinput_t* libinput,char* buffer,char** _attribs) const; play_tree_t* entry(const char* buffer,char** _attribs); int line; // Curent line This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-12 09:07:54
|
Revision: 547 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=547&view=rev Author: nickols_k Date: 2012-12-12 09:07:39 +0000 (Wed, 12 Dec 2012) Log Message: ----------- convert struct ASX_Parser_t into class ASX_Parser + accuracies Modified Paths: -------------- mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/aclib.cpp mplayerxp/osdep/aclib_template.h mplayerxp/osdep/fastmemcpy.h mplayerxp/osdep/mp_malloc.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_param.cpp Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -17,7 +17,7 @@ #include "mp_msg.h" ////// List utils - +namespace mpxp { static void __FASTCALL__ asx_list_add(any_t* list_ptr,any_t* entry){ any_t** list = *(any_t***)list_ptr; int c = 0; @@ -77,90 +77,78 @@ /////// Attribs utils char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs) { - char** ptr; + char** ptr; - if(attrib == NULL || attribs == NULL) return NULL; - for(ptr = attribs; ptr[0] != NULL; ptr += 2){ - if(strcasecmp(ptr[0],attrib) == 0) - return mp_strdup(ptr[1]); - } - return NULL; + if(attrib == NULL || attribs == NULL) return NULL; + for(ptr = attribs; ptr[0] != NULL; ptr += 2){ + if(strcasecmp(ptr[0],attrib) == 0) return mp_strdup(ptr[1]); + } + return NULL; } int __FASTCALL__ asx_attrib_to_enum(const char* val,const char** valid_vals) { - const char** ptr; - int r = 0; + const char** ptr; + int r = 0; - if(valid_vals == NULL || val == NULL) return -2; - for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) { - if(strcasecmp(val,ptr[0]) == 0) return r; - r++; - } - - return -1; + if(valid_vals == NULL || val == NULL) return -2; + for(ptr = valid_vals ; ptr[0] != NULL ; ptr++) { + if(strcasecmp(val,ptr[0]) == 0) return r; + r++; + } + return -1; } -static void __FASTCALL__ asx_warning_attrib_invalid(ASX_Parser_t* parser, char* elem, char* attrib, - const char** valid_vals,char* val) { - char *str,*vals; - const char **ptr; - int len; +void ASX_Parser::warning_attrib_invalid(char* elem, char* attrib, + const char** valid_vals,char* val) +{ + char *str,*vals; + const char **ptr; + int len; - if(valid_vals == NULL || valid_vals[0] == NULL) return; + if(valid_vals == NULL || valid_vals[0] == NULL) return; - len = strlen(valid_vals[0]) + 1; - for(ptr = valid_vals+1 ; ptr[0] != NULL; ptr++) { - len += strlen(ptr[0]); - len += ((ptr[1] == NULL) ? 4 : 2); - } - str = vals = new char[len]; - vals += sprintf(vals,"%s",valid_vals[0]); - for(ptr = valid_vals + 1 ; ptr[0] != NULL ; ptr++) { - if(ptr[1] == NULL) - vals += sprintf(vals," or %s",ptr[0]); - else - vals += sprintf(vals,", %s",ptr[0]); - } - MSG_ERR("at line %d : attribute %s of element %s is invalid (%s). Valid values are %s", - parser->line,attrib,elem,val,str); - delete str; + len = strlen(valid_vals[0]) + 1; + for(ptr = valid_vals+1 ; ptr[0] != NULL; ptr++) { + len += strlen(ptr[0]); + len += ((ptr[1] == NULL) ? 4 : 2); + } + str = vals = new char[len]; + vals += sprintf(vals,"%s",valid_vals[0]); + for(ptr = valid_vals + 1 ; ptr[0] != NULL ; ptr++) { + if(ptr[1] == NULL) vals += sprintf(vals," or %s",ptr[0]); + else vals += sprintf(vals,", %s",ptr[0]); + } + MSG_ERR("at line %d : attribute %s of element %s is invalid (%s). Valid values are %s", + line,attrib,elem,val,str); + delete str; } -static int __FASTCALL__ asx_get_yes_no_attrib(ASX_Parser_t* parser, char* element, char* attrib,char** attribs,int def) { - char* val = asx_get_attrib(attrib,attribs); - const char* valids[] = { "NO", "YES", NULL }; - int r; +int ASX_Parser::get_yes_no_attrib(char* element, char* attrib,char** cattribs,int def) { + char* val = asx_get_attrib(attrib,cattribs); + const char* valids[] = { "NO", "YES", NULL }; + int r; - if(val == NULL) return def; - r = asx_attrib_to_enum(val,valids); + if(val == NULL) return def; + r = asx_attrib_to_enum(val,valids); - if(r < 0) { - asx_warning_attrib_invalid(parser,element,attrib,valids,val); - r = def; - } - - delete val; - return r; + if(r < 0) { + warning_attrib_invalid(element,attrib,valids,val); + r = def; + } + delete val; + return r; } -#define asx_warning_attrib_required(p,e,a) MSG_WARN("At line %d : element %s don't have the required attribute %s",p->line,e,a) -#define asx_warning_body_parse_error(p,e) MSG_WARN("At line %d : error while parsing %s body",p->line,e) +void ASX_Parser::warning_attrib_required(const char *e, const char *a) { MSG_WARN("At line %d : element %s don't have the required attribute %s",line,e,a); } +void ASX_Parser::warning_body_parse_error(const char *e) { MSG_WARN("At line %d : error while parsing %s body",line,e); } -ASX_Parser_t* asx_parser_new(void) { - ASX_Parser_t* parser = new(zeromem) ASX_Parser_t; - return parser; -} +ASX_Parser::ASX_Parser() {} +ASX_Parser::~ASX_Parser() { if(ret_stack) delete ret_stack; } -void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser) { - if(!parser) return; - if(parser->ret_stack) delete parser->ret_stack; - delete parser; -} - -int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) { +int ASX_Parser::parse_attribs(char* buffer,char*** _attribs) { char *ptr1, *ptr2, *ptr3; int n_attrib = 0; - char **attribs = NULL; + char **cattribs = NULL; char *attrib, *val; ptr1 = buffer; @@ -172,7 +160,7 @@ if(ptr3 == NULL) break; for(ptr2 = ptr3-1; isspace(*ptr2); ptr2--) { if (ptr2 <= ptr1) { - MSG_ERR("At line %d : this should never append, back to attribute begin while skipping end space",parser->line); + MSG_ERR("At line %d : this should never append, back to attribute begin while skipping end space",line); goto pa_end; } } @@ -182,14 +170,14 @@ ptr1 = strchr(ptr3,'"'); if(ptr1 == NULL || ptr1[1] == '\0') { - MSG_WARN("At line %d : can't find attribute %s value",parser->line,attrib); + MSG_WARN("At line %d : can't find attribute %s value",line,attrib); delete attrib; break; } ptr1++; ptr2 = strchr(ptr1,'"'); if (ptr2 == NULL) { - MSG_WARN("At line %d : value of attribute %s isn't finished",parser->line,attrib); + MSG_WARN("At line %d : value of attribute %s isn't finished",line,attrib); delete attrib; break; } @@ -198,521 +186,483 @@ val[ptr2-ptr1] = '\0'; n_attrib++; - attribs = (char**)mp_realloc(attribs,(2*n_attrib+1)*sizeof(char*)); - attribs[n_attrib*2-2] = attrib; - attribs[n_attrib*2-1] = val; + cattribs = (char**)mp_realloc(cattribs,(2*n_attrib+1)*sizeof(char*)); + cattribs[n_attrib*2-2] = attrib; + cattribs[n_attrib*2-1] = val; ptr1 = ptr2+1; } pa_end: if(n_attrib > 0) - attribs[n_attrib*2-0] = NULL; - *_attribs = attribs; + cattribs[n_attrib*2-0] = NULL; + *_attribs = cattribs; return n_attrib; } /* * Return -1 on error, 0 when nothing is found, 1 on sucess */ -int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,const char** _buffer, - char** _element,char** _body,char*** _attribs) { - const char *ptr1,*ptr2, *ptr3, *ptr4; - char *attribs = NULL; - char *element = NULL, *body = NULL; - const char *ret = NULL; - const char *buffer; - int n_attrib = 0; - int body_line = 0,attrib_line,ret_line,in = 0; +int ASX_Parser::get_element(const char** _buffer, char** _element, + char** _body,char*** _attribs) { + const char *ptr1,*ptr2, *ptr3, *ptr4; + char *cattribs = NULL; + char *element = NULL, *body = NULL; + const char *ret = NULL; + const char *buffer; + int n_attrib = 0; + int body_line = 0,attrib_line,ret_line,in = 0; - if(_buffer == NULL || _element == NULL || _body == NULL || _attribs == NULL) { - MSG_ERR("At line %d : asx_get_element called with invalid value",parser->line); - return -1; - } + if(_buffer == NULL || _element == NULL || _body == NULL || _attribs == NULL) { + MSG_ERR("At line %d : asx_get_element called with invalid value",line); + return -1; + } - *_body = *_element = NULL; - *_attribs = NULL; - buffer = *_buffer; + *_body = *_element = NULL; + *_attribs = NULL; + buffer = *_buffer; - if(buffer == NULL) return 0; + if(buffer == NULL) return 0; - if(parser->ret_stack && /*parser->last_body && */buffer != parser->last_body) { - ASX_LineSave_t* ls = parser->ret_stack; - int i; - for(i = 0 ; i < parser->ret_stack_size ; i++) { - if(buffer == ls[i].buffer) { - parser->line = ls[i].line; - break; - } - + if(ret_stack && /*last_body && */buffer != last_body) { + ASX_LineSave_t* ls = ret_stack; + int i; + for(i = 0 ; i < ret_stack_size ; i++) { + if(buffer == ls[i].buffer) { + line = ls[i].line; + break; + } + } + if( i < ret_stack_size) { + i++; + if( i < ret_stack_size) memmove(ret_stack,ret_stack+i, (ret_stack_size - i)*sizeof(ASX_LineSave_t)); + ret_stack_size -= i; + if(ret_stack_size > 0) ret_stack = (ASX_LineSave_t*)mp_realloc(ret_stack,ret_stack_size*sizeof(ASX_LineSave_t)); + else { + delete ret_stack; + ret_stack = NULL; + } + } } - if( i < parser->ret_stack_size) { - i++; - if( i < parser->ret_stack_size) - memmove(parser->ret_stack,parser->ret_stack+i, (parser->ret_stack_size - i)*sizeof(ASX_LineSave_t)); - parser->ret_stack_size -= i; - if(parser->ret_stack_size > 0) - parser->ret_stack = (ASX_LineSave_t*)mp_realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); - else { - delete parser->ret_stack; - parser->ret_stack = NULL; - } - } - } + ptr1 = buffer; + while(1) { + for( ; ptr1[0] != '<' ; ptr1++) { + if(ptr1[0] == '\0') { + ptr1 = NULL; + break; + } + if(ptr1[0] == '\n') line++; + } + //ptr1 = strchr(ptr1,'<'); + if(!ptr1 || ptr1[1] == '\0') return 0; // Nothing found - ptr1 = buffer; - while(1) { - for( ; ptr1[0] != '<' ; ptr1++) { - if(ptr1[0] == '\0') { - ptr1 = NULL; - break; - } - if(ptr1[0] == '\n') parser->line++; + if(strncmp(ptr1,"<!--",4) == 0) { // Comments + for( ; strncmp(ptr1,"-->",3) != 0 ; ptr1++) { + if(ptr1[0] == '\0') { + ptr1 = NULL; + break; + } + if(ptr1[0] == '\n') line++; + } + //ptr1 = strstr(ptr1,"-->"); + if(!ptr1) { + MSG_ERR("At line %d : unfinished comment",line); + return -1; + } + } else break; } - //ptr1 = strchr(ptr1,'<'); - if(!ptr1 || ptr1[1] == '\0') return 0; // Nothing found - if(strncmp(ptr1,"<!--",4) == 0) { // Comments - for( ; strncmp(ptr1,"-->",3) != 0 ; ptr1++) { + // Is this space skip very useful ?? + for(ptr1++; isspace(ptr1[0]); ptr1++) { // Skip space if(ptr1[0] == '\0') { - ptr1 = NULL; - break; + MSG_ERR("At line %d : EOB reached while parsing element start",line); + return -1; } - if(ptr1[0] == '\n') parser->line++; - } - //ptr1 = strstr(ptr1,"-->"); - if(!ptr1) { - MSG_ERR("At line %d : unfinished comment",parser->line); - return -1; - } - } else { - break; + if(ptr1[0] == '\n') line++; } - } - // Is this space skip very useful ?? - for(ptr1++; isspace(ptr1[0]); ptr1++) { // Skip space - if(ptr1[0] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - return -1; + for(ptr2 = ptr1; isalpha(*ptr2); ptr2++) { // Go to end of name + if(*ptr2 == '\0'){ + MSG_ERR("At line %d : EOB reached while parsing element start",line); + return -1; + } + if(ptr2[0] == '\n') line++; } - if(ptr1[0] == '\n') parser->line++; - } - for(ptr2 = ptr1; isalpha(*ptr2); ptr2++) { // Go to end of name - if(*ptr2 == '\0'){ - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - return -1; - } - if(ptr2[0] == '\n') parser->line++; - } + element = new char[ptr2-ptr1+1]; + strncpy(element,ptr1,ptr2-ptr1); + element[ptr2-ptr1] = '\0'; - element = new char[ptr2-ptr1+1]; - strncpy(element,ptr1,ptr2-ptr1); - element[ptr2-ptr1] = '\0'; - - for( ; isspace(*ptr2); ptr2++) { // Skip space - if(ptr2[0] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - delete element; - return -1; + for( ; isspace(*ptr2); ptr2++) { // Skip space + if(ptr2[0] == '\0') { + MSG_ERR("At line %d : EOB reached while parsing element start",line); + delete element; + return -1; + } + if(ptr2[0] == '\n') line++; } - if(ptr2[0] == '\n') parser->line++; - } - attrib_line = parser->line; + attrib_line = line; - for(ptr3 = ptr2; ptr3[0] != '\0'; ptr3++) { // Go to element end - if(ptr3[0] == '>' || strncmp(ptr3,"/>",2) == 0) - break; - if(ptr3[0] == '\n') parser->line++; - } - if(ptr3[0] == '\0' || ptr3[1] == '\0') { // End of file - MSG_ERR("At line %d : EOB reached while parsing element start",parser->line); - delete element; - return -1; - } - - // Save attribs string - if(ptr3-ptr2 > 0) { - attribs = new char[ptr3-ptr2+1]; - strncpy(attribs,ptr2,ptr3-ptr2); - attribs[ptr3-ptr2] = '\0'; - } - //bs_line = parser->line; - if(ptr3[0] != '/') { // Not Self closed element - ptr3++; - for( ; isspace(*ptr3); ptr3++) { // Skip space on body begin - if(*ptr3 == '\0') { - MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); + for(ptr3 = ptr2; ptr3[0] != '\0'; ptr3++) { // Go to element end + if(ptr3[0] == '>' || strncmp(ptr3,"/>",2) == 0) break; + if(ptr3[0] == '\n') line++; + } + if(ptr3[0] == '\0' || ptr3[1] == '\0') { // End of file + MSG_ERR("At line %d : EOB reached while parsing element start",line); delete element; - if(attribs) delete attribs; return -1; - } - if(ptr3[0] == '\n') parser->line++; } - ptr4 = ptr3; - body_line = parser->line; - while(1) { // Find closing element - for( ; ptr4[0] != '<' ; ptr4++) { - if(ptr4[0] == '\0') { - ptr4 = NULL; - break; + + // Save attribs string + if(ptr3-ptr2 > 0) { + cattribs = new char[ptr3-ptr2+1]; + strncpy(cattribs,ptr2,ptr3-ptr2); + cattribs[ptr3-ptr2] = '\0'; + } + //bs_line = line; + if(ptr3[0] != '/') { // Not Self closed element + ptr3++; + for( ; isspace(*ptr3); ptr3++) { // Skip space on body begin + if(*ptr3 == '\0') { + MSG_ERR("At line %d : EOB reached while parsing %s element body",line,element); + delete element; + if(cattribs) delete cattribs; + return -1; + } + if(ptr3[0] == '\n') line++; } - if(ptr4[0] == '\n') parser->line++; - } - if(strncmp(ptr4,"<!--",4) == 0) { // Comments - for( ; strncmp(ptr4,"-->",3) != 0 ; ptr4++) { - if(ptr4[0] == '\0') { - ptr4 = NULL; - break; + ptr4 = ptr3; + body_line = line; + while(1) { // Find closing element + for( ; ptr4[0] != '<' ; ptr4++) { + if(ptr4[0] == '\0') { + ptr4 = NULL; + break; + } + if(ptr4[0] == '\n') line++; + } + if(strncmp(ptr4,"<!--",4) == 0) { // Comments + for( ; strncmp(ptr4,"-->",3) != 0 ; ptr4++) { + if(ptr4[0] == '\0') { + ptr4 = NULL; + break; + } + if(ptr1[0] == '\n') line++; + } + continue; + } + if(ptr4 == NULL || ptr4[1] == '\0') { + MSG_ERR("At line %d : EOB reached while parsing %s element body",line,element); + delete element; + if(cattribs) delete cattribs; + return -1; + } + if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) { + in++; + ptr4+=2; + continue; + } else if(strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body + if(in > 0) { + in--; + ptr4 += 2+strlen(element); + continue; + } + ret = ptr4+strlen(element)+3; + if(ptr4 != ptr3) { + ptr4--; + for( ; ptr4 != ptr3 && isspace(*ptr4); ptr4--) ;// Skip space on body end + // if(ptr4[0] == '\0') line--; + //} + ptr4++; + body = new char[ptr4-ptr3+1]; + strncpy(body,ptr3,ptr4-ptr3); + body[ptr4-ptr3] = '\0'; + } + break; + } else { + ptr4 += 2; + } } - if(ptr1[0] == '\n') parser->line++; - } - continue; - } - if(ptr4 == NULL || ptr4[1] == '\0') { - MSG_ERR("At line %d : EOB reached while parsing %s element body",parser->line,element); - delete element; - if(attribs) delete attribs; - return -1; - } - if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) { - in++; - ptr4+=2; - continue; - } else if(strncasecmp(element,ptr4+2,strlen(element)) == 0) { // Extract body - if(in > 0) { - in--; - ptr4 += 2+strlen(element); - continue; - } - ret = ptr4+strlen(element)+3; - if(ptr4 != ptr3) { - ptr4--; - for( ; ptr4 != ptr3 && isspace(*ptr4); ptr4--) ;// Skip space on body end - // if(ptr4[0] == '\0') parser->line--; - //} - ptr4++; - body = new char[ptr4-ptr3+1]; - strncpy(body,ptr3,ptr4-ptr3); - body[ptr4-ptr3] = '\0'; - } - break; - } else { - ptr4 += 2; - } + } else { + ret = ptr3 + 2; // 2 is for /> } - } else { - ret = ptr3 + 2; // 2 is for /> - } - for( ; ret[0] != '\0' && isspace(ret[0]); ret++) { // Skip space - if(ret[0] == '\n') parser->line++; - } + for( ; ret[0] != '\0' && isspace(ret[0]); ret++) { // Skip space + if(ret[0] == '\n') line++; + } - ret_line = parser->line; + ret_line = line; - if(attribs) { - parser->line = attrib_line; - n_attrib = asx_parse_attribs(parser,attribs,_attribs); - delete attribs; - if(n_attrib < 0) { - MSG_WARN("At line %d : error while parsing element %s attributes",parser->line,element); - delete element; - delete body; - return -1; - } - } else + if(cattribs) { + line = attrib_line; + n_attrib = parse_attribs(cattribs,_attribs); + delete cattribs; + if(n_attrib < 0) { + MSG_WARN("At line %d : error while parsing element %s attributes",line,element); + delete element; + delete body; + return -1; + } + } else *_attribs = NULL; - *_element = element; - *_body = body; + *_element = element; + *_body = body; - parser->last_body = body; - parser->ret_stack_size++; - parser->ret_stack = (ASX_LineSave_t*)mp_realloc(parser->ret_stack,parser->ret_stack_size*sizeof(ASX_LineSave_t)); - if(parser->ret_stack_size > 1) - memmove(parser->ret_stack+1,parser->ret_stack,(parser->ret_stack_size-1)*sizeof(ASX_LineSave_t)); - parser->ret_stack[0].buffer = const_cast<char*>(ret); - parser->ret_stack[0].line = ret_line; - parser->line = body ? body_line : ret_line; + last_body = body; + ret_stack_size++; + ret_stack = (ASX_LineSave_t*)mp_realloc(ret_stack,ret_stack_size*sizeof(ASX_LineSave_t)); + if(ret_stack_size > 1) memmove(ret_stack+1,ret_stack,(ret_stack_size-1)*sizeof(ASX_LineSave_t)); + ret_stack[0].buffer = const_cast<char*>(ret); + ret_stack[0].line = ret_line; + line = body ? body_line : ret_line; - *_buffer = ret; - return 1; - + *_buffer = ret; + return 1; } -static void __FASTCALL__ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { - const char *name,*val; +void ASX_Parser::param(char** cattribs, play_tree_t* pt) { + const char *name,*val; - name = asx_get_attrib("NAME",attribs); - if(!name) { - asx_warning_attrib_required(parser,"PARAM" ,"NAME" ); - return; - } - val = asx_get_attrib("VALUE",attribs); - if(m_config_get_option(mpxp_context().mconfig,name) == NULL) { - MSG_WARN("Found unknow param in asx: %s",name); - if(val) - MSG_WARN("=%s\n",val); - else - MSG_WARN("\n"); - return; - } - play_tree_set_param(pt,name,val); + name = asx_get_attrib("NAME",cattribs); + if(!name) { + warning_attrib_required("PARAM" ,"NAME" ); + return; + } + val = asx_get_attrib("VALUE",cattribs); + if(m_config_get_option(mpxp_context().mconfig,name) == NULL) { + MSG_WARN("Found unknow param in asx: %s",name); + if(val) MSG_WARN("=%s\n",val); + else MSG_WARN("\n"); + return; + } + play_tree_set_param(pt,name,val); } -static void __FASTCALL__ asx_parse_ref(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { - char *href; +void ASX_Parser::ref(char** cattribs, play_tree_t* pt) { + char *href; - href = asx_get_attrib("HREF",attribs); - if(href == NULL) { - asx_warning_attrib_required(parser,"REF" ,"HREF" ); - return; - } - // replace http my mmshttp to avoid infinite loops - if (strncmp(href, "http://", 7) == 0) { - char *newref = new char [3 + strlen(href) + 1]; - strcpy(newref, "mms"); - strcpy(newref + 3, href); + href = asx_get_attrib("HREF",cattribs); + if(href == NULL) { + warning_attrib_required("REF" ,"HREF" ); + return; + } + // replace http my mmshttp to avoid infinite loops + if (strncmp(href, "http://", 7) == 0) { + char *newref = new char [3 + strlen(href) + 1]; + strcpy(newref, "mms"); + strcpy(newref + 3, href); + delete href; + href = newref; + } + play_tree_add_file(pt,href); + MSG_V("Adding file %s to element entry\n",href); delete href; - href = newref; - } - - play_tree_add_file(pt,href); - - MSG_V("Adding file %s to element entry\n",href); - - delete href; - } -static play_tree_t* __FASTCALL__ asx_parse_entryref(libinput_t* libinput,ASX_Parser_t* parser,char* buffer,char** _attribs) { - play_tree_t* pt; - char *href; - Stream* stream; - play_tree_parser_t* ptp; - int f; - UNUSED(buffer); +play_tree_t* ASX_Parser::entryref(libinput_t* libinput,char* buffer,char** _attribs) { + play_tree_t* pt; + char *href; + Stream* stream; + play_tree_parser_t* ptp; + int f; + UNUSED(buffer); - if(parser->deep > 0) - return NULL; + if(deep > 0) return NULL; - href = asx_get_attrib("HREF",_attribs); - if(href == NULL) { - asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" ); - return NULL; - } - stream=new(zeromem) Stream; - if(stream->open(libinput,href,&f)!=MPXP_Ok) { - MSG_WARN("Can't open playlist %s\n",href); + href = asx_get_attrib("HREF",_attribs); + if(href == NULL) { + warning_attrib_required("ENTRYREF" ,"HREF" ); + return NULL; + } + stream=new(zeromem) Stream; + if(stream->open(libinput,href,&f)!=MPXP_Ok) { + MSG_WARN("Can't open playlist %s\n",href); + delete stream; + return NULL; + } + if(!(stream->type() & Stream::Type_Text)) { + MSG_WARN("URL %s dont point to a playlist\n",href); + delete stream; + return NULL; + } + MSG_V("Adding playlist %s to element entryref\n",href); + ptp = play_tree_parser_new(stream,deep+1); + pt = play_tree_parser_get_play_tree(libinput,ptp); + play_tree_parser_free(ptp); delete stream; - return NULL; - } - if(!(stream->type() & Stream::Type_Text)) { - MSG_WARN("URL %s dont point to a playlist\n",href); - delete stream; - return NULL; - } +//MSG_INFO("Need to implement entryref\n"); + return pt; +} - MSG_V("Adding playlist %s to element entryref\n",href); +play_tree_t* ASX_Parser::entry(const char* buffer,char** _attribs) { + char *celement,*body,**cattribs; + int r,nref=0; + play_tree_t *pt_ref; + UNUSED(_attribs); - ptp = play_tree_parser_new(stream,parser->deep+1); + pt_ref = play_tree_new(); - pt = play_tree_parser_get_play_tree(libinput,ptp); - - play_tree_parser_free(ptp); - delete stream; - - //MSG_INFO("Need to implement entryref\n"); - - return pt; + while(buffer && buffer[0] != '\0') { + r = get_element(&buffer,&celement,&body,&cattribs); + if(r < 0) { + warning_body_parse_error("ENTRY"); + return NULL; + } else if (r == 0) break; // No more element + if(strcasecmp(celement,"REF") == 0) { + ref(cattribs,pt_ref); + MSG_DBG2("Adding element %s to entry\n",celement); + nref++; + } else MSG_DBG2("Ignoring element %s\n",celement); + if(body) delete body; + asx_free_attribs(cattribs); + } + if(nref <= 0) { + play_tree_free(pt_ref,1); + return NULL; + } + return pt_ref; } -static play_tree_t* __FASTCALL__ asx_parse_entry(ASX_Parser_t* parser,const char* buffer,char** _attribs) { - char *element,*body,**attribs; - int r,nref=0; - play_tree_t *ref; - UNUSED(_attribs); +play_tree_t* ASX_Parser::repeat(libinput_t*libinput,const char* buffer,char** _attribs) { + char *element,*body,**cattribs; + play_tree_t *pt_repeat, *list=NULL, *pt_entry; + char* count; + int r; - ref = play_tree_new(); + pt_repeat = play_tree_new(); - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); - if(r < 0) { - asx_warning_body_parse_error(parser,"ENTRY"); - return NULL; - } else if (r == 0) { // No more element - break; + count = asx_get_attrib("COUNT",_attribs); + if(count == NULL) { + MSG_DBG2("Setting element repeat loop to infinit\n"); + pt_repeat->loop = -1; // Infinit + } else { + pt_repeat->loop = atoi(count); + delete count; + if(pt_repeat->loop == 0) pt_repeat->loop = 1; + MSG_DBG2("Setting element repeat loop to %d\n",pt_repeat->loop); } - if(strcasecmp(element,"REF") == 0) { - asx_parse_ref(parser,attribs,ref); - MSG_DBG2("Adding element %s to entry\n",element); - nref++; - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) delete body; - asx_free_attribs(attribs); - } - if(nref <= 0) { - play_tree_free(ref,1); - return NULL; - } - return ref; + while(buffer && buffer[0] != '\0') { + r = get_element(&buffer,&element,&body,&cattribs); + if(r < 0) { + warning_body_parse_error("REPEAT"); + return NULL; + } else if (r == 0) break; // No more element + if(strcasecmp(element,"ENTRY") == 0) { + pt_entry = entry(body,cattribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"ENTRYREF") == 0) { + pt_entry = entryref(libinput,body,cattribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"REPEAT") == 0) { + pt_entry = repeat(libinput,body,cattribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to repeat\n",element); + } + } else if(strcasecmp(element,"PARAM") == 0) { + param(cattribs,pt_repeat); + } else MSG_DBG2("Ignoring element %s\n",element); + if(body) delete body; + asx_free_attribs(cattribs); + } + if(!list) { + play_tree_free(pt_repeat,1); + return NULL; + } + play_tree_set_child(pt_repeat,list); + return pt_repeat; } -static play_tree_t* __FASTCALL__ asx_parse_repeat(libinput_t*libinput,ASX_Parser_t* parser,const char* buffer,char** _attribs) { - char *element,*body,**attribs; - play_tree_t *repeat, *list=NULL, *entry; - char* count; - int r; +play_tree_t* ASX_Parser::build_tree(libinput_t*libinput,const char* buffer,int deep) { + char *element,*asx_body,**asx_attribs,*body, **attribs; + int r; + play_tree_t *asx,*pt_entry,*list = NULL; + ASX_Parser& parser = *new(zeromem) ASX_Parser; - repeat = play_tree_new(); + parser.line = 1; + parser.deep = deep; - count = asx_get_attrib("COUNT",_attribs); - if(count == NULL) { - MSG_DBG2("Setting element repeat loop to infinit\n"); - repeat->loop = -1; // Infinit - } else { - repeat->loop = atoi(count); - delete count; - if(repeat->loop == 0) repeat->loop = 1; - MSG_DBG2("Setting element repeat loop to %d\n",repeat->loop); - } - - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); + r = parser.get_element(&buffer,&element,&asx_body,&asx_attribs); if(r < 0) { - asx_warning_body_parse_error(parser,"REPEAT"); - return NULL; - } else if (r == 0) { // No more element - break; + MSG_ERR("At line %d : Syntax error ???",parser.line); + delete &parser; + return NULL; + } else if(r == 0) { // No contents + MSG_ERR("empty asx element"); + delete &parser; + return NULL; } - if(strcasecmp(element,"ENTRY") == 0) { - entry = asx_parse_entry(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - entry = asx_parse_entryref(libinput,parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"REPEAT") == 0) { - entry = asx_parse_repeat(libinput,parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to repeat\n",element); - } - } else if(strcasecmp(element,"PARAM") == 0) { - asx_parse_param(parser,attribs,repeat); - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) delete body; - asx_free_attribs(attribs); - } - if(!list) { - play_tree_free(repeat,1); - return NULL; - } - play_tree_set_child(repeat,list); + if(strcasecmp(element,"ASX") != 0) { + MSG_ERR("first element isn't ASX, it's %s\n",element); + asx_free_attribs(asx_attribs); + if(body) delete body; + delete &parser; + return NULL; + } - return repeat; + if(!asx_body) { + MSG_ERR("ASX element is empty"); + asx_free_attribs(asx_attribs); + delete &parser; + return NULL; + } -} + asx = play_tree_new(); + buffer = asx_body; + while(buffer && buffer[0] != '\0') { + r = parser.get_element(&buffer,&element,&body,&attribs); + if(r < 0) { + parser.warning_body_parse_error("ASX"); + delete &parser; + return NULL; + } else if (r == 0) break; // No more element + if(strcasecmp(element,"ENTRY") == 0) { + pt_entry = parser.entry(body,attribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else if(strcasecmp(element,"ENTRYREF") == 0) { + pt_entry = parser.entryref(libinput,body,attribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else if(strcasecmp(element,"REPEAT") == 0) { + pt_entry = parser.repeat(libinput,body,attribs); + if(pt_entry) { + if(!list) list = pt_entry; + else play_tree_append_entry(list,pt_entry); + MSG_DBG2("Adding element %s to asx\n",element); + } + } else MSG_DBG2("Ignoring element %s\n",element); + if(body) delete body; + asx_free_attribs(attribs); + } -play_tree_t* __FASTCALL__ asx_parser_build_tree(libinput_t*libinput,const char* buffer,int deep) { - char *element,*asx_body,**asx_attribs,*body, **attribs; - int r; - play_tree_t *asx,*entry,*list = NULL; - ASX_Parser_t* parser = asx_parser_new(); - - parser->line = 1; - parser->deep = deep; - - r = asx_get_element(parser,&buffer,&element,&asx_body,&asx_attribs); - if(r < 0) { - MSG_ERR("At line %d : Syntax error ???",parser->line); - asx_parser_free(parser); - return NULL; - } else if(r == 0) { // No contents - MSG_ERR("empty asx element"); - asx_parser_free(parser); - return NULL; - } - - if(strcasecmp(element,"ASX") != 0) { - MSG_ERR("first element isn't ASX, it's %s\n",element); + delete asx_body; asx_free_attribs(asx_attribs); - if(body) delete body; - asx_parser_free(parser); - return NULL; - } + delete &parser; - if(!asx_body) { - MSG_ERR("ASX element is empty"); - asx_free_attribs(asx_attribs); - asx_parser_free(parser); - return NULL; - } - - asx = play_tree_new(); - buffer = asx_body; - while(buffer && buffer[0] != '\0') { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); - if(r < 0) { - asx_warning_body_parse_error(parser,"ASX"); - asx_parser_free(parser); - return NULL; - } else if (r == 0) { // No more element - break; - } - if(strcasecmp(element,"ENTRY") == 0) { - entry = asx_parse_entry(parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else if(strcasecmp(element,"ENTRYREF") == 0) { - entry = asx_parse_entryref(libinput,parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else if(strcasecmp(element,"REPEAT") == 0) { - entry = asx_parse_repeat(libinput,parser,body,attribs); - if(entry) { - if(!list) list = entry; - else play_tree_append_entry(list,entry); - MSG_DBG2("Adding element %s to asx\n",element); - } - } else - MSG_DBG2("Ignoring element %s\n",element); - if(body) delete body; - asx_free_attribs(attribs); - } - - delete asx_body; - asx_free_attribs(asx_attribs); - asx_parser_free(parser); - - - if(!list) { - play_tree_free(asx,1); - - return NULL; - } - - play_tree_set_child(asx,list); - - return asx; + if(!list) { + play_tree_free(asx,1); + return NULL; + } + play_tree_set_child(asx,list); + return asx; } +} // namespace mpxp Modified: mplayerxp/libplaytree/asxparser.h =================================================================== --- mplayerxp/libplaytree/asxparser.h 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/libplaytree/asxparser.h 2012-12-12 09:07:39 UTC (rev 547) @@ -6,35 +6,43 @@ using namespace mpxp; -typedef struct _ASX_Parser_t ASX_Parser_t; +namespace mpxp { + struct ASX_LineSave_t { + const char* buffer; + int line; + }; -typedef struct { - const char* buffer; - int line; -} ASX_LineSave_t; + class ASX_Parser : public Opaque { + public: + ASX_Parser(); + virtual ~ASX_Parser(); -struct _ASX_Parser_t { - int line; // Curent line - ASX_LineSave_t *ret_stack; - int ret_stack_size; - char* last_body; - int deep; -}; + static play_tree_t* build_tree(libinput_t* libinput,const char* buffer, int ref); -extern play_tree_t* __FASTCALL__ asx_parser_build_tree(libinput_t* libinput,const char* buffer, int ref); + virtual int parse_attribs(char* buffer,char*** _attribs); + /* + * Return -1 on error, 0 when nothing is found, 1 on sucess + */ + virtual int get_element(const char** _buffer,char** _element,char** _body,char*** _attribs); + int get_line() const { return line; } + private: + play_tree_t* repeat(libinput_t*libinput,const char* buffer,char** _attribs); + void warning_attrib_invalid(char* elem, char* attrib,const char** valid_vals,char* val); + void warning_attrib_required(const char *e, const char *a); + void warning_body_parse_error(const char *e); + int get_yes_no_attrib(char* element, char* attrib,char** attribs,int def); + void param(char** attribs, play_tree_t* pt); + void ref(char** attribs, play_tree_t* pt); + play_tree_t* entryref(libinput_t* libinput,char* buffer,char** _attribs); + play_tree_t* entry(const char* buffer,char** _attribs); -extern ASX_Parser_t* asx_parser_new(void); + int line; // Curent line + ASX_LineSave_t* ret_stack; + int ret_stack_size; + char* last_body; + int deep; +}; -extern void __FASTCALL__ asx_parser_free(ASX_Parser_t* parser); - -/* - * Return -1 on error, 0 when nothing is found, 1 on sucess - */ -extern int __FASTCALL__ asx_get_element(ASX_Parser_t* parser,const char** _buffer, - char** _element,char** _body,char*** _attribs); - -extern int __FASTCALL__ asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs); - /////// Attribs utils extern char* __FASTCALL__ asx_get_attrib(const char* attrib,char** attribs); @@ -48,5 +56,5 @@ extern void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func); static inline void asx_free_attribs(any_t*a) { asx_list_free(&a,mp_free); } - +} // namespace mpxp #endif Modified: mplayerxp/libplaytree/playtreeparser.cpp =================================================================== --- mplayerxp/libplaytree/playtreeparser.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/libplaytree/playtreeparser.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -179,7 +179,7 @@ /* NOTHING */; MSG_DBG3("Parsing asx file : [%s]\n",p->buffer); - return asx_parser_build_tree(libinput,p->buffer,p->deep); + return ASX_Parser::build_tree(libinput,p->buffer,p->deep); } static char* __FASTCALL__ pls_entry_get_value(char* line) { Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/mplayerxp.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -420,7 +420,7 @@ MP_UNIT(NULL); } -void exit_player(const char* why){ +void exit_player(const std::string& why){ fflush(stdout); fflush(stderr); @@ -428,11 +428,11 @@ MP_UNIT("exit_player"); - if(why) MSG_HINT(MSGTR_Exiting,why); + if(!why.empty()) MSG_HINT(MSGTR_Exiting,why.c_str()); if(mpxp_context().mconfig) m_config_free(mpxp_context().mconfig); mpxp_print_uninit(); mpxp_uninit_structs(); - if(why) exit(0); + if(!why.empty()) exit(0); return; /* Still try coredump!!!*/ } @@ -447,7 +447,7 @@ kill(getpid(),SIGKILL); return; } - exit_player(NULL); + exit_player(""); } Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/mplayerxp.h 2012-12-12 09:07:39 UTC (rev 547) @@ -1,6 +1,8 @@ #ifndef __MPLAYERXP_MAIN #define __MPLAYERXP_MAIN 1 +#include <string> + #include <pthread.h> #include <stdint.h> #include <string.h> @@ -177,21 +179,20 @@ extern pthread_mutex_t audio_timer_mutex; - void exit_player(const char* why); + void exit_player(const std::string& why); /* 10 ms or 10'000 microsecs is optimal time for thread sleeping */ - inline int yield_timeslice() { return usleep(10000); } + inline int yield_timeslice() { return ::usleep(10000); } - inline void escape_player(const char* why,unsigned num_calls) { + inline void escape_player(const std::string& why,unsigned num_calls) { show_backtrace(why,num_calls); exit_player(why); } - inline MPXP_Rc check_pin(const char* module,unsigned pin1,unsigned pin2) { + inline MPXP_Rc check_pin(const std::string& module,unsigned pin1,unsigned pin2) { if(pin1!=pin2) { - char msg[4096]; - strcpy(msg,"Found incorrect PIN in module: "); - strcat(msg,module); + std::string msg; + msg=std::string("Found incorrect PIN in module: ")+module; escape_player(msg,mp_conf.max_trace); } return MPXP_Ok; Modified: mplayerxp/osdep/aclib.cpp =================================================================== --- mplayerxp/osdep/aclib.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/osdep/aclib.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -24,7 +24,7 @@ see aclib_template.c ... this file only contains runtime cpu detection and config options stuff runtime cpu detection by michael niedermayer (mic...@gm...) is under GPL */ - +namespace mpxp { static any_t* init_fast_memcpy(any_t* to, const any_t* from, size_t len) { #ifdef __SSE2__ @@ -89,13 +89,13 @@ #endif { MSG_V("Using generic optimized agpcpy\n"); - fast_stream_copy_ptr = memcpy; /* prior to mmx we use the standart memcpy */ + fast_stream_copy_ptr = ::memcpy; /* prior to mmx we use the standart memcpy */ } return (*fast_stream_copy_ptr)(to,from,len); } any_t*(*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len) = init_fast_memcpy; any_t*(*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len) = init_stream_copy; - +} // namespace mpxp #endif /* use fastmemcpy */ Modified: mplayerxp/osdep/aclib_template.h =================================================================== --- mplayerxp/osdep/aclib_template.h 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/osdep/aclib_template.h 2012-12-12 09:07:39 UTC (rev 547) @@ -157,6 +157,7 @@ return retval;\ } +namespace mpxp { #undef MEM_STORE #undef MEM_SFENCE #define MEM_STORE _ivec_stream @@ -176,4 +177,5 @@ MSG_DBG3("fast_memcpy(%p, %p, %u) [cl_size=%u]\n",to,from,len,gCpuCaps.cl_size); FAST_MEMORY_COPY(to,from,len); } +} // namesapce mpxp #endif Modified: mplayerxp/osdep/fastmemcpy.h =================================================================== --- mplayerxp/osdep/fastmemcpy.h 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/osdep/fastmemcpy.h 2012-12-12 09:07:39 UTC (rev 547) @@ -1,55 +1,51 @@ #ifndef __MPLAYER_MEMCPY #define __MPLAYER_MEMCPY 1 +#include "mp_config.h" +using namespace mpxp; -#include "../mp_config.h" - #ifdef USE_FASTMEMCPY #include <stddef.h> #include <string.h> /* memcpy prototypes */ -extern any_t* (*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len); -extern any_t* (*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len); +namespace mpxp { + extern any_t* (*fast_memcpy_ptr)(any_t* to, const any_t* from, size_t len); + extern any_t* (*fast_stream_copy_ptr)(any_t* to, const any_t* from, size_t len); #define memcpy(a,b,c) (*fast_memcpy_ptr)(a,b,c) #define stream_copy(a,b,c) (*fast_stream_copy_ptr)(a,b,c) #else -#define stream_copy(a,b,c) memcpy(a,b,c) +#define stream_copy(a,b,c) ::memcpy(a,b,c) #endif -static inline any_t* stream_copy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) -{ + inline any_t* stream_copy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) + { int i; any_t*retval=dst; if(dstStride == srcStride) stream_copy(dst, src, srcStride*height); - else - { - for(i=0; i<height; i++) - { - stream_copy(dst, src, bytesPerLine); - src=(char *)src+ srcStride; - dst=(char *)dst+ dstStride; - } + else { + for(i=0; i<height; i++) { + stream_copy(dst, src, bytesPerLine); + src=(char *)src+ srcStride; + dst=(char *)dst+ dstStride; + } } return retval; -} + } -static inline any_t* memcpy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) -{ + inline any_t* memcpy_pic(any_t* dst, const any_t* src, int bytesPerLine, int height, int dstStride, int srcStride) + { int i; any_t*retval=dst; if(dstStride == srcStride) memcpy(dst, src, srcStride*height); - else - { - for(i=0; i<height; i++) - { - memcpy(dst, src, bytesPerLine); - src=(char *)src+ srcStride; - dst=(char *)dst+ dstStride; - } + else { + for(i=0; i<height; i++) { + memcpy(dst, src, bytesPerLine); + src=(char *)src+ srcStride; + dst=(char *)dst+ dstStride; + } } - return retval; -} - + } +} // namespace mpxp #endif Modified: mplayerxp/osdep/mp_malloc.cpp =================================================================== --- mplayerxp/osdep/mp_malloc.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/osdep/mp_malloc.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -211,10 +211,10 @@ uninit_bt_cache(cache); } -void print_backtrace(const char *why,any_t** stack,unsigned num) { +void print_backtrace(const std::string& why,any_t** stack,unsigned num) { char result[4096]; unsigned i; - MSG_INFO(why?why:"*** Backtrace for suspect call ***\n"); + MSG_INFO(!why.empty()?why.c_str():"*** Backtrace for suspect call ***\n"); for(i=0;i<num;i++) { MSG_INFO(" %p -> %s\n",stack[i],exec_addr2line(stack[i],result,sizeof(result))); } Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/osdep/mplib.h 2012-12-12 09:07:39 UTC (rev 547) @@ -8,6 +8,9 @@ */ #ifndef __MPLIB_H_INCLUDED__ #define __MPLIB_H_INCLUDED__ 1 + +#include <string> + #include <execinfo.h> #include <stddef.h> #include <sys/mman.h> @@ -62,9 +65,9 @@ MP_DENY_ALL =0x0, /* Page can not be accessed. */ }; int __FASTCALL__ mp_mprotect(any_t* addr,size_t len,enum mp_prot_e flags); - void print_backtrace(const char *why,any_t** stack,unsigned num); + void print_backtrace(const std::string& why,any_t** stack,unsigned num); - inline void show_backtrace(const char *why,unsigned num_calls) { + inline void show_backtrace(const std::string& why,unsigned num_calls) { any_t* stack[num_calls]; unsigned ncalls; ncalls=backtrace(stack,num_calls); Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -62,22 +62,22 @@ char *element,*body, **attribs, *name; menu_info_t* minfo = NULL; int r,i; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = asx_get_element(parser,&buffer,&element,&body,&attribs); + r = parser.get_element(&buffer,&element,&body,&attribs); if(r < 0) { - MSG_WARN("[libmenu] Syntax error at line: %i\n",parser->line); - asx_parser_free(parser); + MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); + delete &parser; return 0; } else if(r == 0) { - asx_parser_free(parser); + delete &parser; return 1; } // Has it a name ? name = asx_get_attrib("name",attribs); if(!name) { - MSG_WARN("[libmenu] Menu definitions need a name attrib: %i\n",parser->line); + MSG_WARN("[libmenu] Menu definitions need a name attrib: %i\n",parser.get_line()); delete element; if(body) delete body; asx_free_attribs(attribs); @@ -103,12 +103,12 @@ if(strcasecmp(attribs[2*i],"name") == 0) continue; if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1])) MSG_WARN("[libmenu] Bad attrib: %s %s %s %i\n",attribs[2*i],attribs[2*i+1], - name,parser->line); + name,parser.get_line()); } menu_count++; memset(&menu_list[menu_count],0,sizeof(menu_def_t)); } else { - MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element,parser->line); + MSG_WARN("[libmenu] Unknown menu type: %s %i\n",element,parser.get_line()); delete name; if(body) delete body; } @@ -116,7 +116,8 @@ delete element; asx_free_attribs(attribs); } - + delete &parser; + return 0; } /// This will build the menu_defs list from the cfg file Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -112,16 +112,16 @@ char *element,*body, **attribs, *name; list_entry_t* m = NULL; int r; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser& parser = *new(zeromem) ASX_Parser; while(1) { - r = asx_get_element(parser,&args,&element,&body,&attribs); + r = parser.get_element(&args,&element,&body,&attribs); if(r < 0) { - MSG_WARN("[libmenu] Syntax error at line: %i\n",parser->line); - asx_parser_free(parser); + MSG_WARN("[libmenu] Syntax error at line: %i\n",parser.get_line()); + delete &parser; return -1; } else if(r == 0) { - asx_parser_free(parser); + delete &parser; if(!m) MSG_WARN("[libmenu] No entry found in the menu definition\n"); return m ? 1 : 0; @@ -129,7 +129,7 @@ // Has it a name ? name = asx_get_attrib("name",attribs); if(!name) { - MSG_WARN("[libmenu] ListMenu entry definitions need a name: %i\n",parser->line); + MSG_WARN("[libmenu] ListMenu entry definitions need a name: %i\n",parser.get_line()); delete element; if(body) delete body; asx_free_attribs(attribs); @@ -147,6 +147,8 @@ if(body) delete body; asx_free_attribs(attribs); } + delete &parser; + return -1; } static int open_cmdlist(menu_t* menu, const char* args) { Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-11 17:07:00 UTC (rev 546) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-12 09:07:39 UTC (rev 547) @@ -96,17 +96,16 @@ list_entry_t* m = NULL; int r; m_option_t* opt; - ASX_Parser_t* parser = asx_parser_new(); + ASX_Parser& parser = *new(zeromem) ASX_Parser; - while(1) { - r = asx_get_element(parser,&args,&element,&body,&attribs); + r = parser.get_element(&args,&element,&body,&attribs); if(r < 0) { - MSG_ERR("[libmenu] Syntax error at line: %s\n",parser->line); - asx_parser_free(parser); + MSG_ERR("[libmenu] Syntax error at line: %s\n",parser.get_line()); + delete &parser; return -1; } else if(r == 0) { - asx_parser_free(parser); + delete &parser; if(!m) MSG_WARN("[libmenu] No entry found in the menu definition\n"); m = new(zeromem) struct list_entry_s; @@ -133,12 +132,12 @@ opt = NULL; if(name && mp_property_do(name,M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) { MSG_WARN("[libmenu] Invalid property: %s %i\n", - name,parser->line); + name,parser.get_line()); goto next_element; } txt = asx_get_attrib("txt",attribs); if(!(name || txt)) { - MSG_WARN("[libmenu] PrefMenu entry definitions need: %i\n",parser->line); + MSG_WARN("[libmenu] PrefMenu entry definitions need: %i\n",parser.get_line()); if(txt) { delete txt; txt = NULL; } goto next_element; } @@ -157,6 +156,8 @@ if(name) delete name; asx_free_attribs(attribs); } + delete &parser; + return -1; } static void read_key(menu_t* menu,int c) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 17:07:11
|
Revision: 546 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=546&view=rev Author: nickols_k Date: 2012-12-11 17:07:00 +0000 (Tue, 11 Dec 2012) Log Message: ----------- cleanups Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_vo2.cpp Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 17:04:33 UTC (rev 545) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 17:07:00 UTC (rev 546) @@ -527,7 +527,7 @@ vf_prepend_filter(s,"palette",&conf); goto csp_again; } else { - // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc + // sws failed, if the last filter (vf_vo2) support MPEGPES try to append vf_lavc // Remove the scale filter if we added it ourself if(strcmp(vf_get_first_name(s),"fmtcvt")==0) vf_remove_first(s); } Modified: mplayerxp/libmpcodecs/vd_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-11 17:04:33 UTC (rev 545) +++ mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-11 17:07:00 UTC (rev 546) @@ -674,7 +674,7 @@ else priv->use_slices=0; /* if codec is capable DR1 - if sh->vfilter==vf_vo (DR1 is meaningless into temp buffer) + if sh->vfilter==vf_vo2 (DR1 is meaningless into temp buffer) It always happens with (vidix+bus mastering), (if (src_w%16==0)) with xv */ has_b_frames=priv->ctx->has_b_frames|| Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-11 17:04:33 UTC (rev 545) +++ mplayerxp/postproc/vf.cpp 2012-12-11 17:07:00 UTC (rev 546) @@ -54,7 +54,7 @@ extern const vf_info_t vf_info_swapuv; extern const vf_info_t vf_info_test; extern const vf_info_t vf_info_unsharp; -extern const vf_info_t vf_info_vo; +extern const vf_info_t vf_info_vo2; extern const vf_info_t vf_info_yuvcsp; extern const vf_info_t vf_info_yuy2; extern const vf_info_t vf_info_yvu9; @@ -96,7 +96,7 @@ &vf_info_swapuv, &vf_info_test, &vf_info_unsharp, - &vf_info_vo, + &vf_info_vo2, &vf_info_yuvcsp, &vf_info_yuy2, &vf_info_yvu9, Modified: mplayerxp/postproc/vf_vo2.cpp =================================================================== --- mplayerxp/postproc/vf_vo2.cpp 2012-12-11 17:04:33 UTC (rev 545) +++ mplayerxp/postproc/vf_vo2.cpp 2012-12-11 17:07:00 UTC (rev 546) @@ -97,7 +97,7 @@ dri_surface_cap_t dcaps; int rflags; uint32_t flags=mpxp_context().video().output->query_format(&fmt,w,h); - MSG_DBG2("[vf_vo] %i=query_format(%s)\n",flags,vo_format_name(fmt)); + MSG_DBG2("[vf_vo2] %i=query_format(%s)\n",flags,vo_format_name(fmt)); rflags=0; UNUSED(vf); if(flags) { @@ -156,7 +156,7 @@ return MPXP_Ok; } -extern const vf_info_t vf_info_vo = { +extern const vf_info_t vf_info_vo2 = { "libvo2 wrapper", "vo", "A'rpi", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 17:04:41
|
Revision: 545 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=545&view=rev Author: nickols_k Date: 2012-12-11 17:04:33 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename vf_vo.cpp -> vf_vo2.cpp (Well, it seems that i need to think about whole rewriting of libmpdemux upto libmpdemux3 with just a packet and frame based [buffer-less] logic) Modified Paths: -------------- mplayerxp/postproc/Makefile Added Paths: ----------- mplayerxp/postproc/vf_vo2.cpp Removed Paths: ------------- mplayerxp/postproc/vf_vo.cpp Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2012-12-11 16:32:57 UTC (rev 544) +++ mplayerxp/postproc/Makefile 2012-12-11 17:04:33 UTC (rev 545) @@ -66,7 +66,7 @@ vf_swapuv.cpp \ vf_test.cpp \ vf_unsharp.cpp \ - vf_vo.cpp \ + vf_vo2.cpp \ vf_yuvcsp.cpp \ vf_yuy2.cpp \ vf_yvu9.cpp Deleted: mplayerxp/postproc/vf_vo.cpp =================================================================== --- mplayerxp/postproc/vf_vo.cpp 2012-12-11 16:32:57 UTC (rev 544) +++ mplayerxp/postproc/vf_vo.cpp 2012-12-11 17:04:33 UTC (rev 545) @@ -1,168 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "xmpcore/mp_image.h" -#include "vf.h" -#include "vf_internal.h" -#include "vfcap.h" -#include "libvo2/video_out.h" -#include "libvo2/dri_vo.h" -#include "pp_msg.h" -#include "mplayerxp.h" // mpxp_context().video().output - -//===========================================================================// -struct vf_priv_t { - int is_planar; - int sw,sh,dw,dh,sflg; - int ofmt; - vo_format_desc vd; -}; -static int vo_config_count; -static int __FASTCALL__ query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h); /* forward declaration */ - -static void __FASTCALL__ print_conf(vf_instance_t* vf) -{ - const vo_info_t *info = mpxp_context().video().output->get_info(); - MSG_INFO("VO-CONF: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, - vf->priv->sw, vf->priv->sh, - vf->priv->dw, vf->priv->dh, - vo_format_name(vf->priv->ofmt), - (vf->priv->sflg&1)?" [fs]":"", - (vf->priv->sflg&2)?" [vm]":"", - (vf->priv->sflg&4)?" [zoom]":"", - (vf->priv->sflg&8)?" [flip]":""); - MSG_V("VO: Description: %s\n",info->name); - MSG_V("VO: Author: %s\n", info->author); - if(info->comment && strlen(info->comment) > 0) - MSG_V("VO: Comment: %s\n", info->comment); -} - -static int __FASTCALL__ vf_config(vf_instance_t* vf, - int width, int height, int d_width, int d_height, - vo_flags_e flags, unsigned int outfmt){ - - if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0)) - { - MSG_ERR("VO: invalid dimensions!\n"); - return 0; - } - - vf->conf.w=width; - vf->conf.h=height; - vf->conf.fourcc=outfmt; - vf->priv->ofmt=outfmt; - vf->priv->sw=width; - vf->priv->sh=height; - vf->priv->dw=d_width; - vf->priv->dh=d_height; - vf->priv->sflg=flags; - // save vo's stride capability for the wanted colorspace: - vf->default_caps=query_format(vf,outfmt,d_width,d_height);// & VFCAP_ACCEPT_STRIDE; - - if(MPXP_Ok!=mpxp_context().video().output->configure(vf->parent,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) - return 0; - vf->priv->is_planar=vo_describe_fourcc(outfmt,&vf->priv->vd); - vf->conf.w=d_width; - vf->conf.h=d_height; - vf->conf.fourcc=outfmt; - ++vo_config_count; - return 1; -} - -static MPXP_Rc __FASTCALL__ control_vf(vf_instance_t* vf, int request,any_t* data) -{ - UNUSED(vf); - MSG_DBG2("vf_control: %u\n",request); - switch(request){ - case VFCTRL_SET_EQUALIZER: { - vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); - if(!vo_config_count) return MPXP_False; // vo not configured? - return mpxp_context().video().output->ctrl(VOCTRL_SET_EQUALIZER, eq); - } - case VFCTRL_GET_EQUALIZER: { - vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); - if(!vo_config_count) return MPXP_False; // vo not configured? - return mpxp_context().video().output->ctrl(VOCTRL_GET_EQUALIZER, eq); - } - } - // return video_out->control_vf(request,data); - return MPXP_Unknown; -} - -static int __FASTCALL__ query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h){ - dri_surface_cap_t dcaps; - int rflags; - uint32_t flags=mpxp_context().video().output->query_format(&fmt,w,h); - MSG_DBG2("[vf_vo] %i=query_format(%s)\n",flags,vo_format_name(fmt)); - rflags=0; - UNUSED(vf); - if(flags) { - mpxp_context().video().output->get_surface_caps(&dcaps); - if(dcaps.caps&DRI_CAP_UPSCALER) rflags |=VFCAP_HWSCALE_UP; - if(dcaps.caps&DRI_CAP_DOWNSCALER) rflags |=VFCAP_HWSCALE_DOWN; - if(rflags&(VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN)) rflags |= VFCAP_SWSCALE; - if(dcaps.caps&DRI_CAP_HWOSD) rflags |=VFCAP_OSD; - if(flags&0x1) rflags|= VFCAP_CSP_SUPPORTED; - if(flags&0x2) rflags|= VFCAP_CSP_SUPPORTED_BY_HW; - } - return rflags; -} - -static void __FASTCALL__ get_image(vf_instance_t* vf, - mp_image_t *mpi){ - MPXP_Rc retval; - UNUSED(vf); - int finalize = mpxp_context().video().output->is_final(); - retval=mpxp_context().video().output->get_surface(mpi); - if(retval==MPXP_Ok) { - mpi->flags |= MP_IMGFLAG_FINAL|MP_IMGFLAG_DIRECT; - if(finalize) mpi->flags |= MP_IMGFLAG_FINALIZED; - MSG_DBG2("vf_vo_get_image was called successfully\n"); - } - MSG_DBG2("vf_vo_get_image was called failed\n"); -} - -static int __FASTCALL__ put_slice(vf_instance_t* vf, mp_image_t *mpi){ - if(!vo_config_count) return 0; // vo not configured? - if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf_first(vf)==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { - MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); - mpxp_context().video().output->draw_slice(mpi); - } - return 1; -} - -static void __FASTCALL__ uninit( vf_instance_t* vf ) { - delete vf->priv ; - vf->priv = NULL; -} - -//===========================================================================// - -static MPXP_Rc __FASTCALL__ vf_open(vf_instance_t *vf,const char* args){ - UNUSED(args); - vf->config_vf=vf_config; - vf->control_vf=control_vf; - vf->uninit=uninit; - vf->print_conf=print_conf; - vf->query_format=query_format; - vf->get_image=get_image; - vf->put_slice=put_slice; - vf->priv = new(zeromem) vf_priv_t; - check_pin("vfilter",vf->pin,VF_PIN); - return MPXP_Ok; -} - -extern const vf_info_t vf_info_vo = { - "libvo2 wrapper", - "vo", - "A'rpi", - "for internal use", - VF_FLAGS_THREADS|VF_FLAGS_SLICES, - vf_open -}; - -//===========================================================================// Copied: mplayerxp/postproc/vf_vo2.cpp (from rev 544, mplayerxp/postproc/vf_vo.cpp) =================================================================== --- mplayerxp/postproc/vf_vo2.cpp (rev 0) +++ mplayerxp/postproc/vf_vo2.cpp 2012-12-11 17:04:33 UTC (rev 545) @@ -0,0 +1,168 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "xmpcore/mp_image.h" +#include "vf.h" +#include "vf_internal.h" +#include "vfcap.h" +#include "libvo2/video_out.h" +#include "libvo2/dri_vo.h" +#include "pp_msg.h" +#include "mplayerxp.h" // mpxp_context().video().output + +//===========================================================================// +struct vf_priv_t { + int is_planar; + int sw,sh,dw,dh,sflg; + int ofmt; + vo_format_desc vd; +}; +static int vo_config_count; +static int __FASTCALL__ query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h); /* forward declaration */ + +static void __FASTCALL__ print_conf(vf_instance_t* vf) +{ + const vo_info_t *info = mpxp_context().video().output->get_info(); + MSG_INFO("VO-CONF: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, + vf->priv->sw, vf->priv->sh, + vf->priv->dw, vf->priv->dh, + vo_format_name(vf->priv->ofmt), + (vf->priv->sflg&1)?" [fs]":"", + (vf->priv->sflg&2)?" [vm]":"", + (vf->priv->sflg&4)?" [zoom]":"", + (vf->priv->sflg&8)?" [flip]":""); + MSG_V("VO: Description: %s\n",info->name); + MSG_V("VO: Author: %s\n", info->author); + if(info->comment && strlen(info->comment) > 0) + MSG_V("VO: Comment: %s\n", info->comment); +} + +static int __FASTCALL__ vf_config(vf_instance_t* vf, + int width, int height, int d_width, int d_height, + vo_flags_e flags, unsigned int outfmt){ + + if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0)) + { + MSG_ERR("VO: invalid dimensions!\n"); + return 0; + } + + vf->conf.w=width; + vf->conf.h=height; + vf->conf.fourcc=outfmt; + vf->priv->ofmt=outfmt; + vf->priv->sw=width; + vf->priv->sh=height; + vf->priv->dw=d_width; + vf->priv->dh=d_height; + vf->priv->sflg=flags; + // save vo's stride capability for the wanted colorspace: + vf->default_caps=query_format(vf,outfmt,d_width,d_height);// & VFCAP_ACCEPT_STRIDE; + + if(MPXP_Ok!=mpxp_context().video().output->configure(vf->parent,width,height,d_width,d_height,flags,"MPlayerXP",outfmt)) + return 0; + vf->priv->is_planar=vo_describe_fourcc(outfmt,&vf->priv->vd); + vf->conf.w=d_width; + vf->conf.h=d_height; + vf->conf.fourcc=outfmt; + ++vo_config_count; + return 1; +} + +static MPXP_Rc __FASTCALL__ control_vf(vf_instance_t* vf, int request,any_t* data) +{ + UNUSED(vf); + MSG_DBG2("vf_control: %u\n",request); + switch(request){ + case VFCTRL_SET_EQUALIZER: { + vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); + if(!vo_config_count) return MPXP_False; // vo not configured? + return mpxp_context().video().output->ctrl(VOCTRL_SET_EQUALIZER, eq); + } + case VFCTRL_GET_EQUALIZER: { + vf_equalizer_t *eq=reinterpret_cast<vf_equalizer_t*>(data); + if(!vo_config_count) return MPXP_False; // vo not configured? + return mpxp_context().video().output->ctrl(VOCTRL_GET_EQUALIZER, eq); + } + } + // return video_out->control_vf(request,data); + return MPXP_Unknown; +} + +static int __FASTCALL__ query_format(vf_instance_t* vf, unsigned int fmt,unsigned w,unsigned h){ + dri_surface_cap_t dcaps; + int rflags; + uint32_t flags=mpxp_context().video().output->query_format(&fmt,w,h); + MSG_DBG2("[vf_vo] %i=query_format(%s)\n",flags,vo_format_name(fmt)); + rflags=0; + UNUSED(vf); + if(flags) { + mpxp_context().video().output->get_surface_caps(&dcaps); + if(dcaps.caps&DRI_CAP_UPSCALER) rflags |=VFCAP_HWSCALE_UP; + if(dcaps.caps&DRI_CAP_DOWNSCALER) rflags |=VFCAP_HWSCALE_DOWN; + if(rflags&(VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN)) rflags |= VFCAP_SWSCALE; + if(dcaps.caps&DRI_CAP_HWOSD) rflags |=VFCAP_OSD; + if(flags&0x1) rflags|= VFCAP_CSP_SUPPORTED; + if(flags&0x2) rflags|= VFCAP_CSP_SUPPORTED_BY_HW; + } + return rflags; +} + +static void __FASTCALL__ get_image(vf_instance_t* vf, + mp_image_t *mpi){ + MPXP_Rc retval; + UNUSED(vf); + int finalize = mpxp_context().video().output->is_final(); + retval=mpxp_context().video().output->get_surface(mpi); + if(retval==MPXP_Ok) { + mpi->flags |= MP_IMGFLAG_FINAL|MP_IMGFLAG_DIRECT; + if(finalize) mpi->flags |= MP_IMGFLAG_FINALIZED; + MSG_DBG2("vf_vo_get_image was called successfully\n"); + } + MSG_DBG2("vf_vo_get_image was called failed\n"); +} + +static int __FASTCALL__ put_slice(vf_instance_t* vf, mp_image_t *mpi){ + if(!vo_config_count) return 0; // vo not configured? + if(!(mpi->flags & MP_IMGFLAG_FINAL) || (vf_first(vf)==vf && !(mpi->flags & MP_IMGFLAG_RENDERED))) { + MSG_DBG2("vf_vo_put_slice was called(%u): %u %u %u %u\n",mpi->xp_idx,mpi->x,mpi->y,mpi->w,mpi->h); + mpxp_context().video().output->draw_slice(mpi); + } + return 1; +} + +static void __FASTCALL__ uninit( vf_instance_t* vf ) { + delete vf->priv ; + vf->priv = NULL; +} + +//===========================================================================// + +static MPXP_Rc __FASTCALL__ vf_open(vf_instance_t *vf,const char* args){ + UNUSED(args); + vf->config_vf=vf_config; + vf->control_vf=control_vf; + vf->uninit=uninit; + vf->print_conf=print_conf; + vf->query_format=query_format; + vf->get_image=get_image; + vf->put_slice=put_slice; + vf->priv = new(zeromem) vf_priv_t; + check_pin("vfilter",vf->pin,VF_PIN); + return MPXP_Ok; +} + +extern const vf_info_t vf_info_vo = { + "libvo2 wrapper", + "vo", + "A'rpi", + "for internal use", + VF_FLAGS_THREADS|VF_FLAGS_SLICES, + vf_open +}; + +//===========================================================================// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 16:33:11
|
Revision: 544 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=544&view=rev Author: nickols_k Date: 2012-12-11 16:32:57 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libvo -> libvo2 (TRANSACTION END) Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao2/ao_wav.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpcodecs/vd_xvid.cpp mplayerxp/libmpconf/codec-cfg.cpp mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/sub_cc.cpp mplayerxp/libmpdemux/sub_ty.cpp mplayerxp/libmpstream2/s_dvdnav.cpp mplayerxp/libmpstream2/s_tv.cpp mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp mplayerxp/libmpstream2/tvi/tvi_dummy.cpp mplayerxp/libmpstream2/tvi/tvi_v4l.cpp mplayerxp/libmpsub/find_sub.cpp mplayerxp/libmpsub/spudec.h mplayerxp/libmpsub/subreader.cpp mplayerxp/libvo2/Makefile mplayerxp/loader/dshow/mediatype.c mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/libmenu/menu_list.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/libmenu/menu_pt.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_aspect.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp mplayerxp/xmpcore/mp_image.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/Makefile 2012-12-11 16:32:57 UTC (rev 544) @@ -11,7 +11,7 @@ TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo xmpcore +SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo2 xmpcore ifeq ($(ENABLE_WIN32LOADER),yes) SUBDIRS+=loader endif @@ -40,7 +40,7 @@ libao2/libao2.a \ postproc/libpostproc.a \ input2/libinput2.a \ - libvo/libvo.a \ + libvo2/libvo2.a \ osdep/libosdep.a \ nls/libnls.a \ libmpconf/libmpconf.a \ Modified: mplayerxp/libao2/ao_wav.cpp =================================================================== --- mplayerxp/libao2/ao_wav.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libao2/ao_wav.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -30,7 +30,7 @@ #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "help_mp.h" #include "ao_msg.h" Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -24,7 +24,7 @@ #include "libmpconf/codec-cfg.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "postproc/vf.h" #include "vd.h" @@ -107,7 +107,7 @@ delete opaque; } -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #define MPDEC_THREAD_COND (VF_FLAGS_THREADS|VF_FLAGS_SLICES) static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; @@ -448,7 +448,7 @@ } } -#include "libvo/video_out.h" +#include "libvo2/video_out.h" MPXP_Rc mpcodecs_config_vf(video_decoder_t *opaque, int w, int h){ decvideo_priv_t* priv=reinterpret_cast<decvideo_priv_t*>(opaque->vd_private); @@ -475,7 +475,7 @@ MSG_V("VDec: vo config request - %d x %d\n",w,h); csp_again: - // check if libvo and codec has common outfmt (no conversion): + // check if libvo2 and codec has common outfmt (no conversion): j=-1; for(i=0;i<CODECS_MAX_OUTFMT;i++){ int flags; Modified: mplayerxp/libmpcodecs/vd.cpp =================================================================== --- mplayerxp/libmpcodecs/vd.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -10,7 +10,7 @@ #include "xmpcore/xmp_core.h" #include "libmpconf/codec-cfg.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" Modified: mplayerxp/libmpcodecs/vd_divx4.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_divx4.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -22,7 +22,7 @@ #include "vd_internal.h" #include "vd.h" #include "codecs_ld.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/bswap.h" static const vd_info_t info = { Modified: mplayerxp/libmpcodecs/vd_internal.h =================================================================== --- mplayerxp/libmpcodecs/vd_internal.h 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_internal.h 2012-12-11 16:32:57 UTC (rev 544) @@ -1,6 +1,6 @@ #include "libmpconf/codec-cfg.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "vd.h" #include "vd_msg.h" Modified: mplayerxp/libmpcodecs/vd_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_lavc.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -23,7 +23,7 @@ #include "codecs_ld.h" #include "postproc/postprocess.h" #include "postproc/vf.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/bswap.h" static const vd_info_t info = { @@ -79,7 +79,7 @@ #include "libavcodec/avcodec.h" #include "libavformat/riff.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" static int vcodec_inited=0; Modified: mplayerxp/libmpcodecs/vd_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -8,7 +8,7 @@ #include <unistd.h> #include <math.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "osdep/bswap.h" #include <libdv/dv.h> Modified: mplayerxp/libmpcodecs/vd_libmpeg2.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -111,7 +111,7 @@ #include "libmpdemux/parse_es.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) #else Modified: mplayerxp/libmpcodecs/vd_xanim.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -21,7 +21,7 @@ #include "libmpconf/codec-cfg.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "osdep/timer.h" #include "osdep/fastmemcpy.h" #include "vd_internal.h" Modified: mplayerxp/libmpcodecs/vd_xvid.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpcodecs/vd_xvid.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -16,7 +16,7 @@ #include "vd_internal.h" #include "codecs_ld.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/bswap.h" static const vd_info_t info = { Modified: mplayerxp/libmpconf/codec-cfg.cpp =================================================================== --- mplayerxp/libmpconf/codec-cfg.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpconf/codec-cfg.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -23,7 +23,7 @@ // for mmioFOURCC: #include "loader/wine/avifmt.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "codec-cfg.h" #define MSGT_CLASS MSGT_CODECCFG #include "mp_msg.h" Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -865,7 +865,7 @@ NULL }; -#include "libvo/img_format.h" +#include "libvo2/img_format.h" /* FIXME: snyc with img_format.h */ static struct { Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -18,7 +18,7 @@ #include "demuxer_internal.h" #include "stheader.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "osdep/fastmemcpy.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -35,7 +35,7 @@ #include "osdep/bswap.h" #include "libmpsub/vobsub.h" #include "libmpsub/subreader.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "libmpcodecs/codecs_ld.h" #include "libmpcodecs/libnuppelvideo/minilzo.h" #include "libao2/afmt.h" Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -24,7 +24,7 @@ #include "osdep/bswap.h" #include "aviheader.h" #include "libmpcodecs/dec_audio.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "aviprint.h" #include "mpxpav64.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,7 +25,7 @@ #include "aviprint.h" #include "libmpcodecs/codecs_ld.h" #include "libmpcodecs/dec_audio.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "libao2/afmt.h" #include "demux_msg.h" @@ -176,7 +176,7 @@ // - subtitles up in demuxer buffer... #include "libmpsub/subreader.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #define OGG_SUB_MAX_LINE 128 static subtitle ogg_sub; Modified: mplayerxp/libmpdemux/demux_rawvideo.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -12,7 +12,7 @@ #include "stheader.h" #include "libmpconf/cfgparser.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "demux_msg.h" struct rawvideo_conf_t { Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -17,7 +17,7 @@ #include "input2/input.h" #include "osdep/fastmemcpy.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "libao2/afmt.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/sub_cc.cpp =================================================================== --- mplayerxp/libmpdemux/sub_cc.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/sub_cc.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,8 +25,8 @@ #include "libmpsub/subreader.h" -#include "libvo/video_out.h" -#include "libvo/sub.h" +#include "libvo2/video_out.h" +#include "libvo2/sub.h" #define CC_MAX_LINE_LENGTH 64 Modified: mplayerxp/libmpdemux/sub_ty.cpp =================================================================== --- mplayerxp/libmpdemux/sub_ty.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpdemux/sub_ty.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -20,7 +20,7 @@ #include "help_mp.h" #include "sub_cc.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "demux_msg.h" extern int sub_justify; Modified: mplayerxp/libmpstream2/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream2/s_dvdnav.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpstream2/s_dvdnav.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -13,7 +13,7 @@ #include "stream_internal.h" #include "help_mp.h" #include "libmpsub/spudec.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "input2/input.h" #include "mplayerxp.h" #include <algorithm> Modified: mplayerxp/libmpstream2/s_tv.cpp =================================================================== --- mplayerxp/libmpstream2/s_tv.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpstream2/s_tv.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -33,7 +33,7 @@ #include "libmpdemux/stheader.h" #include "libao2/afmt.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "osdep/fastmemcpy.h" #include "libao2/audio_out.h" Modified: mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp =================================================================== --- mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -56,7 +56,7 @@ #endif #endif -#include "../libvo/img_format.h" +#include "../libvo2/img_format.h" #include "tv.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream2/tvi/tvi_dummy.cpp =================================================================== --- mplayerxp/libmpstream2/tvi/tvi_dummy.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpstream2/tvi/tvi_dummy.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -7,7 +7,7 @@ #ifdef USE_TV #include <stdio.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "tv.h" #include "tvi_def.h" Modified: mplayerxp/libmpstream2/tvi/tvi_v4l.cpp =================================================================== --- mplayerxp/libmpstream2/tvi/tvi_v4l.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpstream2/tvi/tvi_v4l.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -29,8 +29,7 @@ #include "libao2/afmt.h" #include "libao2/audio_out.h" -#include "libvo/img_format.h" -#include "libvo/fastmemcpy.h" +#include "libvo2/img_format.h" #include "tv.h" #include "stream_msg.h" Modified: mplayerxp/libmpsub/find_sub.cpp =================================================================== --- mplayerxp/libmpsub/find_sub.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpsub/find_sub.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -8,8 +8,8 @@ #include <stdio.h> #include <limits.h> -#include "libvo/video_out.h" -#include "libvo/sub.h" +#include "libvo2/video_out.h" +#include "libvo2/sub.h" #include "subreader.h" #define MSGT_CLASS MSGT_FINDSUB #include "mp_msg.h" Modified: mplayerxp/libmpsub/spudec.h =================================================================== --- mplayerxp/libmpsub/spudec.h 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpsub/spudec.h 2012-12-11 16:32:57 UTC (rev 544) @@ -1,8 +1,8 @@ #ifndef _MPLAYER_SPUDEC_H #define _MPLAYER_SPUDEC_H -#include "libvo/video_out.h" -#include "libvo/sub.h" +#include "libvo2/video_out.h" +#include "libvo2/sub.h" extern int spu_alignment; extern int spu_aamode; Modified: mplayerxp/libmpsub/subreader.cpp =================================================================== --- mplayerxp/libmpsub/subreader.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libmpsub/subreader.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -15,7 +15,7 @@ #include <string.h> #include <ctype.h> #include "subreader.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #ifdef USE_ICONV #ifdef HAVE_GICONV Modified: mplayerxp/libvo2/Makefile =================================================================== --- mplayerxp/libvo2/Makefile 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/libvo2/Makefile 2012-12-11 16:32:57 UTC (rev 544) @@ -1,6 +1,6 @@ include ../mp_config.mak -LIBNAME = libvo.a +LIBNAME = libvo2.a CXXSRCS=video_out.cpp font_load.cpp img_format.cpp screenshot.cpp sub.cpp CXXSRCS+=osd_render.cpp aspect.cpp vo_null.cpp Modified: mplayerxp/loader/dshow/mediatype.c =================================================================== --- mplayerxp/loader/dshow/mediatype.c 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/loader/dshow/mediatype.c 2012-12-11 16:32:57 UTC (rev 544) @@ -26,7 +26,7 @@ #include "wine/winerror.h" #include "com.h" -#include "../libvo/img_format.h" +#include "../libvo2/img_format.h" #ifndef NOAVIFILE_HEADERS #include "audiodecoder.h" #include "except.h" Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/mplayerxp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -53,9 +53,9 @@ #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "libao2/audio_out.h" #include "libao2/afmt.h" Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/mplayerxp.h 2012-12-11 16:32:57 UTC (rev 544) @@ -11,7 +11,7 @@ #include "libmpconf/cfgparser.h" #include "libmpsub/subreader.h" #include "libao2/audio_out.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" struct audio_decoder_t; struct video_decoder_t; Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -11,15 +11,15 @@ #include <fcntl.h> #include <unistd.h> -#include "libvo/osd_render.h" -#include "libvo/font_load.h" -#include "libvo/sub.h" +#include "libvo2/osd_render.h" +#include "libvo2/font_load.h" +#include "libvo2/sub.h" #include "osdep/keycodes.h" #include "libplaytree/asxparser.h" #include "nls/nls.h" -#include "libvo/img_format.h" -#include "libvo/video_out.h" +#include "libvo2/img_format.h" +#include "libvo2/video_out.h" #include "xmpcore/mp_image.h" #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,7 +9,7 @@ #include <ctype.h> #include <string.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "libmpconf/m_option.h" @@ -18,7 +18,7 @@ #include "menu.h" #include "menu_list.h" -#include "libvo/font_load.h" +#include "libvo2/font_load.h" #include "input2/input.h" #include "version.h" Modified: mplayerxp/postproc/libmenu/menu_console.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_console.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -16,7 +16,7 @@ #include <unistd.h> #include <errno.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "libmpconf/cfgparser.h" @@ -24,7 +24,7 @@ #include "libmpconf/m_option.h" #include "menu.h" -#include "libvo/font_load.h" +#include "libvo2/font_load.h" #include "osdep/keycodes.h" #include "input2/input.h" #include "osdep/timer.h" Modified: mplayerxp/postproc/libmenu/menu_filesel.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_filesel.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -19,7 +19,7 @@ #include "libmpconf/m_option.h" #include "libmpconf/cfgparser.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_list.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_list.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,14 +6,14 @@ #include <ctype.h> #include <string.h> -#include "libvo/img_format.h" -#include "libvo/sub.h" +#include "libvo2/img_format.h" +#include "libvo2/sub.h" #include "xmpcore/mp_image.h" #include "libmpconf/m_struct.h" #include "menu.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/keycodes.h" #include "mplayerxp.h" // mpxp_context().video().output Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -19,7 +19,7 @@ #include "libmpconf/m_property.h" #include "libplaytree/asxparser.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "menu.h" Modified: mplayerxp/postproc/libmenu/menu_pt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -7,7 +7,7 @@ #include "help_mp.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "libmpconf/m_struct.h" Modified: mplayerxp/postproc/libmenu/menu_txt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/libmenu/menu_txt.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -8,8 +8,8 @@ #include <stdio.h> #include <string.h> -#include "libvo/img_format.h" -#include "libvo/sub.h" +#include "libvo2/img_format.h" +#include "libvo2/sub.h" #include "xmpcore/mp_image.h" #include "libmpconf/cfgparser.h" @@ -17,7 +17,7 @@ #include "libmpconf/m_option.h" #include "menu.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/keycodes.h" #include "pp_msg.h" #include "mplayerxp.h" // mpxp_context().video().output Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,8 +9,8 @@ #include "mplayerxp.h" #include "help_mp.h" -#include "libvo/img_format.h" -#include "libvo/video_out.h" +#include "libvo2/img_format.h" +#include "libvo2/video_out.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" @@ -165,7 +165,7 @@ MSG_DBG2("passthru mode to %s\n",vf->next->info->name); return vf_get_new_image(vf->next,outfmt,mp_imgtype,mp_imgflag,w,h,xp_idx); } - // Note: we should call libvo first to check if it supports direct rendering + // Note: we should call libvo2 first to check if it supports direct rendering // and if not, then fallback to software buffers: switch(mp_imgtype){ case MP_IMGTYPE_IP: @@ -201,7 +201,7 @@ if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); MSG_DBG2("vf_get_new_image setfmt. flags=0x%X\n",mpi->flags); if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT) { - // check libvo first! + // check libvo2 first! if(vf->get_image) vf->get_image(vf,mpi); MSG_DBG2("[vf->get_image] returns xp_idx=%u\n",mpi->xp_idx); Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf.h 2012-12-11 16:32:57 UTC (rev 544) @@ -3,7 +3,7 @@ #include <stdint.h> #include "xmpcore/xmp_enums.h" #include "xmpcore/mp_image.h" -#include "libvo/video_out.h" // for vo_flags_e +#include "libvo2/video_out.h" // for vo_flags_e #include "vfcap.h" struct vf_instance_t; Modified: mplayerxp/postproc/vf_1bpp.cpp =================================================================== --- mplayerxp/postproc/vf_1bpp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_1bpp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_2xsai.cpp =================================================================== --- mplayerxp/postproc/vf_2xsai.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_2xsai.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_aspect.cpp =================================================================== --- mplayerxp/postproc/vf_aspect.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_aspect.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_delogo.cpp =================================================================== --- mplayerxp/postproc/vf_delogo.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_delogo.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -29,7 +29,7 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_denoise3d.cpp =================================================================== --- mplayerxp/postproc/vf_denoise3d.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_denoise3d.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,7 +25,7 @@ #include <inttypes.h> #include <math.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_dint.cpp =================================================================== --- mplayerxp/postproc/vf_dint.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_dint.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,7 +9,7 @@ #include "osdep/fastmemcpy.h" #include "xmpcore/mp_image.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "vf.h" #include "vf_internal.h" #include "pp_msg.h" Modified: mplayerxp/postproc/vf_down3dright.cpp =================================================================== --- mplayerxp/postproc/vf_down3dright.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_down3dright.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -8,7 +8,7 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_eq.cpp =================================================================== --- mplayerxp/postproc/vf_eq.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_eq.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -20,8 +20,8 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" -#include "libvo/video_out.h" +#include "libvo2/img_format.h" +#include "libvo2/video_out.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_expand.cpp =================================================================== --- mplayerxp/postproc/vf_expand.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_expand.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -7,7 +7,7 @@ #include <stdlib.h> #include <string.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" @@ -15,8 +15,8 @@ #include "osdep/fastmemcpy.h" #ifdef OSD_SUPPORT -#include "libvo/video_out.h" -#include "libvo/sub.h" +#include "libvo2/video_out.h" +#include "libvo2/sub.h" #endif #include "pp_msg.h" #include "mplayerxp.h" // mpxp_context().video().output Modified: mplayerxp/postproc/vf_flip.cpp =================================================================== --- mplayerxp/postproc/vf_flip.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_flip.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -29,7 +29,7 @@ #include "vf.h" #include "vf_internal.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" //===========================================================================// Modified: mplayerxp/postproc/vf_format.cpp =================================================================== --- mplayerxp/postproc/vf_format.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_format.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_framestep.cpp =================================================================== --- mplayerxp/postproc/vf_framestep.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_framestep.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -57,7 +57,7 @@ #include "help_mp.h" #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_il.cpp =================================================================== --- mplayerxp/postproc/vf_il.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_il.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,7 +25,7 @@ #include <inttypes.h> #include <assert.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_menu.cpp =================================================================== --- mplayerxp/postproc/vf_menu.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_menu.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -10,14 +10,14 @@ #include "mplayerxp.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" -#include "libvo/video_out.h" -#include "libvo/font_load.h" +#include "libvo2/video_out.h" +#include "libvo2/font_load.h" #include "input2/input.h" #include "libmpconf/m_struct.h" #include "libmenu/menu.h" Modified: mplayerxp/postproc/vf_mirror.cpp =================================================================== --- mplayerxp/postproc/vf_mirror.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_mirror.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_noise.cpp =================================================================== --- mplayerxp/postproc/vf_noise.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_noise.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -27,7 +27,7 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_ow.cpp =================================================================== --- mplayerxp/postproc/vf_ow.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_ow.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -33,7 +33,7 @@ #include <inttypes.h> #include <math.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_palette.cpp =================================================================== --- mplayerxp/postproc/vf_palette.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_palette.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_panscan.cpp =================================================================== --- mplayerxp/postproc/vf_panscan.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_panscan.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,7 +9,7 @@ #include <stdlib.h> #include <string.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" @@ -17,7 +17,7 @@ #include "osdep/fastmemcpy.h" #ifdef OSD_SUPPORT -#include "libvo/sub.h" +#include "libvo2/sub.h" #endif #include "pp_msg.h" Modified: mplayerxp/postproc/vf_perspective.cpp =================================================================== --- mplayerxp/postproc/vf_perspective.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_perspective.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -26,7 +26,7 @@ #include <assert.h> #include <math.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_pp.cpp =================================================================== --- mplayerxp/postproc/vf_pp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_pp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,7 +9,7 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_raw.cpp =================================================================== --- mplayerxp/postproc/vf_raw.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_raw.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -10,7 +10,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_rgb2bgr.cpp =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_rgb2bgr.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_rotate.cpp =================================================================== --- mplayerxp/postproc/vf_rotate.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_rotate.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_scale.cpp =================================================================== --- mplayerxp/postproc/vf_scale.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_scale.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -8,12 +8,12 @@ #include "osdep/cpudetect.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "osdep/fastmemcpy.h" #include "swscale.h" #include "libavutil/log.h" Modified: mplayerxp/postproc/vf_smartblur.cpp =================================================================== --- mplayerxp/postproc/vf_smartblur.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_smartblur.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -29,7 +29,7 @@ #include <locale.h> #endif -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_softpulldown.cpp =================================================================== --- mplayerxp/postproc/vf_softpulldown.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_softpulldown.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -5,13 +5,13 @@ #include <stdlib.h> #include <string.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" #include "osdep/fastmemcpy.h" -#include "libvo/sub.h" +#include "libvo2/sub.h" #include "pp_msg.h" struct vf_priv_t { Modified: mplayerxp/postproc/vf_swapuv.cpp =================================================================== --- mplayerxp/postproc/vf_swapuv.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_swapuv.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,7 +25,7 @@ #include <inttypes.h> #include <assert.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_test.cpp =================================================================== --- mplayerxp/postproc/vf_test.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_test.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -25,7 +25,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_unsharp.cpp =================================================================== --- mplayerxp/postproc/vf_unsharp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_unsharp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -33,7 +33,7 @@ #include <locale.h> #endif -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_vo.cpp =================================================================== --- mplayerxp/postproc/vf_vo.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_vo.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,8 +9,8 @@ #include "vf.h" #include "vf_internal.h" #include "vfcap.h" -#include "libvo/video_out.h" -#include "libvo/dri_vo.h" +#include "libvo2/video_out.h" +#include "libvo2/dri_vo.h" #include "pp_msg.h" #include "mplayerxp.h" // mpxp_context().video().output @@ -157,7 +157,7 @@ } extern const vf_info_t vf_info_vo = { - "libvo wrapper", + "libvo2 wrapper", "vo", "A'rpi", "for internal use", Modified: mplayerxp/postproc/vf_yuvcsp.cpp =================================================================== --- mplayerxp/postproc/vf_yuvcsp.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_yuvcsp.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_yuy2.cpp =================================================================== --- mplayerxp/postproc/vf_yuy2.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_yuy2.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/postproc/vf_yvu9.cpp =================================================================== --- mplayerxp/postproc/vf_yvu9.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/postproc/vf_yvu9.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include <inttypes.h> -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "xmpcore/mp_image.h" #include "vf.h" #include "vf_internal.h" Modified: mplayerxp/xmpcore/mp_image.cpp =================================================================== --- mplayerxp/xmpcore/mp_image.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/xmpcore/mp_image.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -6,7 +6,7 @@ #include <string.h> #include "mplayerxp.h" -#include "libvo/img_format.h" +#include "libvo2/img_format.h" #include "mp_image.h" #include "osdep/fastmemcpy.h" #define MSGT_CLASS MSGT_CPLAYER Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -20,7 +20,7 @@ #include "xmp_core.h" #include "libao2/audio_out.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/xmpcore/xmp_core.h 2012-12-11 16:32:57 UTC (rev 544) @@ -14,7 +14,7 @@ #include "osdep/mplib.h" using namespace mpxp; -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "libmpdemux/stheader.h" namespace mpxp { Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 16:20:06 UTC (rev 543) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 16:32:57 UTC (rev 544) @@ -9,7 +9,7 @@ #include "sig_hand.h" #include "libao2/audio_out.h" -#include "libvo/video_out.h" +#include "libvo2/video_out.h" #include "libmpdemux/demuxer_r.h" #include "osdep/timer.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 16:20:17
|
Revision: 543 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=543&view=rev Author: nickols_k Date: 2012-12-11 16:20:06 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libvo -> libvo2 (TRANSACTION BEGIN) Removed Paths: ------------- mplayerxp/libvo/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 16:18:36
|
Revision: 542 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=542&view=rev Author: nickols_k Date: 2012-12-11 16:18:22 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libvo -> libvo2 (TRANSACTION BEGIN) Added Paths: ----------- mplayerxp/libvo2/ mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_fbdev.cpp Removed Paths: ------------- mplayerxp/libvo/Makefile mplayerxp/libvo/aspect.cpp mplayerxp/libvo/aspect.h mplayerxp/libvo/dri_vo.h mplayerxp/libvo/font_load.cpp mplayerxp/libvo/font_load.h mplayerxp/libvo/img_format.cpp mplayerxp/libvo/img_format.h mplayerxp/libvo/jpeg_enc.cpp mplayerxp/libvo/jpeg_enc.h mplayerxp/libvo/osd_render.cpp mplayerxp/libvo/osd_render.h mplayerxp/libvo/osd_render_template.h mplayerxp/libvo/screenshot.cpp mplayerxp/libvo/screenshot.h mplayerxp/libvo/sub.cpp mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/videodev_mjpeg.h mplayerxp/libvo/vidix_system.cpp mplayerxp/libvo/vidix_system.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_msg.h mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/wskeys.h mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_fbdev.cpp Deleted: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/Makefile 2012-12-11 16:18:22 UTC (rev 542) @@ -1,70 +0,0 @@ -include ../mp_config.mak - -LIBNAME = libvo.a - -CXXSRCS=video_out.cpp font_load.cpp img_format.cpp screenshot.cpp sub.cpp -CXXSRCS+=osd_render.cpp aspect.cpp vo_null.cpp -ifeq ($(HAVE_SDL),yes) -CXXSRCS+=vo_sdl.cpp -endif -ifeq ($(HAVE_OPENGL),yes) -CXXSRCS+=vo_opengl.cpp -endif -ifeq ($(HAVE_X11),yes) -CXXSRCS+=vo_x11.cpp x11_system.cpp -endif -ifeq ($(HAVE_XV),yes) -CXXSRCS+=vo_xv.cpp -endif -ifeq ($(HAVE_FBDEV),yes) -CXXSRCS+=vo_fbdev.cpp -endif -ifeq ($(HAVE_VESA),yes) -CXXSRCS += vo_vesa.cpp -endif -ifeq ($(CONFIG_VIDIX),yes) -CXXSRCS += vidix_system.cpp -endif - -CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY -Wall -W -CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -DMPG12PLAY -Wall -W - -ifeq ($(CONFIG_VIDIX),yes) -CFLAGS += -DVIDIX_PATH='"$(LIBDIR)/vidix/"' -CXXFLAGS += -DVIDIX_PATH='"$(LIBDIR)/vidix/"' -endif - -OBJS=$(SRCS:.c=.o) -CXXOBJS=$(CXXSRCS:.cpp=.o) - -.SUFFIXES: .c .o - -# .PHONY: all clean - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $< -.cpp.o: - $(CXX) -c $(CXXFLAGS) -o $@ $< - -$(LIBNAME): $(OBJS) $(CXXOBJS) - $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) - -all: dep $(LIBNAME) - -clean: - rm -f *.o *.a *~ - -distclean: - rm -f Makefile.bak *.o *.a *~ .depend - -dep: .depend - -.depend: $(SRCS) $(CXXSRCS) - $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend - -# -# include dependency files if they exist -# -ifneq ($(wildcard .depend),) -include .depend -endif Deleted: mplayerxp/libvo/aspect.cpp =================================================================== --- mplayerxp/libvo/aspect.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/aspect.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,93 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* Stuff for correct aspect scaling. */ -#include "aspect.h" - -//#define ASPECT_DEBUG - -#ifdef ASPECT_DEBUG -#include <stdio.h> -#endif -#include "vo_msg.h" - -namespace mpxp { - -Aspect::Aspect(float mon_pix_aspect) { monitor_pixel_aspect = mon_pix_aspect; } -Aspect::~Aspect() { } - -void Aspect::save(uint32_t _orgw, uint32_t _orgh, - uint32_t _prew, uint32_t _preh, - uint32_t _scrw, uint32_t _scrh) { - orgw = _orgw; - orgh = _orgh; - prew = _prew; - preh = _preh; - screenw = _scrw; - screenh = _scrh; - monitor_aspect = monitor_pixel_aspect * screenw / screenh; -} - -void Aspect::save_image(uint32_t _orgw, uint32_t _orgh, - uint32_t _prew, uint32_t _preh) { - orgw = _orgw; - orgh = _orgh; - prew = _prew; - preh = _preh; -} - -void Aspect::save_screen(uint32_t _scrw, uint32_t _scrh) { - screenw = _scrw; - screenh = _scrh; - monitor_aspect = monitor_pixel_aspect * screenw / screenh; -} - -/* aspect is called with the source resolution and the - * resolution, that the scaled image should fit into - */ -void Aspect::calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom) { - uint32_t tmpw; - -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",screenw,screenh,zoom); - MSG_DBG2("aspect(1) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif - if(zoom){ - if(prew >= preh) { - /* Landscape mode */ - srcw = screenw; - srch = (uint32_t)(((float)screenw / (float)prew * (float)preh) * - ((float)screenh / ((float)screenw / monitor_aspect))); - } else { - /* Portrait mode */ - srch = screenh; - srcw = (uint32_t)(((float)screenh / (float)preh * (float)prew) * - ((float)screenw / ((float)screenh * monitor_aspect))); - } - } else { - srcw = prew; - srch = (uint32_t)((float)preh * - ((float)screenh / ((float)screenw / monitor_aspect))); - } - srch+= srch%2; // round -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(2) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif - if(srch>screenh || srch<orgh){ - if(zoom) - tmpw = (uint32_t)(((float)screenh / (float)preh * (float)prew) * - ((float)screenw / ((float)screenh / (1.0/monitor_aspect)))); - else - tmpw = (uint32_t)((float)prew * - ((float)screenw / ((float)screenh / (1.0/monitor_aspect)))); - if(tmpw<=screenw && tmpw>=orgw) { - srch = zoom?screenh:preh; - srcw = tmpw; - srcw+= srcw%2; // round - } - } -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif -} -} // namesapce mpxp Deleted: mplayerxp/libvo/aspect.h =================================================================== --- mplayerxp/libvo/aspect.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/aspect.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,37 +0,0 @@ -#ifndef __ASPECT_H -#define __ASPECT_H -/* Stuff for correct aspect scaling. */ -#include <stdint.h> -#include "mp_config.h" - -namespace mpxp { - class Aspect : public Opaque { - public: - Aspect(float moitor_pixel_aspect); - virtual ~Aspect(); - - void __FASTCALL__ save(uint32_t orgw, uint32_t orgh, - uint32_t prew, uint32_t preh, - uint32_t scrw, uint32_t scrh); - void __FASTCALL__ save_image(uint32_t orgw, uint32_t orgh, - uint32_t prew, uint32_t preh); - void __FASTCALL__ save_screen(uint32_t scrw, uint32_t scrh); - enum zoom_e { - NOZOOM=0, - ZOOM - }; - void __FASTCALL__ calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom); - private: - uint32_t orgw; // real width - uint32_t orgh; // real height - uint32_t prew; // prescaled width - uint32_t preh; // prescaled height - uint32_t screenw; // horizontal resolution - uint32_t screenh; // vertical resolution - float monitor_aspect; - float monitor_pixel_aspect; - }; -} // namespace mpxp - -#endif - Deleted: mplayerxp/libvo/dri_vo.h =================================================================== --- mplayerxp/libvo/dri_vo.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/dri_vo.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,43 +0,0 @@ -/* - This interface provides new DRI (Direct rendering interface) - for video output library. - This interface still stays in initial state. - Will be expanded in the future -*/ -#ifndef __DRI_VO_INCLUDED -#define __DRI_VO_INCLUDED 1 - -/*---------- LIB_DRI ----------------*/ -/* - Note: Each dri voctl call has following format: - voctl(call_num,any_t*); -*/ -enum { - DRI_CAP_TEMP_VIDEO =0x00000000UL,/**< Means: video buffer was allocated in RAM */ - DRI_CAP_VIDEO_MMAPED=0x00000001UL,/**< Means: surface provides DGA */ - DRI_CAP_UPSCALER =0x00000010UL,/**< Driver supports upscaling */ - DRI_CAP_DOWNSCALER =0x00000020UL,/**< Driver supports downscaling */ - DRI_CAP_HORZSCALER =0x00000040UL,/**< Driver supports horizontal scaling */ - DRI_CAP_VERTSCALER =0x00000080UL,/**< Driver supports vertical scaling */ - DRI_CAP_HWOSD =0x00000100UL,/**< Driver supports OSD painting */ - DRI_CAP_BUSMASTERING=0x80000000UL /**< Means: final video buffer but allocated in RAM */ -}; -typedef struct dri_surface_cap_s -{ - unsigned caps; /**< Capabilities of surface (see DRI_CAP_* for detail) */ - unsigned fourcc; /**< real fourcc of vo2 surface */ - unsigned width,height; /**< specify total dimension of surface */ - unsigned x,y,w,h; /**< specify movie position within surface */ - unsigned strides[4]; /**< drv->app:specify strides of each plane */ -}dri_surface_cap_t; - -enum { - MAX_DRI_BUFFERS=1024 /**< Maximal number of surfaces */ -}; -/** Contains surface address */ -typedef struct dri_surface_s -{ - unsigned idx; /**< app->drv:specify number of surface (0 default for single buffering) */ - uint8_t* planes[4]; /**< drv->app:specify planes (include alpha channel) */ -}dri_surface_t; -#endif Deleted: mplayerxp/libvo/font_load.cpp =================================================================== --- mplayerxp/libvo/font_load.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/font_load.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,291 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include "font_load.h" -#include "sub.h" -#include "osdep/get_path.h" -#include "vo_msg.h" - -raw_file* load_raw(const char *name,int verbose){ - int bpp; - raw_file* raw=new raw_file; - unsigned char head[32]; - FILE *f=fopen(name,"rb"); - if(!f) { delete raw; return NULL; } // can't open - if(fread(head,32,1,f)<1) { delete raw; fclose(f); return NULL; } // too small - if(memcmp(head,"mhwanh",6)) { delete raw; fclose(f); return NULL; } // not raw file - raw->w=head[8]*256+head[9]; - raw->h=head[10]*256+head[11]; - raw->c=head[12]*256+head[13]; - if(raw->w == 0) /* 2 bytes were not enough for the width... read 4 bytes from the end of the header */ - raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31]; - if(raw->c>256) { delete raw; fclose(f); return NULL; } // too many colors!? - MSG_V("RAW: %s %d x %d, %d colors\n",name,raw->w,raw->h,raw->c); - if(raw->c){ - raw->pal=new unsigned char [raw->c*3]; - fread(raw->pal,3,raw->c,f); - bpp=1; - } else { - raw->pal=NULL; - bpp=3; - } - raw->bmp=new unsigned char [raw->h*raw->w*bpp]; - fread(raw->bmp,raw->h*raw->w*bpp,1,f); - fclose(f); - return raw; -} - -font_desc_t* read_font_desc(const char* fname,float factor,int verbose){ - char sor[1024]; - unsigned char sor2[1024]; - font_desc_t *desc; - FILE *f; - char *dn; - char section[64]; - int i,j; - int chardb=0; - int fontdb=-1; - int version=0; - - desc=new(zeromem) font_desc_t; - if(!desc) return NULL; - - f=fopen(fname,"rt"); - if(!f) { - MSG_ERR("font: can't open file: %s\n",fname); - delete desc; - return NULL; - } - - i = strlen (fname) - 9; - if ((dn = new char [i+1])){ - strncpy (dn, fname, i); - dn[i]='\0'; - } - - desc->fpath = dn; // search in the same dir as fonts.desc - - // desc->fpath=get_path("font/"); - // if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; - // set up some defaults, and erase table - desc->charspace=2; - desc->spacewidth=12; - desc->height=0; - for(i=0;i<512;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1; - - section[0]=0; - - while(fgets(sor,1020,f)){ - char* p[8]; - int pdb=0; - unsigned char *s=(unsigned char *)sor; - unsigned char *d=sor2; - int ec=' '; - int id=0; - sor[1020]=0; - p[0]=(char *)d;++pdb; - while(1){ - int c=*s++; - if(c==0 || c==13 || c==10) break; - if(!id){ - if(c==39 || c==34){ id=c;continue;} // idezojel - if(c==';' || c=='#') break; - if(c==9) c=' '; - if(c==' '){ - if(ec==' ') continue; - *d=0; ++d; - p[pdb]=(char *)d;++pdb; - if(pdb>=8) break; - continue; - } - } else { - if(id==c){ id=0; continue; } // idezojel - } - *d=c;d++; - ec=c; - } - if(d==sor2) continue; // skip empty lines - *d=0; - - if(pdb==1 && p[0][0]=='['){ - int len=strlen(p[0]); - if(len && len<63 && p[0][len-1]==']'){ - strcpy(section,p[0]); - MSG_V("font: Reading section: %s\n",section); - if(strcmp(section,"[files]")==0){ - ++fontdb; - if(fontdb>=16) { - MSG_ERR("font: Too many bitmaps defined!\n"); - delete desc; - return NULL; - } - } - continue; - } - } - - if(strcmp(section,"[fpath]")==0){ - if(pdb==1){ - if (desc->fpath) - delete desc->fpath; // release previously allocated memory - desc->fpath=mp_strdup(p[0]); - continue; - } - } else if(strcmp(section,"[files]")==0){ - char *default_dir=DATADIR"/font"; - if(pdb==2 && strcmp(p[0],"alpha")==0){ - char *cp; - if (!(cp=new char [strlen(desc->fpath)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", - desc->fpath,p[1]); - if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ - delete cp; - if (!(cp=new char [strlen(default_dir)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", - default_dir,p[1]); - if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); - delete cp; - delete desc; - return NULL; - } - } - delete cp; - continue; - } - if(pdb==2 && strcmp(p[0],"bitmap")==0){ - char *cp; - if (!(cp=new char [strlen(desc->fpath)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", - desc->fpath,p[1]); - if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ - delete cp; - if (!(cp=new char [strlen(default_dir)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", - default_dir,p[1]); - if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); - delete cp; - delete desc; - return NULL; - } - } - delete cp; - continue; - } - } else if(strcmp(section,"[info]")==0){ - if(pdb==2 && strcmp(p[0],"name")==0){ - desc->name=mp_strdup(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"descversion")==0){ - version=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"spacewidth")==0){ - desc->spacewidth=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"charspace")==0){ - desc->charspace=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"height")==0){ - desc->height=atoi(p[1]); - continue; - } - } else if(strcmp(section,"[characters]")==0){ - if(pdb==3){ - int chr=p[0][0]; - int start=atoi(p[1]); - int end=atoi(p[2]); - if(sub_data.unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; - else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); - if(end<start) MSG_ERR("error in font desc: end<start for char '%c'\n",chr); - else { - desc->start[chr]=start; - desc->width[chr]=end-start+1; - desc->font[chr]=fontdb; - ++chardb; - } - continue; - } - } - MSG_ERR("Syntax error in font desc: %s\n",sor); - } - fclose(f); - for(i=0;i<=fontdb;i++){ - if(!desc->pic_a[i] || !desc->pic_b[i]){ - MSG_ERR("font: Missing bitmap(s) for sub-font #%d\n",i); - delete desc; - return NULL; - } - // re-sample alpha - int f=factor*256.0f; - int size=desc->pic_a[i]->w*desc->pic_a[i]->h; - int j; - MSG_V("font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout); - for(j=0;j<size;j++){ - int x=desc->pic_a[i]->bmp[j]; // alpha - int y=desc->pic_b[i]->bmp[j]; // bitmap - -#ifdef FAST_OSD - x=(x<(255-f))?0:1; -#else - - x=255-((x*f)>>8); // scale - - if(x+y>255) x=255-y; // to avoid overflows - - if(x<1) x=1; else - if(x>=252) x=0; -#endif - - desc->pic_a[i]->bmp[j]=x; -// desc->pic_b[i]->bmp[j]=0; // hack - } - MSG_V("DONE!\n"); - if(!desc->height) desc->height=desc->pic_a[i]->h; - } - - j='_'; - if(desc->font[j]<0) j='?'; - for(i=0;i<512;i++) - if(desc->font[i]<0){ - desc->start[i]=desc->start[j]; - desc->width[i]=desc->width[j]; - desc->font[i]=desc->font[j]; - } - desc->font[' ']=-1; - desc->width[' ']=desc->spacewidth; - - MSG_OK("Font %s loaded successfully! (%d chars)\n",fname,chardb); - return desc; -} - -#if 0 -int main(){ - -read_font_desc("high_arpi.desc",1); - -} -#endif Deleted: mplayerxp/libvo/font_load.h =================================================================== --- mplayerxp/libvo/font_load.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/font_load.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,28 +0,0 @@ -#ifndef __FONT_LOAD_H -#define __FONT_LOAD_H 1 - -typedef struct { - unsigned char *bmp; - unsigned char *pal; - int w,h,c; -} raw_file; - -typedef struct { - char *name; - char *fpath; - int spacewidth; - int charspace; - int height; -// char *fname_a; -// char *fname_b; - raw_file* pic_a[16]; - raw_file* pic_b[16]; - short font[65536]; - int start[65536]; - short width[65536]; -} font_desc_t; - -raw_file* load_raw(const char *name,int verbose); -font_desc_t* read_font_desc(const char* fname,float factor,int verbose); - -#endif Deleted: mplayerxp/libvo/img_format.cpp =================================================================== --- mplayerxp/libvo/img_format.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/img_format.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,204 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <ctype.h> -#include <stdio.h> -#include <limits.h> -#include "img_format.h" - -const char * __FASTCALL__ vo_format_name(int format) -{ - static char unknow_format[20]; - switch(format) - { - case IMGFMT_RGB1: return("RGB 1-bit"); - case IMGFMT_RGB4: return("RGB 4-bit"); - case IMGFMT_RG4B: return("RGB 4-bit per byte"); - case IMGFMT_RGB8: return("RGB 8-bit"); - case IMGFMT_RGB15: return("RGB 15-bit"); - case IMGFMT_RGB16: return("RGB 16-bit"); - case IMGFMT_RGB24: return("RGB 24-bit"); - case IMGFMT_RGB48NE: return("RGB 48-bit"); -// case IMGFMT_RGB32: return("RGB 32-bit"); - case IMGFMT_BGR1: return("BGR 1-bit"); - case IMGFMT_BGR4: return("BGR 4-bit"); - case IMGFMT_BG4B: return("BGR 4-bit per byte"); - case IMGFMT_BGR8: return("BGR 8-bit"); - case IMGFMT_BGR15: return("BGR 15-bit"); - case IMGFMT_BGR16: return("BGR 16-bit"); - case IMGFMT_BGR24: return("BGR 24-bit"); - case IMGFMT_BGR48NE: return("BGR 48-bit"); -// case IMGFMT_BGR32: return("BGR 32-bit"); - case IMGFMT_ABGR: return("ABGR"); - case IMGFMT_BGRA: return("BGRA"); - case IMGFMT_ARGB: return("ARGB"); - case IMGFMT_RGBA: return("RGBA"); - case IMGFMT_YVU9: return("Planar YVU9"); - case IMGFMT_IF09: return("Planar IF09"); - case IMGFMT_YV12: return("Planar YV12"); - case IMGFMT_I420: return("Planar I420"); - case IMGFMT_IYUV: return("Planar IYUV"); - case IMGFMT_CLPL: return("Planar CLPL"); - case IMGFMT_Y800: return("Planar Y800"); - case IMGFMT_Y8: return("Planar Y8"); - case IMGFMT_444P: return("Planar 444P"); - case IMGFMT_422P: return("Planar 422P"); - case IMGFMT_411P: return("Planar 411P"); - case IMGFMT_NV12: return("Planar NV12"); - case IMGFMT_NV21: return("Planar NV21"); - case IMGFMT_HM12: return("Planar NV12 Macroblock"); - case IMGFMT_IUYV: return("Packed IUYV"); - case IMGFMT_IY41: return("Packed IY41"); - case IMGFMT_IYU1: return("Packed IYU1"); - case IMGFMT_IYU2: return("Packed IYU2"); - case IMGFMT_UYVY: return("Packed UYVY"); - case IMGFMT_UYNV: return("Packed UYNV"); - case IMGFMT_cyuv: return("Packed CYUV"); - case IMGFMT_Y422: return("Packed Y422"); - case IMGFMT_YUY2: return("Packed YUY2"); - case IMGFMT_YUNV: return("Packed YUNV"); - case IMGFMT_YVYU: return("Packed YVYU"); - case IMGFMT_Y41P: return("Packed Y41P"); - case IMGFMT_Y211: return("Packed Y211"); - case IMGFMT_Y41T: return("Packed Y41T"); - case IMGFMT_Y42T: return("Packed Y42T"); - case IMGFMT_V422: return("Packed V422"); - case IMGFMT_V655: return("Packed V655"); - case IMGFMT_CLJR: return("Packed CLJR"); - case IMGFMT_YUVP: return("Packed YUVP"); - case IMGFMT_UYVP: return("Packed UYVP"); - case IMGFMT_420A: return "Planar YV12 with alpha"; - case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian"; - case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian"; - case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian"; - case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; - case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian"; - case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian"; - case IMGFMT_MPEGPES: return("Mpeg PES"); - case IMGFMT_ZRMJPEGNI: return("Zoran MJPEG non-interlaced"); - case IMGFMT_ZRMJPEGIT: return("Zoran MJPEG top field first"); - case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first"); - case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation"); - case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT"); - } - char *p=reinterpret_cast<char *>(&format); - if(isprint(p[0])&&isprint(p[1])&&isprint(p[2])&&isprint(p[4])) - snprintf(unknow_format,20,"Unknown %c%c%c%c",p[0],p[1],p[2],p[3]); - else - snprintf(unknow_format,20,"Unknown 0x%04x",format); - return unknow_format; -} - -typedef struct s_pix_fourcc{ - PixelFormat pix_fmt; - uint32_t fourcc; -}pix_fourcc; -static pix_fourcc pfcc[] = -{ - { PIX_FMT_YUV420P, IMGFMT_YV12 }, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - { PIX_FMT_YUYV422, IMGFMT_YUY2 }, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - { PIX_FMT_RGB24, IMGFMT_RGB24}, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - { PIX_FMT_BGR24, IMGFMT_BGR24}, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - { PIX_FMT_YUV422P, IMGFMT_422P }, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - { PIX_FMT_YUV444P, IMGFMT_444P }, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - { PIX_FMT_RGB32, IMGFMT_RGB32}, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - { PIX_FMT_YUV410P, IMGFMT_YVU9 }, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - { PIX_FMT_YUV410P, IMGFMT_IF09 }, ///< rough alias - { PIX_FMT_YUV411P, IMGFMT_411P }, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - { PIX_FMT_RGB48BE, IMGFMT_RGB48BE }, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian - { PIX_FMT_RGB48LE, IMGFMT_RGB48LE }, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian - { PIX_FMT_RGB565, IMGFMT_RGB16}, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - { PIX_FMT_RGB555, IMGFMT_RGB15}, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 - { PIX_FMT_GRAY8, IMGFMT_Y800 }, ///< Y , 8bpp - { PIX_FMT_GRAY8, IMGFMT_Y8 }, ///< alias - { PIX_FMT_MONOWHITE, IMGFMT_RGB1}, ///< Y , 1bpp, 1 is white - { PIX_FMT_MONOBLACK, IMGFMT_RGB1}, ///< Y , 1bpp, 0 is black - { PIX_FMT_PAL8, IMGFMT_RGB8 }, ///< 8 bit with PIX_FMT_RGB32 palette - { PIX_FMT_YUVJ420P,IMGFMT_YV12 }, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - { PIX_FMT_YUVJ420P,IMGFMT_I420 }, ///< alias - { PIX_FMT_YUVJ422P,IMGFMT_422P }, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - { PIX_FMT_YUVJ444P,IMGFMT_444P }, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - { PIX_FMT_XVMC_MPEG2_MC, IMGFMT_XVMC},///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - { PIX_FMT_XVMC_MPEG2_IDCT, IMGFMT_XVMC_IDCT_MPEG2}, - { PIX_FMT_UYVY422, IMGFMT_UYVY }, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - { PIX_FMT_UYYVYY411, IMGFMT_Y41P },///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - { PIX_FMT_BGR32, IMGFMT_BGR32 }, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - { PIX_FMT_BGR565, IMGFMT_BGR16 }, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - { PIX_FMT_BGR555, IMGFMT_BGR15 }, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - { PIX_FMT_BGR8, IMGFMT_BGR8 }, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - { PIX_FMT_BGR4, IMGFMT_BGR4 }, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - { PIX_FMT_BGR4_BYTE,IMGFMT_BGR4_CHAR}, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - { PIX_FMT_RGB8, IMGFMT_RGB8 }, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_RGB4, IMGFMT_RGB4 }, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_RGB4_BYTE,IMGFMT_RGB4_CHAR }, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_NV12, IMGFMT_NV12 }, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - { PIX_FMT_NV21, IMGFMT_NV21 }, ///< as above, but U and V bytes are swapped - - { PIX_FMT_YUVA420P, IMGFMT_420A },///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) - { PIX_FMT_YUV420P16LE, IMGFMT_420P16_LE }, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - { PIX_FMT_YUV420P16BE, IMGFMT_420P16_BE },///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - { PIX_FMT_YUV422P16LE, IMGFMT_422P16_LE },///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - { PIX_FMT_YUV422P16BE, IMGFMT_422P16_BE },///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - { PIX_FMT_YUV444P16LE, IMGFMT_444P16_LE },///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - { PIX_FMT_YUV444P16BE, IMGFMT_444P16_BE },///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - - { PIX_FMT_RGB32_1, IMGFMT_RGBA }, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - { PIX_FMT_BGR32_1, IMGFMT_BGRA } ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness -}; - -PixelFormat pixfmt_from_fourcc(uint32_t fourcc) -{ - unsigned i; - for(i=0;i<sizeof(pfcc)/sizeof(pix_fourcc);i++) { - if(fourcc==pfcc[i].fourcc) return pfcc[i].pix_fmt; - } - return PIX_FMT_NONE; -} - -uint32_t fourcc_from_pixfmt(enum PixelFormat pixfmt) -{ - unsigned i; - for(i=0;i<sizeof(pfcc)/sizeof(pix_fourcc);i++) { - if(pixfmt==pfcc[i].pix_fmt) return pfcc[i].fourcc; - } - return UINT_MAX; -} - -unsigned rgbfmt_depth(unsigned fmt) -{ - switch(pixfmt_from_fourcc(fmt)) { - case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: -// case PIX_FMT_BGR48BE: -// case PIX_FMT_BGR48LE: - return 48; - case PIX_FMT_BGRA: - case PIX_FMT_ABGR: - case PIX_FMT_RGBA: - case PIX_FMT_ARGB: - return 32; - case PIX_FMT_BGR24: - case PIX_FMT_RGB24: - return 24; - case PIX_FMT_BGR565: - case PIX_FMT_RGB565: - case PIX_FMT_GRAY16BE: - case PIX_FMT_GRAY16LE: - return 16; - case PIX_FMT_BGR555: - case PIX_FMT_RGB555: - return 15; - case PIX_FMT_BGR8: - case PIX_FMT_RGB8: - return 8; - case PIX_FMT_BGR4: - case PIX_FMT_RGB4: - case PIX_FMT_BGR4_BYTE: - case PIX_FMT_RGB4_BYTE: - return 4; - case PIX_FMT_MONOBLACK: - return 1; - default: - return 256; - } -} Deleted: mplayerxp/libvo/img_format.h =================================================================== --- mplayerxp/libvo/img_format.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/img_format.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,161 +0,0 @@ - -#ifndef __IMG_FORMAT_H -#define __IMG_FORMAT_H -#include <inttypes.h> -#include <stdint.h> -#include "mp_config.h" -#include "mp_conf_lavc.h" - -/* RGB/BGR Formats */ -enum { - IMGFMT_RGB_MASK =0xFFFFFF00, - IMGFMT_RGB =(('R'<<24)|('G'<<16)|('B'<<8)), - IMGFMT_RGB1 =(IMGFMT_RGB|1), - IMGFMT_RGB4 =(IMGFMT_RGB|4), - IMGFMT_RGB4_CHAR =(IMGFMT_RGB|4|128), // RGB4 with 1 pixel per byte - IMGFMT_RGB8 =(IMGFMT_RGB|8), - IMGFMT_RGB15 =(IMGFMT_RGB|15), - IMGFMT_RGB16 =(IMGFMT_RGB|16), - IMGFMT_RGB24 =(IMGFMT_RGB|24), - IMGFMT_RGB32 =(IMGFMT_RGB|32), - IMGFMT_RGB48LE =(IMGFMT_RGB|48), - IMGFMT_RGB48BE =(IMGFMT_RGB|48|128), - - IMGFMT_BGR_MASK =0xFFFFFF00, - IMGFMT_BGR =(('B'<<24)|('G'<<16)|('R'<<8)), - IMGFMT_BGR1 =(IMGFMT_BGR|1), - IMGFMT_BGR4 =(IMGFMT_BGR|4), - IMGFMT_BGR4_CHAR =(IMGFMT_BGR|4|128), // BGR4 with 1 pixel per byte - IMGFMT_BGR8 =(IMGFMT_BGR|8), - IMGFMT_BGR15 =(IMGFMT_BGR|15), - IMGFMT_BGR16 =(IMGFMT_BGR|16), - IMGFMT_BGR24 =(IMGFMT_BGR|24), - IMGFMT_BGR32 =(IMGFMT_BGR|32), - IMGFMT_BGR48LE =(IMGFMT_BGR|48), - IMGFMT_BGR48BE =(IMGFMT_BGR|48|128), - -#ifdef WORDS_BIGENDIAN - IMGFMT_ABGR =IMGFMT_RGB32, - IMGFMT_BGRA =(IMGFMT_RGB32|64), - IMGFMT_ARGB =IMGFMT_BGR32, - IMGFMT_RGBA =(IMGFMT_BGR32|64), - IMGFMT_RGB48NE =IMGFMT_RGB48BE, - IMGFMT_BGR48NE =IMGFMT_RGB48LE, -#else - IMGFMT_ABGR =(IMGFMT_BGR32|64), - IMGFMT_BGRA =IMGFMT_BGR32, - IMGFMT_ARGB =(IMGFMT_RGB32|64), - IMGFMT_RGBA =IMGFMT_RGB32, - IMGFMT_RGB48NE =IMGFMT_RGB48LE, - IMGFMT_BGR48NE =IMGFMT_RGB48BE, -#endif -/* old names for compatibility */ - IMGFMT_RG4B =IMGFMT_RGB4_CHAR, - IMGFMT_BG4B =IMGFMT_BGR4_CHAR, -/* Planar YUV Formats */ - IMGFMT_YVU9 =0x39555659, - IMGFMT_IF09 =0x39304649, - IMGFMT_YV12 =0x32315659, - IMGFMT_I420 =0x30323449, - IMGFMT_IYUV =0x56555949, - IMGFMT_CLPL =0x4C504C43, - IMGFMT_Y800 =0x30303859, - IMGFMT_Y8 =0x20203859, - IMGFMT_NV12 =0x3231564E, - IMGFMT_NV21 =0x3132564E, -/* unofficial Planar Formats, FIXME if official 4CC exists */ - IMGFMT_444P =0x50343434, - IMGFMT_422P =0x50323234, - IMGFMT_411P =0x50313134, - IMGFMT_HM12 =0x32314D48, -/* Packed YUV Formats */ - IMGFMT_IUYV =0x56595549, - IMGFMT_IY41 =0x31435949, - IMGFMT_IYU1 =0x31555949, - IMGFMT_IYU2 =0x32555949, - IMGFMT_UYVY =0x59565955, - IMGFMT_UYNV =0x564E5955, - IMGFMT_cyuv =0x76757963, - IMGFMT_Y422 =0x32323459, - IMGFMT_YUY2 =0x32595559, - IMGFMT_YUNV =0x564E5559, - IMGFMT_YVYU =0x55595659, - IMGFMT_Y41P =0x50313459, - IMGFMT_Y211 =0x31313259, - IMGFMT_Y41T =0x54313459, - IMGFMT_Y42T =0x54323459, - IMGFMT_V422 =0x32323456, - IMGFMT_V655 =0x35353656, - IMGFMT_CLJR =0x524A4C43, - IMGFMT_YUVP =0x50565559, - IMGFMT_UYVP =0x50565955, -// 4:2:0 planar with alpha - IMGFMT_420A =0x41303234, - - IMGFMT_444P16_LE =0x51343434, - IMGFMT_444P16_BE =0x34343451, - IMGFMT_422P16_LE =0x51323234, - IMGFMT_422P16_BE =0x34323251, - IMGFMT_420P16_LE =0x51303234, - IMGFMT_420P16_BE =0x34323051, -#if HAVE_BIGENDIAN - IMGFMT_444P16 =IMGFMT_444P16_BE, - IMGFMT_422P16 =IMGFMT_422P16_BE, - IMGFMT_420P16 =IMGFMT_420P16_BE, -#else - IMGFMT_444P16 =IMGFMT_444P16_LE, - IMGFMT_422P16 =IMGFMT_422P16_LE, - IMGFMT_420P16 =IMGFMT_420P16_LE, -#endif -/* Compressed Formats */ - IMGFMT_MPEGPES =(('M'<<24)|('P'<<16)|('E'<<8)|('S')), -/* Formats that are understood by zoran chips, we include - * non-interlaced, interlaced top-first, interlaced bottom-first */ - IMGFMT_ZRMJPEGNI =(('Z'<<24)|('R'<<16)|('N'<<8)|('I')), - IMGFMT_ZRMJPEGIT =(('Z'<<24)|('R'<<16)|('I'<<8)|('T')), - IMGFMT_ZRMJPEGIB =(('Z'<<24)|('R'<<16)|('I'<<8)|('B')), -// I think that this code could not be used by any other codec/format - IMGFMT_XVMC =0x1DC70000, - IMGFMT_XVMC_MASK =0xFFFF0000, -//these are chroma420 - IMGFMT_XVMC_MOCO_MPEG2=(IMGFMT_XVMC|0x02), - IMGFMT_XVMC_IDCT_MPEG2=(IMGFMT_XVMC|0x82), -// VDPAU specific format. - IMGFMT_VDPAU =0x1DC80000, - IMGFMT_VDPAU_MASK =0xFFFF0000, - IMGFMT_VDPAU_MPEG1 =(IMGFMT_VDPAU|0x01), - IMGFMT_VDPAU_MPEG2 =(IMGFMT_VDPAU|0x02), - IMGFMT_VDPAU_H264 =(IMGFMT_VDPAU|0x03), - IMGFMT_VDPAU_WMV3 =(IMGFMT_VDPAU|0x04), - IMGFMT_VDPAU_VC1 =(IMGFMT_VDPAU|0x05), - IMGFMT_VDPAU_MPEG4 =(IMGFMT_VDPAU|0x06) -}; - -static inline int IMGFMT_IS_RGB(uint32_t fmt) { return (fmt&IMGFMT_RGB_MASK)==IMGFMT_RGB; } -static inline int IMGFMT_IS_BGR(uint32_t fmt) { return (fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR; } -static inline int IMGFMT_RGB_DEPTH(uint32_t fmt) { return (fmt&0x3F); } -static inline int IMGFMT_BGR_DEPTH(uint32_t fmt) { return (fmt&0x3F); } -static inline int IMGFMT_IS_YUVP16_LE(uint32_t fmt) { return ((fmt^IMGFMT_420P16_LE) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16_BE(uint32_t fmt) { return ((fmt^IMGFMT_420P16_BE) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16_NE(uint32_t fmt) { return ((fmt^IMGFMT_420P16 ) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16(uint32_t fmt) { return (IMGFMT_IS_YUVP16_LE(fmt)||IMGFMT_IS_YUVP16_BE(fmt)); } -static inline int IMGFMT_IS_XVMC(uint32_t fmt) { return ((fmt)&IMGFMT_XVMC_MASK)==IMGFMT_XVMC; } -static inline int IMGFMT_IS_VDPAU(uint32_t fmt) { return ((fmt)&IMGFMT_VDPAU_MASK)==IMGFMT_VDPAU; } - -typedef struct { - any_t* data; - int size; - int id; // stream id. usually 0x1E0 - int timestamp; // pts, 90000 Hz counter based -} vo_mpegpes_t; - -/** Returns human-readable fourcc description - * @param format fourcc of image - * @return string of format name -**/ -const char * __FASTCALL__ vo_format_name(int format); -enum PixelFormat pixfmt_from_fourcc(uint32_t fourcc); -uint32_t fourcc_from_pixfmt(enum PixelFormat pixfmt); -extern unsigned rgbfmt_depth(unsigned fmt); - -#endif Deleted: mplayerxp/libvo/jpeg_enc.cpp =================================================================== --- mplayerxp/libvo/jpeg_enc.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/jpeg_enc.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,451 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* Straightforward (to be) optimized JPEG encoder for the YUV422 format - * based on mjpeg code from ffmpeg. - * - * Copyright (c) 2002, Rik Snel - * Parts from ffmpeg Copyright (c) 2000, 2001 Gerard Lantau - * - * This program is mp_free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For an excellent introduction to the JPEG format, see: - * http://www.ece.purdue.edu/~bouman/grad-labs/lab8/pdf/lab.pdf - */ - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" -#endif -/* We need this #define because we need ../libavcodec/common.h to #define - * be2me_32, otherwise the linker will complain that it doesn't exist */ -#include "mp_conf_lavc.h" - -#include "jpeg_enc.h" -#include "vo_msg.h" - -/* zr_mjpeg_encode_mb needs access to these tables for the black & white - * option */ -typedef struct MJpegContext { - UINT8 huff_size_dc_luminance[12]; - UINT16 huff_code_dc_luminance[12]; - UINT8 huff_size_dc_chrominance[12]; - UINT16 huff_code_dc_chrominance[12]; - - UINT8 huff_size_ac_luminance[256]; - UINT16 huff_code_ac_luminance[256]; - UINT8 huff_size_ac_chrominance[256]; - UINT16 huff_code_ac_chrominance[256]; -} MJpegContext; - - -/* A very important function pointer */ -extern int (*dct_quantize)(MpegEncContext *s, - DCTELEM *block, int n, int qscale); - - -/* Begin excessive code duplication ************************************/ -/* Code coming from mpegvideo.c and mjpeg.c in ../libavcodec ***********/ - -static const unsigned short aanscales[64] = { - /* precomputed values scaled up by 14 bits */ - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, - 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 -}; - -static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale) -{ - int i; - - if (av_fdct == jpeg_fdct_ifast) { - for(i=0;i<64;i++) { - /* 16 <= qscale * quant_matrix[i] <= 7905 */ - /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ - /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ - /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ - - qmat[block_permute_op(i)] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) / - (aanscales[i] * qscale * quant_matrix[block_permute_op(i)])); - } - } else { - for(i=0;i<64;i++) { - /* We can safely suppose that 16 <= quant_matrix[i] <= 255 - So 16 <= qscale * quant_matrix[i] <= 7905 - so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 - so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 - */ - qmat[i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); - qmat16[i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[block_permute_op(i)]); - } - } -} - -static inline void encode_dc(MpegEncContext *s, int val, - UINT8 *huff_size, UINT16 *huff_code) -{ - int mant, nbits; - - if (val == 0) { - jput_bits(&s->pb, huff_size[0], huff_code[0]); - } else { - mant = val; - if (val < 0) { - val = -val; - mant--; - } - - /* compute the log (XXX: optimize) */ - nbits = 0; - while (val != 0) { - val = val >> 1; - nbits++; - } - - jput_bits(&s->pb, huff_size[nbits], huff_code[nbits]); - - jput_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); - } -} - -static void encode_block(MpegEncContext *s, DCTELEM *block, int n) -{ - int mant, nbits, code, i, j; - int component, dc, run, last_index, val; - MJpegContext *m = s->mjpeg_ctx; - UINT8 *huff_size_ac; - UINT16 *huff_code_ac; - - /* DC coef */ - component = (n <= 3 ? 0 : n - 4 + 1); - dc = block[0]; /* overflow is impossible */ - val = dc - s->last_dc[component]; - if (n < 4) { - encode_dc(s, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance); - huff_size_ac = m->huff_size_ac_luminance; - huff_code_ac = m->huff_code_ac_luminance; - } else { - encode_dc(s, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance); - huff_size_ac = m->huff_size_ac_chrominance; - huff_code_ac = m->huff_code_ac_chrominance; - } - s->last_dc[component] = dc; - - /* AC coefs */ - - run = 0; - last_index = s->block_last_index[n]; - for(i=1;i<=last_index;i++) { - j = zigzag_direct[i]; - val = block[j]; - if (val == 0) { - run++; - } else { - while (run >= 16) { - jput_bits(&s->pb, huff_size_ac[0xf0], huff_code_ac[0xf0]); - run -= 16; - } - mant = val; - if (val < 0) { - val = -val; - mant--; - } - - /* compute the log (XXX: optimize) */ - nbits = 0; - while (val != 0) { - val = val >> 1; - nbits++; - } - code = (run << 4) | nbits; - - jput_bits(&s->pb, huff_size_ac[code], huff_code_ac[code]); - - jput_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); - run = 0; - } - } - - /* output EOB only if not already 64 values */ - if (last_index < 63 || run != 0) - jput_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]); -} - -/* End excessive code duplication **************************************/ - -/* this function is a reproduction of the one in mjpeg, it includes two - * changes, it allows for black&white encoding (it skips the U and V - * macroblocks and it outputs the huffman code for 'no change' (dc) and - * 'all zero' (ac)) and it takes 4 macroblocks (422) instead of 6 (420) */ -static void zr_mjpeg_encode_mb(jpeg_enc_t *j) { - - MJpegContext *m = j->s->mjpeg_ctx; - - encode_block(j->s, j->s->block[0], 0); - encode_block(j->s, j->s->block[1], 1); - if (j->bw) { - /* U */ - jput_bits(&j->s->pb, m->huff_size_dc_chrominance[0], - m->huff_code_dc_chrominance[0]); - jput_bits(&j->s->pb, m->huff_size_ac_chrominance[0], - m->huff_code_ac_chrominance[0]); - /* V */ - jput_bits(&j->s->pb, m->huff_size_dc_chrominance[0], - m->huff_code_dc_chrominance[0]); - jput_bits(&j->s->pb, m->huff_size_ac_chrominance[0], - m->huff_code_ac_chrominance[0]); - } else { - /* we trick encode_block here so that it uses - * chrominance huffman tables instead of luminance ones - * (see the effect of second argument of encode_block) */ - encode_block(j->s, j->s->block[2], 4); - encode_block(j->s, j->s->block[3], 5); - } -} - -/* this function can take all kinds of YUV colorspaces - * YV12, YVYU, UYVY. The necesary parameters must be set up by the caller - * y_ps means "y pixel size", y_rs means "y row size". - * For YUYV, for example, is u_buf = y_buf + 1, v_buf = y_buf + 3, - * y_ps = 2, u_ps = 4, v_ps = 4, y_rs = u_rs = v_rs. - * - * The actual buffers must be passed with mjpeg_encode_frame, this is - * to make it possible to call encode on the buffer provided by the - * codec in draw_frame. - * - * The data is straightened out at the moment it is put in DCT - * blocks, there are therefore no spurious memcopies involved */ -/* Notice that w must be a multiple of 16 and h must be a multiple of 8 */ -/* We produce YUV422 jpegs, the colors must be subsampled horizontally, - * if the colors are also subsampled vertically, then this function - * performs cheap upsampling (better solution will be: a DCT that is - * optimized in the case that every two rows are the same) */ -/* cu = 0 means 'No cheap upsampling' - * cu = 1 means 'perform cheap upsampling' */ -/* The encoder doesn't know anything about interlacing, the halve height - * needs to be passed and the double rowstride. Which field gets encoded - * is decided by what buffers are passed to mjpeg_encode_frame */ -jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, - int u_psize, int u_rsize, int v_psize, int v_rsize, - int cu, int q, int b) { - jpeg_enc_t *j; - int i = 0; - MSGL_V( "JPEnc init: %dx%d %d %d %d %d %d %d\n", - w, h, y_psize, y_rsize, u_psize, - u_rsize, v_psize, v_rsize); - - j = mp_malloc(sizeof(jpeg_enc_t)); - if (j == NULL) return NULL; - - j->s = mp_malloc(sizeof(MpegEncContext)); - if (j->s == NULL) { - delete j; - return NULL; - } - - /* info on how to access the pixels */ - j->y_ps = y_psize; - j->u_ps = u_psize; - j->v_ps = v_psize; - j->y_rs = y_rsize; - j->u_rs = u_rsize; - j->v_rs = v_rsize; - - j->s->width = w; - j->s->height = h; - j->s->qscale = q; - - j->s->out_format = FMT_MJPEG; - j->s->intra_only = 1; - j->s->encoding = 1; - j->s->pict_type = I_TYPE; - j->s->y_dc_scale = 8; - j->s->c_dc_scale = 8; - - j->s->mjpeg_write_tables = 1; - j->s->mjpeg_vsample[0] = 1; - j->s->mjpeg_vsample[1] = 1; - j->s->mjpeg_vsample[2] = 1; - j->s->mjpeg_hsample[0] = 2; - j->s->mjpeg_hsample[1] = 1; - j->s->mjpeg_hsample[2] = 1; - - j->cheap_upsample = cu; - j->bw = b; - - /* if libavcodec is used by the decoder then we must not - * initialize again, but if it is not initialized then we must - * initialize it here. There must be a better way to find out - * if it is initialized */ - if (av_fdct != jpeg_fdct_ifast -#ifdef CAN_COMPILE_MMX - && av_fdct != fdct_mmx -#endif - ) { - /* we need to initialize libavcodec */ - avcodec_init(); - } - - if (mjpeg_init(j->s) < 0) { - delete j->s; - delete j; - return NULL; - } - - if (MPV_common_init(j->s) < 0) { - delete j->s; - delete j; - return NULL; - } - - /* correct the value for sc->mb_height */ - j->s->mb_height = j->s->height/8; - j->s->mb_intra = 1; - - j->s->intra_matrix[0] = default_intra_matrix[0]; - for (i = 1; i < 64; i++) - j->s->intra_matrix[i] = - (default_intra_matrix[i]*j->s->qscale) >> 3; - convert_matrix(j->s->q_intra_matrix, j->s->q_intra_matrix16, - j->s->intra_matrix, 8); - return j; -} - -int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, - unsigned char *u_data, unsigned char *v_data, char *bufr) { - int i, k, mb_x, mb_y; - short int *dest; - unsigned char *source; - /* initialize the buffer */ - - init_put_bits(&j->s->pb, bufr, 1024*256, NULL, NULL); - - mjpeg_picture_header(j->s); - - j->s->last_dc[0] = 128; - j->s->last_dc[1] = 128; - j->s->last_dc[2] = 128; - - for (mb_y = 0; mb_y < j->s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < j->s->mb_width; mb_x++) { - /* conversion 8 to 16 bit and filling of blocks - * must be mmx optimized */ - /* fill 2 Y macroblocks and one U and one V */ - source = mb_y * 8 * j->y_rs + - 16 * j->y_ps * mb_x + y_data; - dest = j->s->block[0]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->y_ps]; - } - dest += 8; - source += j->y_rs; - } - source = mb_y * 8 * j->y_rs + - (16*mb_x + 8)*j->y_ps + y_data; - dest = j->s->block[1]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->y_ps]; - } - dest += 8; - source += j->y_rs; - } - if (!j->bw && j->cheap_upsample) { - source = mb_y*4*j->u_rs + - 8*mb_x*j->u_ps + u_data; - dest = j->s->block[2]; - for (i = 0; i < 4; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->u_ps]; - dest[k+8] = source[k*j->u_ps]; - } - dest += 16; - source += j->u_rs; - } - source = mb_y*4*j->v_rs + - 8*mb_x*j->v_ps + v_data; - dest = j->s->block[3]; - for (i = 0; i < 4; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->v_ps]; - dest[k+8] = source[k*j->v_ps]; - } - dest += 16; - source += j->u_rs; - } - } else if (!j->bw && !j->cheap_upsample) { - source = mb_y*8*j->u_rs + - 8*mb_x*j->u_ps + u_data; - dest = j->s->block[2]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) - dest[k] = source[k*j->u_ps]; - dest += 8; - source += j->u_rs; - } - source = mb_y*8*j->v_rs + - 8*mb_x*j->v_ps + v_data; - dest = j->s->block[3]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) - dest[k] = source[k*j->v_ps]; - dest += 8; - source += j->u_rs; - } - } - emms_c(); /* is this really needed? */ - - j->s->block_last_index[0] = - dct_quantize(j->s, j->s->block[0], - 0, j->s->qscale); - j->s->block_last_index[1] = - dct_quantize(j->s, j->s->block[1], - 1, j->s->qscale); - - if (!j->bw) { - j->s->block_last_index[4] = - dct_quantize(j->s, j->s->block[2], - 4, j->s->qscale); - j->s->block_last_index[5] = - dct_quantize(j->s, j->s->block[3], - 5, j->s->qscale); - } - zr_mjpeg_encode_mb(j); - } - } - emms_c(); - mjpeg_picture_trailer(j->s); - flush_put_bits(&j->s->pb); - - if (j->s->mjpeg_write_tables == 1) - j->s->mjpeg_write_tables = 0; - - return pbBufPtr(&(j->s->pb)) - j->s->pb.buf; -} - -void jpeg_enc_uninit(jpeg_enc_t *j) { - mjpeg_close(j->s); - delete j->s; - delete j; -} - Deleted: mplayerxp/libvo/jpeg_enc.h =================================================================== --- mplayerxp/libvo/jpeg_enc.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/jpeg_enc.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,45 +0,0 @@ -/* Straightforward (to be) optimized JPEG encoder for the YUV422 format - * based on mjpeg code from ffmpeg. - * - * Copyright (c) 2002, Rik Snel - * Parts from ffmpeg Copyright (c) 2000, 2001 Gerard Lantau - * - * This program is mp_free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For an excellent introduction to the JPEG format, see: - * http://www.ece.purdue.edu/~bourman/grad-labs/lab8/pdf/lab.pdf - */ - - -typedef struct { - struct MpegEncContext *s; - int cheap_upsample; - int bw; - int y_ps; - int u_ps; - int v_ps; - int y_rs; - int u_rs; - int v_rs; -} jpeg_enc_t; - -jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, - int u_psize, int u_rsize, int v_psize, int v_rsize, - int cu, int q, int b); - -int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, - unsigned char *u_data, unsigned char *v_data, char *bufr); - -void jpeg_enc_uninit(jpeg_enc_t *j); Deleted: mplayerxp/libvo/osd_render.cpp =================================================================== --- mplayerxp/libvo/osd_render.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,263 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* - Generic alpha renderers for all YUV modes and RGB depths. - These are "reference implementations", should be optimized later (MMX, etc) - Templating Code from Michael Niedermayer (mic...@gm...) is under GPL -*/ - -#include <stdio.h> -#include <pthread.h> - -#include <inttypes.h> -#include "osdep/cpudetect.h" -#include "osdep/mangle.h" -#include "mplayerxp.h" -#include "osd_render.h" -#include "vo_msg.h" - -#if defined(__MMX__) -static const uint64_t bFF __attribute__((used)) __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; -static const unsigned long long mask24lh __attribute__((used)) __attribute__((aligned(8))) = 0xFFFF000000000000ULL; -static const unsigned long long mask24hl __attribute__((used)) __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; -#endif - -#define PVECTOR_ACCEL_H "osd_render_template.h" -#include "pvector/pvector_inc.h" - -namespace mpxp { -#ifdef FAST_OSD_TABLE -static unsigned short fast_osd_15bpp_table[256]; -static unsigned short fast_osd_16bpp_table[256]; -#endif - -static void __FASTCALL__ vo_draw_alpha_rgb15_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; - for(y=0;y<h;y++){ - register unsigned short *dst = (unsigned short*) dstbase; - register int x; - for(x=0;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD -#ifdef FAST_OSD_TABLE - dst[x]=fast_osd_15bpp_table[src[x]]; -#else - register unsigned int a=src[x]>>3; - dst[x]=(a<<10)|(a<<5)|a; -#endif -#else - unsigned char r=dst[x]&0x1F; - unsigned char g=(dst[x]>>5)&0x1F; - unsigned char b=(dst[x]>>10)&0x1F; - r=(((r*srca[x])>>5)+src[x])>>3; - g=(((g*srca[x])>>5)+src[x])>>3; - b=(((b*srca[x])>>5)+src[x])>>3; - dst[x]=(b<<10)|(g<<5)|r; -#endif - } - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } - return; -} - -static void __FASTCALL__ vo_draw_alpha_rgb16_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; - for(y=0;y<h;y++){ - register unsigned short *dst = (unsigned short*) dstbase; - register int x; - for(x=0;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD -#ifdef FAST_OSD_TABLE - dst[x]=fast_osd_16bpp_table[src[x]]; -#else - dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3); -#endif -#else - unsigned char r=dst[x]&0x1F; - unsigned char g=(dst[x]>>5)&0x3F; - unsigned char b=(dst[x]>>11)&0x1F; - r=(((r*srca[x])>>5)+src[x])>>3; - g=(((g*srca[x])>>6)+src[x])>>2; - b=(((b*srca[x])>>5)+src[x])>>3; - dst[x]=(b<<11)|(g<<5)|r; -#endif - } - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } - return; -} - -static void __FASTCALL__ vo_draw_alpha_uyvy_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - vo_draw_alpha_yuy2_c(w,h,src,srca,srcstride,dstbase+1,dststride,finalize); -} - -static void __FASTCALL__ vo_draw_alpha_null(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - UNUSED(w); - UNUSED(h); - UNUSED(src); - UNUSED(srca); - UNUSED(srcstride); - UNUSED(dstbase); - UNUSED(dststride); - UNUSED(finalize); -} - -void OSD_Render::render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const -{ - (*draw_alpha_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); -} - -void OSD_Render::get_draw_alpha(unsigned fmt) { - MSG_DBG2("get_draw_alpha(%s)\n",vo_format_name(fmt)); - switch(fmt) { - case IMGFMT_BGR15: - case IMGFMT_RGB15: - draw_alpha_ptr=draw_alpha_rgb15_ptr; - break; - case IMGFMT_BGR16: - case IMGFMT_RGB16: - draw_alpha_ptr=draw_alpha_rgb16_ptr; - break; - case IMGFMT_BGR24: - case IMGFMT_RGB24: - draw_alpha_ptr=draw_alpha_rgb24_ptr; - break; - case IMGFMT_BGR32: - case IMGFMT_RGB32: - draw_alpha_ptr=draw_alpha_rgb32_ptr; - break; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_Y800: - case IMGFMT_Y8: - draw_alpha_ptr=draw_alpha_yv12_ptr; - break; - case IMGFMT_YUY2: - draw_alpha_ptr=draw_alpha_yuy2_ptr; - break; - case IMGFMT_UYVY: - draw_alpha_ptr=draw_alpha_uyvy_ptr; - break; - default: - MSG_ERR("draw alpha for %s fourcc not implemented yet!",vo_format_name(fmt)); - draw_alpha_ptr=vo_draw_alpha_null; - break; - } -} - -OSD_Render::OSD_Render(unsigned fourcc) -{ -#ifdef FAST_OSD_TABLE - int i; - for(i=0;i<256;i++){ - fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3); - fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3); - } -#endif -/*FIXME the optimized stuff is a lie for 15/16bpp as they arent optimized yet*/ -// ordered per speed fasterst first -#ifdef __AVX__ -if(gCpuCaps.hasSSE41) -{ - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_AVX; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_AVX; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_AVX; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_AVX; -} -else -#endif -#ifdef __SSE4_1__ -if(gCpuCaps.hasSSE41) -{ - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE4; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE4; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE4; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE4; -} -else -#endif -#ifdef __SSSE3__ -if(gCpuCaps.hasSSSE3) -{ - MSG_V("Using SSSE3 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSSE3; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSSE3; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSSE3; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSSE3; -} -else -#endif -#ifdef __SSE3__ -if(gCpuCaps.hasSSE3) -{ - MSG_V("Using SSE3 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE3; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE3; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE3; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE3; -} -else -#endif -#ifdef __SSE2__ -if(gCpuCaps.hasSSE2) -{ - MSG_V("Using SSE2 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE2; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE2; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE2; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE2; -} -else -#endif -#ifndef __x86_64__ -#ifdef __SSE__ -if(gCpuCaps.hasMMX2) -{ - MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE; -} -else -#endif -//#ifdef __MMX__ -//if(gCpuCaps.hasMMX) -//{ -// MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); -// draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; -// draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; -// draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; -// draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; -//} -//else -//#endif -#endif -{ - MSG_V("Using generic OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_c; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_c; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_c; -} - draw_alpha_uyvy_ptr=vo_draw_alpha_uyvy_c; - draw_alpha_rgb15_ptr=vo_draw_alpha_rgb15_c; - draw_alpha_rgb16_ptr=vo_draw_alpha_rgb16_c; - get_draw_alpha(fourcc); -} - -OSD_Render::~OSD_Render(){} -} // namesapce mpxp Deleted: mplayerxp/libvo/osd_render.h =================================================================== --- mplayerxp/libvo/osd_render.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,27 +0,0 @@ -#ifndef __MPLAYER_OSD_RENDER_H_INCLUDED -#define __MPLAYER_OSD_RENDER_H_INCLUDED 1 - -/* Generic alpha renderers for all YUV modes and RGB depths. */ -/* These are "reference implementations", should be optimized later (MMX, etc) */ -namespace mpxp { - class OSD_Render : public Opaque { - public: - OSD_Render(unsigned fourcc); - virtual ~OSD_Render(); - - void render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const; - private: - void get_draw_alpha(unsigned fmt); - typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); - draw_alpha_f draw_alpha_ptr; - draw_alpha_f draw_alpha_yv12_ptr; - draw_alpha_f draw_alpha_yuy2_ptr; - draw_alpha_f draw_alpha_uyvy_ptr; - draw_alpha_f draw_alpha_rgb24_ptr; - draw_alpha_f draw_alpha_rgb32_ptr; - draw_alpha_f draw_alpha_rgb15_ptr; - draw_alpha_f draw_alpha_rgb16_ptr; - }; -} // namespace mpxp - -#endif Deleted: mplayerxp/libvo/osd_render_template.h =================================================================== --- mplayerxp/libvo/osd_render_template.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render_template.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,318 +0,0 @@ -// Generic alpha renderers for all YUV modes and RGB depths. -// Optimized by Nick and Michael -// Code from Michael Niedermayer (mic...@gm...) is under GPL -#include "pvector/pvector.h" - -#ifdef HAVE_INT_PVECTOR -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load)(const any_t*__P) -{ - return *(const __m64 *)__P; -} -#undef _m_load -#define _m_load PVECTOR_RENAME(_m_load) - -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load_half)(const any_t*__P) -{ - return _mm_cvtsi32_si64 (*(const int *)__P); -} -#undef _m_load_half -#define _m_load_half PVECTOR_RENAME(_m_load_half) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store)(any_t*__P, __m64 src) -{ - *(__m64 *)__P = src; -} -#undef _m_store -#define _m_store PVECTOR_RENAME(_m_store) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store_half)(any_t*__P, __m64 src) -{ - *(int *)__P = _mm_cvtsi64_si32(src); -} -#undef _m_store_half -#define _m_store_half PVECTOR_RENAME(_m_store_half) - -stat... [truncated message content] |
From: <nic...@us...> - 2012-12-11 16:06:17
|
Revision: 541 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=541&view=rev Author: nickols_k Date: 2012-12-11 16:06:04 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libmpstream -> libmpstream2 (TRANSACTION END) Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.cpp mplayerxp/libao2/ao_alsa9.cpp mplayerxp/libao2/ao_null.cpp mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpconf/m_option.cpp mplayerxp/libmpdemux/aviprint.cpp mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_demuxers.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_fli.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mp3.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_musepack.cpp mplayerxp/libmpdemux/demux_nsv.cpp mplayerxp/libmpdemux/demux_null.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_rawvideo.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.cpp mplayerxp/libmpdemux/demux_snd_au.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_voc.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_wav.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/mux_lavf.cpp mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/parse_es.cpp mplayerxp/libmpdemux/parse_mp4.cpp mplayerxp/libmpdemux/stheader.cpp mplayerxp/libmpdemux/yuv4mpeg.cpp mplayerxp/libmpstream2/Makefile mplayerxp/libmpstream2/librtsp/rtsp.h mplayerxp/libmpsub/vobsub.cpp mplayerxp/libplaytree/asxparser.cpp mplayerxp/libplaytree/playtree.cpp mplayerxp/libplaytree/playtreeparser.cpp mplayerxp/libvo/sub.cpp mplayerxp/libvo/vo_fbdev.cpp mplayerxp/mp-opt-reg.cpp mplayerxp/mplayerxp.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/Makefile 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpstream libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo xmpcore +SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input2 nls libvo xmpcore ifeq ($(ENABLE_WIN32LOADER),yes) SUBDIRS+=loader endif @@ -32,7 +32,7 @@ ../lavc/libavformat/libavformat$(LAVC_SUFFIX).a \ ../lavc/libavutil/libavutil$(LAVC_SUFFIX).a -MP_LIBS = libmpstream/libmpstream.a \ +MP_LIBS = libmpstream2/libmpstream2.a \ libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ libmpsub/libmpsub.a \ Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/dump.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -15,8 +15,8 @@ #include "input2/input.h" #include "mplayerxp.h" #include "libmpdemux/muxer.h" -#include "libmpstream/stream.h" -#include "libmpstream/mrl.h" +#include "libmpstream2/stream.h" +#include "libmpstream2/mrl.h" #define MSGT_CLASS MSGT_GLOBAL #include "mp_msg.h" #include "dump.h" Modified: mplayerxp/libao2/ao_alsa9.cpp =================================================================== --- mplayerxp/libao2/ao_alsa9.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libao2/ao_alsa9.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -29,7 +29,7 @@ #include "audio_out_internal.h" #include "afmt.h" #include "ao_msg.h" -#include "libmpstream/mrl.h" +#include "libmpstream2/mrl.h" static ao_info_t info = { Modified: mplayerxp/libao2/ao_null.cpp =================================================================== --- mplayerxp/libao2/ao_null.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libao2/ao_null.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -10,7 +10,7 @@ #include "osdep/bswap.h" -#include "libmpstream/mrl.h" +#include "libmpstream2/mrl.h" #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" Modified: mplayerxp/libmpcodecs/ad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/ad.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -9,7 +9,7 @@ #include <stdlib.h> #include <string.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "ad.h" Modified: mplayerxp/libmpcodecs/ad_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/ad_libdv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include <libdv/dv.h> #include <libdv/dv_types.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "libao2/afmt.h" Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -12,7 +12,7 @@ #include "mplayerxp.h" #include "xmpcore/xmp_core.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "libmpconf/codec-cfg.h" Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/dec_video.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -16,7 +16,7 @@ #include "osdep/timer.h" #include "osdep/shmem.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/parse_es.h" #include "libmpdemux/stheader.h" Modified: mplayerxp/libmpcodecs/vd.cpp =================================================================== --- mplayerxp/libmpcodecs/vd.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/vd.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -12,7 +12,7 @@ #include "libvo/img_format.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "vd.h" Modified: mplayerxp/libmpcodecs/vd_libdv.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpcodecs/vd_libdv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -14,7 +14,7 @@ #include <libdv/dv.h> #include <libdv/dv_types.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" Modified: mplayerxp/libmpconf/m_option.cpp =================================================================== --- mplayerxp/libmpconf/m_option.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpconf/m_option.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -15,7 +15,7 @@ #include "cfgparser.h" #include "m_option.h" -#include "libmpstream/url.h" +#include "libmpstream2/url.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" Modified: mplayerxp/libmpdemux/aviprint.cpp =================================================================== --- mplayerxp/libmpdemux/aviprint.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/aviprint.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -6,7 +6,7 @@ #include <stdlib.h> #include <unistd.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "aviprint.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_ac3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -5,7 +5,7 @@ #include <stdio.h> #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_asf.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -10,7 +10,7 @@ #include "help_mp.h" #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "asf.h" #include "demuxer.h" #include "demuxer_internal.h" Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_dca.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dca.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_dca.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_demuxers.cpp =================================================================== --- mplayerxp/libmpdemux/demux_demuxers.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_demuxers.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -4,7 +4,7 @@ #include <stdlib.h> #include <stdio.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "stheader.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -32,7 +32,7 @@ #include <libdv/dv_types.h> #include "demux_msg.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -21,7 +21,7 @@ #include "help_mp.h" #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_flac.cpp =================================================================== --- mplayerxp/libmpdemux/demux_flac.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_flac.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_fli.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -15,7 +15,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -22,7 +22,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include <stdlib.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -24,7 +24,7 @@ #include "mplayerxp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -29,7 +29,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_mp3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -17,7 +17,7 @@ #include "help_mp.h" #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "parse_es.h" Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_musepack.cpp =================================================================== --- mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_nsv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nsv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_nsv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -19,7 +19,7 @@ #include <unistd.h> #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_null.cpp =================================================================== --- mplayerxp/libmpdemux/demux_null.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_null.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -4,7 +4,7 @@ #include <stdlib.h> #include <stdio.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_nuv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -18,7 +18,7 @@ #include <unistd.h> #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -18,7 +18,7 @@ #include "mplayerxp.h" #include "osdep/bswap.h" #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -31,7 +31,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_rawaudio.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_rawaudio.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -5,7 +5,7 @@ #include <stdio.h> #include "mplayerxp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_rawvideo.cpp =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_rawvideo.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -6,7 +6,7 @@ #include <unistd.h> #include <string.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -28,7 +28,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_roq.cpp =================================================================== --- mplayerxp/libmpdemux/demux_roq.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_roq.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -17,7 +17,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_smjpeg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_smjpeg.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -21,7 +21,7 @@ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_snd_au.cpp =================================================================== --- mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -32,7 +32,7 @@ #include "mplayerxp.h" #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "parse_es.h" Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -42,7 +42,7 @@ #include "osdep/bswap.h" #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "parse_es.h" Modified: mplayerxp/libmpdemux/demux_viv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_viv.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_viv.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -14,7 +14,7 @@ #include <string.h> /* strtok */ #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_voc.cpp =================================================================== --- mplayerxp/libmpdemux/demux_voc.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_voc.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -7,7 +7,7 @@ #include <stdio.h> #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_wav.cpp =================================================================== --- mplayerxp/libmpdemux/demux_wav.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_wav.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demux_y4m.cpp =================================================================== --- mplayerxp/libmpdemux/demux_y4m.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demux_y4m.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -17,7 +17,7 @@ #include "yuv4mpeg.h" //#include "stream.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -23,7 +23,7 @@ #include "demux_msg.h" #include "demuxer.h" #include "demuxer_internal.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "stheader.h" #include "mplayerxp.h" Modified: mplayerxp/libmpdemux/demuxer_r.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demuxer_r.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -6,7 +6,7 @@ #define __USE_ISOC99 1 /* for lrint */ #include <math.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "stheader.h" #include "demuxer_r.h" Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -2,7 +2,7 @@ #include "osdep/mplib.h" using namespace mpxp; -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer_stream.h" #include "demuxer.h" #include "demuxer_internal.h" Modified: mplayerxp/libmpdemux/mux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/mux_lavf.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/mux_lavf.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -14,7 +14,7 @@ #include "aviheader.h" #include "muxer.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "stheader.h" #include "libavformat/avformat.h" Modified: mplayerxp/libmpdemux/mux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/mux_mpxp64.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/mux_mpxp64.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -24,7 +24,7 @@ #include "loader/qtx/qtxsdk/components.h" #include "osdep/bswap.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/parse_es.cpp =================================================================== --- mplayerxp/libmpdemux/parse_es.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/parse_es.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -8,7 +8,7 @@ #include <unistd.h> #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "parse_es.h" #include "demux_msg.h" Modified: mplayerxp/libmpdemux/parse_mp4.cpp =================================================================== --- mplayerxp/libmpdemux/parse_mp4.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/parse_mp4.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include <stdlib.h> #include "parse_mp4.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demux_msg.h" int mp4_read_descr_len(Memory_Stream& s) { Modified: mplayerxp/libmpdemux/stheader.cpp =================================================================== --- mplayerxp/libmpdemux/stheader.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/stheader.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #include "help_mp.h" #include "sub_cc.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "demuxer.h" #include "stheader.h" #include "parse_es.h" Modified: mplayerxp/libmpdemux/yuv4mpeg.cpp =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpdemux/yuv4mpeg.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -32,7 +32,7 @@ #include "yuv4mpeg.h" #include "demux_msg.h" #include "yuv4mpeg_intern.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" /* quick test of two ratios for equality (i.e. identical components) */ #define Y4M_RATIO_EQL(a,b) ( ((a).n == (b).n) && ((a).d == (b).d) ) Modified: mplayerxp/libmpstream2/Makefile =================================================================== --- mplayerxp/libmpstream2/Makefile 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpstream2/Makefile 2012-12-11 16:06:04 UTC (rev 541) @@ -1,5 +1,5 @@ -LIBNAME = libmpstream.a +LIBNAME = libmpstream2.a include ../mp_config.mak Modified: mplayerxp/libmpstream2/librtsp/rtsp.h =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpstream2/librtsp/rtsp.h 2012-12-11 16:06:04 UTC (rev 541) @@ -31,7 +31,7 @@ #ifndef HAVE_RTSP_H #define HAVE_RTSP_H -#include "libmpstream/tcp.h" +#include "libmpstream2/tcp.h" /* some codes returned by rtsp_request_* functions */ enum { Modified: mplayerxp/libmpsub/vobsub.cpp =================================================================== --- mplayerxp/libmpsub/vobsub.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libmpsub/vobsub.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -18,7 +18,7 @@ #include <sys/types.h> #include "mplayerxp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "vobsub.h" #include "spudec.h" #define MSGT_CLASS MSGT_VOBSUB Modified: mplayerxp/libplaytree/asxparser.cpp =================================================================== --- mplayerxp/libplaytree/asxparser.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libplaytree/asxparser.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -8,7 +8,7 @@ #include <string.h> #include <unistd.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "playtreeparser.h" #include "asxparser.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/libplaytree/playtree.cpp =================================================================== --- mplayerxp/libplaytree/playtree.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libplaytree/playtree.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -11,7 +11,7 @@ #ifdef MP_DEBUG #include <assert.h> #endif -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "playtree.h" #define MSGT_CLASS MSGT_PLAYTREE #include "mp_msg.h" Modified: mplayerxp/libplaytree/playtreeparser.cpp =================================================================== --- mplayerxp/libplaytree/playtreeparser.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libplaytree/playtreeparser.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -13,7 +13,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "asxparser.h" #include "playtree.h" #include "playtreeparser.h" Modified: mplayerxp/libvo/sub.cpp =================================================================== --- mplayerxp/libvo/sub.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libvo/sub.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -7,7 +7,7 @@ #include <string.h> #include "mplayerxp.h" -#include "libmpstream/stream.h" // for nav_hl +#include "libmpstream2/stream.h" // for nav_hl #include "xmpcore/xmp_core.h" #include "video_out.h" #include "font_load.h" Modified: mplayerxp/libvo/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo/vo_fbdev.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/libvo/vo_fbdev.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -35,7 +35,7 @@ #endif #include "aspect.h" #include "dri_vo.h" -#include "libmpstream/mrl.h" +#include "libmpstream2/mrl.h" #include "vo_msg.h" namespace mpxp { Modified: mplayerxp/mp-opt-reg.cpp =================================================================== --- mplayerxp/mp-opt-reg.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/mp-opt-reg.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -4,7 +4,7 @@ #include <stdlib.h> #include <stdio.h> -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpconf/cfgparser.h" Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-11 16:00:46 UTC (rev 540) +++ mplayerxp/mplayerxp.cpp 2012-12-11 16:06:04 UTC (rev 541) @@ -35,7 +35,7 @@ #define HELP_MP_DEFINE_STATIC #include "help_mp.h" -#include "libmpstream/stream.h" +#include "libmpstream2/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "libmpdemux/parse_es.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 16:00:52
|
Revision: 540 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=540&view=rev Author: nickols_k Date: 2012-12-11 16:00:46 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libmpstream -> libmpstream2 (TRANSACTION BEGIN) Added Paths: ----------- mplayerxp/libmpstream2/ Removed Paths: ------------- mplayerxp/libmpstream/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 15:24:59
|
Revision: 539 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=539&view=rev Author: nickols_k Date: 2012-12-11 15:24:51 +0000 (Tue, 11 Dec 2012) Log Message: ----------- anti-illegal patch cleanups: project compiled with -g3 lost >4MB of size. 117777K -> 112026K Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/yuv4mpeg.cpp mplayerxp/libmpdemux/yuv4mpeg.h mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/librtsp/rtsp.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/s_dvdnav.cpp mplayerxp/libmpstream/stream.cpp mplayerxp/libplaytree/playtree.h mplayerxp/libvo/sub.cpp mplayerxp/postproc/af_crystality.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/dump.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -15,6 +15,7 @@ #include "input2/input.h" #include "mplayerxp.h" #include "libmpdemux/muxer.h" +#include "libmpstream/stream.h" #include "libmpstream/mrl.h" #define MSGT_CLASS MSGT_GLOBAL #include "mp_msg.h" Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-12-11 15:24:51 UTC (rev 539) @@ -2,10 +2,7 @@ #include "loader/wine/msacm.h" #endif #include "libmpconf/codec-cfg.h" - -#include "libmpstream/stream.h" #include "libmpdemux/demuxer_r.h" -#include "libmpdemux/stheader.h" #include "ad.h" Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpcodecs/dec_video.h 2012-12-11 15:24:51 UTC (rev 539) @@ -2,8 +2,6 @@ #define DEC_VIDEO_H_INCLUDED 1 #include "xmpcore/xmp_enums.h" #include "libmpdemux/demuxer_r.h" -#include "libmpstream/stream.h" -#include "libmpdemux/stheader.h" namespace mpxp { struct libinput_t; Modified: mplayerxp/libmpcodecs/vd_internal.h =================================================================== --- mplayerxp/libmpcodecs/vd_internal.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpcodecs/vd_internal.h 2012-12-11 15:24:51 UTC (rev 539) @@ -2,10 +2,6 @@ #include "libmpconf/codec-cfg.h" #include "libvo/img_format.h" -#include "libmpstream/stream.h" -#include "libmpdemux/demuxer_r.h" -#include "libmpdemux/stheader.h" - #include "vd.h" #include "vd_msg.h" // prototypes: Modified: mplayerxp/libmpdemux/demux_y4m.cpp =================================================================== --- mplayerxp/libmpdemux/demux_y4m.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/demux_y4m.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -17,6 +17,7 @@ #include "yuv4mpeg.h" //#include "stream.h" +#include "libmpstream/stream.h" #include "demuxer.h" #include "demuxer_internal.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-11 15:24:51 UTC (rev 539) @@ -4,7 +4,6 @@ #include "osdep/mplib.h" using namespace mpxp; -#include "libmpstream/stream.h" #include "xmpcore/xmp_enums.h" #include "libmpconf/cfgparser.h" #include "demuxer_packet.h" Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-12-11 15:24:51 UTC (rev 539) @@ -4,7 +4,6 @@ #include <pthread.h> #include <stdint.h> -#include "libmpstream/stream.h" #include "demuxer.h" #include "stheader.h" Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -2,6 +2,7 @@ #include "osdep/mplib.h" using namespace mpxp; +#include "libmpstream/stream.h" #include "demuxer_stream.h" #include "demuxer.h" #include "demuxer_internal.h" Modified: mplayerxp/libmpdemux/yuv4mpeg.cpp =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/yuv4mpeg.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -32,6 +32,7 @@ #include "yuv4mpeg.h" #include "demux_msg.h" #include "yuv4mpeg_intern.h" +#include "libmpstream/stream.h" /* quick test of two ratios for equality (i.e. identical components) */ #define Y4M_RATIO_EQL(a,b) ( ((a).n == (b).n) && ((a).d == (b).d) ) @@ -50,8 +51,6 @@ return old; } - - /************************************************************************* * * Convenience functions for fd read/write Modified: mplayerxp/libmpdemux/yuv4mpeg.h =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpdemux/yuv4mpeg.h 2012-12-11 15:24:51 UTC (rev 539) @@ -28,9 +28,10 @@ #define __YUV4MPEG_H__ #include <stdlib.h> -#include "libmpstream/stream.h" - +namespace mpxp { + struct Stream; +} /************************************************************************ * error codes returned by y4m_* functions ************************************************************************/ Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -20,7 +20,6 @@ #include "mplayerxp.h" #include "tcp.h" #include "url.h" -#include "libmpdemux/asf.h" #include "stream.h" #include "network.h" Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -20,10 +20,10 @@ #include "url.h" #include "tcp.h" #include "http.h" -#include "libmpdemux/asf.h" #include "stream.h" #include "asf_streaming.h" +#include "libmpdemux/asf.h" #include "network.h" #include "stream_msg.h" Modified: mplayerxp/libmpstream/librtsp/rtsp.h =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/librtsp/rtsp.h 2012-12-11 15:24:51 UTC (rev 539) @@ -31,8 +31,8 @@ #ifndef HAVE_RTSP_H #define HAVE_RTSP_H +#include "libmpstream/tcp.h" - /* some codes returned by rtsp_request_* functions */ enum { RTSP_STATUS_SET_PARAMETER =10, Modified: mplayerxp/libmpstream/network.cpp =================================================================== --- mplayerxp/libmpstream/network.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/network.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -28,9 +28,7 @@ #endif #include "stream.h" -#include "libmpdemux/demuxer.h" #include "libmpconf/cfgparser.h" -#include "libmpdemux/mpdemux.h" #include "help_mp.h" #include "tcp.h" @@ -39,7 +37,6 @@ #include "cookies.h" #include "url.h" #include "udp.h" -#include "libmpdemux/asf.h" #include "pnm.h" #ifndef STREAMING_LIVE_DOT_COM #include "rtp.h" @@ -63,42 +60,6 @@ net_config_t::~net_config_t() {} net_config_t net_conf; -static const struct { - const char *mime_type; - int demuxer_type; -} mime_type_table[] = { - // MP3 networking, some MP3 networking server answer with audio/mpeg - { "audio/mpeg", Demuxer::Type_AUDIO }, - // MPEG networking - { "video/mpeg", Demuxer::Type_UNKNOWN }, - { "video/x-mpeg", Demuxer::Type_UNKNOWN }, - { "video/x-mpeg2", Demuxer::Type_UNKNOWN }, - // AVI ??? => video/x-msvideo - { "video/x-msvideo", Demuxer::Type_AVI }, - // MOV => video/quicktime - { "video/quicktime", Demuxer::Type_MOV }, - // ASF - { "audio/x-ms-wax", Demuxer::Type_ASF }, - { "audio/x-ms-wma", Demuxer::Type_ASF }, - { "video/x-ms-asf", Demuxer::Type_ASF }, - { "video/x-ms-afs", Demuxer::Type_ASF }, - { "video/x-ms-wvx", Demuxer::Type_ASF }, - { "video/x-ms-wmv", Demuxer::Type_ASF }, - { "video/x-ms-wma", Demuxer::Type_ASF }, - // Playlists - { "video/x-ms-wmx", Demuxer::Type_PLAYLIST }, - { "audio/x-scpls", Demuxer::Type_PLAYLIST }, - { "audio/x-mpegurl", Demuxer::Type_PLAYLIST }, - { "audio/x-pls", Demuxer::Type_PLAYLIST }, - // Real Media - { "audio/x-pn-realaudio", Demuxer::Type_REAL }, - // OGG Streaming - { "application/x-ogg", Demuxer::Type_OGG }, - // NullSoft Streaming Video - { "video/nsv", Demuxer::Type_NSV}, - { "misc/ultravox", Demuxer::Type_NSV} -}; - networking_t* new_networking() { networking_t *networking = new(zeromem) networking_t; if( networking==NULL ) { @@ -359,7 +320,6 @@ // we might be able to guess the networking type. static MPXP_Rc autodetectProtocol(networking_t *networking, Tcp& tcp) { HTTP_Header *http_hdr=NULL; - unsigned int i; int redirect; int auth_retry=0; MPXP_Rc seekable=MPXP_False; @@ -457,12 +417,6 @@ MSG_V("Content-Type: [%s]\n", content_type ); if( (content_length = http_hdr->get_field("Content-Length")) != NULL) MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length")); - // Check in the mime type table for a demuxer type - for( i=0 ; i<(sizeof(mime_type_table)/sizeof(mime_type_table[0])) ; i++ ) { - if( !strcasecmp( content_type, mime_type_table[i].mime_type ) ) { - return seekable; - } - } } // Not found in the mime type table, don't fail, // we should try raw HTTP Modified: mplayerxp/libmpstream/s_dvdnav.cpp =================================================================== --- mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/s_dvdnav.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -12,7 +12,6 @@ #include "stream.h" #include "stream_internal.h" #include "help_mp.h" -#include "libmpdemux/demuxer.h" #include "libmpsub/spudec.h" #include "libvo/sub.h" #include "input2/input.h" Modified: mplayerxp/libmpstream/stream.cpp =================================================================== --- mplayerxp/libmpstream/stream.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libmpstream/stream.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -24,7 +24,6 @@ #include "stream.h" #include "stream_internal.h" -#include "libmpdemux/demuxer.h" #include "stream_msg.h" namespace mpxp { Modified: mplayerxp/libplaytree/playtree.h =================================================================== --- mplayerxp/libplaytree/playtree.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libplaytree/playtree.h 2012-12-11 15:24:51 UTC (rev 539) @@ -1,7 +1,10 @@ #ifndef __PLAYTREE_H #define __PLAYTREE_H -#include "libmpstream/stream.h" +namespace mpxp { + struct Stream; +} + enum { PLAY_TREE_ITER_ERROR=0, PLAY_TREE_ITER_ENTRY=1, Modified: mplayerxp/libvo/sub.cpp =================================================================== --- mplayerxp/libvo/sub.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/libvo/sub.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -7,6 +7,7 @@ #include <string.h> #include "mplayerxp.h" +#include "libmpstream/stream.h" // for nav_hl #include "xmpcore/xmp_core.h" #include "video_out.h" #include "font_load.h" Modified: mplayerxp/postproc/af_crystality.cpp =================================================================== --- mplayerxp/postproc/af_crystality.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/postproc/af_crystality.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -63,15 +63,12 @@ #include <math.h> #include <limits.h> +#include "libmpdemux/stheader.h" #include "mplayerxp.h" #include "af.h" #include "af_internal.h" #include "aflib.h" -#include "libmpstream/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" - #define SAMPLE_MAX 1.0f //#define SAMPLE_MAX 1.0 /* for float32 */ Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -12,6 +12,7 @@ #include "mp_msg.h" #include "sig_hand.h" +#include "libmpdemux/demuxer.h" #include "libmpcodecs/dec_audio.h" #include "libao2/audio_out.h" Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/xmpcore/xmp_core.h 2012-12-11 15:24:51 UTC (rev 539) @@ -14,10 +14,8 @@ #include "osdep/mplib.h" using namespace mpxp; -#include "libmpdemux/demuxer_r.h" -#include "libmpstream/stream.h" -#include "libmpdemux/stheader.h" #include "libvo/video_out.h" +#include "libmpdemux/stheader.h" namespace mpxp { enum xp_modes { XP_NA=0, XP_UniCore, XP_DualCore, XP_TripleCore, XP_MultiCore }; Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 14:15:08 UTC (rev 538) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 15:24:51 UTC (rev 539) @@ -11,8 +11,8 @@ #include "libao2/audio_out.h" #include "libvo/video_out.h" +#include "libmpdemux/demuxer_r.h" #include "osdep/timer.h" -#include "libmpdemux/demuxer.h" #include "mplayerxp.h" #include "xmp_core.h" #include "xmp_adecoder.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 14:15:18
|
Revision: 538 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=538&view=rev Author: nickols_k Date: 2012-12-11 14:15:08 +0000 (Tue, 11 Dec 2012) Log Message: ----------- convert dec_ahead_engine_t::sh into Opaque* Modified Paths: -------------- mplayerxp/Makefile mplayerxp/input2/Makefile mplayerxp/libao2/Makefile mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/liba52/Makefile mplayerxp/libmpcodecs/libdca/Makefile mplayerxp/libmpcodecs/libnuppelvideo/Makefile mplayerxp/libmpconf/Makefile mplayerxp/libmpdemux/Makefile mplayerxp/libmpstream/Makefile mplayerxp/libmpstream/freesdp/Makefile mplayerxp/libmpstream/librtsp/Makefile mplayerxp/libmpstream/realrtsp/Makefile mplayerxp/libmpstream/tvi/Makefile mplayerxp/libmpsub/Makefile mplayerxp/libplaytree/Makefile mplayerxp/libvo/Makefile mplayerxp/loader/Makefile mplayerxp/nls/Makefile mplayerxp/osdep/Makefile mplayerxp/postproc/Makefile mplayerxp/postproc/libmenu/Makefile mplayerxp/xmpcore/Makefile mplayerxp/xmpcore/mp_image.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_core.cpp mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -56,7 +56,7 @@ # .PHONY: all clean -all: $(TARGET_EXE) $(SUBDIRS) +all: dep $(TARGET_EXE) $(SUBDIRS) .cpp.o: $(CXX) -c $(CXXFLAGS) -o $@ $< @@ -68,7 +68,7 @@ $(DO_MAKE_ALL) $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common -$(SRCS): .depend +$(SRCS): install: $(TARGET_EXE) ifeq ($(INSTALL),) @@ -103,7 +103,9 @@ -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h -rm -f cpuinfo help_mp.h -.depend: +dep: .depend + +.depend: $(SRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/input2/Makefile =================================================================== --- mplayerxp/input2/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/input2/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -16,7 +16,7 @@ $(LIBNAME): $(OBJS) $(AR) r $(LIBNAME) $(OBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -24,9 +24,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend # Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libao2/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -49,7 +49,7 @@ $(LIBNAME): $(OBJS) $(CXXOBJS) $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -57,9 +57,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpcodecs/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -64,7 +64,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -89,9 +89,9 @@ $(DO_MAKE) rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libmpcodecs/liba52/Makefile =================================================================== --- mplayerxp/libmpcodecs/liba52/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpcodecs/liba52/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -1,7 +1,7 @@ include ../../mp_config.mak CXXSRCS = parse.cpp bitstream.cpp imdct.cpp downmix.cpp bit_allocate.cpp crc.cpp resample.cpp -SRCS = +SRCS = OBJS = $(SRCS:.c=.o) CXXOBJS = $(CXXSRCS:.cpp=.o) @@ -17,7 +17,7 @@ .cpp.o: $(CC) -c $(CXXFLAGS) -o $@ $< -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) clean: rm -f *.o *.a *~ @@ -25,9 +25,9 @@ distclean: rm -f test *.o $(LIBNAME) *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpcodecs/libdca/Makefile =================================================================== --- mplayerxp/libmpcodecs/libdca/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpcodecs/libdca/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -12,7 +12,7 @@ .cpp.o: $(CXX) -c $(CXXFLAGS) -o $@ $< -all: $(CXXOBJS) +all: dep $(CXXOBJS) clean: rm -f *.o *.a *~ @@ -20,9 +20,9 @@ distclean: rm -f test *.o $(LIBNAME) *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpcodecs/libnuppelvideo/Makefile =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpcodecs/libnuppelvideo/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -8,7 +8,7 @@ .SUFFIXES: .cpp .o -all: $(CXXOBJS) +all: dep $(CXXOBJS) .cpp.o: $(CXX) -c $(CXXFLAGS) -o $@ $< @@ -19,9 +19,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpconf/Makefile =================================================================== --- mplayerxp/libmpconf/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpconf/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -22,7 +22,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -43,9 +43,9 @@ $(DO_MAKE) rm -f test Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpdemux/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -69,7 +69,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -96,9 +96,9 @@ $(DO_MAKE) rm -f test Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libmpstream/Makefile =================================================================== --- mplayerxp/libmpstream/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpstream/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -56,7 +56,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -85,9 +85,9 @@ $(DO_MAKE) rm -f test Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libmpstream/freesdp/Makefile =================================================================== --- mplayerxp/libmpstream/freesdp/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpstream/freesdp/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -11,7 +11,7 @@ .SUFFIXES: .c .o -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -24,9 +24,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpstream/librtsp/Makefile =================================================================== --- mplayerxp/libmpstream/librtsp/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpstream/librtsp/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -10,7 +10,7 @@ .SUFFIXES: .c .o -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -23,9 +23,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpstream/realrtsp/Makefile =================================================================== --- mplayerxp/libmpstream/realrtsp/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpstream/realrtsp/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -12,7 +12,7 @@ .SUFFIXES: .c .o -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -25,9 +25,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpstream/tvi/Makefile =================================================================== --- mplayerxp/libmpstream/tvi/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpstream/tvi/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -10,7 +10,7 @@ .SUFFIXES: .c .o -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -23,9 +23,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/libmpsub/Makefile =================================================================== --- mplayerxp/libmpsub/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libmpsub/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -19,7 +19,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -40,9 +40,9 @@ $(DO_MAKE) rm -f test Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libplaytree/Makefile =================================================================== --- mplayerxp/libplaytree/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libplaytree/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -19,7 +19,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -40,9 +40,9 @@ $(DO_MAKE) rm -f test Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/libvo/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -49,7 +49,7 @@ $(LIBNAME): $(OBJS) $(CXXOBJS) $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -57,9 +57,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/loader/Makefile =================================================================== --- mplayerxp/loader/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/loader/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -47,7 +47,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -73,9 +73,9 @@ $(wildcard dshow/*.o) \ $(wildcard dmo/*.o) -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend Modified: mplayerxp/nls/Makefile =================================================================== --- mplayerxp/nls/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/nls/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -18,7 +18,7 @@ $(LIBNAME): $(OBJS) $(AR) r $(LIBNAME) $(OBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -26,9 +26,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend # Modified: mplayerxp/osdep/Makefile =================================================================== --- mplayerxp/osdep/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/osdep/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -33,7 +33,7 @@ $(LIBNAME): $(CXXOBJS) $(OBJS) $(AR) r $(LIBNAME) $(CXXOBJS) $(OBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -41,9 +41,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(CXXSRCS) $(SRCS) 1>.depend # Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/postproc/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -80,7 +80,7 @@ .PHONY: $(SUBDIRS) -all: $(LIBNAME) +all: dep $(LIBNAME) $(SUBDIRS): $(DO_ALL) @@ -103,9 +103,9 @@ $(DO_MAKE) rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(DO_MAKE) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend Modified: mplayerxp/postproc/libmenu/Makefile =================================================================== --- mplayerxp/postproc/libmenu/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/postproc/libmenu/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -17,7 +17,7 @@ .SUFFIXES: .c .o -all: $(OBJS) $(CXXOBJS) +all: dep $(OBJS) $(CXXOBJS) .c.o: $(CC) -c $(CFLAGS) -o $@ $< @@ -30,9 +30,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # Modified: mplayerxp/xmpcore/Makefile =================================================================== --- mplayerxp/xmpcore/Makefile 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/Makefile 2012-12-11 14:15:08 UTC (rev 538) @@ -19,7 +19,7 @@ $(LIBNAME): $(OBJS) $(AR) r $(LIBNAME) $(OBJS) -all: $(LIBNAME) +all: dep $(LIBNAME) clean: rm -f *.o *.a *~ @@ -27,9 +27,9 @@ distclean: rm -f Makefile.bak *.o *.a *~ .depend -dep: depend +dep: .depend -depend: +.depend: $(SRCS) $(CXXSRCS) $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend # Modified: mplayerxp/xmpcore/mp_image.cpp =================================================================== --- mplayerxp/xmpcore/mp_image.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/mp_image.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -143,7 +143,7 @@ } mp_image_t* new_mp_image(unsigned w,unsigned h,unsigned xp_idx){ - mp_image_t* mpi=(mp_image_t*)mp_mallocz(sizeof(mp_image_t)); + mp_image_t* mpi=new(zeromem) mp_image_t; if(!mpi) return NULL; // error! mpi->xp_idx = xp_idx; mpi->width=mpi->w=w; Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -66,9 +66,9 @@ int init_audio_buffer( int size, int min_reserv, int indices, sh_audio_t *sha ) { MSG_V("Using audio buffer %i bytes (min reserve = %i, indices %i)\n",size,min_reserv, indices); - if( !(audio_buffer.buffer = (unsigned char*)mp_malloc(size)) ) + if( !(audio_buffer.buffer = new unsigned char[size]) ) return ENOMEM; - if( !(audio_buffer.indices = (audio_buffer_index_t*)mp_malloc(indices*sizeof(audio_buffer_index_t))) ) { + if( !(audio_buffer.indices = new audio_buffer_index_t[indices])) { delete audio_buffer.buffer; audio_buffer.buffer=NULL; return ENOMEM; @@ -384,9 +384,9 @@ int xp_thread_decode_audio(Demuxer_Stream *d_audio) { - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(mpxp_context().engine().xp_core->audio->sh); + sh_audio_t* sh_audio=static_cast<sh_audio_t*>(mpxp_context().engine().xp_core->audio->sh); sh_video_t* sh_video=NULL; - if(mpxp_context().engine().xp_core->video) sh_video=reinterpret_cast<sh_video_t*>(mpxp_context().engine().xp_core->video->sh); + if(mpxp_context().engine().xp_core->video) sh_video=static_cast<sh_video_t*>(mpxp_context().engine().xp_core->video->sh); int free_buf, vbuf_size, pref_buf; unsigned len=0; @@ -426,7 +426,7 @@ any_t* a_dec_ahead_routine( any_t* arg ) { mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); + sh_audio_t* sh_audio=static_cast<sh_audio_t*>(priv->dae->sh); Demuxer_Stream *d_audio=sh_audio->ds; int ret; Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -134,10 +134,10 @@ any_t* audio_play_routine( any_t* arg ) { mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); + sh_audio_t* sh_audio=static_cast<sh_audio_t*>(priv->dae->sh); Demuxer_Stream *d_audio=sh_audio->ds; Demuxer *demuxer=d_audio->demuxer; - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); + sh_video_t* sh_video=static_cast<sh_video_t*>(demuxer->video->sh); int eof = 0; struct timeval now; Modified: mplayerxp/xmpcore/xmp_core.cpp =================================================================== --- mplayerxp/xmpcore/xmp_core.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_core.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -71,7 +71,7 @@ unsigned xmp_register_main(sig_handler_t sigfunc) { unsigned idx=0; - mpxp_context().engine().xp_core->mpxp_threads[idx]=(mpxp_thread_t*)mp_mallocz(sizeof(mpxp_thread_t)); + mpxp_context().engine().xp_core->mpxp_threads[idx]=new(zeromem) mpxp_thread_t; mpxp_context().engine().xp_core->mpxp_threads[idx]->p_idx=idx; mpxp_context().engine().xp_core->mpxp_threads[idx]->pid=getpid(); mpxp_context().engine().xp_core->main_pth_id=mpxp_context().engine().xp_core->mpxp_threads[idx]->pth_id=pthread_self(); @@ -110,10 +110,10 @@ it->num_decoded_frames=0; } -void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh) +void dae_init(dec_ahead_engine_t* it,unsigned nframes,Opaque* sh) { it->nframes=nframes; - it->frame = (xmp_frame_t*)mp_malloc(sizeof(xmp_frame_t)*nframes); + it->frame = new(zeromem) xmp_frame_t[nframes]; it->sh=sh; dae_reset(it); } @@ -243,7 +243,7 @@ { mpxp_context().engine().xp_core->flags=xmp_engine_compute_model(shv,sha); if(shv) { - mpxp_context().engine().xp_core->video=(dec_ahead_engine_t*)mp_mallocz(sizeof(dec_ahead_engine_t)); + mpxp_context().engine().xp_core->video=new(zeromem) dec_ahead_engine_t; dae_init(mpxp_context().engine().xp_core->video,mpxp_context().engine().xp_core->num_v_buffs,shv); } if(sha) { @@ -262,7 +262,7 @@ min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); } - mpxp_context().engine().xp_core->audio=(dec_ahead_engine_t*)mp_mallocz(sizeof(dec_ahead_engine_t)); + mpxp_context().engine().xp_core->audio=new(zeromem) dec_ahead_engine_t; dae_init(mpxp_context().engine().xp_core->audio,mpxp_context().engine().xp_core->num_a_buffs,sha); } return 0; @@ -302,7 +302,7 @@ /* requires root privelegies */ pthread_attr_setschedpolicy(&attr,SCHED_FIFO); #endif - mpxp_context().engine().xp_core->mpxp_threads[idx]=(mpxp_thread_t*)mp_mallocz(sizeof(mpxp_thread_t)); + mpxp_context().engine().xp_core->mpxp_threads[idx]=new(zeromem) mpxp_thread_t; mpxp_context().engine().xp_core->mpxp_threads[idx]->p_idx=idx; mpxp_context().engine().xp_core->mpxp_threads[idx]->name=name; Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_core.h 2012-12-11 14:15:08 UTC (rev 538) @@ -10,6 +10,7 @@ #include <inttypes.h> #include <pthread.h> +#include "mp_config.h" #include "osdep/mplib.h" using namespace mpxp; @@ -38,7 +39,7 @@ volatile unsigned decoder_idx; /* index of frame which is currently decoded */ unsigned nframes; /* number of frames in buffer */ xmp_frame_t* frame; /* frame related attributes */ - any_t* sh; /* corresponded sh_audio_t or sh_video_t */ + Opaque* sh; /* corresponded sh_audio_t or sh_video_t */ int eof; /* EOF for stream */ /* methods */ func_new_frame_priv_t new_priv; @@ -132,7 +133,7 @@ int xmp_run_players( void ); void xmp_reset_sh_video(sh_video_t* shv); - void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh); + void dae_init(dec_ahead_engine_t* it,unsigned nframes,Opaque* sh); void dae_uninit(dec_ahead_engine_t* it); void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -116,7 +116,7 @@ any_t* xmp_video_decoder( any_t* arg ) { mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->dae->sh); + sh_video_t* sh_video=static_cast<sh_video_t*>(priv->dae->sh); Demuxer_Stream *d_video=sh_video->ds; Demuxer* demuxer=d_video->demuxer; Demuxer_Stream* d_audio=demuxer->audio; Modified: mplayerxp/xmpcore/xmp_vplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 13:30:51 UTC (rev 537) +++ mplayerxp/xmpcore/xmp_vplayer.cpp 2012-12-11 14:15:08 UTC (rev 538) @@ -273,10 +273,10 @@ any_t* xmp_video_player( any_t* arg ) { mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); - sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->dae->sh); + sh_video_t* sh_video=static_cast<sh_video_t*>(priv->dae->sh); Demuxer_Stream *d_video=sh_video->ds; Demuxer *demuxer=d_video->demuxer; - sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); + sh_audio_t* sh_audio=static_cast<sh_audio_t*>(demuxer->audio->sh); priv->state=Pth_Run; priv->dae->eof = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 13:31:04
|
Revision: 537 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=537&view=rev Author: nickols_k Date: 2012-12-11 13:30:51 +0000 (Tue, 11 Dec 2012) Log Message: ----------- supress warning: deleting any_t* is undefined + declare network support more or less safe Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpdemux/asf.h mplayerxp/libmpstream/asf_mmst_streaming.cpp mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/asf_streaming.h mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/librtsp/rtsp.cpp mplayerxp/libmpstream/librtsp/rtsp.h mplayerxp/libmpstream/librtsp/rtsp_session.cpp mplayerxp/libmpstream/librtsp/rtsp_session.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h mplayerxp/libmpstream/pnm.cpp mplayerxp/libmpstream/pnm.h mplayerxp/libmpstream/s_ftp.cpp mplayerxp/libmpstream/s_network.cpp mplayerxp/libmpstream/s_rtsp.cpp mplayerxp/libmpstream/s_udp.cpp mplayerxp/libmpstream/udp.cpp mplayerxp/libmpstream/udp.h mplayerxp/libmpstream/url.cpp mplayerxp/libmpstream/url.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/configure 2012-12-11 13:30:51 UTC (rev 537) @@ -91,7 +91,6 @@ "random_name|generates pseudo random suffix of target", "sdl|build with SDL video and audio output|http://www.libsdl.org", "sdl_image|build with SDL_image for screenshots|http://www.libsdl.org/projects/SDL_image", - "im_sure_that_must_have_streaming| the key to unlock streaming" "libvorbis|build with libvorbis support|http://www.vorbis.com", ) @@ -407,7 +406,6 @@ check_func2 execinfo.h backtrace print_config HAVE_ mp_config.h mp_config.mak backtrace -disabled im_sure_that_must_have_streaming && disable streaming disable inet_pton if enabled streaming ; then disable socklib Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpdemux/asf.h 2012-12-11 13:30:51 UTC (rev 537) @@ -123,25 +123,6 @@ }; #endif -// Definition of the differents type of ASF streaming -typedef enum { - ASF_Unknown_e, - ASF_Live_e, - ASF_Prerecorded_e, - ASF_Redirector_e, - ASF_PlainText_e, - ASF_Authenticate_e -} ASF_StreamType_e; - -typedef struct { - ASF_StreamType_e networking_type; - int request; - int packet_size; - int *audio_streams,n_audio,*video_streams,n_video; - int audio_id, video_id; -} asf_http_networking_t; - - /* * Some macros to swap little endian structures read from an ASF file * into machine endian format Modified: mplayerxp/libmpstream/asf_mmst_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/asf_mmst_streaming.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -498,7 +498,7 @@ int asf_header_len; int len, i, packet_length; char* path, *unescpath; - URL_t* url1 = networking->url; + URL* url1 = networking->url; tcp.close(); Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -564,8 +564,8 @@ static HTTP_Header* asf_http_request(networking_t *networking) { HTTP_Header* http_hdr = new(zeromem) HTTP_Header; - URL_t *url = NULL; - URL_t *server_url = NULL; + URL *url = NULL; + URL *server_url = NULL; asf_http_networking_t *asf_http_ctrl; char str[250]; char *ptr; @@ -595,7 +595,7 @@ } http_hdr->set_uri(server_url->url ); sprintf( str, "Host: %.220s:%d", server_url->hostname, server_url->port ); - url_free( server_url ); + delete server_url; } else { http_hdr->set_uri(url->file ); sprintf( str, "Host: %.220s:%d", url->hostname, url->port ); @@ -719,7 +719,7 @@ static MPXP_Rc asf_http_networking_start(Tcp& tcp, networking_t *networking) { HTTP_Header *http_hdr=NULL; - URL_t *url = networking->url; + URL *url = networking->url; asf_http_networking_t *asf_http_ctrl; char buffer[BUFFER_SIZE]; int i, ret; @@ -735,7 +735,7 @@ asf_http_ctrl->request = 1; asf_http_ctrl->audio_streams = asf_http_ctrl->video_streams = NULL; asf_http_ctrl->n_audio = asf_http_ctrl->n_video = 0; - networking->data = (any_t*)asf_http_ctrl; + networking->data = asf_http_ctrl; do { done = 1; @@ -842,3 +842,5 @@ return MPXP_Ok; } +asf_http_networking_t::asf_http_networking_t() {} +asf_http_networking_t::~asf_http_networking_t() {} \ No newline at end of file Modified: mplayerxp/libmpstream/asf_streaming.h =================================================================== --- mplayerxp/libmpstream/asf_streaming.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/asf_streaming.h 2012-12-11 13:30:51 UTC (rev 537) @@ -1,10 +1,37 @@ #ifndef __ASF_STEAMING_H_INCLUDED #define __ASF_STEAMING_H_INCLUDED 1 +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; + #include "stream.h" namespace mpxp { class Tcp; } + +// Definition of the differents type of ASF streaming +enum ASF_StreamType_e { + ASF_Unknown_e, + ASF_Live_e, + ASF_Prerecorded_e, + ASF_Redirector_e, + ASF_PlainText_e, + ASF_Authenticate_e +}; + +struct asf_http_networking_t : public Opaque { + public: + asf_http_networking_t(); + virtual ~asf_http_networking_t(); + + ASF_StreamType_e networking_type; + int request; + int packet_size; + int *audio_streams,n_audio,*video_streams,n_video; + int audio_id, video_id; +}; + extern MPXP_Rc asf_networking_start(Tcp& fd, networking_t *networking); extern MPXP_Rc asf_mmst_networking_start(Tcp& fd, networking_t *networking); Modified: mplayerxp/libmpstream/cddb.cpp =================================================================== --- mplayerxp/libmpstream/cddb.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/cddb.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -145,7 +145,7 @@ char request[4096]; int ret = 0; Tcp tcp(cddb_data->libinput,-1); - URL_t *url; + URL *url; if( reply_parser==NULL || command==NULL || cddb_data==NULL ) return -1; @@ -183,7 +183,7 @@ } delete http_hdr; - url_free( url ); + delete url; return ret; } Modified: mplayerxp/libmpstream/librtsp/rtsp.cpp =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/librtsp/rtsp.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -68,7 +68,7 @@ #define HEADER_SIZE 1024 #define MAX_FIELDS 256 -struct rtsp_s { +struct rtsp_t { Tcp* tcp; Modified: mplayerxp/libmpstream/librtsp/rtsp.h =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/librtsp/rtsp.h 2012-12-11 13:30:51 UTC (rev 537) @@ -45,7 +45,7 @@ #define RTSP_METHOD_TEARDOWN "TEARDOWN" #define RTSP_METHOD_SET_PARAMETER "SET_PARAMETER" -typedef struct rtsp_s rtsp_t; +struct rtsp_t; rtsp_t* rtsp_connect (Tcp& tcp, char *mrl, char *path, char *host, int port, char *user_agent); Modified: mplayerxp/libmpstream/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/librtsp/rtsp_session.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -59,6 +59,7 @@ #include "realrtsp/xbuffer.h" #include "stream_msg.h" +namespace mpxp { /* #define LOG */ @@ -71,22 +72,16 @@ #define RTSP_SERVER_TYPE_HELIX "Helix" #define RTSP_SERVER_TYPE_UNKNOWN "unknown" -struct rtsp_session_s { - rtsp_t *s; - struct real_rtsp_session_t* real_session; - struct rtp_rtsp_session_t* rtp_session; -}; - -//rtsp_session_t *rtsp_session_start(char *mrl) { -rtsp_session_t *rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, +//Rtsp_Session *rtsp_session_start(char *mrl) { +Rtsp_Session *rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, int port, int *redir, uint32_t bandwidth, char *user, char *pass) { - rtsp_session_t *rtsp_session = NULL; + Rtsp_Session *rtsp_session = NULL; char *server; char *mrl_line = NULL; rmff_header_t *h; - rtsp_session = new rtsp_session_t; + rtsp_session = new Rtsp_Session; rtsp_session->s = NULL; rtsp_session->real_session = NULL; rtsp_session->rtp_session = NULL; @@ -219,75 +214,63 @@ return rtsp_session; } -int rtsp_session_read (Tcp& tcp,rtsp_session_t *self, char *data, int len) { +int Rtsp_Session::read(Tcp& tcp,char *data, int len) { - if (self->real_session) { - int to_copy=len; - char *dest=data; - char *source = - (char *) (self->real_session->recv + self->real_session->recv_read); - int fill = self->real_session->recv_size - self->real_session->recv_read; + if (real_session) { + int to_copy=len; + char *dest=data; + char *source = + (char *) (real_session->recv + real_session->recv_read); + int fill = real_session->recv_size - real_session->recv_read; - if(self->real_session->rdteof) - return -1; - if (len < 0) return 0; - if (self->real_session->recv_size < 0) return -1; - while (to_copy > fill) { - - memcpy(dest, source, fill); - to_copy -= fill; - dest += fill; - self->real_session->recv_read = 0; - self->real_session->recv_size = - real_get_rdt_chunk (self->s, (char **)&(self->real_session->recv), self->real_session->rdt_rawdata); - if (self->real_session->recv_size < 0) { - self->real_session->rdteof = 1; - self->real_session->recv_size = 0; - } - source = (char *) self->real_session->recv; - fill = self->real_session->recv_size; - - if (self->real_session->recv_size == 0) { + if(real_session->rdteof) return -1; + if(len < 0) return 0; + if(real_session->recv_size < 0) return -1; + while (to_copy > fill) { + memcpy(dest, source, fill); + to_copy -= fill; + dest += fill; + real_session->recv_read = 0; + real_session->recv_size = + real_get_rdt_chunk (s, (char **)&(real_session->recv), real_session->rdt_rawdata); + if (real_session->recv_size < 0) { + real_session->rdteof = 1; + real_session->recv_size = 0; + } + source = (char *) real_session->recv; + fill = real_session->recv_size; + if (real_session->recv_size == 0) { #ifdef LOG - MSG_INFO("librtsp: %d of %d bytes provided\n", len-to_copy, len); + MSG_INFO("librtsp: %d of %d bytes provided\n", len-to_copy, len); #endif - return len-to_copy; - } - } - - memcpy(dest, source, to_copy); - self->real_session->recv_read += to_copy; - + return len-to_copy; + } + } + memcpy(dest, source, to_copy); + real_session->recv_read += to_copy; #ifdef LOG - MSG_INFO("librtsp: %d bytes provided\n", len); + MSG_INFO("librtsp: %d bytes provided\n", len); #endif + return len; + } else if (rtp_session) { + int l = 0; + Tcp _tcp(tcp.get_libinput(),rtp_session->rtp_socket); - return len; - } - else if (self->rtp_session) - { - int l = 0; - Tcp _tcp(tcp.get_libinput(),self->rtp_session->rtp_socket); - - l = read_rtp_from_server (_tcp, data, len); - /* send RTSP and RTCP keepalive */ - rtcp_send_rr (self->s, self->rtp_session); - - if (l == 0) - rtsp_session_end (self); - - return l; - } - - return 0; + l = read_rtp_from_server (_tcp, data, len); + /* send RTSP and RTCP keepalive */ + rtcp_send_rr (s, rtp_session); + if (l == 0) end (); + return l; + } + return 0; } -void rtsp_session_end(rtsp_session_t *session) { - - rtsp_close(session->s); - if (session->real_session) - free_real_rtsp_session (session->real_session); - if (session->rtp_session) - rtp_session_free (session->rtp_session); - delete session; +void Rtsp_Session::end() { + rtsp_close(s); + if (real_session) free_real_rtsp_session (real_session); + if (rtp_session) rtp_session_free (rtp_session); } + +Rtsp_Session::Rtsp_Session() {} +Rtsp_Session::~Rtsp_Session() {} +} // namespace mpxp \ No newline at end of file Modified: mplayerxp/libmpstream/librtsp/rtsp_session.h =================================================================== --- mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/librtsp/rtsp_session.h 2012-12-11 13:30:51 UTC (rev 537) @@ -1,3 +1,6 @@ +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; /* * This file was ported to MPlayer from xine CVS rtsp_session.h,v 1.4 2003/01/31 14:06:18 */ @@ -31,13 +34,24 @@ #ifndef HAVE_RTSP_SESSION_H #define HAVE_RTSP_SESSION_H -typedef struct rtsp_session_s rtsp_session_t; +struct real_rtsp_session_t; +struct rtp_rtsp_session_t; +struct rtsp_t; +namespace mpxp { + struct Rtsp_Session : public Opaque { + public: + Rtsp_Session(); + virtual ~Rtsp_Session(); -rtsp_session_t *rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, - int port, int *redir, uint32_t bandwidth, char *user, char *pass); + virtual int read(Tcp& tcp,char *data, int len); + virtual void end(); -int rtsp_session_read(Tcp& tcp,rtsp_session_t *session, char *data, int len); + rtsp_t* s; + real_rtsp_session_t* real_session; + rtp_rtsp_session_t* rtp_session; + }; -void rtsp_session_end(rtsp_session_t *session); - + Rtsp_Session* rtsp_session_start(Tcp& tcp, char **mrl, char *path, char *host, + int port, int *redir, uint32_t bandwidth, char *user, char *pass); +} // namespace mpxp #endif Modified: mplayerxp/libmpstream/network.cpp =================================================================== --- mplayerxp/libmpstream/network.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/network.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -111,15 +111,15 @@ void free_networking( networking_t *networking ) { if( networking==NULL ) return; - if( networking->url ) url_free( networking->url ); + if( networking->url ) delete networking->url; if( networking->buffer ) delete networking->buffer ; if( networking->data ) delete networking->data ; delete networking; } -URL_t* -check4proxies( URL_t *url ) { - URL_t *url_out = NULL; +URL* +check4proxies( URL *url ) { + URL *url_out = NULL; if( url==NULL ) return NULL; url_out = url_new( url->url ); if( !strcasecmp(url->protocol, "http_proxy") ) { @@ -134,8 +134,8 @@ // We got a proxy, build the URL to use it int len; char *new_url; - URL_t *tmp_url; - URL_t *proxy_url = url_new( proxy ); + URL *tmp_url; + URL *proxy_url = url_new( proxy ); if( proxy_url==NULL ) { MSG_WARN("Invalid proxy setting...Trying without proxy.\n"); @@ -162,18 +162,18 @@ if( tmp_url==NULL ) { return url_out; } - url_free( url_out ); + delete url_out; url_out = tmp_url; delete new_url ; - url_free( proxy_url ); + delete proxy_url; } } return url_out; } -MPXP_Rc http_send_request(Tcp& tcp, URL_t *url, off_t pos ) { +MPXP_Rc http_send_request(Tcp& tcp, URL *url, off_t pos ) { HTTP_Header& http_hdr = *new(zeromem) HTTP_Header; - URL_t *server_url; + URL *server_url; char str[256]; int ret; int proxy = 0; // Boolean @@ -219,7 +219,7 @@ if( url->port==0 ) url->port = 8080; // Default port for the proxy server tcp.close(); tcp.open(url->hostname, url->port, Tcp::IP4); - url_free( server_url ); + delete server_url; server_url = NULL; } else { if( server_url->port==0 ) server_url->port = 80; // Default port for the web server @@ -240,8 +240,7 @@ return MPXP_Ok; err_out: delete &http_hdr; - if (proxy && server_url) - url_free(server_url); + if (proxy && server_url) delete server_url; return MPXP_False; } @@ -271,7 +270,7 @@ } int -http_authenticate(HTTP_Header& http_hdr, URL_t *url, int *auth_retry) { +http_authenticate(HTTP_Header& http_hdr, URL *url, int *auth_retry) { const char *aut; if( *auth_retry==1 ) { @@ -368,7 +367,7 @@ const char *content_type; const char *next_url; - URL_t *url = networking->url; + URL *url = networking->url; do { next_url = NULL; @@ -400,7 +399,7 @@ http_hdr = http_read_response(tcp); if( http_hdr==NULL ) goto err_out; if( mp_conf.verbose ) http_hdr->debug_hdr(); - networking->data = (any_t*)http_hdr; + networking->data = http_hdr; // Check if we can make partial content requests and thus seek in http-streams if( http_hdr->get_status()==200 ) { @@ -558,7 +557,7 @@ MPXP_Rc nop_networking_start(Tcp& tcp,networking_t* networking ) { HTTP_Header *http_hdr = NULL; const char *next_url=NULL; - URL_t *rd_url=NULL; + URL *rd_url=NULL; MPXP_Rc ret; if( !tcp.established() ) { @@ -645,22 +644,23 @@ int pnm_networking_read(Tcp& tcp, char *buffer, int size, networking_t *stream_ctrl ) { + Pnm& pnm=*static_cast<Pnm*>(stream_ctrl->data); UNUSED(tcp); - return pnm_read(reinterpret_cast<pnm_t*>(stream_ctrl->data), buffer, size); + return pnm.read(buffer, size); } MPXP_Rc pnm_networking_start(Tcp& tcp,networking_t *networking ) { - pnm_t *pnm; + Pnm* pnm = new(zeromem) Pnm(tcp); tcp.open(networking->url->hostname, networking->url->port ? networking->url->port : 7070); if(!tcp.established()) return MPXP_False; - pnm = pnm_connect(tcp,networking->url->file); - if(!pnm) return MPXP_NA; - + if(pnm->connect(networking->url->file)!=MPXP_Ok) { + delete pnm; + return MPXP_NA; + } networking->data=pnm; - networking->networking_read = pnm_networking_read; networking->prebuffer_size = 8*1024; // 8 KBytes networking->buffering = 1; @@ -670,11 +670,12 @@ int realrtsp_networking_read( Tcp& tcp, char *buffer, int size, networking_t *networking ) { - return rtsp_session_read(tcp,reinterpret_cast<rtsp_session_t*>(networking->data), buffer, size); + Rtsp_Session& rtsp=*static_cast<Rtsp_Session*>(networking->data); + return rtsp.read(tcp, buffer, size); } MPXP_Rc realrtsp_networking_start( Tcp& tcp, networking_t *networking ) { - rtsp_session_t *rtsp; + Rtsp_Session* rtsp; char *mrl; char *file; int port; @@ -701,7 +702,7 @@ networking->url->password); if ( redirected == 1 ) { - url_free(networking->url); + delete networking->url; networking->url = url_new(mrl); tcp.close(); } @@ -751,7 +752,7 @@ } #endif -MPXP_Rc networking_start(Tcp& tcp,networking_t* networking, URL_t *url) { +MPXP_Rc networking_start(Tcp& tcp,networking_t* networking, URL *url) { MPXP_Rc rc; networking->url = check4proxies( url ); Modified: mplayerxp/libmpstream/network.h =================================================================== --- mplayerxp/libmpstream/network.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/network.h 2012-12-11 13:30:51 UTC (rev 537) @@ -58,7 +58,7 @@ }; struct networking_t { - URL_t *url; + URL *url; std::string mime; networking_status status; int buffering; // boolean @@ -69,23 +69,23 @@ unsigned int bandwidth; // The downstream available int (*networking_read)( Tcp& fd, char *buffer, int buffer_size, networking_t *stream_ctrl ); int (*networking_seek)( Tcp& fd, off_t pos, networking_t *stream_ctrl ); - any_t*data; + Opaque* data; }; extern void fixup_network_stream_cache(networking_t *s); -extern MPXP_Rc networking_start(Tcp& fd,networking_t *n, URL_t *url); +extern MPXP_Rc networking_start(Tcp& fd,networking_t *n, URL *url); extern int networking_bufferize(networking_t *networking,unsigned char *buffer, int size); extern networking_t *new_networking(); extern void free_networking( networking_t *networking ); -extern URL_t* check4proxies( URL_t *url ); +extern URL* check4proxies( URL* url ); int nop_networking_read(Tcp& fd, char *buffer, int size, networking_t *stream_ctrl ); int nop_networking_seek(Tcp& fd, off_t pos, networking_t *stream_ctrl ); -MPXP_Rc http_send_request(Tcp& tcp,URL_t *url, off_t pos); +MPXP_Rc http_send_request(Tcp& tcp,URL* url, off_t pos); HTTP_Header* http_read_response(Tcp& fd); -int http_authenticate(HTTP_Header& http_hdr, URL_t *url, int *auth_retry); +int http_authenticate(HTTP_Header& http_hdr, URL* url, int *auth_retry); /* * Joey Parrish <jo...@yu...>: Modified: mplayerxp/libmpstream/pnm.cpp =================================================================== --- mplayerxp/libmpstream/pnm.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/pnm.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -50,6 +50,7 @@ #include "tcp.h" #include "pnm.h" +namespace mpxp { #define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ (((long)(unsigned char)(ch3) ) | \ ( (long)(unsigned char)(ch2) << 8 ) | \ @@ -69,28 +70,6 @@ #define LOG */ -#define BUF_SIZE 4096 -#define HEADER_SIZE 4096 - -struct pnm_s { - Tcp* tcp; - char* path; - char buffer[BUF_SIZE]; /* scratch buffer */ - /* receive buffer */ - uint8_t recv[BUF_SIZE]; - int recv_size; - int recv_read; - - uint8_t header[HEADER_SIZE]; - int header_len; - int header_read; - unsigned seq_num[4]; /* two streams with two indices */ - unsigned seq_current[2]; /* seqs of last stream chunk read */ - uint32_t ts_current; /* timestamp of current chunk */ - uint32_t ts_last[2]; /* timestamps of last chunks */ - unsigned packet; /* number of last recieved packet */ -}; - /* * utility macros */ @@ -195,6 +174,9 @@ static void hexdump (char *buf, int length); +Pnm::Pnm(Tcp& _tcp):tcp(_tcp) {} +Pnm::~Pnm() {} + static int rm_write(Tcp& tcp, const char *buf, int len) { int total, timeout; @@ -281,10 +263,9 @@ * and returns number of bytes read */ -static unsigned int pnm_get_chunk(pnm_t *p, - unsigned int max, +unsigned int Pnm::get_chunk(unsigned int max, unsigned int *chunk_type, - char *data, int *need_response) { + char *data, int *need_response) const { unsigned int chunk_size; unsigned int n; @@ -294,11 +275,11 @@ return -1; /* get first PREAMBLE_SIZE bytes and ignore checksum */ - rm_read (*p->tcp, data, CHECKSUM_SIZE); + rm_read (tcp, data, CHECKSUM_SIZE); if (data[0] == 0x72) - rm_read (*p->tcp, data, PREAMBLE_SIZE); + rm_read (tcp, data, PREAMBLE_SIZE); else - rm_read (*p->tcp, data+CHECKSUM_SIZE, PREAMBLE_SIZE-CHECKSUM_SIZE); + rm_read (tcp, data+CHECKSUM_SIZE, PREAMBLE_SIZE-CHECKSUM_SIZE); max -= PREAMBLE_SIZE; @@ -311,7 +292,7 @@ ptr=data+PREAMBLE_SIZE; if (max < 1) return -1; - rm_read (*p->tcp, ptr++, 1); + rm_read (tcp, ptr++, 1); max -= 1; while(1) { @@ -319,19 +300,19 @@ if (max < 2) return -1; - rm_read (*p->tcp, ptr, 2); + rm_read (tcp, ptr, 2); max -= 2; if (*ptr == 'X') /* checking for server message */ { printf("input_pnm: got a message from server:\n"); if (max < 1) return -1; - rm_read (*p->tcp, ptr+2, 1); + rm_read (tcp, ptr+2, 1); max = -1; n=BE_16((uint8_t*)(ptr+1)); if (max < n) return -1; - rm_read (*p->tcp, ptr+3, n); + rm_read (tcp, ptr+3, n); max -= n; ptr[3+n]=0; printf("%s\n",ptr+3); @@ -353,14 +334,14 @@ n=ptr[1]; if (max < n) return -1; - rm_read (*p->tcp, ptr+2, n); + rm_read (tcp, ptr+2, n); max -= n; ptr+=(n+2); } /* the checksum of the next chunk is ignored here */ if (max < 1) return -1; - rm_read (*p->tcp, ptr+2, 1); + rm_read (tcp, ptr+2, 1); ptr+=3; chunk_size=ptr-data; break; @@ -372,12 +353,12 @@ if (chunk_size > max || chunk_size < PREAMBLE_SIZE) { printf("error: max chunk size exeeded (max was 0x%04x)\n", max); #ifdef LOG - n=rm_read (*p->tcp, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE); + n=rm_read (tcp, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE); hexdump(data,n+PREAMBLE_SIZE); #endif return -1; } - rm_read (*p->tcp, &data[PREAMBLE_SIZE], chunk_size-PREAMBLE_SIZE); + rm_read (tcp, &data[PREAMBLE_SIZE], chunk_size-PREAMBLE_SIZE); break; default: *chunk_type = 0; @@ -392,8 +373,8 @@ * writes a chunk to a buffer, returns number of bytes written */ -static int pnm_write_chunk(uint16_t chunk_id, uint16_t length, - const char *chunk, char *data) { +int Pnm::write_chunk(uint16_t chunk_id, uint16_t length, + const char *chunk, char *data) const { data[0]=(chunk_id>>8)%0xff; data[1]=chunk_id%0xff; @@ -408,93 +389,92 @@ * constructs a request and sends it */ -static void pnm_send_request(pnm_t *p, uint32_t bandwidth) { +void Pnm::send_request(uint32_t bandwidth) { UNUSED(bandwidth); uint16_t i16; int c=PNM_HEADER_SIZE; char fixme[]={0,1}; - memcpy(p->buffer,pnm_header,PNM_HEADER_SIZE); - c+=pnm_write_chunk(PNA_CLIENT_CHALLANGE,strlen(pnm_challenge), - pnm_challenge,&p->buffer[c]); - c+=pnm_write_chunk(PNA_CLIENT_CAPS,PNM_CLIENT_CAPS_SIZE, - reinterpret_cast<const char*>(pnm_client_caps),&p->buffer[c]); - c+=pnm_write_chunk(0x0a,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x0c,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x0d,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x16,2,fixme,&p->buffer[c]); - c+=pnm_write_chunk(PNA_TIMESTAMP,strlen(pnm_timestamp), - pnm_timestamp,&p->buffer[c]); - c+=pnm_write_chunk(PNA_BANDWIDTH,4, - (const char *)&pnm_default_bandwidth,&p->buffer[c]); - c+=pnm_write_chunk(0x08,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x0e,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x0f,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x11,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x10,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x15,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(0x12,0,NULL,&p->buffer[c]); - c+=pnm_write_chunk(PNA_GUID,strlen(pnm_guid), - pnm_guid,&p->buffer[c]); - c+=pnm_write_chunk(PNA_TWENTYFOUR,PNM_TWENTYFOUR_SIZE, - reinterpret_cast<char*>(pnm_twentyfour),&p->buffer[c]); + memcpy(buffer,pnm_header,PNM_HEADER_SIZE); + c+=write_chunk(PNA_CLIENT_CHALLANGE,strlen(pnm_challenge), + pnm_challenge,&buffer[c]); + c+=write_chunk(PNA_CLIENT_CAPS,PNM_CLIENT_CAPS_SIZE, + reinterpret_cast<const char*>(pnm_client_caps),&buffer[c]); + c+=write_chunk(0x0a,0,NULL,&buffer[c]); + c+=write_chunk(0x0c,0,NULL,&buffer[c]); + c+=write_chunk(0x0d,0,NULL,&buffer[c]); + c+=write_chunk(0x16,2,fixme,&buffer[c]); + c+=write_chunk(PNA_TIMESTAMP,strlen(pnm_timestamp), + pnm_timestamp,&buffer[c]); + c+=write_chunk(PNA_BANDWIDTH,4, + (const char *)&pnm_default_bandwidth,&buffer[c]); + c+=write_chunk(0x08,0,NULL,&buffer[c]); + c+=write_chunk(0x0e,0,NULL,&buffer[c]); + c+=write_chunk(0x0f,0,NULL,&buffer[c]); + c+=write_chunk(0x11,0,NULL,&buffer[c]); + c+=write_chunk(0x10,0,NULL,&buffer[c]); + c+=write_chunk(0x15,0,NULL,&buffer[c]); + c+=write_chunk(0x12,0,NULL,&buffer[c]); + c+=write_chunk(PNA_GUID,strlen(pnm_guid), + pnm_guid,&buffer[c]); + c+=write_chunk(PNA_TWENTYFOUR,PNM_TWENTYFOUR_SIZE, + reinterpret_cast<char*>(pnm_twentyfour),&buffer[c]); /* data after chunks */ - memcpy(&p->buffer[c],after_chunks,after_chunks_length); + memcpy(&buffer[c],after_chunks,after_chunks_length); c+=after_chunks_length; /* client id string */ - p->buffer[c]=PNA_CLIENT_STRING; + buffer[c]=PNA_CLIENT_STRING; i16=BE_16D((uint8_t*)((strlen(client_string)-1))); /* dont know why do we have -1 here */ - memcpy(&p->buffer[c+1],&i16,2); - memcpy(&p->buffer[c+3],client_string,strlen(client_string)+1); + memcpy(&buffer[c+1],&i16,2); + memcpy(&buffer[c+3],client_string,strlen(client_string)+1); c=c+3+strlen(client_string)+1; /* file path */ - p->buffer[c]=0; - p->buffer[c+1]=PNA_PATH_REQUEST; - i16=BE_16D((uint8_t*)(strlen(p->path))); - memcpy(&p->buffer[c+2],&i16,2); - memcpy(&p->buffer[c+4],p->path,strlen(p->path)); - c=c+4+strlen(p->path); + buffer[c]=0; + buffer[c+1]=PNA_PATH_REQUEST; + i16=BE_16D((uint8_t*)path.length()); + memcpy(&buffer[c+2],&i16,2); + memcpy(&buffer[c+4],path.c_str(),path.length()); + c=c+4+path.length(); /* some trailing bytes */ - p->buffer[c]='y'; - p->buffer[c+1]='B'; + buffer[c]='y'; + buffer[c+1]='B'; - rm_write(*p->tcp,p->buffer,c+2); + rm_write(tcp,buffer,c+2); } /* * pnm_send_response sends a response of a challenge */ -static void pnm_send_response(pnm_t *p, const char *response) { +void Pnm::send_response(const char *response) { int size=strlen(response); - p->buffer[0]=0x23; - p->buffer[1]=0; - p->buffer[2]=(unsigned char) size; + buffer[0]=0x23; + buffer[1]=0; + buffer[2]=(unsigned char) size; - memcpy(&p->buffer[3], response, size); + memcpy(&buffer[3], response, size); - rm_write (*p->tcp, p->buffer, size+3); + rm_write (tcp, buffer, size+3); } /* * get headers and challenge and fix headers - * write headers to p->header - * write challenge to p->buffer + * write headers to header + * write challenge to buffer * * return 0 on error. != 0 on success */ +int Pnm::get_headers(int *need_response) { -static int pnm_get_headers(pnm_t *p, int *need_response) { - uint32_t chunk_type; - char *ptr=reinterpret_cast<char*>(p->header); + char *ptr=reinterpret_cast<char*>(header); uint8_t *prop_hdr=NULL; int chunk_size,size=0; int nr; @@ -503,12 +483,12 @@ *need_response=0; while(1) { - if (HEADER_SIZE-size<=0) + if (Pnm::HEADER_SIZE-size<=0) { printf("input_pnm: header buffer overflow. exiting\n"); return 0; } - chunk_size=pnm_get_chunk(p,HEADER_SIZE-size,&chunk_type,ptr,&nr); + chunk_size=get_chunk(Pnm::HEADER_SIZE-size,&chunk_type,ptr,&nr); if (chunk_size < 0) return 0; if (chunk_type == 0) break; if (chunk_type == PNA_TAG) @@ -541,19 +521,19 @@ size++; /* read challenge */ - memcpy (p->buffer, ptr, PREAMBLE_SIZE); - rm_read (*p->tcp, &p->buffer[PREAMBLE_SIZE], 64); + memcpy (buffer, ptr, PREAMBLE_SIZE); + rm_read (tcp, &buffer[PREAMBLE_SIZE], 64); /* now write a data header */ memcpy(ptr, pnm_data_header, PNM_DATA_HEADER_SIZE); size+=PNM_DATA_HEADER_SIZE; /* - h=rmff_scan_header(p->header); + h=rmff_scan_header(header); rmff_fix_header(h); - p->header_len=rmff_get_header_size(h); - rmff_dump_header(h, p->header, HEADER_SIZE); + header_len=rmff_get_header_size(h); + rmff_dump_header(h, header, HEADER_SIZE); */ - p->header_len=size; + header_len=size; return 1; } @@ -562,61 +542,61 @@ * determine correct stream number by looking at indices */ -static int pnm_calc_stream(pnm_t *p) { +int Pnm::calc_stream() { char str0=0,str1=0; /* looking at the first index to * find possible stream types */ - if (p->seq_current[0]==p->seq_num[0]) str0=1; - if (p->seq_current[0]==p->seq_num[2]) str1=1; + if (seq_current[0]==seq_num[0]) str0=1; + if (seq_current[0]==seq_num[2]) str1=1; switch (str0+str1) { case 1: /* one is possible, good. */ if (str0) { - p->seq_num[0]++; - p->seq_num[1]=p->seq_current[1]+1; + seq_num[0]++; + seq_num[1]=seq_current[1]+1; return 0; } else { - p->seq_num[2]++; - p->seq_num[3]=p->seq_current[1]+1; + seq_num[2]++; + seq_num[3]=seq_current[1]+1; return 1; } break; case 0: case 2: /* both types or none possible, not so good */ /* try to figure out by second index */ - if ( (p->seq_current[1] == p->seq_num[1]) - &&(p->seq_current[1] != p->seq_num[3])) + if ( (seq_current[1] == seq_num[1]) + &&(seq_current[1] != seq_num[3])) { /* ok, only stream0 matches */ - p->seq_num[0]=p->seq_current[0]+1; - p->seq_num[1]++; + seq_num[0]=seq_current[0]+1; + seq_num[1]++; return 0; } - if ( (p->seq_current[1] == p->seq_num[3]) - &&(p->seq_current[1] != p->seq_num[1])) + if ( (seq_current[1] == seq_num[3]) + &&(seq_current[1] != seq_num[1])) { /* ok, only stream1 matches */ - p->seq_num[2]=p->seq_current[0]+1; - p->seq_num[3]++; + seq_num[2]=seq_current[0]+1; + seq_num[3]++; return 1; } /* wow, both streams match, or not. */ /* now we try to decide by timestamps */ - if (p->ts_current < p->ts_last[1]) + if (ts_current < ts_last[1]) return 0; - if (p->ts_current < p->ts_last[0]) + if (ts_current < ts_last[0]) return 1; /* does not help, we guess type 0 */ #ifdef LOG printf("guessing stream# 0\n"); #endif - p->seq_num[0]=p->seq_current[0]+1; - p->seq_num[1]=p->seq_current[1]+1; + seq_num[0]=seq_current[0]+1; + seq_num[1]=seq_current[1]+1; return 0; break; } @@ -628,7 +608,7 @@ * gets a stream chunk and writes it to a recieve buffer */ -static int pnm_get_stream_chunk(pnm_t *p) { +int Pnm::get_stream_chunk() { int n; char keepalive='!'; @@ -636,9 +616,9 @@ /* send a keepalive */ /* realplayer seems to do that every 43th package */ - if ((p->packet%43) == 42) + if ((packet%43) == 42) { - rm_write(*p->tcp,&keepalive,1); + rm_write(tcp,&keepalive,1); } /* data chunks begin with: 'Z' <o> <o> <i1> 'Z' <i2> @@ -647,13 +627,13 @@ * <i2> is a 8 bit index which counts from 0x10 to somewhere */ - n = rm_read (*p->tcp, p->buffer, 8); + n = rm_read (tcp, buffer, 8); if (n<8) return 0; /* skip 8 bytes if 0x62 is read */ - if (p->buffer[0] == 0x62) + if (buffer[0] == 0x62) { - n = rm_read (*p->tcp, p->buffer, 8); + n = rm_read (tcp, buffer, 8); if (n<8) return 0; #ifdef LOG printf("input_pnm: had to seek 8 bytes on 0x62\n"); @@ -661,16 +641,16 @@ } /* a server message */ - if (p->buffer[0] == 'X') + if (buffer[0] == 'X') { - int size=BE_16((uint8_t*)(&p->buffer[1])); + int size=BE_16((uint8_t*)(&buffer[1])); - rm_read (*p->tcp, &p->buffer[8], size-5); - p->buffer[size+3]=0; - printf("input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]); + rm_read (tcp, &buffer[8], size-5); + buffer[size+3]=0; + printf("input_pnm: got message from server while reading stream:\n%s\n", &buffer[3]); return 0; } - if (p->buffer[0] == 'F') + if (buffer[0] == 'F') { printf("input_pnm: server error.\n"); return 0; @@ -681,12 +661,12 @@ * keepalives */ n=0; - while (p->buffer[0] != 0x5a) { + while (buffer[0] != 0x5a) { int i; for (i=1; i<8; i++) { - p->buffer[i-1]=p->buffer[i]; + buffer[i-1]=buffer[i]; } - rm_read (*p->tcp, &p->buffer[7], 1); + rm_read (tcp, &buffer[7], 1); n++; } @@ -695,16 +675,16 @@ #endif /* check for 'Z's */ - if ((p->buffer[0] != 0x5a)||(p->buffer[7] != 0x5a)) + if ((buffer[0] != 0x5a)||(buffer[7] != 0x5a)) { printf("input_pnm: bad boundaries\n"); - hexdump(p->buffer, 8); + hexdump(buffer, 8); return 0; } /* check offsets */ - fof1=BE_16((uint8_t*)(&p->buffer[1])); - fof2=BE_16((uint8_t*)(&p->buffer[3])); + fof1=BE_16((uint8_t*)(&buffer[1])); + fof2=BE_16((uint8_t*)(&buffer[3])); if (fof1 != fof2) { printf("input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2); @@ -712,121 +692,110 @@ } /* get first index */ - p->seq_current[0]=BE_16((uint8_t*)(&p->buffer[5])); + seq_current[0]=BE_16((uint8_t*)(&buffer[5])); /* now read the rest of stream chunk */ - n = rm_read (*p->tcp, &p->recv[5], fof1-5); + n = rm_read (tcp, &recv[5], fof1-5); if (n<(fof1-5)) return 0; /* get second index */ - p->seq_current[1]=p->recv[5]; + seq_current[1]=recv[5]; /* get timestamp */ - p->ts_current=BE_32(&p->recv[6]); + ts_current=BE_32(&recv[6]); /* get stream number */ - stream=pnm_calc_stream(p); + stream=calc_stream(); /* saving timestamp */ - p->ts_last[stream]=p->ts_current; + ts_last[stream]=ts_current; /* constructing a data packet header */ - p->recv[0]=0; /* object version */ - p->recv[1]=0; + recv[0]=0; /* object version */ + recv[1]=0; fof2=BE_16((uint8_t*)(&fof2)); - memcpy(&p->recv[2], &fof2, 2); - /*p->recv[2]=(fof2>>8)%0xff;*/ /* length */ - /*p->recv[3]=(fof2)%0xff;*/ + memcpy(&recv[2], &fof2, 2); + /*recv[2]=(fof2>>8)%0xff;*/ /* length */ + /*recv[3]=(fof2)%0xff;*/ - p->recv[4]=0; /* stream number */ - p->recv[5]=stream; + recv[4]=0; /* stream number */ + recv[5]=stream; - p->recv[10]=p->recv[10] & 0xfe; /* streambox seems to do that... */ + recv[10]=recv[10] & 0xfe; /* streambox seems to do that... */ - p->packet++; + packet++; - p->recv_size=fof1; + recv_size=fof1; return fof1; } -// pnm_t *pnm_connect(const char *mrl) { -pnm_t *pnm_connect(Tcp& tcp,const char *path) { +// Pnm *pnm_connect(const char *mrl) { +MPXP_Rc Pnm::connect(const std::string& _path) { - pnm_t *p=new(zeromem) pnm_t; int need_response=0; - p->path=mp_strdup(path); - p->tcp=&tcp; + path=_path; - pnm_send_request(p,pnm_available_bandwidths[10]); - if (!pnm_get_headers(p, &need_response)) { + send_request(pnm_available_bandwidths[10]); + if (!get_headers(&need_response)) { printf ("input_pnm: failed to set up stream\n"); - delete p->path; - delete p; - return NULL; + return MPXP_False; } - if (need_response) pnm_send_response(p, pnm_response); - p->ts_last[0]=0; - p->ts_last[1]=0; + if (need_response) send_response(pnm_response); + ts_last[0]=0; + ts_last[1]=0; /* copy header to recv */ - memcpy(p->recv, p->header, p->header_len); - p->recv_size = p->header_len; - p->recv_read = 0; + memcpy(recv, header, header_len); + recv_size = header_len; + recv_read = 0; - return p; + return MPXP_Ok; } -int pnm_read (pnm_t *self, char *data, int len) { +int Pnm::read (char *data, int len) { - int to_copy=len; - char *dest=data; - char *source=reinterpret_cast<char*>(self->recv) + self->recv_read; - int fill=self->recv_size - self->recv_read; + int to_copy=len; + char *dest=data; + char *source=reinterpret_cast<char*>(recv) + recv_read; + int fill=recv_size - recv_read; - if (len < 0) return 0; - while (to_copy > fill) { + if (len < 0) return 0; + while (to_copy > fill) { - memcpy(dest, source, fill); - to_copy -= fill; - dest += fill; - self->recv_read=0; + memcpy(dest, source, fill); + to_copy -= fill; + dest += fill; + recv_read=0; - if (!pnm_get_stream_chunk (self)) { + if (!get_stream_chunk ()) { #ifdef LOG - printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len); + printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len); #endif - return len-to_copy; + return len-to_copy; + } + source = reinterpret_cast<char*>(recv); + fill = recv_size - recv_read; } - source = reinterpret_cast<char*>(self->recv); - fill = self->recv_size - self->recv_read; - } - - memcpy(dest, source, to_copy); - self->recv_read += to_copy; - + memcpy(dest, source, to_copy); + recv_read += to_copy; #ifdef LOG - printf ("input_pnm: %d bytes provided\n", len); + printf ("input_pnm: %d bytes provided\n", len); #endif - - return len; + return len; } -int pnm_peek_header (pnm_t *self, char *data) { +int Pnm::peek_header (char *data) const { - memcpy (data, self->header, self->header_len); - return self->header_len; + memcpy (data, header, header_len); + return header_len; } -void pnm_close(pnm_t *p) { - - if (p->tcp->established()) p->tcp->close(); - delete p->path; - delete p->tcp; - delete p; +void Pnm::close() { + if (tcp.established()) tcp.close(); } - +} // namespace mpxp Modified: mplayerxp/libmpstream/pnm.h =================================================================== --- mplayerxp/libmpstream/pnm.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/pnm.h 2012-12-11 13:30:51 UTC (rev 537) @@ -25,22 +25,55 @@ #ifndef HAVE_PNM_H #define HAVE_PNM_H +#include <string> #ifndef __CYGWIN__ #include <inttypes.h> #endif /*#include "xine_internal.h" */ -typedef struct pnm_s pnm_t; namespace mpxp { class Tcp; -} -pnm_t* pnm_connect (Tcp&,const char *url); + class Pnm : public Opaque { + public: + Pnm(Tcp& tcp); + virtual ~Pnm(); -int pnm_read (pnm_t *self, char *data, int len); -void pnm_close (pnm_t *self); + enum sizes { + BUF_SIZE=4096, + HEADER_SIZE=4096 + }; -int pnm_peek_header (pnm_t *self, char *data); + virtual MPXP_Rc connect(const std::string& path); + virtual int read (char *data, int len); + virtual void close (); + virtual int peek_header(char *data) const; + private: + unsigned int get_chunk(unsigned int max, unsigned int *chunk_type,char *data, int *need_response) const; + int write_chunk(uint16_t chunk_id, uint16_t length, const char *chunk, char *data) const; + void send_request(uint32_t bandwidth); + void send_response(const char *response); + int get_headers(int *need_response); + int calc_stream(); + int get_stream_chunk(); + Tcp& tcp; + std::string path; + char buffer[Pnm::BUF_SIZE]; /* scratch buffer */ + /* receive buffer */ + uint8_t recv[Pnm::BUF_SIZE]; + int recv_size; + int recv_read; + + uint8_t header[Pnm::HEADER_SIZE]; + int header_len; + int header_read; + unsigned seq_num[4]; /* two streams with two indices */ + unsigned seq_current[2]; /* seqs of last stream chunk read */ + uint32_t ts_current; /* timestamp of current chunk */ + uint32_t ts_last[2]; /* timestamps of last chunks */ + unsigned packet; /* number of last recieved packet */ + }; +} // namespace mpxp #endif Modified: mplayerxp/libmpstream/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream/s_ftp.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/s_ftp.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -52,7 +52,7 @@ const char* host; int port; const char* filename; - URL_t* url; + URL* url; char* cput,*cget; Tcp tcp; @@ -341,14 +341,14 @@ tcp.open(host,port); if(!tcp.established()) { - url_free(url); + delete url; return MPXP_False; } // We got a connection, let's start serious things buf = new char [BUFSIZE]; if (readresp(NULL) == 0) { close(); - url_free(url); + delete url; return MPXP_False; } // Login @@ -361,13 +361,13 @@ if(resp != 2) { MSG_ERR("[ftp] command '%s' failed: %s\n",str,rsp_txt); close(); - url_free(url); + delete url; return MPXP_False; } } else if(resp != 2) { MSG_ERR("[ftp] command '%s' failed: %s\n",str,rsp_txt); close(); - url_free(url); + delete url; return MPXP_False; } @@ -376,7 +376,7 @@ if(resp != 2) { MSG_ERR("[ftp] command 'TYPE I' failed: %s\n",rsp_txt); close(); - url_free(url); + delete url; return MPXP_False; } @@ -385,7 +385,7 @@ if(resp != 2) { MSG_ERR("[ftp] command 'SYST' failed: %s\n",rsp_txt); close(); - url_free(url); + delete url; return MPXP_False; } MSG_INFO("[ftp] System: %s\n",rsp_txt); @@ -393,7 +393,7 @@ if(resp != 2) { MSG_ERR("[ftp] command 'STAT' failed: %s\n",rsp_txt); close(); - url_free(url); + delete url; return MPXP_False; } @@ -414,7 +414,7 @@ // because the connection would stay open in the main process, // preventing correct abort with many servers. - url_free(url); + delete url; return MPXP_Ok; } Stream::type_e Ftp_Stream_Interface::type() const { return file_len?Stream::Type_Seekable:Stream::Type_Stream; } Modified: mplayerxp/libmpstream/s_network.cpp =================================================================== --- mplayerxp/libmpstream/s_network.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/s_network.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -37,7 +37,7 @@ virtual off_t sector_size() const; virtual std::string mime_type() const; private: - URL_t* url; + URL* url; off_t spos; Tcp tcp; networking_t* networking; @@ -47,10 +47,7 @@ :Stream_Interface(libinput), tcp(libinput,-1) {} Network_Stream_Interface::~Network_Stream_Interface() { - if(url) { - url_free(url); - delete url; - } + if(url) delete url; } MPXP_Rc Network_Stream_Interface::open(const std::string& filename,unsigned flags) @@ -61,7 +58,7 @@ networking=new_networking(); if(networking_start(tcp,networking,url)!=MPXP_Ok){ MSG_ERR(MSGTR_UnableOpenURL, filename.c_str()); - url_free(url); + delete url; url=NULL; free_networking(networking); networking=NULL; Modified: mplayerxp/libmpstream/s_rtsp.cpp =================================================================== --- mplayerxp/libmpstream/s_rtsp.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/s_rtsp.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -58,7 +58,8 @@ int Rtsp_Stream_Interface::read(stream_packet_t*sp) { - return rtsp_session_read (tcp,reinterpret_cast<rtsp_session_t*>(networking->data), sp->buf, sp->len); + Rtsp_Session& rtsp = *static_cast<Rtsp_Session*>(networking->data); + return rtsp.read (tcp, sp->buf, sp->len); } off_t Rtsp_Stream_Interface::seek(off_t newpos) { return newpos; } @@ -73,19 +74,16 @@ void Rtsp_Stream_Interface::close() { - rtsp_session_t *rtsp = NULL; - - rtsp = reinterpret_cast<rtsp_session_t*>(networking->data); - if (rtsp) - rtsp_session_end (rtsp); - url_free(networking->url); + Rtsp_Session* rtsp = static_cast<Rtsp_Session*>(networking->data); + if (rtsp) rtsp->end (); + delete networking->url; free_networking(networking); networking=NULL; } MPXP_Rc Rtsp_Stream_Interface::start() { - rtsp_session_t *rtsp; + Rtsp_Session *rtsp; char *mrl; char *file; int port; @@ -119,7 +117,7 @@ networking->url->username, networking->url->password); if (redirected == 1) { - url_free (networking->url); + delete networking->url; networking->url = url_new (mrl); tcp.close(); } @@ -141,7 +139,7 @@ extern int index_mode; MPXP_Rc Rtsp_Stream_Interface::open(const std::string& filename,unsigned flags) { - URL_t *url; + URL *url; UNUSED(flags); if(filename.substr(0,7)!="rtsp://") return MPXP_False; Modified: mplayerxp/libmpstream/s_udp.cpp =================================================================== --- mplayerxp/libmpstream/s_udp.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/s_udp.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -72,7 +72,6 @@ void Udp_Stream_Interface::close() { - url_free(networking->url); free_networking(networking); networking=NULL; } @@ -94,7 +93,7 @@ MPXP_Rc Udp_Stream_Interface::open(const std::string& filename,unsigned flags) { - URL_t *url; + URL *url; UNUSED(flags); MSG_V("STREAM_UDP, URL: %s\n", filename.c_str()); networking = new_networking(); Modified: mplayerxp/libmpstream/udp.cpp =================================================================== --- mplayerxp/libmpstream/udp.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/udp.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -45,7 +45,7 @@ namespace mpxp { /* Start listening on a UDP port. If multicast, join the group. */ -void Udp::open(const URL_t *url,int reuse_socket) +void Udp::open(const URL *url,int reuse_socket) { int socket_server_fd, rxsockbufsz; int err; @@ -175,7 +175,7 @@ return; } } -Udp::Udp(const URL_t *url,int reuse_socket) +Udp::Udp(const URL *url,int reuse_socket) :_fd(-1) ,_error(0) { Modified: mplayerxp/libmpstream/udp.h =================================================================== --- mplayerxp/libmpstream/udp.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/udp.h 2012-12-11 13:30:51 UTC (rev 537) @@ -25,10 +25,10 @@ class Udp { public: Udp(net_fd_t fd); - Udp(const URL_t* url,int reuse_socket=0); + Udp(const URL* url,int reuse_socket=0); virtual ~Udp(); - void open(const URL_t* url,int reuse_socket=0); + void open(const URL* url,int reuse_socket=0); net_fd_t socket() const { return _fd; } int established() const; int error() const { return _error; } Modified: mplayerxp/libmpstream/url.cpp =================================================================== --- mplayerxp/libmpstream/url.cpp 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/url.cpp 2012-12-11 13:30:51 UTC (rev 537) @@ -21,33 +21,33 @@ #include "mplayerxp.h" namespace mpxp { -URL_t *url_redirect(URL_t **url, const char *redir) { - URL_t *u = *url; - URL_t *res; - if (!strchr(redir, '/') || *redir == '/') { +URL *url_redirect(URL **url, const std::string& _redir) { + std::string redir=_redir; + URL *u = *url; + URL *res; + if (redir.find('/')==std::string::npos || redir[0] == '/') { char *tmp; - char *newurl = new char [strlen(u->url) + strlen(redir) + 1]; - strcpy(newurl, u->url); - if (*redir == '/') { - redir++; - tmp = strstr(newurl, "://"); + std::string newurl; + newurl=u->url; + if (redir[0] == '/') { + redir=redir.substr(1); + tmp = strstr(const_cast<char*>(newurl.c_str()), "://"); if (tmp) tmp = strchr(tmp + 3, '/'); } else - tmp = strrchr(newurl, '/'); + tmp = strrchr(const_cast<char*>(newurl.c_str()), '/'); if (tmp) tmp[1] = 0; - strcat(newurl, redir); + newurl+=redir; res = url_new(newurl); - delete newurl; } else res = url_new(redir); - url_free(u); + delete u; *url = res; return res; } -URL_t* url_new(const std::string& url) { +URL* url_new(const std::string& url) { int pos1, pos2,v6addr = 0; - URL_t* Curl = NULL; + URL* Curl = NULL; char *escfilename=NULL; char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL; int jumpSize = 3; @@ -65,15 +65,12 @@ } // Create the URL container - Curl = new(zeromem) URL_t; + Curl = new(zeromem) URL; if( Curl==NULL ) { MSG_FATAL("MemAllocFailed\n"); goto err_out; } - // Initialisation of the URL container members - memset( Curl, 0, sizeof(URL_t) ); - string2url(escfilename,url); // Copy the url in the URL container @@ -220,23 +217,20 @@ return Curl; err_out: if (escfilename) delete escfilename; - if (Curl) url_free(Curl); + if (Curl) delete Curl; return NULL; } -void -url_free(URL_t* url) { - if(!url) return; - if(url->url) delete url->url; - if(url->protocol) delete url->protocol; - if(url->hostname) delete url->hostname; - if(url->file) delete url->file; - if(url->username) delete url->username; - if(url->password) delete url->password; - delete url; +URL::URL() {} +URL::~URL() { + if(url) delete url; + if(protocol) delete protocol; + if(hostname) delete hostname; + if(file) delete file; + if(username) delete username; + if(password) delete password; } - /* Replace escape sequences in an URL (or a part of an URL) */ /* works like strcpy(), but without return argument */ void @@ -373,7 +367,7 @@ #ifdef __URL_DEBUG void -url_debug(const URL_t *url) { +url_debug(const URL *url) { if( url==NULL ) { printf("URL pointer NULL\n"); return; Modified: mplayerxp/libmpstream/url.h =================================================================== --- mplayerxp/libmpstream/url.h 2012-12-11 11:31:23 UTC (rev 536) +++ mplayerxp/libmpstream/url.h 2012-12-11 13:30:51 UTC (rev 537) @@ -10,25 +10,28 @@ //#define __URL_DEBUG namespace mpxp { - typedef struct { - char *url; - char *protocol; - char *hostname; - char *file; - unsigned int port; - char *username; - char *password; - } URL_t; + struct URL : public Opaque { + public: + URL(); + virtual ~URL(); - URL_t* url_new(const std::string& url); - void url_free(URL_t* url); + const char* url; + char* protocol; + char* hostname; + char* file; + unsigned int port; + char* username; + char* password; + }; - URL_t *url_redirect(URL_t **url, const char *redir); + URL* url_new(const std::string& url); + + URL *url_redirect(URL **url, const std::string& redir); void url2string(char *outbuf, const std::string& inbuf); void string2url(char *outbuf, const std::string& inbuf); #ifdef __URL_DEBUG - void url_debug(URL_t* url); + void url_debug(URL* url); #endif // __URL_DEBUG } // namespace #endif // __URL_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-11 11:31:35
|
Revision: 536 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=536&view=rev Author: nickols_k Date: 2012-12-11 11:31:23 +0000 (Tue, 11 Dec 2012) Log Message: ----------- simplify logic of HTTP_Header: use std::vector<std::string> instead of HTTP_field_t + move variables into private Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/http.cpp mplayerxp/libmpstream/http.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/tcp.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/Makefile 2012-12-11 11:31:23 UTC (rev 536) @@ -68,7 +68,7 @@ $(DO_MAKE_ALL) $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common -$(SRCS): dep +$(SRCS): .depend install: $(TARGET_EXE) ifeq ($(INSTALL),) @@ -103,7 +103,7 @@ -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h -rm -f cpuinfo help_mp.h -dep: version.h +.depend: $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-11 11:31:23 UTC (rev 536) @@ -502,15 +502,15 @@ static int asf_header_check( HTTP_Header& http_hdr ) { ASF_obj_header_t *objh; - if( http_hdr.body==NULL || http_hdr.body_size<sizeof(ASF_obj_header_t) ) return -1; + if( http_hdr.get_body()==NULL || http_hdr.get_body_size()<sizeof(ASF_obj_header_t) ) return -1; - objh = (ASF_obj_header_t*)http_hdr.body; + objh = (ASF_obj_header_t*)http_hdr.get_body(); if( ASF_LOAD_GUID_PREFIX(objh->guid)==0x75B22630 ) return 0; return -1; } static ASF_StreamType_e -asf_http_networking_type(char *content_type, char *features, HTTP_Header& http_hdr ) { +asf_http_networking_type(const char *content_type,const char *features, HTTP_Header& http_hdr ) { if( content_type==NULL ) return ASF_Unknown_e; if( !strcasecmp(content_type, "application/octet-stream") || !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request @@ -529,7 +529,7 @@ // so we could used mime type to know the stream type, // but guess what? All of them are not well configured. // So we have to check for an asf header :(, but it works :p - if( http_hdr.body_size>sizeof(ASF_obj_header_t) ) { + if( http_hdr.get_body_size()>sizeof(ASF_obj_header_t) ) { if( asf_header_check( http_hdr )==0 ) { MSG_V("=====> ASF Plain text\n"); return ASF_PlainText_e; @@ -661,20 +661,20 @@ static int asf_http_parse_response(asf_http_networking_t *asf_http_ctrl, HTTP_Header& http_hdr ) { - char *content_type, *pragma; + const char *content_type, *pragma; char features[64] = "\0"; size_t len; if( http_hdr.response_parse()<0 ) { MSG_ERR("Failed to parse HTTP response\n"); return -1; } - switch( http_hdr.status_code ) { + switch( http_hdr.get_status()) { case 200: break; case 401: // Authentication required return ASF_Authenticate_e; default: - MSG_ERR("Server return %d:%s\n", http_hdr.status_code, http_hdr.get_reason_phrase()); + MSG_ERR("Server return %d:%s\n", http_hdr.get_status(), http_hdr.get_reason_phrase()); return -1; } @@ -682,8 +682,8 @@ pragma = http_hdr.get_field("Pragma"); while( pragma!=NULL ) { - char *comma_ptr=NULL; - char *end; + const char *comma_ptr=NULL; + const char *end; // The pragma line can get severals attributes // separeted with a comma ','. do { @@ -750,9 +750,9 @@ if( !tcp.established()) return MPXP_False; http_hdr = asf_http_request( networking ); - MSG_DBG2("Request [%s]\n", http_hdr->buffer ); - for(i=0; i < (int)http_hdr->buffer_size ; ) { - int r = tcp.write((uint8_t*)(http_hdr->buffer+i), http_hdr->buffer_size-i); + MSG_DBG2("Request [%s]\n", http_hdr->get_buffer() ); + for(i=0; i < (int)http_hdr->get_buffer_size() ; ) { + int r = tcp.write((uint8_t*)(http_hdr->get_buffer()+i), http_hdr->get_buffer_size()-i); if(r<0) { MSG_ERR("Socket write error : %s\n",strerror(errno)); return MPXP_False; @@ -771,8 +771,7 @@ http_hdr->response_append(buffer,i); } while( !http_hdr->is_header_entire()); if( mp_conf.verbose>0 ) { - http_hdr->buffer[http_hdr->buffer_size]='\0'; - MSG_DBG2("Response [%s]\n", http_hdr->buffer ); + MSG_DBG2("Response [%s]\n", http_hdr->get_buffer() ); } ret = asf_http_parse_response(asf_http_ctrl, *http_hdr); if( ret<0 ) { @@ -784,8 +783,8 @@ case ASF_Live_e: case ASF_Prerecorded_e: case ASF_PlainText_e: - if( http_hdr->body_size>0 ) { - if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { + if( http_hdr->get_body_size()>0 ) { + if( networking_bufferize( networking, (unsigned char *)(http_hdr->get_body()), http_hdr->get_body_size())<0 ) { delete http_hdr; return MPXP_False; } @@ -805,8 +804,8 @@ } break; case ASF_Redirector_e: - if( http_hdr->body_size>0 ) { - if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { + if( http_hdr->get_body_size()>0 ) { + if( networking_bufferize( networking, (unsigned char*)http_hdr->get_body(), http_hdr->get_body_size())<0 ) { delete http_hdr; return MPXP_False; } Modified: mplayerxp/libmpstream/cddb.cpp =================================================================== --- mplayerxp/libmpstream/cddb.cpp 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/cddb.cpp 2012-12-11 11:31:23 UTC (rev 536) @@ -171,7 +171,7 @@ http_hdr->debug_hdr(); - switch(http_hdr->status_code) { + switch(http_hdr->get_status()) { case 200: ret = reply_parser(*http_hdr, cddb_data); break; @@ -271,7 +271,7 @@ if( cddb_data==NULL ) return -1; - ret = sscanf((char*)http_hdr.body, "%d ", &status); + ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; @@ -279,13 +279,13 @@ switch(status) { case 210: - ret = sscanf((char*)http_hdr.body, "%d %s %08lx", &status, category, &disc_id); + ret = sscanf(http_hdr.get_body(), "%d %s %08lx", &status, category, &disc_id); if( ret!=3 ) { MSG_ERR("Parse error\n"); return -1; } // Check if it's a xmcd database file - ptr = strstr((char*)http_hdr.body, "# xmcd"); + ptr = strstr(const_cast<char*>(http_hdr.get_body()), "# xmcd"); if( ptr==NULL ) { MSG_ERR("Invalid xmcd database file returned\n"); return -1; @@ -302,7 +302,7 @@ } // Ok found the end // do a sanity check - if( http_hdr.body_size<(unsigned long)(ptr2-ptr) ) { + if( http_hdr.get_body_size()<(unsigned long)(ptr2-ptr) ) { MSG_ERR("Unexpected fix me\n"); return -1; } @@ -310,8 +310,7 @@ cddb_data->xmcd_file_size = ptr2-ptr+2; cddb_data->xmcd_file[cddb_data->xmcd_file_size] = '\0'; // Avoid the http_free function to mp_free the xmcd file...save a mempcy... - http_hdr.body = NULL; - http_hdr.body_size = 0; + http_hdr.erase_body(); return cddb_write_cache(cddb_data); default: MSG_ERR("Unhandled code\n"); @@ -330,7 +329,7 @@ char *ptr = NULL; int ret, status; - ret = sscanf((char*)http_hdr.body, "%d ", &status); + ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; @@ -339,18 +338,18 @@ switch(status) { case 200: // Found exact match - ret = sscanf((char*)http_hdr.body, "%d %s %08lx %s", &status, cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); + ret = sscanf(http_hdr.get_body(), "%d %s %08lx %s", &status, cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); if( ret!=4 ) { MSG_ERR("Parse error\n"); return -1; } - ptr = strstr((char*)http_hdr.body, album_title); + ptr = strstr(const_cast<char*>(http_hdr.get_body()), album_title); if( ptr!=NULL ) { char *ptr2; int len; ptr2 = strstr(ptr, "\n"); if( ptr2==NULL ) { - len = (http_hdr.body_size)-(ptr-(char*)(http_hdr.body)); + len = http_hdr.get_body_size()-(ptr-http_hdr.get_body()); } else { len = ptr2-ptr+1; } @@ -365,7 +364,7 @@ break; case 210: // Found exact matches, list follows - ptr = strstr((char*)http_hdr.body, "\n"); + ptr = strstr(const_cast<char*>(http_hdr.get_body()), "\n"); if( ptr==NULL ) { MSG_ERR("Unable to find end of line\n"); return -1; @@ -378,13 +377,13 @@ MSG_ERR("Parse error\n"); return -1; } - ptr = strstr((char*)http_hdr.body, album_title); + ptr = strstr(const_cast<char*>(http_hdr.get_body()), album_title); if( ptr!=NULL ) { char *ptr2; int len; ptr2 = strstr(ptr, "\n"); if( ptr2==NULL ) { - len = (http_hdr.body_size)-(ptr-(char*)(http_hdr.body)); + len = (http_hdr.get_body_size())-(ptr-http_hdr.get_body()); } else { len = ptr2-ptr+1; } @@ -415,7 +414,7 @@ int ret, status; char *ptr; - ret = sscanf((char*)http_hdr.body, "%d ", &status); + ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; @@ -423,7 +422,7 @@ switch(status) { case 210: - ptr = strstr((char*)http_hdr.body, "max proto:"); + ptr = strstr(const_cast<char*>(http_hdr.get_body()), "max proto:"); if( ptr==NULL ) { MSG_ERR("Parse error\n"); return -1; @@ -448,7 +447,7 @@ static int cddb_freedb_sites_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { int ret, status; UNUSED(cddb_data); - ret = sscanf((char*)http_hdr.body, "%d ", &status); + ret = sscanf((const char*)http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; Modified: mplayerxp/libmpstream/http.cpp =================================================================== --- mplayerxp/libmpstream/http.cpp 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/http.cpp 2012-12-11 11:31:23 UTC (rev 536) @@ -6,6 +6,8 @@ * by Bertrand Baudet <ber...@ya...> * (C) 2001, MPlayer team. */ +#include <algorithm> +#include <ctype.h> #include <limits> #include <stdio.h> @@ -19,20 +21,8 @@ namespace mpxp { HTTP_Header::HTTP_Header() {} HTTP_Header::~HTTP_Header() { - HTTP_field_t *field, *field2free; - if( protocol!=NULL ) delete protocol ; - if( uri!=NULL ) delete uri ; if( reason_phrase!=NULL ) delete reason_phrase ; - if( field_search!=NULL ) delete field_search ; - if( method!=NULL ) delete method ; if( buffer!=NULL ) delete buffer ; - field = first_field; - while( field!=NULL ) { - field2free = field; - if (field->field_name) delete field->field_name; - field = field->next; - delete field2free; - } } int HTTP_Header::response_append(const char *response, int length ) { @@ -75,15 +65,11 @@ return -1; } len = hdr_ptr-buffer; - protocol = new char [len+1]; - if( protocol==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - strncpy( protocol, buffer, len ); - protocol[len]='\0'; - if( !strncasecmp( protocol, "HTTP", 4) ) { - if( sscanf( protocol+5,"1.%d", &(http_minor_version) )!=1 ) { + protocol.assign(buffer,len); + std::string sstr=protocol.substr(0,4); + std::transform(sstr.begin(), sstr.end(),sstr.begin(), ::toupper); + if(sstr=="HTTP") { + if( sscanf( &protocol.c_str()[5],"1.%d", &(http_minor_version) )!=1 ) { MSG_FATAL("Malformed answer. Unable to get HTTP minor version.\n"); return -1; } @@ -149,7 +135,7 @@ if( pos_hdr_sep+hdr_sep_len<buffer_size ) { // Response has data! - body = (unsigned char*)buffer+pos_hdr_sep+hdr_sep_len; + body = buffer+pos_hdr_sep+hdr_sep_len; body_size = buffer_size-(pos_hdr_sep+hdr_sep_len); } @@ -157,23 +143,19 @@ return 0; } -char* HTTP_Header::build_request() { +const char* HTTP_Header::build_request() { char *ptr; int len; - HTTP_field_t *field; - if( method==NULL ) set_method( "GET"); - if( uri==NULL ) set_uri( "/"); + if( method.empty() ) set_method( "GET"); + if( uri.empty() ) set_uri( "/"); //**** Compute the request length // Add the Method line - len = strlen(method)+strlen(uri)+12; + len = method.length()+uri.length()+12; // Add the fields - field = first_field; - while( field!=NULL ) { - len += strlen(field->field_name)+2; - field = field->next; - } + std::vector<std::string>::size_type sz = fields.size(); + for(unsigned i=0;i<sz;i++) len+= fields[i].length()+2; // Add the CRLF len += 2; // Add the body @@ -195,13 +177,9 @@ //*** Building the request ptr = buffer; // Add the method line - ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", method,uri, http_minor_version ); - field = first_field; + ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", method.c_str(),uri.c_str(), http_minor_version ); // Add the field - while( field!=NULL ) { - ptr += sprintf( ptr, "%s\r\n", field->field_name ); - field = field->next; - } + for(unsigned i=0;i<sz;i++) ptr += sprintf( ptr, "%s\r\n", fields[i].c_str()); ptr += sprintf( ptr, "\r\n" ); // Add the body if( body!=NULL ) { @@ -211,72 +189,45 @@ return buffer; } -char* HTTP_Header::get_field(const char *field_name ) { - if( field_name==NULL ) return NULL; - field_search_pos = first_field; - field_search = (char*)mp_realloc( field_search, strlen(field_name)+1 ); - if( field_search==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return NULL; - } - strcpy( field_search, field_name ); +const char* HTTP_Header::get_field(const char *field_name ) { + search_pos=0; + field_search=field_name; return get_next_field(); } -char* HTTP_Header::get_next_field() { - char *ptr; - HTTP_field_t *field; - - field = field_search_pos; - while( field!=NULL ) { - ptr = strstr( field->field_name, ":" ); - if( ptr==NULL ) return NULL; - if( !strncasecmp( field->field_name, field_search, ptr-(field->field_name) ) ) { - ptr++; // Skip the column - while( ptr[0]==' ' ) ptr++; // Skip the spaces if there is some - field_search_pos = field->next; - return ptr; // return the value without the field name +const char* HTTP_Header::get_next_field() { + std::vector<std::string>::size_type sz = fields.size(); + for(unsigned i=search_pos;i<sz;i++) { + size_t pos,epos; + const std::string& str = fields[i]; + pos=0; + epos=str.find(':',pos); + if(epos!=std::string::npos) { + if(str.substr(pos,epos)==field_search) { + epos++; // skip the column + pos=epos; + while(::isspace(str[epos])) epos++; + search_pos=i+1; + return &str[epos]; + } } - field = field->next; } return NULL; } void HTTP_Header::set_field(const char *field_name ) { - HTTP_field_t *new_field; if( field_name==NULL ) return; - - new_field = new(zeromem) HTTP_field_t; - if( new_field==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return; - } - new_field->next = NULL; - new_field->field_name = new char [strlen(field_name)+1]; - if( new_field->field_name==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - delete new_field; - return; - } - strcpy( new_field->field_name, field_name ); - - if( last_field==NULL ) { - first_field = new_field; - } else { - last_field->next = new_field; - } - last_field = new_field; - field_nb++; + fields.push_back(field_name); } void HTTP_Header::set_method( const char *_method ) { if( _method==NULL ) return; - method=mp_strdup(_method); + method=_method; } void HTTP_Header::set_uri(const char *_uri ) { if(_uri==NULL ) return; - uri=mp_strdup(_uri); + uri=_uri; } int HTTP_Header::add_basic_authentication( const char *username, const char *password ) { @@ -328,9 +279,13 @@ return res; } +void HTTP_Header::erase_body() { + body=NULL; + body_size=0; +} + void HTTP_Header::debug_hdr( ) { - HTTP_field_t *field; - int i = 0; + unsigned i = 0; MSG_V( "--- HTTP DEBUG HEADER --- START ---\n" "protocol: [%s]\n" @@ -340,20 +295,17 @@ "status code: [%d]\n" "reason phrase: [%s]\n" "body size: [%d]\n" - ,protocol + ,protocol.c_str() ,http_minor_version - ,uri - ,method + ,uri.c_str() + ,method.c_str() ,status_code ,reason_phrase ,body_size ); MSG_V("Fields:\n"); - field = first_field; - while( field!=NULL ) { - MSG_V(" %d - %s\n", i++, field->field_name ); - field = field->next; - } + std::vector<std::string>::size_type sz = fields.size(); + for(i=0;i<sz;i++) MSG_V(" %d - %s\n", i, fields[i].c_str()); MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); } Modified: mplayerxp/libmpstream/http.h =================================================================== --- mplayerxp/libmpstream/http.h 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/http.h 2012-12-11 11:31:23 UTC (rev 536) @@ -6,15 +6,12 @@ #ifndef __HTTP_H_INCLUDED #define __HTTP_H_INCLUDED 1 - #include "mp_config.h" +#include <string> +#include <vector> + namespace mpxp { - struct HTTP_field_t { - char *field_name; - HTTP_field_t *next; - }; - class HTTP_Header : public Opaque { public: HTTP_Header(); @@ -23,9 +20,9 @@ virtual int response_append(const char *data, int length ); virtual int response_parse(); virtual int is_header_entire() const; - virtual char* build_request(); - virtual char* get_field(const char *field_name ); - virtual char* get_next_field(); + virtual const char* build_request(); + virtual const char* get_field(const char *field_name ); + virtual const char* get_next_field(); virtual void set_field(const char *field_name ); virtual void set_method(const char *method ); virtual void set_uri(const char *uri ); @@ -34,27 +31,31 @@ virtual void debug_hdr(); virtual void cookies_set(const char *hostname, const char *url); - char* buffer; - size_t buffer_size; - unsigned int status_code; - unsigned char* body; - size_t body_size; const char* get_reason_phrase() const { return reason_phrase; } - const char* get_protocol() const { return protocol; } + const char* get_protocol() const { return protocol.c_str(); } + unsigned get_status() const { return status_code; } + const char* get_body() const { return body; } + size_t get_body_size() const { return body_size; } + virtual void erase_body(); + const char* get_buffer() const { return buffer; } + size_t get_buffer_size() const { return buffer_size; } private: - char* protocol; - char* method; - char* uri; + std::string protocol; + std::string method; + std::string uri; char* reason_phrase; unsigned int http_minor_version; // Field variables - HTTP_field_t* first_field; - HTTP_field_t* last_field; - unsigned int field_nb; - char* field_search; - HTTP_field_t* field_search_pos; + std::vector<std::string> fields; + std::string field_search; + std::vector<std::string>::size_type search_pos; // Body variables + unsigned int status_code; + char* body; + size_t body_size; unsigned int is_parsed; + char* buffer; + size_t buffer_size; }; extern int base64_encode(const any_t*enc, int encLen, char *out, int outMax); Modified: mplayerxp/libmpstream/network.cpp =================================================================== --- mplayerxp/libmpstream/network.cpp 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/network.cpp 2012-12-11 11:31:23 UTC (rev 536) @@ -172,7 +172,7 @@ } MPXP_Rc http_send_request(Tcp& tcp, URL_t *url, off_t pos ) { - HTTP_Header* http_hdr = new(zeromem) HTTP_Header; + HTTP_Header& http_hdr = *new(zeromem) HTTP_Header; URL_t *server_url; char str[256]; int ret; @@ -181,37 +181,37 @@ if( !strcasecmp(url->protocol, "http_proxy") ) { proxy = 1; server_url = url_new( (url->file)+1 ); - http_hdr->set_uri(server_url->url ); + http_hdr.set_uri(server_url->url ); } else { server_url = url; - http_hdr->set_uri( server_url->file ); + http_hdr.set_uri( server_url->file ); } if (server_url->port && server_url->port != 80) snprintf(str, 256, "Host: %s:%d", server_url->hostname, server_url->port ); else snprintf(str, 256, "Host: %s", server_url->hostname ); - http_hdr->set_field(str); + http_hdr.set_field(str); if (net_conf.useragent) { snprintf(str, 256, "User-Agent: %s", net_conf.useragent); - http_hdr->set_field(str); + http_hdr.set_field(str); } else - http_hdr->set_field("User-Agent: MPlayerXP/"VERSION); + http_hdr.set_field("User-Agent: MPlayerXP/"VERSION); - http_hdr->set_field("Icy-MetaData: 1"); + http_hdr.set_field("Icy-MetaData: 1"); if(pos>0) { // Extend http_send_request with possibility to do partial content retrieval snprintf(str, 256, "Range: bytes=%d-", (int)pos); - http_hdr->set_field(str); + http_hdr.set_field(str); } - if (net_conf.cookies_enabled) http_hdr->cookies_set( server_url->hostname, server_url->url ); + if (net_conf.cookies_enabled) http_hdr.cookies_set( server_url->hostname, server_url->url ); - http_hdr->set_field( "Connection: closed"); - http_hdr->add_basic_authentication( url->username, url->password ); - if( http_hdr->build_request( )==NULL ) { + http_hdr.set_field( "Connection: closed"); + http_hdr.add_basic_authentication( url->username, url->password ); + if( http_hdr.build_request( )==NULL ) { goto err_out; } @@ -226,20 +226,20 @@ tcp.close(); tcp.open(server_url->hostname, server_url->port, Tcp::IP4); } - if(!tcp.established()) goto err_out; - MSG_DBG2("Request: [%s]\n", http_hdr->buffer ); + if(!tcp.established()) { MSG_ERR("Cannot establish connection\n"); goto err_out; } + MSG_DBG2("Request: [%s]\n", http_hdr.get_buffer() ); - ret = tcp.write((uint8_t*)(http_hdr->buffer), http_hdr->buffer_size); - if( ret!=(int)http_hdr->buffer_size ) { + ret = tcp.write((uint8_t*)(http_hdr.get_buffer()), http_hdr.get_buffer_size()); + if( ret!=(int)http_hdr.get_buffer_size() ) { MSG_ERR("Error while sending HTTP request: didn't sent all the request\n"); goto err_out; } - delete http_hdr; + delete &http_hdr; return MPXP_Ok; err_out: - delete http_hdr; + delete &http_hdr; if (proxy && server_url) url_free(server_url); return MPXP_False; @@ -272,7 +272,7 @@ int http_authenticate(HTTP_Header& http_hdr, URL_t *url, int *auth_retry) { - char *aut; + const char *aut; if( *auth_retry==1 ) { MSG_ERR(MSGTR_ConnAuthFailed); @@ -291,7 +291,7 @@ aut = http_hdr.get_field("WWW-Authenticate"); if( aut!=NULL ) { - char *aut_space; + const char *aut_space; aut_space = strstr(aut, "realm="); if( aut_space!=NULL ) aut_space += 6; MSG_INFO("Authentication required for %s\n", aut_space); @@ -331,20 +331,20 @@ if( http_hdr==NULL ) return 0; - switch( http_hdr->status_code ) { + switch( http_hdr->get_status() ) { case 200: case 206: // OK MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); - if( http_hdr->body_size>0 ) { - if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { + if( http_hdr->get_body_size()>0 ) { + if( networking_bufferize( networking, (unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; return 0; } } break; default: - MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); + MSG_ERR("Server return %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); tcp.close(); } @@ -364,9 +364,9 @@ int redirect; int auth_retry=0; MPXP_Rc seekable=MPXP_False; - char *extension; - char *content_type; - char *next_url; + const char *extension; + const char *content_type; + const char *next_url; URL_t *url = networking->url; @@ -403,16 +403,16 @@ networking->data = (any_t*)http_hdr; // Check if we can make partial content requests and thus seek in http-streams - if( http_hdr->status_code==200 ) { - char *accept_ranges; + if( http_hdr->get_status()==200 ) { + const char *accept_ranges; if( (accept_ranges = http_hdr->get_field("Accept-Ranges")) != NULL ) seekable = strncmp(accept_ranges,"bytes",5)==0?MPXP_Ok:MPXP_False; } - // Check if the response is an ICY status_code reason_phrase + // Check if the response is an ICY get_status() reason_phrase if( !strcasecmp(http_hdr->get_protocol(), "ICY") ) { - switch( http_hdr->status_code ) { + switch( http_hdr->get_status() ) { case 200: { // OK - char *field_data = NULL; + const char *field_data = NULL; // note: I skip icy-notice1 and 2, as they contain html <BR> // and are IMHO useless info ::atmos if( (field_data = http_hdr->get_field("icy-name")) != NULL ) @@ -449,7 +449,7 @@ } // Assume standard http if not ICY - switch( http_hdr->status_code ) { + switch( http_hdr->get_status() ) { case 200: // OK // Look if we can use the Content-Type content_type = http_hdr->get_field("Content-Type" ); @@ -477,7 +477,7 @@ networking->url = url = url_redirect( &url, next_url ); if (!strcasecmp(url->protocol, "mms")) goto err_out; if (strcasecmp(url->protocol, "http")) { - MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->status_code, url->protocol); + MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->get_status(), url->protocol); goto err_out; } redirect = 1; @@ -488,7 +488,7 @@ redirect = 1; break; default: - MSG_ERR("Server returned %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); + MSG_ERR("Server returned %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); goto err_out; } } else { @@ -557,7 +557,7 @@ MPXP_Rc nop_networking_start(Tcp& tcp,networking_t* networking ) { HTTP_Header *http_hdr = NULL; - char *next_url=NULL; + const char *next_url=NULL; URL_t *rd_url=NULL; MPXP_Rc ret; @@ -567,12 +567,12 @@ http_hdr = http_read_response(tcp); if( http_hdr==NULL ) return MPXP_False; - switch( http_hdr->status_code ) { + switch( http_hdr->get_status() ) { case 200: // OK MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); - if( http_hdr->body_size>0 ) { - if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { + if( http_hdr->get_body_size()>0 ) { + if( networking_bufferize( networking, (unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; return MPXP_False; } @@ -602,15 +602,15 @@ case 404: //Not found case 500: //Server Error default: - MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); + MSG_ERR("Server return %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); tcp.close(); return MPXP_False; break; } } else { http_hdr = (HTTP_Header*)networking->data; - if( http_hdr->body_size>0 ) { - if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { + if( http_hdr->get_body_size()>0 ) { + if( networking_bufferize( networking, (unsigned char*)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; networking->data = NULL; return MPXP_False; Modified: mplayerxp/libmpstream/tcp.cpp =================================================================== --- mplayerxp/libmpstream/tcp.cpp 2012-12-10 17:44:11 UTC (rev 535) +++ mplayerxp/libmpstream/tcp.cpp 2012-12-11 11:31:23 UTC (rev 536) @@ -72,6 +72,7 @@ struct timeval to; #endif + buf[0]=0; MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host.c_str()); _fd = ::socket(af==Tcp::IP4?AF_INET:AF_INET6, SOCK_STREAM, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-10 17:44:23
|
Revision: 535 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=535&view=rev Author: nickols_k Date: 2012-12-10 17:44:11 +0000 (Mon, 10 Dec 2012) Log Message: ----------- convert struct HTTP_header_t into class HTTP_Header Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpstream/asf_streaming.cpp mplayerxp/libmpstream/cddb.cpp mplayerxp/libmpstream/cookies.cpp mplayerxp/libmpstream/cookies.h mplayerxp/libmpstream/http.cpp mplayerxp/libmpstream/http.h mplayerxp/libmpstream/network.cpp mplayerxp/libmpstream/network.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/Makefile 2012-12-10 17:44:11 UTC (rev 535) @@ -103,7 +103,7 @@ -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h -rm -f cpuinfo help_mp.h -dep: +dep: version.h $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/libmpstream/asf_streaming.cpp =================================================================== --- mplayerxp/libmpstream/asf_streaming.cpp 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/asf_streaming.cpp 2012-12-10 17:44:11 UTC (rev 535) @@ -500,18 +500,17 @@ } static int -asf_header_check( HTTP_header_t *http_hdr ) { - ASF_obj_header_t *objh; - if( http_hdr==NULL ) return -1; - if( http_hdr->body==NULL || http_hdr->body_size<sizeof(ASF_obj_header_t) ) return -1; +asf_header_check( HTTP_Header& http_hdr ) { + ASF_obj_header_t *objh; + if( http_hdr.body==NULL || http_hdr.body_size<sizeof(ASF_obj_header_t) ) return -1; - objh = (ASF_obj_header_t*)http_hdr->body; - if( ASF_LOAD_GUID_PREFIX(objh->guid)==0x75B22630 ) return 0; - return -1; + objh = (ASF_obj_header_t*)http_hdr.body; + if( ASF_LOAD_GUID_PREFIX(objh->guid)==0x75B22630 ) return 0; + return -1; } static ASF_StreamType_e -asf_http_networking_type(char *content_type, char *features, HTTP_header_t *http_hdr ) { +asf_http_networking_type(char *content_type, char *features, HTTP_Header& http_hdr ) { if( content_type==NULL ) return ASF_Unknown_e; if( !strcasecmp(content_type, "application/octet-stream") || !strcasecmp(content_type, "application/vnd.ms.wms-hdr.asfv1") || // New in Corona, first request @@ -530,7 +529,7 @@ // so we could used mime type to know the stream type, // but guess what? All of them are not well configured. // So we have to check for an asf header :(, but it works :p - if( http_hdr->body_size>sizeof(ASF_obj_header_t) ) { + if( http_hdr.body_size>sizeof(ASF_obj_header_t) ) { if( asf_header_check( http_hdr )==0 ) { MSG_V("=====> ASF Plain text\n"); return ASF_PlainText_e; @@ -563,9 +562,8 @@ return ASF_Unknown_e; } -static HTTP_header_t * -asf_http_request(networking_t *networking) { - HTTP_header_t *http_hdr; +static HTTP_Header* asf_http_request(networking_t *networking) { + HTTP_Header* http_hdr = new(zeromem) HTTP_Header; URL_t *url = NULL; URL_t *server_url = NULL; asf_http_networking_t *asf_http_ctrl; @@ -583,38 +581,37 @@ if( url==NULL || asf_http_ctrl==NULL ) return NULL; // Common header for all requests. - http_hdr = http_new_header(); - http_set_field( http_hdr, "Accept: */*" ); - http_set_field( http_hdr, "User-Agent: NSPlayer/4.1.0.3856" ); - http_add_basic_authentication( http_hdr, url->username, url->password ); + http_hdr->set_field("Accept: */*" ); + http_hdr->set_field("User-Agent: NSPlayer/4.1.0.3856" ); + http_hdr->add_basic_authentication(url->username, url->password ); // Check if we are using a proxy if( !strcasecmp( url->protocol, "http_proxy" ) ) { server_url = url_new( (url->file)+1 ); if( server_url==NULL ) { MSG_ERR("Invalid proxy URL\n"); - http_free( http_hdr ); + delete http_hdr; return NULL; } - http_set_uri( http_hdr, server_url->url ); + http_hdr->set_uri(server_url->url ); sprintf( str, "Host: %.220s:%d", server_url->hostname, server_url->port ); url_free( server_url ); } else { - http_set_uri( http_hdr, url->file ); + http_hdr->set_uri(url->file ); sprintf( str, "Host: %.220s:%d", url->hostname, url->port ); } - http_set_field( http_hdr, str ); - http_set_field( http_hdr, "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); + http_hdr->set_field(str ); + http_hdr->set_field("Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" ); sprintf(str, "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u", offset_hi, offset_lo, asf_http_ctrl->request, length ); - http_set_field( http_hdr, str ); + http_hdr->set_field( str ); switch( asf_http_ctrl->networking_type ) { case ASF_Live_e: case ASF_Prerecorded_e: - http_set_field( http_hdr, "Pragma: xPlayStrm=1" ); + http_hdr->set_field("Pragma: xPlayStrm=1" ); ptr = str; ptr += sprintf( ptr, "Pragma: stream-switch-entry="); if(asf_http_ctrl->n_audio > 0) { @@ -643,9 +640,9 @@ ptr += sprintf(ptr, "ffff:%d:%d ", stream_id, enable); } } - http_set_field( http_hdr, str ); + http_hdr->set_field(str ); sprintf( str, "Pragma: stream-switch-count=%d", asf_nb_stream ); - http_set_field( http_hdr, str ); + http_hdr->set_field( str ); break; case ASF_Redirector_e: break; @@ -656,34 +653,34 @@ MSG_ERR("Unknown asf stream type\n"); } - http_set_field( http_hdr, "Connection: Close" ); - http_build_request( http_hdr ); + http_hdr->set_field("Connection: Close" ); + http_hdr->build_request( ); return http_hdr; } static int -asf_http_parse_response(asf_http_networking_t *asf_http_ctrl, HTTP_header_t *http_hdr ) { +asf_http_parse_response(asf_http_networking_t *asf_http_ctrl, HTTP_Header& http_hdr ) { char *content_type, *pragma; char features[64] = "\0"; size_t len; - if( http_response_parse(http_hdr)<0 ) { + if( http_hdr.response_parse()<0 ) { MSG_ERR("Failed to parse HTTP response\n"); return -1; } - switch( http_hdr->status_code ) { + switch( http_hdr.status_code ) { case 200: break; case 401: // Authentication required return ASF_Authenticate_e; default: - MSG_ERR("Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase); + MSG_ERR("Server return %d:%s\n", http_hdr.status_code, http_hdr.get_reason_phrase()); return -1; } - content_type = http_get_field( http_hdr, "Content-Type"); + content_type = http_hdr.get_field("Content-Type"); - pragma = http_get_field( http_hdr, "Pragma"); + pragma = http_hdr.get_field("Pragma"); while( pragma!=NULL ) { char *comma_ptr=NULL; char *end; @@ -714,14 +711,14 @@ if( pragma[0]==' ' ) pragma++; } } while( comma_ptr!=NULL ); - pragma = http_get_next_field( http_hdr ); + pragma = http_hdr.get_next_field(); } asf_http_ctrl->networking_type = asf_http_networking_type( content_type, features, http_hdr ); return 0; } static MPXP_Rc asf_http_networking_start(Tcp& tcp, networking_t *networking) { - HTTP_header_t *http_hdr=NULL; + HTTP_Header *http_hdr=NULL; URL_t *url = networking->url; asf_http_networking_t *asf_http_ctrl; char buffer[BUFFER_SIZE]; @@ -762,25 +759,25 @@ } i += r; } - http_free( http_hdr ); - http_hdr = http_new_header(); + delete http_hdr; + http_hdr = new(zeromem) HTTP_Header; do { i = tcp.read((uint8_t*)buffer, BUFFER_SIZE); if( i<=0 ) { perror("read"); - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } - http_response_append( http_hdr, buffer, i ); - } while( !http_is_header_entire( http_hdr ) ); + http_hdr->response_append(buffer,i); + } while( !http_hdr->is_header_entire()); if( mp_conf.verbose>0 ) { http_hdr->buffer[http_hdr->buffer_size]='\0'; MSG_DBG2("Response [%s]\n", http_hdr->buffer ); } - ret = asf_http_parse_response(asf_http_ctrl, http_hdr); + ret = asf_http_parse_response(asf_http_ctrl, *http_hdr); if( ret<0 ) { MSG_ERR("Failed to parse header\n"); - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } switch( asf_http_ctrl->networking_type ) { @@ -789,7 +786,7 @@ case ASF_PlainText_e: if( http_hdr->body_size>0 ) { if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } } @@ -810,7 +807,7 @@ case ASF_Redirector_e: if( http_hdr->body_size>0 ) { if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } } @@ -818,7 +815,7 @@ done = 1; break; case ASF_Authenticate_e: - if( http_authenticate( http_hdr, url, &auth_retry)<0 ) return MPXP_False; + if( http_authenticate( *http_hdr, url, &auth_retry)<0 ) return MPXP_False; asf_http_ctrl->networking_type = ASF_Unknown_e; done = 0; break; @@ -826,7 +823,7 @@ default: MSG_ERR("Unknown ASF networking type\n"); tcp.close(); - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } // Check if we got a redirect. @@ -842,7 +839,7 @@ } networking->status = networking_playing_e; - http_free( http_hdr ); + delete http_hdr; return MPXP_Ok; } Modified: mplayerxp/libmpstream/cddb.cpp =================================================================== --- mplayerxp/libmpstream/cddb.cpp 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/cddb.cpp 2012-12-10 17:44:11 UTC (rev 535) @@ -141,53 +141,51 @@ return ((n % 0xff) << 24 | t << 8 | tot_trks); } -static int __FASTCALL__ cddb_http_request(const char *command, int (*reply_parser)(HTTP_header_t*,cddb_data_t*), cddb_data_t *cddb_data) { - char request[4096]; - int ret = 0; - Tcp tcp(cddb_data->libinput,-1); - URL_t *url; - HTTP_header_t *http_hdr; +static int __FASTCALL__ cddb_http_request(const char *command, int (*reply_parser)(HTTP_Header&,cddb_data_t*), cddb_data_t *cddb_data) { + char request[4096]; + int ret = 0; + Tcp tcp(cddb_data->libinput,-1); + URL_t *url; - if( reply_parser==NULL || command==NULL || cddb_data==NULL ) return -1; + if( reply_parser==NULL || command==NULL || cddb_data==NULL ) return -1; - sprintf( request, "http://%s/~cddb/cddb.cgi?cmd=%s%s&proto=%d", cddb_data->freedb_server, command, cddb_data->cddb_hello.c_str(), cddb_data->freedb_proto_level ); - MSG_V("Request[%s]\n", request ); + sprintf( request, "http://%s/~cddb/cddb.cgi?cmd=%s%s&proto=%d", cddb_data->freedb_server, command, cddb_data->cddb_hello.c_str(), cddb_data->freedb_proto_level ); + MSG_V("Request[%s]\n", request ); - url = url_new(request); - if( url==NULL ) { - MSG_ERR("Not a valid URL\n"); - return -1; - } + url = url_new(request); + if( url==NULL ) { + MSG_ERR("Not a valid URL\n"); + return -1; + } - if(http_send_request(tcp,url,0)!=MPXP_Ok) { - MSG_ERR("failed to send the http request\n"); - return -1; - } + if(http_send_request(tcp,url,0)!=MPXP_Ok) { + MSG_ERR("failed to send the http request\n"); + return -1; + } - http_hdr = http_read_response( tcp ); - if( http_hdr==NULL ) { - MSG_ERR("Failed to read the http response\n"); - return -1; - } + HTTP_Header* http_hdr = http_read_response( tcp ); + if( http_hdr==NULL ) { + MSG_ERR("Failed to read the http response\n"); + return -1; + } - http_debug_hdr(http_hdr); - MSG_V("body=[%s]\n", http_hdr->body ); + http_hdr->debug_hdr(); - switch(http_hdr->status_code) { - case 200: - ret = reply_parser(http_hdr, cddb_data); - break; - case 400: - MSG_V("Not Found\n"); - break; - default: - MSG_V("Unknown Error code\n"); - } + switch(http_hdr->status_code) { + case 200: + ret = reply_parser(*http_hdr, cddb_data); + break; + case 400: + MSG_V("Not Found\n"); + break; + default: + MSG_V("Unknown Error code\n"); + } - http_free( http_hdr ); - url_free( url ); + delete http_hdr; + url_free( url ); - return ret; + return ret; } static int __FASTCALL__ cddb_read_cache(cddb_data_t *cddb_data) { @@ -265,60 +263,60 @@ return 0; } -static int cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { - unsigned long disc_id; - char category[100]; - char *ptr=NULL, *ptr2=NULL; - int ret, status; +static int cddb_read_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { + unsigned long disc_id; + char category[100]; + char *ptr=NULL, *ptr2=NULL; + int ret, status; - if( http_hdr==NULL || cddb_data==NULL ) return -1; + if( cddb_data==NULL ) return -1; - ret = sscanf((char*)http_hdr->body, "%d ", &status); - if( ret!=1 ) { + ret = sscanf((char*)http_hdr.body, "%d ", &status); + if( ret!=1 ) { + MSG_ERR("Parse error\n"); + return -1; + } + + switch(status) { + case 210: + ret = sscanf((char*)http_hdr.body, "%d %s %08lx", &status, category, &disc_id); + if( ret!=3 ) { MSG_ERR("Parse error\n"); return -1; - } - - switch(status) { - case 210: - ret = sscanf((char*)http_hdr->body, "%d %s %08lx", &status, category, &disc_id); - if( ret!=3 ) { - MSG_ERR("Parse error\n"); - return -1; - } - // Check if it's a xmcd database file - ptr = strstr((char*)http_hdr->body, "# xmcd"); - if( ptr==NULL ) { - MSG_ERR("Invalid xmcd database file returned\n"); - return -1; - } - // Ok found the beginning of the file - // look for the end - ptr2 = strstr(ptr, "\r\n.\r\n"); - if( ptr2==NULL ) { - ptr2 = strstr(ptr, "\n.\n"); - if( ptr2==NULL ) { - MSG_ERR("Unable to find '.'\n"); - return -1; - } - } - // Ok found the end - // do a sanity check - if( http_hdr->body_size<(unsigned long)(ptr2-ptr) ) { - MSG_ERR("Unexpected fix me\n"); - return -1; - } - cddb_data->xmcd_file = ptr; - cddb_data->xmcd_file_size = ptr2-ptr+2; - cddb_data->xmcd_file[cddb_data->xmcd_file_size] = '\0'; - // Avoid the http_free function to mp_free the xmcd file...save a mempcy... - http_hdr->body = NULL; - http_hdr->body_size = 0; - return cddb_write_cache(cddb_data); - default: - MSG_ERR("Unhandled code\n"); - } - return 0; + } + // Check if it's a xmcd database file + ptr = strstr((char*)http_hdr.body, "# xmcd"); + if( ptr==NULL ) { + MSG_ERR("Invalid xmcd database file returned\n"); + return -1; + } + // Ok found the beginning of the file + // look for the end + ptr2 = strstr(ptr, "\r\n.\r\n"); + if( ptr2==NULL ) { + ptr2 = strstr(ptr, "\n.\n"); + if( ptr2==NULL ) { + MSG_ERR("Unable to find '.'\n"); + return -1; + } + } + // Ok found the end + // do a sanity check + if( http_hdr.body_size<(unsigned long)(ptr2-ptr) ) { + MSG_ERR("Unexpected fix me\n"); + return -1; + } + cddb_data->xmcd_file = ptr; + cddb_data->xmcd_file_size = ptr2-ptr+2; + cddb_data->xmcd_file[cddb_data->xmcd_file_size] = '\0'; + // Avoid the http_free function to mp_free the xmcd file...save a mempcy... + http_hdr.body = NULL; + http_hdr.body_size = 0; + return cddb_write_cache(cddb_data); + default: + MSG_ERR("Unhandled code\n"); + } + return 0; } static int __FASTCALL__ cddb_request_titles(cddb_data_t *cddb_data) { @@ -327,12 +325,12 @@ return cddb_http_request(command, cddb_read_parse, cddb_data); } -static int cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { +static int cddb_query_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { char album_title[100]; char *ptr = NULL; int ret, status; - ret = sscanf((char*)http_hdr->body, "%d ", &status); + ret = sscanf((char*)http_hdr.body, "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; @@ -341,18 +339,18 @@ switch(status) { case 200: // Found exact match - ret = sscanf((char*)http_hdr->body, "%d %s %08lx %s", &status, cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); + ret = sscanf((char*)http_hdr.body, "%d %s %08lx %s", &status, cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); if( ret!=4 ) { MSG_ERR("Parse error\n"); return -1; } - ptr = strstr((char*)http_hdr->body, album_title); + ptr = strstr((char*)http_hdr.body, album_title); if( ptr!=NULL ) { char *ptr2; int len; ptr2 = strstr(ptr, "\n"); if( ptr2==NULL ) { - len = (http_hdr->body_size)-(ptr-(char*)(http_hdr->body)); + len = (http_hdr.body_size)-(ptr-(char*)(http_hdr.body)); } else { len = ptr2-ptr+1; } @@ -367,7 +365,7 @@ break; case 210: // Found exact matches, list follows - ptr = strstr((char*)http_hdr->body, "\n"); + ptr = strstr((char*)http_hdr.body, "\n"); if( ptr==NULL ) { MSG_ERR("Unable to find end of line\n"); return -1; @@ -380,13 +378,13 @@ MSG_ERR("Parse error\n"); return -1; } - ptr = strstr((char*)http_hdr->body, album_title); + ptr = strstr((char*)http_hdr.body, album_title); if( ptr!=NULL ) { char *ptr2; int len; ptr2 = strstr(ptr, "\n"); if( ptr2==NULL ) { - len = (http_hdr->body_size)-(ptr-(char*)(http_hdr->body)); + len = (http_hdr.body_size)-(ptr-(char*)(http_hdr.body)); } else { len = ptr2-ptr+1; } @@ -412,12 +410,12 @@ return -1; } -static int cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { +static int cddb_proto_level_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { int max; int ret, status; char *ptr; - ret = sscanf((char*)http_hdr->body, "%d ", &status); + ret = sscanf((char*)http_hdr.body, "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; @@ -425,7 +423,7 @@ switch(status) { case 210: - ptr = strstr((char*)http_hdr->body, "max proto:"); + ptr = strstr((char*)http_hdr.body, "max proto:"); if( ptr==NULL ) { MSG_ERR("Parse error\n"); return -1; @@ -447,10 +445,10 @@ return cddb_http_request("stat", cddb_proto_level_parse, cddb_data); } -static int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { +static int cddb_freedb_sites_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { int ret, status; UNUSED(cddb_data); - ret = sscanf((char*)http_hdr->body, "%d ", &status); + ret = sscanf((char*)http_hdr.body, "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); return -1; Modified: mplayerxp/libmpstream/cookies.cpp =================================================================== --- mplayerxp/libmpstream/cookies.cpp 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/cookies.cpp 2012-12-10 17:44:11 UTC (rev 535) @@ -26,6 +26,7 @@ #define MAX_COOKIES 20 +namespace mpxp { typedef struct cookie_list_type { char *name; char *value; @@ -220,8 +221,7 @@ } /* Take an HTTP_header_t, and insert the correct headers. The cookie files are read if necessary. */ -void -cookies_set(HTTP_header_t * http_hdr, const char *domain, const char *url) +void HTTP_Header::cookies_set(const char *domain, const char *url) { int found_cookies = 0; struct cookie_list_type *cookies[MAX_COOKIES]; @@ -281,7 +281,8 @@ } if (found_cookies) - http_set_field(http_hdr, buf); + set_field(buf); else delete buf; } +} // namespace mpxp Modified: mplayerxp/libmpstream/cookies.h =================================================================== --- mplayerxp/libmpstream/cookies.h 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/cookies.h 2012-12-10 17:44:11 UTC (rev 535) @@ -10,7 +10,4 @@ #include "http.h" -extern void cookies_set(HTTP_header_t * http_hdr, const char *hostname, - const char *url); - #endif Modified: mplayerxp/libmpstream/http.cpp =================================================================== --- mplayerxp/libmpstream/http.cpp 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/http.cpp 2012-12-10 17:44:11 UTC (rev 535) @@ -16,376 +16,323 @@ #include "url.h" #include "stream_msg.h" -HTTP_header_t * -http_new_header() { - HTTP_header_t *http_hdr; - - http_hdr = (HTTP_header_t*)mp_mallocz(sizeof(HTTP_header_t)); - if( http_hdr==NULL ) return NULL; - - return http_hdr; +namespace mpxp { +HTTP_Header::HTTP_Header() {} +HTTP_Header::~HTTP_Header() { + HTTP_field_t *field, *field2free; + if( protocol!=NULL ) delete protocol ; + if( uri!=NULL ) delete uri ; + if( reason_phrase!=NULL ) delete reason_phrase ; + if( field_search!=NULL ) delete field_search ; + if( method!=NULL ) delete method ; + if( buffer!=NULL ) delete buffer ; + field = first_field; + while( field!=NULL ) { + field2free = field; + if (field->field_name) delete field->field_name; + field = field->next; + delete field2free; + } } -void -http_free( HTTP_header_t *http_hdr ) { - HTTP_field_t *field, *field2free; - if( http_hdr==NULL ) return; - if( http_hdr->protocol!=NULL ) delete http_hdr->protocol ; - if( http_hdr->uri!=NULL ) delete http_hdr->uri ; - if( http_hdr->reason_phrase!=NULL ) delete http_hdr->reason_phrase ; - if( http_hdr->field_search!=NULL ) delete http_hdr->field_search ; - if( http_hdr->method!=NULL ) delete http_hdr->method ; - if( http_hdr->buffer!=NULL ) delete http_hdr->buffer ; - field = http_hdr->first_field; - while( field!=NULL ) { - field2free = field; - if (field->field_name) - delete field->field_name; - field = field->next; - delete field2free ; - } - delete http_hdr ; - http_hdr = NULL; -} +int HTTP_Header::response_append(const char *response, int length ) { + if( response==NULL || length<0 ) return -1; -int -http_response_append( HTTP_header_t *http_hdr, char *response, int length ) { - if( http_hdr==NULL || response==NULL || length<0 ) return -1; - - if( (unsigned)length > std::numeric_limits<size_t>::max() - http_hdr->buffer_size - 1) { - MSG_FATAL("Bad size in memory (re)allocation\n"); - return -1; - } - http_hdr->buffer = (char*)mp_realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); - if(http_hdr->buffer ==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - memcpy( http_hdr->buffer+http_hdr->buffer_size, response, length ); - http_hdr->buffer_size += length; - http_hdr->buffer[http_hdr->buffer_size]=0; // close the string! - return http_hdr->buffer_size; + if( (unsigned)length > std::numeric_limits<size_t>::max() - buffer_size - 1) { + MSG_FATAL("Bad size in memory (re)allocation\n"); + return -1; + } + buffer = (char*)mp_realloc( buffer, buffer_size+length+1 ); + if(buffer ==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return -1; + } + memcpy( buffer+buffer_size, response, length ); + buffer_size += length; + buffer[buffer_size]=0; // close the string! + return buffer_size; } -int -http_is_header_entire( HTTP_header_t *http_hdr ) { - if( http_hdr==NULL ) return -1; - if( http_hdr->buffer==NULL ) return 0; // empty +int HTTP_Header::is_header_entire() const { + if( buffer==NULL ) return 0; // empty - if( strstr(http_hdr->buffer, "\r\n\r\n")==NULL && - strstr(http_hdr->buffer, "\n\n")==NULL ) return 0; - return 1; + if( strstr(buffer, "\r\n\r\n")==NULL && + strstr(buffer, "\n\n")==NULL ) return 0; + return 1; } -int -http_response_parse( HTTP_header_t *http_hdr ) { - char *hdr_ptr, *ptr; - char *field=NULL; - int pos_hdr_sep, hdr_sep_len; - size_t len; - if( http_hdr==NULL ) return -1; - if( http_hdr->is_parsed ) return 0; +int HTTP_Header::response_parse( ) { + char *hdr_ptr, *ptr; + char *field=NULL; + int pos_hdr_sep, hdr_sep_len; + size_t len; + if( is_parsed ) return 0; - // Get the protocol - hdr_ptr = strstr( http_hdr->buffer, " " ); - if( hdr_ptr==NULL ) { - MSG_FATAL("Malformed answer. No space separator found.\n"); - return -1; + // Get the protocol + hdr_ptr = strstr( buffer, " " ); + if( hdr_ptr==NULL ) { + MSG_FATAL("Malformed answer. No space separator found.\n"); + return -1; + } + len = hdr_ptr-buffer; + protocol = new char [len+1]; + if( protocol==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return -1; + } + strncpy( protocol, buffer, len ); + protocol[len]='\0'; + if( !strncasecmp( protocol, "HTTP", 4) ) { + if( sscanf( protocol+5,"1.%d", &(http_minor_version) )!=1 ) { + MSG_FATAL("Malformed answer. Unable to get HTTP minor version.\n"); + return -1; } - len = hdr_ptr-http_hdr->buffer; - http_hdr->protocol = (char*)mp_malloc(len+1); - if( http_hdr->protocol==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - strncpy( http_hdr->protocol, http_hdr->buffer, len ); - http_hdr->protocol[len]='\0'; - if( !strncasecmp( http_hdr->protocol, "HTTP", 4) ) { - if( sscanf( http_hdr->protocol+5,"1.%d", &(http_hdr->http_minor_version) )!=1 ) { - MSG_FATAL("Malformed answer. Unable to get HTTP minor version.\n"); - return -1; - } - } + } - // Get the status code - if( sscanf( ++hdr_ptr, "%d", &(http_hdr->status_code) )!=1 ) { - MSG_FATAL("Malformed answer. Unable to get status code.\n"); - return -1; - } - hdr_ptr += 4; + // Get the status code + if( sscanf( ++hdr_ptr, "%d", &status_code )!=1 ) { + MSG_FATAL("Malformed answer. Unable to get status code.\n"); + return -1; + } + hdr_ptr += 4; - // Get the reason phrase - ptr = strstr( hdr_ptr, "\n" ); - if( hdr_ptr==NULL ) { - MSG_FATAL("Malformed answer. Unable to get the reason phrase.\n"); - return -1; - } - len = ptr-hdr_ptr; - http_hdr->reason_phrase = (char*)mp_malloc(len+1); - if( http_hdr->reason_phrase==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - strncpy( http_hdr->reason_phrase, hdr_ptr, len ); - if( http_hdr->reason_phrase[len-1]=='\r' ) { - len--; - } - http_hdr->reason_phrase[len]='\0'; + // Get the reason phrase + ptr = strstr( hdr_ptr, "\n" ); + if( hdr_ptr==NULL ) { + MSG_FATAL("Malformed answer. Unable to get the reason phrase.\n"); + return -1; + } + len = ptr-hdr_ptr; + reason_phrase = new char[len+1]; + if( reason_phrase==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return -1; + } + strncpy( reason_phrase, hdr_ptr, len ); + if( reason_phrase[len-1]=='\r' ) { + len--; + } + reason_phrase[len]='\0'; - // Set the position of the header separator: \r\n\r\n - hdr_sep_len = 4; - ptr = strstr( http_hdr->buffer, "\r\n\r\n" ); + // Set the position of the header separator: \r\n\r\n + hdr_sep_len = 4; + ptr = strstr( buffer, "\r\n\r\n" ); + if( ptr==NULL ) { + ptr = strstr( buffer, "\n\n" ); if( ptr==NULL ) { - ptr = strstr( http_hdr->buffer, "\n\n" ); - if( ptr==NULL ) { - MSG_ERR("Header may be incomplete. No CRLF CRLF found.\n"); - return -1; - } - hdr_sep_len = 2; + MSG_ERR("Header may be incomplete. No CRLF CRLF found.\n"); + return -1; } - pos_hdr_sep = ptr-http_hdr->buffer; + hdr_sep_len = 2; + } + pos_hdr_sep = ptr-buffer; - // Point to the first line after the method line. - hdr_ptr = strstr( http_hdr->buffer, "\n" )+1; - do { - ptr = hdr_ptr; - while( *ptr!='\r' && *ptr!='\n' ) ptr++; - len = ptr-hdr_ptr; - if( len==0 ) break; - field = (char*)mp_realloc(field, len+1); - if( field==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return -1; - } - strncpy( field, hdr_ptr, len ); - field[len]='\0'; - http_set_field( http_hdr, field ); - hdr_ptr = ptr+((*ptr=='\r')?2:1); - } while( hdr_ptr<(http_hdr->buffer+pos_hdr_sep) ); + // Point to the first line after the method line. + hdr_ptr = strstr( buffer, "\n" )+1; + do { + ptr = hdr_ptr; + while( *ptr!='\r' && *ptr!='\n' ) ptr++; + len = ptr-hdr_ptr; + if( len==0 ) break; + field = (char*)mp_realloc(field, len+1); + if( field==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return -1; + } + strncpy( field, hdr_ptr, len ); + field[len]='\0'; + set_field( field ); + hdr_ptr = ptr+((*ptr=='\r')?2:1); + } while( hdr_ptr<(buffer+pos_hdr_sep) ); - if( field!=NULL ) delete field ; + if( field!=NULL ) delete field ; - if( pos_hdr_sep+hdr_sep_len<http_hdr->buffer_size ) { - // Response has data! - http_hdr->body = (unsigned char*)http_hdr->buffer+pos_hdr_sep+hdr_sep_len; - http_hdr->body_size = http_hdr->buffer_size-(pos_hdr_sep+hdr_sep_len); - } + if( pos_hdr_sep+hdr_sep_len<buffer_size ) { + // Response has data! + body = (unsigned char*)buffer+pos_hdr_sep+hdr_sep_len; + body_size = buffer_size-(pos_hdr_sep+hdr_sep_len); + } - http_hdr->is_parsed = 1; - return 0; + is_parsed = 1; + return 0; } -char * -http_build_request( HTTP_header_t *http_hdr ) { - char *ptr, *uri=NULL; - int len; - HTTP_field_t *field; - if( http_hdr==NULL ) return NULL; +char* HTTP_Header::build_request() { + char *ptr; + int len; + HTTP_field_t *field; - if( http_hdr->method==NULL ) http_set_method( http_hdr, "GET"); - if( http_hdr->uri==NULL ) http_set_uri( http_hdr, "/"); - else { - uri = (char*)mp_malloc(strlen(http_hdr->uri) + 1); - if( uri==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return NULL; - } - strcpy(uri,http_hdr->uri); - } + if( method==NULL ) set_method( "GET"); + if( uri==NULL ) set_uri( "/"); - //**** Compute the request length - // Add the Method line - len = strlen(http_hdr->method)+strlen(uri)+12; - // Add the fields - field = http_hdr->first_field; - while( field!=NULL ) { - len += strlen(field->field_name)+2; - field = field->next; - } - // Add the CRLF - len += 2; - // Add the body - if( http_hdr->body!=NULL ) { - len += http_hdr->body_size; - } - // Free the buffer if it was previously used - if( http_hdr->buffer!=NULL ) { - delete http_hdr->buffer ; - http_hdr->buffer = NULL; - } - http_hdr->buffer = (char*)mp_malloc(len+1); - if( http_hdr->buffer==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return NULL; - } - http_hdr->buffer_size = len; + //**** Compute the request length + // Add the Method line + len = strlen(method)+strlen(uri)+12; + // Add the fields + field = first_field; + while( field!=NULL ) { + len += strlen(field->field_name)+2; + field = field->next; + } + // Add the CRLF + len += 2; + // Add the body + if( body!=NULL ) { + len += body_size; + } + // Free the buffer if it was previously used + if( buffer!=NULL ) { + delete buffer ; + buffer = NULL; + } + buffer = new char [len+1]; + if( buffer==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return NULL; + } + buffer_size = len; - //*** Building the request - ptr = http_hdr->buffer; - // Add the method line - ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", http_hdr->method, uri, http_hdr->http_minor_version ); - field = http_hdr->first_field; - // Add the field - while( field!=NULL ) { - ptr += sprintf( ptr, "%s\r\n", field->field_name ); - field = field->next; - } - ptr += sprintf( ptr, "\r\n" ); - // Add the body - if( http_hdr->body!=NULL ) { - memcpy( ptr, http_hdr->body, http_hdr->body_size ); - } + //*** Building the request + ptr = buffer; + // Add the method line + ptr += sprintf( ptr, "%s %s HTTP/1.%d\r\n", method,uri, http_minor_version ); + field = first_field; + // Add the field + while( field!=NULL ) { + ptr += sprintf( ptr, "%s\r\n", field->field_name ); + field = field->next; + } + ptr += sprintf( ptr, "\r\n" ); + // Add the body + if( body!=NULL ) { + memcpy( ptr, body, body_size ); + } - if( uri ) delete uri ; - return http_hdr->buffer; + return buffer; } -char * -http_get_field( HTTP_header_t *http_hdr, const char *field_name ) { - if( http_hdr==NULL || field_name==NULL ) return NULL; - http_hdr->field_search_pos = http_hdr->first_field; - http_hdr->field_search = (char*)mp_realloc( http_hdr->field_search, strlen(field_name)+1 ); - if( http_hdr->field_search==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return NULL; - } - strcpy( http_hdr->field_search, field_name ); - return http_get_next_field( http_hdr ); +char* HTTP_Header::get_field(const char *field_name ) { + if( field_name==NULL ) return NULL; + field_search_pos = first_field; + field_search = (char*)mp_realloc( field_search, strlen(field_name)+1 ); + if( field_search==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return NULL; + } + strcpy( field_search, field_name ); + return get_next_field(); } -char * -http_get_next_field( HTTP_header_t *http_hdr ) { - char *ptr; - HTTP_field_t *field; - if( http_hdr==NULL ) return NULL; +char* HTTP_Header::get_next_field() { + char *ptr; + HTTP_field_t *field; - field = http_hdr->field_search_pos; - while( field!=NULL ) { - ptr = strstr( field->field_name, ":" ); - if( ptr==NULL ) return NULL; - if( !strncasecmp( field->field_name, http_hdr->field_search, ptr-(field->field_name) ) ) { - ptr++; // Skip the column - while( ptr[0]==' ' ) ptr++; // Skip the spaces if there is some - http_hdr->field_search_pos = field->next; - return ptr; // return the value without the field name - } - field = field->next; + field = field_search_pos; + while( field!=NULL ) { + ptr = strstr( field->field_name, ":" ); + if( ptr==NULL ) return NULL; + if( !strncasecmp( field->field_name, field_search, ptr-(field->field_name) ) ) { + ptr++; // Skip the column + while( ptr[0]==' ' ) ptr++; // Skip the spaces if there is some + field_search_pos = field->next; + return ptr; // return the value without the field name } - return NULL; + field = field->next; + } + return NULL; } -void -http_set_field( HTTP_header_t *http_hdr, const char *field_name ) { - HTTP_field_t *new_field; - if( http_hdr==NULL || field_name==NULL ) return; +void HTTP_Header::set_field(const char *field_name ) { + HTTP_field_t *new_field; + if( field_name==NULL ) return; - new_field = (HTTP_field_t*)mp_malloc(sizeof(HTTP_field_t)); - if( new_field==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return; - } - new_field->next = NULL; - new_field->field_name = (char*)mp_malloc(strlen(field_name)+1); - if( new_field->field_name==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - delete new_field; - return; - } - strcpy( new_field->field_name, field_name ); + new_field = new(zeromem) HTTP_field_t; + if( new_field==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + return; + } + new_field->next = NULL; + new_field->field_name = new char [strlen(field_name)+1]; + if( new_field->field_name==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + delete new_field; + return; + } + strcpy( new_field->field_name, field_name ); - if( http_hdr->last_field==NULL ) { - http_hdr->first_field = new_field; - } else { - http_hdr->last_field->next = new_field; - } - http_hdr->last_field = new_field; - http_hdr->field_nb++; + if( last_field==NULL ) { + first_field = new_field; + } else { + last_field->next = new_field; + } + last_field = new_field; + field_nb++; } -void -http_set_method( HTTP_header_t *http_hdr, const char *method ) { - if( http_hdr==NULL || method==NULL ) return; - - http_hdr->method = (char*)mp_malloc(strlen(method)+1); - if( http_hdr->method==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return; - } - strcpy( http_hdr->method, method ); +void HTTP_Header::set_method( const char *_method ) { + if( _method==NULL ) return; + method=mp_strdup(_method); } -void -http_set_uri( HTTP_header_t *http_hdr, const char *uri ) { - if( http_hdr==NULL || uri==NULL ) return; - - http_hdr->uri = (char*)mp_malloc(strlen(uri)+1); - if( http_hdr->uri==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return; - } - strcpy( http_hdr->uri, uri ); +void HTTP_Header::set_uri(const char *_uri ) { + if(_uri==NULL ) return; + uri=mp_strdup(_uri); } -int -http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, const char *password ) { - char *auth=NULL, *usr_pass=NULL, *b64_usr_pass=NULL; - int encoded_len, pass_len=0, out_len; - int res = -1; - if( http_hdr==NULL || username==NULL ) return -1; +int HTTP_Header::add_basic_authentication( const char *username, const char *password ) { + char *auth=NULL, *usr_pass=NULL, *b64_usr_pass=NULL; + int encoded_len, pass_len=0, out_len; + int res = -1; + if( username==NULL ) return -1; - if( password!=NULL ) { - pass_len = strlen(password); - } + if( password!=NULL ) pass_len = strlen(password); - usr_pass = (char*)mp_malloc(strlen(username)+pass_len+2); - if( usr_pass==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - goto out; - } + usr_pass = new char [strlen(username)+pass_len+2]; + if( usr_pass==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + goto out; + } - sprintf( usr_pass, "%s:%s", username, (password==NULL)?"":password ); + sprintf( usr_pass, "%s:%s", username, (password==NULL)?"":password ); - // Base 64 encode with at least 33% more data than the original size - encoded_len = strlen(usr_pass)*2; - b64_usr_pass = (char*)mp_malloc(encoded_len); - if( b64_usr_pass==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - goto out; - } + // Base 64 encode with at least 33% more data than the original size + encoded_len = strlen(usr_pass)*2; + b64_usr_pass = new char [encoded_len]; + if( b64_usr_pass==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + goto out; + } - out_len = base64_encode( usr_pass, strlen(usr_pass), b64_usr_pass, encoded_len); - if( out_len<0 ) { - MSG_FATAL("Base64 out overflow\n"); - goto out; - } + out_len = base64_encode( usr_pass, strlen(usr_pass), b64_usr_pass, encoded_len); + if( out_len<0 ) { + MSG_FATAL("Base64 out overflow\n"); + goto out; + } - b64_usr_pass[out_len]='\0'; + b64_usr_pass[out_len]='\0'; - auth = (char*)mp_malloc(encoded_len+22); - if( auth==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - goto out; - } + auth = new char [encoded_len+22]; + if( auth==NULL ) { + MSG_FATAL("Memory allocation failed\n"); + goto out; + } - sprintf( auth, "Authorization: Basic %s", b64_usr_pass); - http_set_field( http_hdr, auth ); - res = 0; - + sprintf( auth, "Authorization: Basic %s", b64_usr_pass); + set_field( auth ); + res = 0; out: - delete usr_pass ; - delete b64_usr_pass ; - delete auth ; + delete usr_pass ; + delete b64_usr_pass ; + delete auth ; - return res; + return res; } -void -http_debug_hdr( HTTP_header_t *http_hdr ) { - HTTP_field_t *field; - int i = 0; - if( http_hdr==NULL ) return; +void HTTP_Header::debug_hdr( ) { + HTTP_field_t *field; + int i = 0; - MSG_V( "--- HTTP DEBUG HEADER --- START ---\n" + MSG_V( "--- HTTP DEBUG HEADER --- START ---\n" "protocol: [%s]\n" "http minor version: [%d]\n" "uri: [%s]\n" @@ -393,21 +340,21 @@ "status code: [%d]\n" "reason phrase: [%s]\n" "body size: [%d]\n" - , http_hdr->protocol - , http_hdr->http_minor_version - , http_hdr->uri - , http_hdr->method - , http_hdr->status_code - , http_hdr->reason_phrase - , http_hdr->body_size ); + ,protocol + ,http_minor_version + ,uri + ,method + ,status_code + ,reason_phrase + ,body_size ); - MSG_V("Fields:\n"); - field = http_hdr->first_field; - while( field!=NULL ) { - MSG_V(" %d - %s\n", i++, field->field_name ); - field = field->next; - } - MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); + MSG_V("Fields:\n"); + field = first_field; + while( field!=NULL ) { + MSG_V(" %d - %s\n", i++, field->field_name ); + field = field->next; + } + MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); } int @@ -463,5 +410,4 @@ // Output overflow return -1; } - - +}// namespace mpxp Modified: mplayerxp/libmpstream/http.h =================================================================== --- mplayerxp/libmpstream/http.h 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/http.h 2012-12-10 17:44:11 UTC (rev 535) @@ -4,51 +4,59 @@ * (C) 2001, MPlayer team. */ -#ifndef __HTTP_H -#define __HTTP_H +#ifndef __HTTP_H_INCLUDED +#define __HTTP_H_INCLUDED 1 #include "mp_config.h" -typedef struct HTTP_field_type { +namespace mpxp { + struct HTTP_field_t { char *field_name; - struct HTTP_field_type *next; -} HTTP_field_t; + HTTP_field_t *next; + }; -typedef struct { - char *protocol; - char *method; - char *uri; - unsigned int status_code; - char *reason_phrase; - unsigned int http_minor_version; - // Field variables - HTTP_field_t *first_field; - HTTP_field_t *last_field; - unsigned int field_nb; - char *field_search; - HTTP_field_t *field_search_pos; - // Body variables - unsigned char *body; - size_t body_size; - char *buffer; - size_t buffer_size; - unsigned int is_parsed; -} HTTP_header_t; + class HTTP_Header : public Opaque { + public: + HTTP_Header(); + virtual ~HTTP_Header(); -HTTP_header_t* http_new_header(); -void http_free( HTTP_header_t *http_hdr ); -int http_response_append( HTTP_header_t *http_hdr, char *data, int length ); -int http_response_parse( HTTP_header_t *http_hdr ); -int http_is_header_entire( HTTP_header_t *http_hdr ); -char* http_build_request( HTTP_header_t *http_hdr ); -char* http_get_field( HTTP_header_t *http_hdr, const char *field_name ); -char* http_get_next_field( HTTP_header_t *http_hdr ); -void http_set_field( HTTP_header_t *http_hdr, const char *field_name ); -void http_set_method( HTTP_header_t *http_hdr, const char *method ); -void http_set_uri( HTTP_header_t *http_hdr, const char *uri ); -int http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, const char *password ); + virtual int response_append(const char *data, int length ); + virtual int response_parse(); + virtual int is_header_entire() const; + virtual char* build_request(); + virtual char* get_field(const char *field_name ); + virtual char* get_next_field(); + virtual void set_field(const char *field_name ); + virtual void set_method(const char *method ); + virtual void set_uri(const char *uri ); + virtual int add_basic_authentication(const char *username, const char *password ); -void http_debug_hdr( HTTP_header_t *http_hdr ); + virtual void debug_hdr(); + virtual void cookies_set(const char *hostname, const char *url); -int base64_encode(const any_t*enc, int encLen, char *out, int outMax); + char* buffer; + size_t buffer_size; + unsigned int status_code; + unsigned char* body; + size_t body_size; + const char* get_reason_phrase() const { return reason_phrase; } + const char* get_protocol() const { return protocol; } + private: + char* protocol; + char* method; + char* uri; + char* reason_phrase; + unsigned int http_minor_version; + // Field variables + HTTP_field_t* first_field; + HTTP_field_t* last_field; + unsigned int field_nb; + char* field_search; + HTTP_field_t* field_search_pos; + // Body variables + unsigned int is_parsed; + }; + + extern int base64_encode(const any_t*enc, int encLen, char *out, int outMax); +} // namespace mpxp #endif // __HTTP_H Modified: mplayerxp/libmpstream/network.cpp =================================================================== --- mplayerxp/libmpstream/network.cpp 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/network.cpp 2012-12-10 17:44:11 UTC (rev 535) @@ -172,48 +172,46 @@ } MPXP_Rc http_send_request(Tcp& tcp, URL_t *url, off_t pos ) { - HTTP_header_t *http_hdr; + HTTP_Header* http_hdr = new(zeromem) HTTP_Header; URL_t *server_url; char str[256]; int ret; int proxy = 0; // Boolean - http_hdr = http_new_header(); - if( !strcasecmp(url->protocol, "http_proxy") ) { proxy = 1; server_url = url_new( (url->file)+1 ); - http_set_uri( http_hdr, server_url->url ); + http_hdr->set_uri(server_url->url ); } else { server_url = url; - http_set_uri( http_hdr, server_url->file ); + http_hdr->set_uri( server_url->file ); } if (server_url->port && server_url->port != 80) snprintf(str, 256, "Host: %s:%d", server_url->hostname, server_url->port ); else snprintf(str, 256, "Host: %s", server_url->hostname ); - http_set_field( http_hdr, str); + http_hdr->set_field(str); if (net_conf.useragent) { snprintf(str, 256, "User-Agent: %s", net_conf.useragent); - http_set_field(http_hdr, str); + http_hdr->set_field(str); } else - http_set_field( http_hdr, "User-Agent: MPlayerXP/"VERSION); + http_hdr->set_field("User-Agent: MPlayerXP/"VERSION); - http_set_field(http_hdr, "Icy-MetaData: 1"); + http_hdr->set_field("Icy-MetaData: 1"); if(pos>0) { // Extend http_send_request with possibility to do partial content retrieval snprintf(str, 256, "Range: bytes=%d-", (int)pos); - http_set_field(http_hdr, str); + http_hdr->set_field(str); } - if (net_conf.cookies_enabled) cookies_set( http_hdr, server_url->hostname, server_url->url ); + if (net_conf.cookies_enabled) http_hdr->cookies_set( server_url->hostname, server_url->url ); - http_set_field( http_hdr, "Connection: closed"); - http_add_basic_authentication( http_hdr, url->username, url->password ); - if( http_build_request( http_hdr )==NULL ) { + http_hdr->set_field( "Connection: closed"); + http_hdr->add_basic_authentication( url->username, url->password ); + if( http_hdr->build_request( )==NULL ) { goto err_out; } @@ -237,46 +235,43 @@ goto err_out; } - http_free( http_hdr ); + delete http_hdr; return MPXP_Ok; err_out: - http_free(http_hdr); + delete http_hdr; if (proxy && server_url) url_free(server_url); return MPXP_False; } -HTTP_header_t* http_read_response( Tcp& tcp ) { - HTTP_header_t *http_hdr; +HTTP_Header* http_read_response( Tcp& tcp ) { + HTTP_Header* http_hdr = new(zeromem) HTTP_Header; char response[BUFFER_SIZE]; int i; - http_hdr = http_new_header(); - if( http_hdr==NULL ) { - return NULL; - } + if( http_hdr==NULL ) return NULL; do { i = tcp.read((uint8_t*)response, BUFFER_SIZE); if( i<0 ) { MSG_ERR("Read failed\n"); - http_free( http_hdr ); + delete http_hdr; return NULL; } if( i==0 ) { MSG_ERR("http_read_response read 0 -ie- EOF\n"); - http_free( http_hdr ); + delete http_hdr; return NULL; } - http_response_append( http_hdr, response, i ); - } while( !http_is_header_entire( http_hdr ) ); - http_response_parse( http_hdr ); + http_hdr->response_append(response, i ); + } while( !http_hdr->is_header_entire() ); + http_hdr->response_parse(); return http_hdr; } int -http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) { +http_authenticate(HTTP_Header& http_hdr, URL_t *url, int *auth_retry) { char *aut; if( *auth_retry==1 ) { @@ -294,7 +289,7 @@ } } - aut = http_get_field(http_hdr, "WWW-Authenticate"); + aut = http_hdr.get_field("WWW-Authenticate"); if( aut!=NULL ) { char *aut_space; aut_space = strstr(aut, "realm="); @@ -327,7 +322,7 @@ } off_t http_seek(Tcp& tcp, networking_t *networking, off_t pos ) { - HTTP_header_t *http_hdr = NULL; + HTTP_Header* http_hdr = NULL; tcp.close(); if(http_send_request(tcp,networking->url, pos)==MPXP_Ok) return 0; @@ -339,22 +334,22 @@ switch( http_hdr->status_code ) { case 200: case 206: // OK - MSG_V("Content-Type: [%s]\n", http_get_field(http_hdr, "Content-Type") ); - MSG_V("Content-Length: [%s]\n", http_get_field(http_hdr, "Content-Length") ); + MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); + MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); if( http_hdr->body_size>0 ) { if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { - http_free( http_hdr ); + delete http_hdr; return 0; } } break; default: - MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase ); + MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); tcp.close(); } if( http_hdr ) { - http_free( http_hdr ); + delete http_hdr; networking->data = NULL; } @@ -364,7 +359,7 @@ // By using the protocol, the extension of the file or the content-type // we might be able to guess the networking type. static MPXP_Rc autodetectProtocol(networking_t *networking, Tcp& tcp) { - HTTP_header_t *http_hdr=NULL; + HTTP_Header *http_hdr=NULL; unsigned int i; int redirect; int auth_retry=0; @@ -404,34 +399,34 @@ http_hdr = http_read_response(tcp); if( http_hdr==NULL ) goto err_out; - if( mp_conf.verbose ) http_debug_hdr( http_hdr ); + if( mp_conf.verbose ) http_hdr->debug_hdr(); networking->data = (any_t*)http_hdr; // Check if we can make partial content requests and thus seek in http-streams - if( http_hdr!=NULL && http_hdr->status_code==200 ) { + if( http_hdr->status_code==200 ) { char *accept_ranges; - if( (accept_ranges = http_get_field(http_hdr,"Accept-Ranges")) != NULL ) + if( (accept_ranges = http_hdr->get_field("Accept-Ranges")) != NULL ) seekable = strncmp(accept_ranges,"bytes",5)==0?MPXP_Ok:MPXP_False; } // Check if the response is an ICY status_code reason_phrase - if( !strcasecmp(http_hdr->protocol, "ICY") ) { + if( !strcasecmp(http_hdr->get_protocol(), "ICY") ) { switch( http_hdr->status_code ) { case 200: { // OK char *field_data = NULL; // note: I skip icy-notice1 and 2, as they contain html <BR> // and are IMHO useless info ::atmos - if( (field_data = http_get_field(http_hdr, "icy-name")) != NULL ) + if( (field_data = http_hdr->get_field("icy-name")) != NULL ) MSG_INFO("Name : %s\n", field_data); field_data = NULL; - if( (field_data = http_get_field(http_hdr, "icy-genre")) != NULL ) + if( (field_data = http_hdr->get_field("icy-genre")) != NULL ) MSG_INFO("Genre : %s\n", field_data); field_data = NULL; - if( (field_data = http_get_field(http_hdr, "icy-url")) != NULL ) + if( (field_data = http_hdr->get_field("icy-url")) != NULL ) MSG_INFO("Website: %s\n", field_data); field_data = NULL; // XXX: does this really mean public server? ::atmos - if( (field_data = http_get_field(http_hdr, "icy-pub")) != NULL ) + if( (field_data = http_hdr->get_field("icy-pub")) != NULL ) MSG_INFO("Public : %s\n", atoi(field_data)?"yes":"no"); field_data = NULL; - if( (field_data = http_get_field(http_hdr, "icy-br")) != NULL ) + if( (field_data = http_hdr->get_field("icy-br")) != NULL ) MSG_INFO("Bitrate: %skbit/s\n", field_data); field_data = NULL; - if ( (field_data = http_get_field(http_hdr, "content-type")) != NULL ) + if ( (field_data = http_hdr->get_field("content-type")) != NULL ) networking->mime = field_data; return MPXP_Ok; } @@ -457,12 +452,12 @@ switch( http_hdr->status_code ) { case 200: // OK // Look if we can use the Content-Type - content_type = http_get_field( http_hdr, "Content-Type" ); + content_type = http_hdr->get_field("Content-Type" ); if( content_type!=NULL ) { const char *content_length = NULL; MSG_V("Content-Type: [%s]\n", content_type ); - if( (content_length = http_get_field(http_hdr, "Content-Length")) != NULL) - MSG_V("Content-Length: [%s]\n", http_get_field(http_hdr, "Content-Length")); + if( (content_length = http_hdr->get_field("Content-Length")) != NULL) + MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length")); // Check in the mime type table for a demuxer type for( i=0 ; i<(sizeof(mime_type_table)/sizeof(mime_type_table[0])) ; i++ ) { if( !strcasecmp( content_type, mime_type_table[i].mime_type ) ) { @@ -477,7 +472,7 @@ case 301: // Permanently case 302: // Temporarily // TODO: RFC 2616, recommand to detect infinite redirection loops - next_url = http_get_field( http_hdr, "Location" ); + next_url = http_hdr->get_field("Location" ); if( next_url!=NULL ) { networking->url = url = url_redirect( &url, next_url ); if (!strcasecmp(url->protocol, "mms")) goto err_out; @@ -489,11 +484,11 @@ } break; case 401: // Authentication required - if( http_authenticate(http_hdr, url, &auth_retry)<0 ) goto err_out; + if( http_authenticate(*http_hdr,url, &auth_retry)<0 ) goto err_out; redirect = 1; break; default: - MSG_ERR("Server returned %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase ); + MSG_ERR("Server returned %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); goto err_out; } } else { @@ -502,8 +497,7 @@ } } while( redirect ); err_out: - http_free( http_hdr ); - http_hdr = NULL; + delete http_hdr; return MPXP_False; } @@ -562,7 +556,7 @@ } MPXP_Rc nop_networking_start(Tcp& tcp,networking_t* networking ) { - HTTP_header_t *http_hdr = NULL; + HTTP_Header *http_hdr = NULL; char *next_url=NULL; URL_t *rd_url=NULL; MPXP_Rc ret; @@ -575,11 +569,11 @@ switch( http_hdr->status_code ) { case 200: // OK - MSG_V("Content-Type: [%s]\n", http_get_field(http_hdr, "Content-Type") ); - MSG_V("Content-Length: [%s]\n", http_get_field(http_hdr, "Content-Length") ); + MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); + MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); if( http_hdr->body_size>0 ) { if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { - http_free( http_hdr ); + delete http_hdr; return MPXP_False; } } @@ -588,7 +582,7 @@ case 301: // Permanently case 302: // Temporarily ret=MPXP_False; - next_url = http_get_field( http_hdr, "Location" ); + next_url = http_hdr->get_field("Location" ); if (next_url != NULL) rd_url=url_new(next_url); @@ -608,16 +602,16 @@ case 404: //Not found case 500: //Server Error default: - MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase ); + MSG_ERR("Server return %d: %s\n", http_hdr->status_code, http_hdr->get_reason_phrase()); tcp.close(); return MPXP_False; break; } } else { - http_hdr = (HTTP_header_t*)networking->data; + http_hdr = (HTTP_Header*)networking->data; if( http_hdr->body_size>0 ) { if( networking_bufferize( networking, http_hdr->body, http_hdr->body_size )<0 ) { - http_free( http_hdr ); + delete http_hdr; networking->data = NULL; return MPXP_False; } @@ -625,7 +619,7 @@ } if( http_hdr ) { - http_free( http_hdr ); + delete http_hdr; networking->data = NULL; } Modified: mplayerxp/libmpstream/network.h =================================================================== --- mplayerxp/libmpstream/network.h 2012-12-10 16:07:37 UTC (rev 534) +++ mplayerxp/libmpstream/network.h 2012-12-10 17:44:11 UTC (rev 535) @@ -3,9 +3,11 @@ * by Bertrand BAUDET <ber...@ya...> * (C) 2001, MPlayer team. */ - #ifndef __NETWORK_H #define __NETWORK_H +#include "mp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; #include <string> @@ -81,9 +83,9 @@ int nop_networking_seek(Tcp& fd, off_t pos, networking_t *stream_ctrl ); MPXP_Rc http_send_request(Tcp& tcp,URL_t *url, off_t pos); -HTTP_header_t *http_read_response(Tcp& fd); +HTTP_Header* http_read_response(Tcp& fd); -int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry); +int http_authenticate(HTTP_Header& http_hdr, URL_t *url, int *auth_retry); /* * Joey Parrish <jo...@yu...>: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-10 16:07:45
|
Revision: 534 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=534&view=rev Author: nickols_k Date: 2012-12-10 16:07:37 +0000 (Mon, 10 Dec 2012) Log Message: ----------- cleanus Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/libmpstream/mrl.cpp mplayerxp/libmpstream/mrl.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/Makefile 2012-12-10 16:07:37 UTC (rev 534) @@ -68,7 +68,7 @@ $(DO_MAKE_ALL) $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common -$(SRCS): version.h +$(SRCS): dep install: $(TARGET_EXE) ifeq ($(INSTALL),) @@ -103,11 +103,7 @@ -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h -rm -f cpuinfo help_mp.h -version.h: - ./version.sh `$(CC) --version` - $(MAKE) dep - -dep: version.h +dep: $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/configure 2012-12-10 16:07:37 UTC (rev 534) @@ -884,6 +884,8 @@ fi CXXFLAGS=$CFLAGS + +./version.sh ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF Modified: mplayerxp/libmpstream/mrl.cpp =================================================================== --- mplayerxp/libmpstream/mrl.cpp 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/mrl.cpp 2012-12-10 16:07:37 UTC (rev 534) @@ -13,10 +13,11 @@ #include <stdio.h> #endif namespace mpxp { -const char *mrl_parse_line(const char *line,char **user,char **pass,char **ms,char **port) +const char *mrl_parse_line(const std::string& _line,char **user,char **pass,char **ms,char **port) { unsigned ssize; const char *endp,*endl; + const char* line=_line.c_str(); if(user) *user=NULL; if(pass) *pass=NULL; if(ms) *ms=NULL; @@ -82,13 +83,8 @@ return line; } -const char *mrl_parse_line(const std::string& line,char **user,char **pass,char **ms,char **port) +static void mrl_store_args(const std::string& arg,char *value, const mrl_config_t * args) { - return mrl_parse_line(line.c_str(),user,pass,ms,port); -} - -static void mrl_store_args(const char *arg,char *value, const mrl_config_t * args) -{ #ifdef TEST_MRL printf("arg='%s' value='%s'\n",arg,value); return; @@ -96,13 +92,10 @@ unsigned i; int done=0; i=0; - while(arg!=NULL) - { - if(strcmp(arg,args[i].arg)==0) - { + while(args[i].arg!=NULL) { + if(arg==args[i].arg) { done=1; - switch(args[i].type) - { + switch(args[i].type) { case MRL_TYPE_PRINT: MSG_INFO("%s", (char *)args[i].value); default: @@ -117,8 +110,7 @@ *((int *)args[i].value)=args[i].min; delete value; break; - case MRL_TYPE_INT: - { + case MRL_TYPE_INT: { int result=atoi(value); delete value; if(result < args[i].min) result=args[i].min; @@ -126,8 +118,7 @@ *((int *)args[i].value)=result; } break; - case MRL_TYPE_FLOAT: - { + case MRL_TYPE_FLOAT: { int result=atof(value); delete value; if(result < args[i].min) result=args[i].min; @@ -135,8 +126,7 @@ *((float *)args[i].value)=result; } break; - case MRL_TYPE_STRING: - { + case MRL_TYPE_STRING: { char *p=reinterpret_cast<char*>(args[i].value); p=value; break; @@ -146,22 +136,21 @@ } i++; } - if(!done) MSG_WARN(" Can't handle argument: '%s'",arg); + if(!done) MSG_WARN(" Can't handle argument: '%s'",arg.c_str()); } #define MRL_ARG_SEP ',' -const char * mrl_parse_params(const char *param, const mrl_config_t * args) +const char * mrl_parse_params(const std::string& _param, const mrl_config_t * args) { const char *sep,*endp,*endl; char *arg=NULL,*value=NULL; unsigned ssize; + const char* param=_param.c_str(); endl=param+strlen(param); - while(*param) - { + while(*param) { sep=strchr(param,'='); - if(sep) - { + if(sep) { sep++; endp=strchr(sep,MRL_ARG_SEP); if(!endp) endp=endl; @@ -185,9 +174,5 @@ if(value) delete value; return param; } -const char * mrl_parse_params(const std::string& param, const mrl_config_t * args) -{ - return mrl_parse_params(param.c_str(),args); -} } // namespace mpxp Modified: mplayerxp/libmpstream/mrl.h =================================================================== --- mplayerxp/libmpstream/mrl.h 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/mrl.h 2012-12-10 16:07:37 UTC (rev 534) @@ -23,7 +23,6 @@ * x11://~username:passwd@localhost:8081#bpp=32 * @see mrl_parse_params **/ - extern const char *mrl_parse_line(const char *line,char **user,char **pass,char **ms,char **port); extern const char *mrl_parse_line(const std::string& line,char **user,char **pass,char **ms,char **port); enum { @@ -53,7 +52,6 @@ * may want to use non-standard arguments for plugin. * @see mrl_parse_line **/ - extern const char * mrl_parse_params(const char *param,const mrl_config_t * args); extern const char * mrl_parse_params(const std::string& param,const mrl_config_t * args); } // namespace mpxp #endif Modified: mplayerxp/libmpstream/tcp.cpp =================================================================== --- mplayerxp/libmpstream/tcp.cpp 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/tcp.cpp 2012-12-10 16:07:37 UTC (rev 534) @@ -51,7 +51,7 @@ // return -2 for fatal error, like unable to resolve name, connection timeout... // return -1 is unable to connect to a particular port -void Tcp::open(const char *host, int port, tcp_af_e af) { +void Tcp::open(const std::string& host, int port, tcp_af_e af) { socklen_t err_len; int ret,count = 0; fd_set set; @@ -72,7 +72,7 @@ struct timeval to; #endif - MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host); + MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host.c_str()); _fd = ::socket(af==Tcp::IP4?AF_INET:AF_INET6, SOCK_STREAM, 0); if( _fd==-1 ) { @@ -103,26 +103,26 @@ memset(&server_address, 0, sizeof(server_address)); - MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), host); + MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), host.c_str()); #ifndef HAVE_WINSOCK2 #ifdef USE_ATON - if (::inet_aton(host, our_s_addr)!=1) + if (::inet_aton(host.c_str(), our_s_addr)!=1) #else - if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, host, our_s_addr)!=1) + if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, host.c_str(), our_s_addr)!=1) #endif #else - if (::inet_addr(host)==INADDR_NONE ) + if (::inet_addr(host.c_str())==INADDR_NONE ) #endif { - MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), host); + MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), host.c_str()); #ifdef HAVE_GETHOSTBYNAME2 - hp=(struct hostent*)::gethostbyname2( host, af==Tcp::IP4?AF_INET:AF_INET6 ); + hp=(struct hostent*)::gethostbyname2( host.c_str(), af==Tcp::IP4?AF_INET:AF_INET6 ); #else - hp=(struct hostent*)::gethostbyname( host ); + hp=(struct hostent*)::gethostbyname( host.c_str() ); #endif if( hp==NULL ) { - MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), host); + MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), host.c_str()); _error=Tcp::Err_Fatal; return; } @@ -131,7 +131,7 @@ } #ifdef HAVE_WINSOCK2 else { - unsigned long addr = inet_addr(host); + unsigned long addr = inet_addr(host.c_str()); memcpy( our_s_addr, (any_t*)&addr, sizeof(addr) ); } #endif @@ -158,7 +158,7 @@ #else ::inet_ntop(af==Tcp::IP4?AF_INET:AF_INET6, our_s_addr, buf, 255); #endif - MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),host,buf,port); + MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),host.c_str(),buf,port); // Turn the socket as non blocking so we can timeout on the connection #ifndef HAVE_WINSOCK2 @@ -173,7 +173,7 @@ #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { #endif - MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),host); + MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),host.c_str()); ::closesocket(_fd); _fd=-1; _error=Tcp::Err_Port; @@ -224,7 +224,7 @@ } } -Tcp::Tcp(libinput_t* _libinput,const char *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) Modified: mplayerxp/libmpstream/tcp.h =================================================================== --- mplayerxp/libmpstream/tcp.h 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/tcp.h 2012-12-10 16:07:37 UTC (rev 534) @@ -20,6 +20,7 @@ */ #ifndef TCP_H_INCLUDED #define TCP_H_INCLUDED 1 +#include <string> #include <stdint.h> #include "input2/input.h" @@ -39,7 +40,7 @@ Err_None =0 /* no error */ }; Tcp(libinput_t* libinput,net_fd_t fd); - Tcp(libinput_t* libinput,const char *host,int port,tcp_af_e af=Tcp::IP4); + Tcp(libinput_t* libinput,const std::string& host,int port,tcp_af_e af=Tcp::IP4); virtual ~Tcp(); Tcp& operator=(Tcp& other); @@ -50,7 +51,7 @@ virtual tcp_error_e error() const; virtual libinput_t* get_libinput() const; - virtual void open(const char *host,int port,tcp_af_e af=Tcp::IP4); + 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); virtual int write(const uint8_t* buf,unsigned len,int flags=0) const; virtual void close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |