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(-) (limited to 'audio/out/ao.c') 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 From d8d42b44fc717c695af59c14213d54885088ea37 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 19:45:42 +0100 Subject: m_option, m_config: mp_msg conversions Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later. --- audio/out/ao.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/out/ao.c') diff --git a/audio/out/ao.c b/audio/out/ao.c index ab2b15b031..7aea6239d2 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -149,7 +149,7 @@ static struct ao *ao_create(bool probing, struct mpv_global *global, }; if (ao->driver->encode != !!ao->encode_lavc_ctx) goto error; - struct m_config *config = m_config_from_obj_desc(ao, &desc); + struct m_config *config = m_config_from_obj_desc(ao, ao->log, &desc); if (m_config_apply_defaults(config, name, global->opts->ao_defs) < 0) goto error; if (m_config_set_obj_params(config, args) < 0) -- cgit v1.2.3 From eef36f03ea76f97c10075ae4b08e1e53e5195479 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 21:49:13 +0100 Subject: msg: rename mp_msg_log -> mp_msg Same for companion functions. --- audio/out/ao.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/out/ao.c') diff --git a/audio/out/ao.c b/audio/out/ao.c index 7aea6239d2..4530b1c3b7 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -130,7 +130,7 @@ static struct ao *ao_create(bool probing, struct mpv_global *global, struct mp_log *log = mp_log_new(NULL, global->log, "ao"); struct m_obj_desc desc; if (!m_obj_list_find(&desc, &ao_obj_list, bstr0(name))) { - mp_msg_log(log, MSGL_ERR, "Audio output %s not found!\n", name); + mp_msg(log, MSGL_ERR, "Audio output %s not found!\n", name); talloc_free(log); return NULL; }; -- cgit v1.2.3