From 7eba27c125f6e4813ecc6cff567dc29e17d10fc5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 21 Jul 2013 21:33:17 +0200 Subject: options: use new option code for --ao This requires completely refactoring the AO creation code too. --- core/mplayer.c | 17 ++++------------- core/options.c | 3 ++- core/options.h | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'core') diff --git a/core/mplayer.c b/core/mplayer.c index 07f54b142f..e54b55444f 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -1618,14 +1618,10 @@ void reinit_audio_chain(struct MPContext *mpctx) mpctx->initialized_flags |= INITIALIZED_AO; mp_chmap_remove_useless_channels(&ao_channels, &opts->audio_output_channels); - mpctx->ao = ao_create(opts, mpctx->input); + mpctx->ao = ao_init_best(opts, mpctx->input, mpctx->encode_lavc_ctx, + ao_srate, ao_format, ao_channels); struct ao *ao = mpctx->ao; - ao->samplerate = ao_srate; - ao->format = ao_format; - ao->channels = ao_channels; - ao->encode_lavc_ctx = mpctx->encode_lavc_ctx; - ao_init(ao, opts->audio_driver_list); - if (!ao->initialized) { + if (!ao) { mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Could not open/initialize audio device -> no sound.\n"); goto init_error; @@ -4117,7 +4113,7 @@ static void play_current_file(struct MPContext *mpctx) opts->vo.video_driver_list[0].name); if (opts->audio_driver_list) load_per_output_config(mpctx->mconfig, PROFILE_CFG_AO, - opts->audio_driver_list[0]); + opts->audio_driver_list[0].name); if (opts->position_resume) load_playback_resume(mpctx->mconfig, mpctx->filename); @@ -4504,11 +4500,6 @@ static bool handle_help_options(struct MPContext *mpctx) { struct MPOpts *opts = &mpctx->opts; int opt_exit = 0; - if (opts->audio_driver_list && - strcmp(opts->audio_driver_list[0], "help") == 0) { - list_audio_out(); - opt_exit = 1; - } if (opts->audio_decoders && strcmp(opts->audio_decoders, "help") == 0) { struct mp_decoder_list *list = mp_audio_decoder_list(); mp_print_decoders(MSGT_CPLAYER, MSGL_INFO, "Audio decoders:", list); diff --git a/core/options.c b/core/options.c index 3c0bf213a1..eceb1f259f 100644 --- a/core/options.c +++ b/core/options.c @@ -183,6 +183,7 @@ extern double mf_fps; extern char * mf_type; extern const struct m_obj_list vf_obj_list; extern const struct m_obj_list vo_obj_list; +extern const struct m_obj_list ao_obj_list; static const m_option_t mfopts_conf[]={ {"fps", &mf_fps, CONF_TYPE_DOUBLE, 0, 0, 0, NULL}, @@ -520,7 +521,7 @@ const m_option_t mp_opts[] = { //---------------------- libao/libvo options ------------------------ OPT_SETTINGSLIST("vo", vo.video_driver_list, 0, &vo_obj_list), - OPT_STRINGLIST("ao", audio_driver_list, 0), + OPT_SETTINGSLIST("ao", audio_driver_list, 0, &ao_obj_list), OPT_FLAG("fixed-vo", fixed_vo, CONF_GLOBAL), OPT_FLAG("ontop", vo.ontop, 0), OPT_FLAG("border", vo.border, 0), diff --git a/core/options.h b/core/options.h index f70f7f8553..44ca1148b9 100644 --- a/core/options.h +++ b/core/options.h @@ -47,7 +47,7 @@ typedef struct mp_vo_opts { typedef struct MPOpts { char **reset_options; - char **audio_driver_list; + struct m_obj_settings *audio_driver_list; int fixed_vo; char *mixer_device; char *mixer_channel; -- cgit v1.2.3