mirror of https://github.com/mpv-player/mpv
Convert vo_aa suboption parser to using the subopt-helper.
This obsoletes all -aa* commandline options. Use -vo aa:* instead. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14936 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
0c7b6fc212
commit
b0e5f570bb
|
@ -1912,11 +1912,6 @@ plugin audio output driver
|
||||||
.SH "VIDEO OUTPUT OPTIONS (MPLAYER ONLY)"
|
.SH "VIDEO OUTPUT OPTIONS (MPLAYER ONLY)"
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-aa* (\-vo aa only)
|
|
||||||
You can get a list and an explanation of available options executing
|
|
||||||
.I mplayer \-aahelp
|
|
||||||
.
|
|
||||||
.TP
|
|
||||||
.B \-adapter <value>
|
.B \-adapter <value>
|
||||||
Set the graphics card that will receive the image.
|
Set the graphics card that will receive the image.
|
||||||
Needs the \-vm option to work.
|
Needs the \-vm option to work.
|
||||||
|
@ -2637,8 +2632,10 @@ Produces no video output.
|
||||||
Useful for benchmarking.
|
Useful for benchmarking.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B aa (also see \-aa*)
|
.B aa\ \ \ \ \
|
||||||
ASCII art video output driver that works on a text console.
|
ASCII art video output driver that works on a text console.
|
||||||
|
You can get a list and an explanation of available suboptions executing
|
||||||
|
.I mplayer \-vo aa:help
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B caca\ \ \
|
.B caca\ \ \
|
||||||
|
|
|
@ -73,11 +73,6 @@ extern int WinID;
|
||||||
extern int menu_startup;
|
extern int menu_startup;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_AA
|
|
||||||
extern int vo_aa_parseoption(m_option_t* conf, char *opt, char * param);
|
|
||||||
extern void vo_aa_revertoption(m_option_t* opt,char* param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ZR
|
#ifdef HAVE_ZR
|
||||||
extern int vo_zr_parseoption(m_option_t* conf, char *opt, char * param);
|
extern int vo_zr_parseoption(m_option_t* conf, char *opt, char * param);
|
||||||
extern void vo_zr_revertoption(m_option_t* opt,char* pram);
|
extern void vo_zr_revertoption(m_option_t* opt,char* pram);
|
||||||
|
@ -284,7 +279,7 @@ m_option_t mplayer_opts[]={
|
||||||
|
|
||||||
#ifdef HAVE_AA
|
#ifdef HAVE_AA
|
||||||
// -vo aa
|
// -vo aa
|
||||||
{"aa*", vo_aa_parseoption, CONF_TYPE_FUNC_FULL, 0, 0, 0 , &vo_aa_revertoption},
|
{"aa*", "-aa* is deprecated. Use -vo aa:suboption instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ZR
|
#ifdef HAVE_ZR
|
||||||
|
|
|
@ -897,6 +897,16 @@ static char help_text[]=
|
||||||
#define MSGTR_VO_NoValueSpecified "No value specified."
|
#define MSGTR_VO_NoValueSpecified "No value specified."
|
||||||
#define MSGTR_VO_UnknownSuboptions "Unknown suboption(s)"
|
#define MSGTR_VO_UnknownSuboptions "Unknown suboption(s)"
|
||||||
|
|
||||||
|
// vo_aa.c
|
||||||
|
|
||||||
|
#define MSGTR_VO_AA_HelpHeader "\n\nHere are the aalib vo_aa suboptions:\n"
|
||||||
|
#define MSGTR_VO_AA_AdditionalOptions "Additional options vo_aa provides:\n" \
|
||||||
|
" help print this help message\n" \
|
||||||
|
" osdcolor set osd color\n subcolor set subtitle color\n" \
|
||||||
|
" the color parameters are:\n 0 : normal\n" \
|
||||||
|
" 1 : dim\n 2 : bold\n 3 : boldfont\n" \
|
||||||
|
" 4 : reverse\n 5 : special\n\n\n"
|
||||||
|
|
||||||
// vo_jpeg.c
|
// vo_jpeg.c
|
||||||
#define MSGTR_VO_JPEG_ProgressiveJPEG "Progressive JPEG enabled."
|
#define MSGTR_VO_JPEG_ProgressiveJPEG "Progressive JPEG enabled."
|
||||||
#define MSGTR_VO_JPEG_NoProgressiveJPEG "Progressive JPEG disabled."
|
#define MSGTR_VO_JPEG_NoProgressiveJPEG "Progressive JPEG disabled."
|
||||||
|
|
181
libvo/vo_aa.c
181
libvo/vo_aa.c
|
@ -34,7 +34,8 @@
|
||||||
|
|
||||||
#include "osdep/keycodes.h"
|
#include "osdep/keycodes.h"
|
||||||
#include <aalib.h>
|
#include <aalib.h>
|
||||||
#include "m_option.h"
|
#include "subopt-helper.h"
|
||||||
|
#include "help_mp.h"
|
||||||
#include "mp_msg.h"
|
#include "mp_msg.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,11 +289,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width,
|
||||||
|
|
||||||
mp_msg(MSGT_VO,MSGL_INFO,
|
mp_msg(MSGT_VO,MSGL_INFO,
|
||||||
"\n"
|
"\n"
|
||||||
"Important Options\n"
|
"Important suboptions\n"
|
||||||
"\t-aaextended use use all 256 characters\n"
|
"\textended use use all 256 characters\n"
|
||||||
"\t-aaeight use eight bit ascii\n"
|
"\teight use eight bit ascii\n"
|
||||||
"\t-aadriver set recommended aalib driver (X11,curses,linux)\n"
|
"\tdriver set recommended aalib driver (X11,curses,linux)\n"
|
||||||
"\t-aahelp to see all options provided by aalib\n"
|
"\thelp to see all options provided by aalib\n"
|
||||||
"\n"
|
"\n"
|
||||||
"AA-MPlayer Keys\n"
|
"AA-MPlayer Keys\n"
|
||||||
"\t1 : contrast -\n"
|
"\t1 : contrast -\n"
|
||||||
|
@ -588,94 +589,94 @@ getcolor(char * s){
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int parse_suboptions(const char *arg) {
|
||||||
vo_aa_parseoption(m_option_t * conf, char *opt, char *param){
|
char *pseudoargv[4], *osdcolor = NULL, *subcolor = NULL, **strings,
|
||||||
/* got an option starting with aa */
|
*helpmsg = NULL;
|
||||||
char *pseudoargv[4];
|
int pseudoargc, displayhelp = 0, *booleans;
|
||||||
int pseudoargc;
|
opt_t extra_opts[] = {
|
||||||
char * x, *help;
|
{"osdcolor", OPT_ARG_MSTRZ, &osdcolor, NULL, 0},
|
||||||
int i;
|
{"subcolor", OPT_ARG_MSTRZ, &subcolor, NULL, 0},
|
||||||
/* do WE need it ? */
|
{"help", OPT_ARG_BOOL, &displayhelp, NULL, 0} };
|
||||||
if (!strcasecmp(opt, "aaosdcolor")){
|
opt_t *subopts = NULL, *p;
|
||||||
if (param==NULL) return M_OPT_MISSING_PARAM;
|
char *strings_list[] = {"-driver", "-kbddriver", "-mousedriver", "-font",
|
||||||
if ((i=getcolor(param))==-1) return M_OPT_OUT_OF_RANGE;
|
"-width", "-height", "-minwidth", "-minheight", "-maxwidth",
|
||||||
aaopt_osdcolor=i;
|
"-maxheight", "-recwidth", "-recheight", "-bright", "-contrast",
|
||||||
return 1;
|
"-gamma", "-dimmul", "-boldmul", "-random" };
|
||||||
}else if (!strcasecmp(opt, "aasubcolor")){
|
char *booleans_list[] = {"-dim", "-bold", "-reverse", "-normal",
|
||||||
if ((i=getcolor(param))==-1) return M_OPT_OUT_OF_RANGE;
|
"-boldfont", "-inverse", "-extended", "-eight", "-dither",
|
||||||
aaopt_subcolor=i;
|
"-floyd_steinberg", "-error_distribution"};
|
||||||
return 1;
|
char *nobooleans_list[] = {"-nodim", "-nobold", "-noreverse", "-nonormal",
|
||||||
}else if (!strcasecmp(opt, "aahelp")){
|
"-noboldfont", "-noinverse", "-noextended", "-noeight", "-nodither",
|
||||||
printf("Here are the aalib options:\n");
|
"-nofloyd_steinberg", "-noerror_distribution"};
|
||||||
help=strdup(aa_help); /* aa_help is const :( */
|
const int nstrings = sizeof(strings_list) / sizeof(char*);
|
||||||
x=strtok(help,"-");
|
const int nbooleans = sizeof(booleans_list) / sizeof(int);
|
||||||
printf(x);
|
const int nextra_opts = sizeof(extra_opts) / sizeof(opt_t);
|
||||||
while ((x=strtok(NULL, "-"))){
|
const int nsubopts = nstrings + nbooleans + nextra_opts;
|
||||||
if (*(x-2)==' ') printf("-aa");
|
int i, retval = 0;
|
||||||
else printf("-");
|
|
||||||
printf("%s", x);
|
|
||||||
}
|
|
||||||
printf(
|
|
||||||
"\n"
|
|
||||||
"\n"
|
|
||||||
"Additional options vo_aa provides:\n"
|
|
||||||
" -aaosdcolor set osd color\n"
|
|
||||||
" -aasubcolor set subtitle color\n"
|
|
||||||
" the color parameters are:\n"
|
|
||||||
" 0 : normal\n"
|
|
||||||
" 1 : dim\n"
|
|
||||||
" 2 : bold\n"
|
|
||||||
" 3 : boldfont\n"
|
|
||||||
" 4 : reverse\n"
|
|
||||||
" 5 : special\n"
|
|
||||||
"\n\n"
|
|
||||||
" dT8 8Tb\n"
|
|
||||||
" dT 8 8 Tb\n"
|
|
||||||
" dT 8 8 Tb\n"
|
|
||||||
" <PROJECT><PROJECT>\n"
|
|
||||||
" dT 8 8 Tb\n"
|
|
||||||
" dT 8 8 Tb\n"
|
|
||||||
"\n"
|
|
||||||
|
|
||||||
);
|
subopts = calloc(nsubopts + 1, sizeof(opt_t));
|
||||||
exit(0);
|
strings = calloc(nstrings, sizeof(char*));
|
||||||
|
booleans = calloc(nbooleans, sizeof(int));
|
||||||
}else{
|
|
||||||
/* parse param to aalib */
|
|
||||||
pseudoargv[1]=malloc(strlen(opt));
|
|
||||||
pseudoargv[3]=NULL;
|
|
||||||
sprintf(pseudoargv[1], "-%s", opt+2);
|
|
||||||
if (param!=NULL){
|
|
||||||
pseudoargv[2]=param;
|
|
||||||
pseudoargc=3;
|
|
||||||
}else{
|
|
||||||
pseudoargv[2]=NULL;
|
|
||||||
pseudoargc=2;
|
|
||||||
}
|
|
||||||
fprintf(stderr,"VO: [aa] ");
|
|
||||||
i=aa_parseoptions(&aa_defparams, &aa_defrenderparams, &pseudoargc, pseudoargv);
|
|
||||||
if (i!=1){
|
|
||||||
return M_OPT_MISSING_PARAM;
|
|
||||||
}
|
|
||||||
if (pseudoargv[1]!=NULL){
|
|
||||||
/* aalib has given param back */
|
|
||||||
fprintf(stderr," Parameter -%s accepted\n", opt);
|
|
||||||
return 0; /* param could be the filename */
|
|
||||||
}
|
|
||||||
fprintf(stderr," Parameter -%s %s accepted\n", opt, ((param==NULL) ? "" : param) );
|
|
||||||
return 1; /* all opt & params accepted */
|
|
||||||
|
|
||||||
|
p = subopts;
|
||||||
|
for (i=0; i<nstrings; i++, p++) {
|
||||||
|
p->name = strings_list[i] + 1; // skip '-'
|
||||||
|
p->type = OPT_ARG_MSTRZ;
|
||||||
|
p->valp = &strings[i];
|
||||||
}
|
}
|
||||||
return M_OPT_UNKNOWN;
|
for (i=0; i<nbooleans; i++, p++) {
|
||||||
|
p->name = booleans_list[i] + 1;
|
||||||
|
p->type = OPT_ARG_BOOL;
|
||||||
|
p->valp = &booleans[i];
|
||||||
|
}
|
||||||
|
memcpy(p, extra_opts, sizeof(extra_opts));
|
||||||
|
|
||||||
}
|
retval = subopt_parse(arg, subopts);
|
||||||
|
|
||||||
void
|
if (retval == 0 && displayhelp) {
|
||||||
vo_aa_revertoption(m_option_t* opt,char* param) {
|
helpmsg = strdup(aa_help);
|
||||||
if (!strcasecmp(param, "aaosdcolor"))
|
for (i=0; i<(signed)strlen(helpmsg); i++)
|
||||||
aaopt_osdcolor= AA_SPECIAL;
|
if (helpmsg[i] == '-') helpmsg[i] = ' ';
|
||||||
else if (!strcasecmp(param, "aasubcolor"))
|
mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_HelpHeader);
|
||||||
aaopt_subcolor= AA_SPECIAL;
|
mp_msg(MSGT_VO, MSGL_INFO, "%s\n\n", helpmsg);
|
||||||
|
mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_AdditionalOptions);
|
||||||
|
retval = -1;
|
||||||
|
}
|
||||||
|
if (retval == 0) {
|
||||||
|
pseudoargv[3] = NULL;
|
||||||
|
for (i=0; i<nstrings; i++) {
|
||||||
|
pseudoargc = 3; // inside loop because aalib changes it
|
||||||
|
if (strings[i] != NULL) {
|
||||||
|
pseudoargv[1] = strings_list[i];
|
||||||
|
pseudoargv[2] = strings[i];
|
||||||
|
aa_parseoptions(&aa_defparams, &aa_defrenderparams,
|
||||||
|
&pseudoargc, pseudoargv) != 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pseudoargv[2] = NULL;
|
||||||
|
for (i=0; i<nbooleans; i++) {
|
||||||
|
pseudoargc = 2;
|
||||||
|
if (booleans[i]) pseudoargv[1] = booleans_list[i];
|
||||||
|
else pseudoargv[1] = nobooleans_list[i];
|
||||||
|
aa_parseoptions(&aa_defparams, &aa_defrenderparams,
|
||||||
|
&pseudoargc, pseudoargv) != 1;
|
||||||
|
}
|
||||||
|
if (osdcolor) aaopt_osdcolor = getcolor(osdcolor);
|
||||||
|
if (subcolor) aaopt_subcolor = getcolor(subcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subopts) free(subopts);
|
||||||
|
if (booleans) free(booleans);
|
||||||
|
if (strings) {
|
||||||
|
for (i=0; i<nstrings; i++)
|
||||||
|
if (strings[i])
|
||||||
|
free(strings[i]);
|
||||||
|
free(strings);
|
||||||
|
}
|
||||||
|
if (osdcolor) free(osdcolor);
|
||||||
|
if (subcolor) free(subcolor);
|
||||||
|
if (helpmsg) free(helpmsg);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t preinit(const char *arg)
|
static uint32_t preinit(const char *arg)
|
||||||
|
@ -689,7 +690,7 @@ static uint32_t preinit(const char *arg)
|
||||||
|
|
||||||
if(arg)
|
if(arg)
|
||||||
{
|
{
|
||||||
mp_msg(MSGT_VO,MSGL_ERR,"vo_aa: Unknown subdevice: %s\n",arg);
|
if (parse_suboptions(arg) != 0)
|
||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue