options: move sub_name, sub_auto and vobsub_name to struct

This commit is contained in:
Clément Bœsch 2011-02-08 00:35:51 +01:00 committed by Uoti Urpala
parent 59fff90d94
commit 4587f030cc
6 changed files with 15 additions and 17 deletions

View File

@ -628,7 +628,7 @@ const m_option_t common_opts[] = {
{"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
// ------------------------- subtitles options --------------------
{"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
OPT_STRINGLIST("sub", sub_name, 0),
#ifdef CONFIG_FRIBIDI
{"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL},
@ -647,8 +647,7 @@ const m_option_t common_opts[] = {
#endif
{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
{"autosub", &sub_auto, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL},
OPT_MAKE_FLAGS("autosub", sub_auto, 0),
{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},

View File

@ -235,7 +235,7 @@ const m_option_t mplayer_opts[]={
{"menu", "OSD menu support was not compiled in.\n", CONF_TYPE_PRINT,0, 0, 0, NULL},
#endif /* CONFIG_MENU */
{"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
OPT_STRING("vobsub", vobsub_name, 0),
{"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
#ifdef CONFIG_UNRAR_EXEC
{"unrarexec", &unrar_executable, CONF_TYPE_STRING, 0, 0, 0, NULL},

View File

@ -46,6 +46,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.movie_aspect = -1.,
.flip = -1,
.vd_use_slices = 1,
.sub_auto = 1,
#ifdef CONFIG_ASS
.ass_enabled = 1,
#endif

View File

@ -323,11 +323,8 @@ char *font_name=NULL;
char *sub_font_name=NULL;
extern int font_fontconfig;
float font_factor=0.75;
char **sub_name=NULL;
float sub_delay=0;
float sub_fps=0;
int sub_auto = 1;
char *vobsub_name=NULL;
int subcc_enabled=0;
int suboverlap_enabled = 1;
@ -4170,12 +4167,12 @@ if (edl_output_filename) {
//==================== Open VOB-Sub ============================
current_module="vobsub";
if (vobsub_name){
vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec);
if (opts->vobsub_name){
vo_vobsub=vobsub_open(opts->vobsub_name,spudec_ifo,1,&vo_spudec);
if(vo_vobsub==NULL)
mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load subtitles: %s\n",
filename_recode(vobsub_name));
} else if (sub_auto && mpctx->filename){
filename_recode(opts->vobsub_name));
} else if (opts->sub_auto && mpctx->filename){
/* try to autodetect vobsub from movie filename ::atmos */
char *buf = strdup(mpctx->filename), *psub;
char *pdot = strrchr(buf, '.');
@ -4566,11 +4563,11 @@ if(vo_spudec==NULL &&
// check .sub
current_module="read_subtitles_file";
double sub_fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
if(sub_name){
for (i = 0; sub_name[i] != NULL; ++i)
add_subtitles(mpctx, sub_name[i], sub_fps, 0);
if(opts->sub_name){
for (i = 0; opts->sub_name[i] != NULL; ++i)
add_subtitles(mpctx, opts->sub_name[i], sub_fps, 0);
}
if(sub_auto) { // auto load sub file ...
if(opts->sub_auto) { // auto load sub file ...
char *psub = get_path( "sub/" );
char **tmp = sub_filenames((psub ? psub : ""), mpctx->filename);
int i = 0;

View File

@ -38,10 +38,8 @@ extern char * sub_font_name;
extern float font_factor;
extern double force_fps;
//extern char **sub_name;
extern float sub_delay;
extern float sub_fps;
extern int sub_auto;
extern int stream_cache_size;

View File

@ -31,6 +31,7 @@ typedef struct MPOpts {
int osd_level;
int osd_duration;
char *vobsub_name;
int auto_quality;
int benchmark;
char *stream_dump_name;
@ -86,6 +87,8 @@ typedef struct MPOpts {
float screen_size_xy;
int flip;
int vd_use_slices;
char **sub_name;
int sub_auto;
int ass_enabled;
struct lavc_param {
int workaround_bugs;