[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[83] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-07 09:23:05
|
Revision: 83 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=83&view=rev Author: nickols_k Date: 2010-01-07 09:22:57 +0000 (Thu, 07 Jan 2010) Log Message: ----------- add: --long-help option Modified Paths: -------------- mplayerxp/cfgparser.c mplayerxp/codec-cfg.c mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/vd.c mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/vf.c Modified: mplayerxp/cfgparser.c =================================================================== --- mplayerxp/cfgparser.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/cfgparser.c 2010-01-07 09:22:57 UTC (rev 83) @@ -86,7 +86,7 @@ } memset(&save[sl],0,2*sizeof(config_save_t)); save[sl].opt = conf; - + switch(conf->type) { case CONF_TYPE_FLAG : case CONF_TYPE_INT : @@ -97,13 +97,13 @@ break; case CONF_TYPE_STRING : save[sl].param.as_pointer = *((char**)conf->p); - break; + break; case CONF_TYPE_FUNC_FULL : if(strcasecmp(conf->name,opt) != 0) save->opt_name = strdup(opt); case CONF_TYPE_FUNC_PARAM : if(param) save->param.as_pointer = strdup(param); - case CONF_TYPE_FUNC : + case CONF_TYPE_FUNC : break; default : MSG_ERR("Should never append in m_config_save_option : conf->type=%d\n",conf->type); @@ -170,7 +170,7 @@ if (iter->param.as_pointer == NULL) { MSG_ERR("We lost param for option %s?\n",iter->opt->name); return -1; - } + } if ((((cfg_func_param_t) iter->opt->p)(iter->opt, (char*)iter->param.as_pointer)) < 0) return -1; break; @@ -181,7 +181,7 @@ }else { if (((cfg_func_arg_param_t) save->opt->p)(iter->opt, arg, (char*)iter->param.as_pointer) < 0) return -1; - + } break; } @@ -189,7 +189,7 @@ default : MSG_ERR("Why do we reverse this : name=%s type=%d ?\n",save->opt->name,save->opt->type); } - + return 1; } @@ -216,7 +216,7 @@ 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); @@ -393,7 +393,7 @@ free(pr); if(channel) free(channel); - + } } @@ -445,7 +445,7 @@ if (config->parser_mode == CONFIG_FILE) MSG_ERR( "invalid option: %s\n",opt); ret = ERR_NOT_AN_OPTION; - goto out; + goto out; option_found : MSG_DBG3( "read_option: name='%s' p=%p type=%d\n", conf[i].name, conf[i].p, conf[i].type); @@ -639,7 +639,7 @@ int sscanf_ret; /* clear out */ subopt[0] = subparam[0] = 0; - + sscanf_ret = sscanf(token, "%[^=]=%s", subopt, subparam); MSG_DBG3( "token: '%s', i=%d, subopt='%s', subparam='%s' (ret: %d)\n", token, i, subopt, subparam, sscanf_ret); @@ -930,6 +930,8 @@ return ret; } +extern void show_help(void); +extern void show_long_help(void); int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) { int i; @@ -955,8 +957,16 @@ for (i = 1; i < argc; i++) { //next: opt = argv[i]; + if(strcmp(opt,"--help")==0) { + show_help(); + exit(0); + } + if(strcmp(opt,"--long-help")==0) { + show_long_help(); + exit(0); + } /* check for -- (no more options id.) except --help! */ - if ((*opt == '-') && (*(opt+1) == '-') && (*(opt+2) != 'h')) + if ((*opt == '-') && (*(opt+1) == '-')) { no_more_opts = 1; if (i+1 >= argc) @@ -969,7 +979,7 @@ if((opt[0] == '{') && (opt[1] == '\0')) { play_tree_t* entry = play_tree_new(); - UNSET_GLOBAL(config); + UNSET_GLOBAL(config); if(config->last_entry == NULL) { play_tree_set_child(config->last_parent,entry); } else { @@ -990,7 +1000,7 @@ config->last_parent = config->last_entry->parent; continue; } - + if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */ { /* remove leading '-' */ @@ -1022,8 +1032,8 @@ /* 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_set_child(config->last_parent,entry); + else play_tree_append_entry(config->last_entry,entry); config->last_entry = entry; } @@ -1034,7 +1044,7 @@ MSG_ERR("Missing }- ?\n"); UNSET_GLOBAL(config); SET_RUNNING(config); - return 1; + return 1; #if 0 err_out_mem: MSG_ERR( "can't allocate memory for filenames (%s)\n", strerror(errno)); @@ -1054,12 +1064,12 @@ assert(config != NULL); assert(args != NULL); #endif - + if(conf_list) { for ( ; conf_list[list_len] != NULL; list_len++) /* NOTHING */; } - + conf_list = (config_t**)realloc(conf_list,sizeof(struct conf*)*(list_len+2)); if(conf_list == NULL) { MSG_ERR( "Can't allocate %d bytes of memory : %s\n",sizeof(struct conf*)*(list_len+2),strerror(errno)); @@ -1215,12 +1225,12 @@ int m_config_switch_flag(m_config_t *config,const char* opt) { config_t *conf; - + #ifdef MP_DEBUG assert(config != NULL); assert(opt != NULL); #endif - + 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; @@ -1229,7 +1239,7 @@ return 1; } - + int m_config_set_flag(m_config_t* config,const char* opt, int state) { config_t *conf; @@ -1275,7 +1285,7 @@ opt = m_config_get_option(config,arg); - if(!opt) + if(!opt) return -1; for(l = config->cs_level ; l >= 0 ; l--) { Modified: mplayerxp/codec-cfg.c =================================================================== --- mplayerxp/codec-cfg.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/codec-cfg.c 2010-01-07 09:22:57 UTC (rev 83) @@ -702,34 +702,39 @@ } void list_codecs(int audioflag){ - int i; - codecs_t *c; + int i; + codecs_t *c; - if (audioflag) { - i = nr_acodecs; - c = audio_codecs; - MSG_INFO("ac: afm: status: info: [lib/dll]\n"); - } else { - i = nr_vcodecs; - c = video_codecs; - MSG_INFO("vc: vfm: status: info: [lib/dll]\n"); + if (audioflag) { + i = nr_acodecs; + c = audio_codecs; + MSG_INFO("Available audio codecs:\n"); + } else { + i = nr_vcodecs; + c = video_codecs; + MSG_INFO("Available video codecs:\n"); + } + MSG_INFO(" %-11s %-10s %s %s [%s]\n" + ,audioflag?"ac:":"vc:" + ,audioflag?"afm:":"vfm:" + ,"status:" + ,"info:" + ,"lib/dll"); + if(!i) return; + for (/* NOTHING */; i--; c++) { + char* s="unknown "; + switch(c->status){ + case CODECS_STATUS_WORKING: s="working ";break; + case CODECS_STATUS_PROBLEMS: s="problems";break; + case CODECS_STATUS_NOT_WORKING: s="crashing";break; + case CODECS_STATUS_UNTESTED: s="untested";break; } - if(!i) return; - for (/* NOTHING */; i--; c++) { - char* s="unknown "; - switch(c->status){ - case CODECS_STATUS_WORKING: s="working ";break; - case CODECS_STATUS_PROBLEMS: s="problems";break; - case CODECS_STATUS_NOT_WORKING: s="crashing";break; - case CODECS_STATUS_UNTESTED: s="untested";break; - } - if(c->dll_name) - MSG_INFO("%-11s %s %s %s [%s]\n",c->codec_name,c->driver_name,s,c->s_info,c->dll_name); - else - MSG_INFO("%-11s %s %s %s\n",c->codec_name,c->driver_name,s,c->s_info); - - } - + if(c->dll_name) + MSG_INFO(" %-11s %-10s %s %s [%s]\n",c->codec_name,c->driver_name,s,c->s_info,c->dll_name); + else + MSG_INFO(" %-11s %-10s %s %s\n",c->codec_name,c->driver_name,s,c->s_info); + } + MSG_INFO("\n"); } Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/libmpcodecs/ad.c 2010-01-07 09:22:57 UTC (rev 83) @@ -76,9 +76,11 @@ void afm_help(void) { unsigned i; + MSG_INFO("Available audio codec families/drivers:\n"); for(i=0;i<nddrivers;i++) { if(mpcodecs_ad_drivers[i]) if(mpcodecs_ad_drivers[i]->options) - MSG_INFO(" %-10s %s\n",mpcodecs_ad_drivers[i]->info->driver_name,mpcodecs_ad_drivers[i]->info->descr); + MSG_INFO("\t%-10s %s\n",mpcodecs_ad_drivers[i]->info->driver_name,mpcodecs_ad_drivers[i]->info->descr); } + MSG_INFO("\n"); } Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/libmpcodecs/vd.c 2010-01-07 09:22:57 UTC (rev 83) @@ -85,11 +85,13 @@ void vfm_help(void) { unsigned i; + MSG_INFO("Available video codec families/drivers:\n"); for(i=0;i<nddrivers;i++) { if(mpcodecs_vd_drivers[i]) if(mpcodecs_vd_drivers[i]->options) - MSG_INFO(" %-10s %s\n",mpcodecs_vd_drivers[i]->info->driver_name,mpcodecs_vd_drivers[i]->info->descr); + MSG_INFO("\t%-10s %s\n",mpcodecs_vd_drivers[i]->info->driver_name,mpcodecs_vd_drivers[i]->info->descr); } + MSG_INFO("\n"); } #include "libvo/video_out.h" Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/mplayer.c 2010-01-07 09:22:57 UTC (rev 83) @@ -930,6 +930,7 @@ } #endif + static void init_player( void ) { if(video_driver && strcmp(video_driver,"help")==0) @@ -937,60 +938,72 @@ vo_print_help(); exit(0); } - if(audio_driver && strcmp(audio_driver,"help")==0) { ao_print_help(); exit(0); } - - /* check codec.conf*/ - if(!parse_codec_cfg(get_path("codecs.conf"))){ - if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ - MSG_HINT(MSGTR_CopyCodecsConf); - exit(0); - } + if(video_family && strcmp(video_family,"help")==0){ + vfm_help(); + exit(0); } - - if(audio_codec && strcmp(audio_codec,"help")==0){ - MSG_INFO("Available audio codecs:\n"); - list_codecs(1); - MSG_INFO("\n"); + if(audio_family && strcmp(audio_family,"help")==0){ + afm_help(); exit(0); } - if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0){ vf_help(); MSG_INFO("\n"); exit(0); } - if(af_cfg.list && strcmp(af_cfg.list,"help")==0){ af_help(); MSG_INFO("\n"); exit(0); } + /* check codec.conf*/ + if(!parse_codec_cfg(get_path("codecs.conf"))){ + if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ + MSG_HINT(MSGTR_CopyCodecsConf); + exit(0); + } + } + + if(audio_codec && strcmp(audio_codec,"help")==0){ + list_codecs(1); + exit(0); + } if(video_codec && strcmp(video_codec,"help")==0){ - MSG_INFO("Available video codecs:\n"); list_codecs(0); - MSG_INFO("\n"); exit(0); } +} - if(video_family && strcmp(video_family,"help")==0){ - MSG_INFO("Available video codec families/drivers:\n"); - vfm_help(); - MSG_INFO("\n"); - exit(0); - } +void show_help(void) { + // no file/vcd/dvd -> show HELP: + MSG_INFO("%s",help_text); + print_stream_drivers(); + MSG_INFO("\nUse --long-help option for full help\n"); +} - if(audio_family && strcmp(audio_family,"help")==0){ - MSG_INFO("Available audio codec families/drivers:\n"); - afm_help(); - MSG_INFO("\n"); - exit(0); +void show_long_help(void) { + show_help(); + vo_print_help(); + ao_print_help(); + vf_help(); + af_help(); + vfm_help(); + afm_help(); + /* check codec.conf*/ + if(!parse_codec_cfg(get_path("codecs.conf"))){ + if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ + MSG_HINT(MSGTR_CopyCodecsConf); + exit(0); + } } + list_codecs(0); + list_codecs(1); } int decore_audio( int xp_id ) @@ -1003,17 +1016,17 @@ int playsize; float pts=HUGE; int ret=0; - + ao_data.pts=sh_audio->timer*90000.0; playsize=ao_get_space(); - + if(!playsize) { if(sh_video) break; // buffer is full, do not block here!!! usec_sleep(10000); // Wait a tick before retry continue; } - + if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! //if(playsize>outburst) playsize=outburst; @@ -2104,9 +2117,7 @@ init_player(); if(!filename){ - // no file/vcd/dvd -> show HELP: - MSG_INFO("%s",help_text); - print_stream_drivers(); + show_help(); return 0; } Modified: mplayerxp/postproc/af.c =================================================================== --- mplayerxp/postproc/af.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/postproc/af.c 2010-01-07 09:22:57 UTC (rev 83) @@ -706,11 +706,12 @@ MSG_INFO( "Available audio filters:\n"); while (filter_list[i]) { if (filter_list[i]->comment && filter_list[i]->comment[0]) - MSG_INFO( " %-15s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); + MSG_INFO( "\t%-10s: %s (%s)\n", filter_list[i]->name, filter_list[i]->info, filter_list[i]->comment); else - MSG_INFO( " %-15s: %s\n", filter_list[i]->name, filter_list[i]->info); + MSG_INFO( "\t%-10s: %s\n", filter_list[i]->name, filter_list[i]->info); i++; } + MSG_INFO("\n"); } af_stream_t *af_new(void *_parent) Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2010-01-06 18:42:48 UTC (rev 82) +++ mplayerxp/postproc/vf.c 2010-01-07 09:22:57 UTC (rev 83) @@ -468,10 +468,12 @@ void vf_help(){ int i=0; + MSG_INFO( "Available video filters:\n"); while(filter_list[i]){ MSG_INFO("\t%-10s: %s\n",filter_list[i]->name,filter_list[i]->info); i++; } + MSG_INFO("\n"); } extern vf_cfg_t vf_cfg; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |