Move options "vo" and "ao" to common struct

This commit is contained in:
Uoti Urpala 2008-04-01 17:35:10 +03:00
parent 9db0c118d3
commit 732ee3474a
4 changed files with 19 additions and 16 deletions

View File

@ -89,6 +89,7 @@ const m_option_t tvscan_conf[]={
#define FLAG_ON(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)} #define FLAG_ON(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)}
#define FLAG_OFF(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)} #define FLAG_OFF(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)}
#define STRINGLIST(optname, varname, flags) {optname, NULL, CONF_TYPE_STRING_LIST, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
const m_option_t mplayer_opts[]={ const m_option_t mplayer_opts[]={
/* name, pointer, type, flags, min, max */ /* name, pointer, type, flags, min, max */
@ -96,8 +97,8 @@ const m_option_t mplayer_opts[]={
//---------------------- libao/libvo options ------------------------ //---------------------- libao/libvo options ------------------------
{"o", "Option -o has been renamed to -vo (video-out), use -vo.\n", {"o", "Option -o has been renamed to -vo (video-out), use -vo.\n",
CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"vo", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, STRINGLIST("vo", video_driver_list, 0),
{"ao", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, STRINGLIST("ao", audio_driver_list, 0),
FLAG_ON("fixed-vo", fixed_vo, CONF_GLOBAL), FLAG_ON("fixed-vo", fixed_vo, CONF_GLOBAL),
FLAG_OFF("nofixed-vo", fixed_vo, CONF_GLOBAL), FLAG_OFF("nofixed-vo", fixed_vo, CONF_GLOBAL),
{"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},

View File

@ -1,9 +1,12 @@
#include <stddef.h>
#include "defaultopts.h" #include "defaultopts.h"
#include "options.h" #include "options.h"
void set_default_mplayer_options(struct MPOpts *opts) void set_default_mplayer_options(struct MPOpts *opts)
{ {
*opts = (const struct MPOpts){ *opts = (const struct MPOpts){
.audio_driver_list = NULL,
.video_driver_list = NULL,
.fixed_vo = 0, .fixed_vo = 0,
}; };
} }

View File

@ -307,10 +307,6 @@ static int audio_output_format=-1; // AF_FORMAT_UNKNOWN
static int play_n_frames=-1; static int play_n_frames=-1;
static int play_n_frames_mf=-1; static int play_n_frames_mf=-1;
// screen info:
char** video_driver_list=NULL;
char** audio_driver_list=NULL;
// sub: // sub:
char *font_name=NULL; char *font_name=NULL;
char *sub_font_name=NULL; char *sub_font_name=NULL;
@ -1576,6 +1572,7 @@ static void update_osd_msg(void) {
void reinit_audio_chain(void) { void reinit_audio_chain(void) {
struct MPOpts *opts = &mpctx->opts;
if(mpctx->sh_audio){ if(mpctx->sh_audio){
current_module="init_audio_codec"; current_module="init_audio_codec";
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
@ -1605,7 +1602,7 @@ if(mpctx->sh_audio){
} }
#endif #endif
current_module="ao2_init"; current_module="ao2_init";
if(!(mpctx->audio_out=init_best_audio_out(audio_driver_list, if(!(mpctx->audio_out=init_best_audio_out(opts->audio_driver_list,
0, // plugin flag 0, // plugin flag
ao_data.samplerate, ao_data.samplerate,
ao_data.channels, ao_data.channels,
@ -2136,7 +2133,7 @@ static int sleep_until_update(float *time_frame, float *aq_sleep_time)
} }
int reinit_video_chain(void) { int reinit_video_chain(void) {
MPOpts *opts = &mpctx->opts; struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video; sh_video_t * const sh_video = mpctx->sh_video;
double ar=-1.0; double ar=-1.0;
//================== Init VIDEO (codec & libvo) ========================== //================== Init VIDEO (codec & libvo) ==========================
@ -2146,7 +2143,7 @@ int reinit_video_chain(void) {
//shouldn't we set dvideo->id=-2 when we fail? //shouldn't we set dvideo->id=-2 when we fail?
vo_config_count=0; vo_config_count=0;
//if((mpctx->video_out->preinit(vo_subdevice))!=0){ //if((mpctx->video_out->preinit(vo_subdevice))!=0){
if(!(mpctx->video_out=init_best_video_out(video_driver_list))){ if(!(mpctx->video_out=init_best_video_out(opts->video_driver_list))){
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice); mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
goto err_out; goto err_out;
} }
@ -2564,7 +2561,7 @@ int gui_no_filename=0;
mp_msg_init(); mp_msg_init();
MPOpts *opts = &mpctx->opts; struct MPOpts *opts = &mpctx->opts;
set_default_mplayer_options(opts); set_default_mplayer_options(opts);
// Create the config context and register the options // Create the config context and register the options
mconfig = m_config_new(opts); mconfig = m_config_new(opts);
@ -2677,12 +2674,12 @@ int gui_no_filename=0;
} }
#endif /* HAVE_NEW_GUI */ #endif /* HAVE_NEW_GUI */
if(video_driver_list && strcmp(video_driver_list[0],"help")==0){ if(opts->video_driver_list && strcmp(opts->video_driver_list[0],"help")==0){
list_video_out(); list_video_out();
opt_exit = 1; opt_exit = 1;
} }
if(audio_driver_list && strcmp(audio_driver_list[0],"help")==0){ if(opts->audio_driver_list && strcmp(opts->audio_driver_list[0],"help")==0){
list_audio_out(); list_audio_out();
opt_exit = 1; opt_exit = 1;
} }
@ -2946,10 +2943,10 @@ play_next_file:
load_per_file_config (mconfig, filename); load_per_file_config (mconfig, filename);
} }
if (video_driver_list) if (opts->video_driver_list)
load_per_output_config (mconfig, PROFILE_CFG_VO, video_driver_list[0]); load_per_output_config (mconfig, PROFILE_CFG_VO, opts->video_driver_list[0]);
if (audio_driver_list) if (opts->audio_driver_list)
load_per_output_config (mconfig, PROFILE_CFG_AO, audio_driver_list[0]); load_per_output_config (mconfig, PROFILE_CFG_AO, opts->audio_driver_list[0]);
// We must enable getch2 here to be able to interrupt network connection // We must enable getch2 here to be able to interrupt network connection
// or cache filling // or cache filling

View File

@ -2,6 +2,8 @@
#define MPLAYER_OPTIONS_H #define MPLAYER_OPTIONS_H
typedef struct MPOpts { typedef struct MPOpts {
char **video_driver_list;
char **audio_driver_list;
int fixed_vo; int fixed_vo;
} MPOpts; } MPOpts;