mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +00:00
ao: some missing mp_msg conversions
This commit is contained in:
parent
7cc3c3aeec
commit
138d183d83
@ -176,33 +176,37 @@ struct ao *ao_init_best(struct mpv_global *global,
|
|||||||
struct encode_lavc_context *encode_lavc_ctx,
|
struct encode_lavc_context *encode_lavc_ctx,
|
||||||
int samplerate, int format, struct mp_chmap channels)
|
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;
|
struct m_obj_settings *ao_list = global->opts->audio_driver_list;
|
||||||
if (ao_list && ao_list[0].name) {
|
if (ao_list && ao_list[0].name) {
|
||||||
for (int n = 0; ao_list[n].name; n++) {
|
for (int n = 0; ao_list[n].name; n++) {
|
||||||
if (strlen(ao_list[n].name) == 0)
|
if (strlen(ao_list[n].name) == 0)
|
||||||
goto autoprobe;
|
goto autoprobe;
|
||||||
mp_msg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%s'\n",
|
mp_verbose(log, "Trying preferred audio driver '%s'\n",
|
||||||
ao_list[n].name);
|
ao_list[n].name);
|
||||||
struct ao *ao = ao_create(false, global, input_ctx, encode_lavc_ctx,
|
ao = ao_create(false, global, input_ctx, encode_lavc_ctx,
|
||||||
samplerate, format, channels,
|
samplerate, format, channels,
|
||||||
ao_list[n].name, ao_list[n].attribs);
|
ao_list[n].name, ao_list[n].attribs);
|
||||||
if (ao)
|
if (ao)
|
||||||
return ao;
|
goto done;
|
||||||
mp_msg(MSGT_AO, MSGL_WARN, "Failed to initialize audio driver '%s'\n",
|
mp_warn(log, "Failed to initialize audio driver '%s'\n",
|
||||||
ao_list[n].name);
|
ao_list[n].name);
|
||||||
}
|
}
|
||||||
return NULL;
|
goto done;
|
||||||
}
|
}
|
||||||
autoprobe:
|
autoprobe:
|
||||||
// now try the rest...
|
// now try the rest...
|
||||||
for (int i = 0; audio_out_drivers[i]; i++) {
|
for (int i = 0; audio_out_drivers[i]; i++) {
|
||||||
struct ao *ao = ao_create(true, global, input_ctx, encode_lavc_ctx,
|
ao = ao_create(true, global, input_ctx, encode_lavc_ctx,
|
||||||
samplerate, format, channels,
|
samplerate, format, channels,
|
||||||
(char *)audio_out_drivers[i]->name, NULL);
|
(char *)audio_out_drivers[i]->name, NULL);
|
||||||
if (ao)
|
if (ao)
|
||||||
return ao;
|
goto done;
|
||||||
}
|
}
|
||||||
return NULL;
|
done:
|
||||||
|
talloc_free(log);
|
||||||
|
return ao;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ao_uninit(struct ao *ao, bool cut_audio)
|
void ao_uninit(struct ao *ao, bool cut_audio)
|
||||||
|
Loading…
Reference in New Issue
Block a user