[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[554] mplayerxp
Brought to you by:
olov
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. |