From 138d183d83b4ef58aa1d62203b27a5df9792e93b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 18:43:03 +0100 Subject: ao: some missing mp_msg conversions --- audio/out/ao.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/audio/out/ao.c b/audio/out/ao.c index ddd177400d..ab2b15b031 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -176,33 +176,37 @@ struct ao *ao_init_best(struct mpv_global *global, struct encode_lavc_context *encode_lavc_ctx, int samplerate, int format, struct mp_chmap channels) { + struct mp_log *log = mp_log_new(NULL, global->log, "ao"); + struct ao *ao = NULL; struct m_obj_settings *ao_list = global->opts->audio_driver_list; if (ao_list && ao_list[0].name) { for (int n = 0; ao_list[n].name; n++) { if (strlen(ao_list[n].name) == 0) goto autoprobe; - mp_msg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%s'\n", - ao_list[n].name); - struct ao *ao = ao_create(false, global, input_ctx, encode_lavc_ctx, - samplerate, format, channels, - ao_list[n].name, ao_list[n].attribs); + mp_verbose(log, "Trying preferred audio driver '%s'\n", + ao_list[n].name); + ao = ao_create(false, global, input_ctx, encode_lavc_ctx, + samplerate, format, channels, + ao_list[n].name, ao_list[n].attribs); if (ao) - return ao; - mp_msg(MSGT_AO, MSGL_WARN, "Failed to initialize audio driver '%s'\n", + goto done; + mp_warn(log, "Failed to initialize audio driver '%s'\n", ao_list[n].name); } - return NULL; + goto done; } autoprobe: // now try the rest... for (int i = 0; audio_out_drivers[i]; i++) { - struct ao *ao = ao_create(true, global, input_ctx, encode_lavc_ctx, - samplerate, format, channels, - (char *)audio_out_drivers[i]->name, NULL); + ao = ao_create(true, global, input_ctx, encode_lavc_ctx, + samplerate, format, channels, + (char *)audio_out_drivers[i]->name, NULL); if (ao) - return ao; + goto done; } - return NULL; +done: + talloc_free(log); + return ao; } void ao_uninit(struct ao *ao, bool cut_audio) -- cgit v1.2.3