summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-08-01 17:41:32 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-08-01 20:32:49 +0200
commit3449e893e1cefc92e092e1952ed4db52f7247ce8 (patch)
tree44a9657081e24aa33de94dc69c303407776da173 /audio
parent01178727a9e5808177d49aa5c26b0b9dbd1fcce0 (diff)
downloadmpv-3449e893e1cefc92e092e1952ed4db52f7247ce8.tar.bz2
mpv-3449e893e1cefc92e092e1952ed4db52f7247ce8.tar.xz
audio/out: add support for new logging API
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao.c19
-rw-r--r--audio/out/ao.h4
2 files changed, 15 insertions, 8 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index 04e6fcda12..49fffb657d 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -30,6 +30,7 @@
#include "core/options.h"
#include "core/m_config.h"
#include "core/mp_msg.h"
+#include "core/mpv_global.h"
// there are some globals:
struct ao *global_ao;
@@ -121,27 +122,31 @@ const struct m_obj_list ao_obj_list = {
.allow_trailer = true,
};
-static struct ao *ao_create(bool probing, struct MPOpts *opts,
+static struct ao *ao_create(bool probing, struct mpv_global *global,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx,
int samplerate, int format, struct mp_chmap channels,
char *name, char **args)
{
+ 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_tmsg(MSGT_CPLAYER, MSGL_ERR, "Audio output %s not found!\n", name);
+ mp_tmsg_log(log, MSGL_ERR, "Audio output %s not found!\n", name);
+ talloc_free(log);
return NULL;
};
struct ao *ao = talloc_ptrtype(NULL, ao);
+ talloc_steal(ao, log);
*ao = (struct ao) {
.driver = desc.p,
.probing = probing,
- .opts = opts,
+ .opts = global->opts,
.encode_lavc_ctx = encode_lavc_ctx,
.input_ctx = input_ctx,
.samplerate = samplerate,
.channels = channels,
.format = format,
+ .log = mp_log_new(ao, log, name),
};
if (ao->driver->encode != !!ao->encode_lavc_ctx)
goto error;
@@ -158,19 +163,19 @@ error:
return NULL;
}
-struct ao *ao_init_best(struct MPOpts *opts,
+struct ao *ao_init_best(struct mpv_global *global,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx,
int samplerate, int format, struct mp_chmap channels)
{
- struct m_obj_settings *ao_list = opts->audio_driver_list;
+ 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_tmsg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%s'\n",
ao_list[n].name);
- struct ao *ao = ao_create(false, opts, input_ctx, encode_lavc_ctx,
+ struct ao *ao = ao_create(false, global, input_ctx, encode_lavc_ctx,
samplerate, format, channels,
ao_list[n].name, ao_list[n].attribs);
if (ao)
@@ -183,7 +188,7 @@ struct ao *ao_init_best(struct MPOpts *opts,
autoprobe:
// now try the rest...
for (int i = 0; audio_out_drivers[i]; i++) {
- struct ao *ao = ao_create(true, opts, input_ctx, encode_lavc_ctx,
+ struct ao *ao = ao_create(true, global, input_ctx, encode_lavc_ctx,
samplerate, format, channels,
(char *)audio_out_drivers[i]->info->short_name, NULL);
if (ao)
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 25cd12a0f1..65e5a3fc6b 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -93,11 +93,13 @@ struct ao {
struct encode_lavc_context *encode_lavc_ctx;
struct MPOpts *opts;
struct input_ctx *input_ctx;
+ struct mp_log *log; // Using e.g. "[ao/coreaudio]" as prefix
};
extern char *ao_subdevice;
-struct ao *ao_init_best(struct MPOpts *opts,
+struct mpv_global;
+struct ao *ao_init_best(struct mpv_global *global,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx,
int samplerate, int format, struct mp_chmap channels);