summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorAnton Kindestam <antonki@kth.se>2018-12-05 19:02:03 +0100
committerAnton Kindestam <antonki@kth.se>2018-12-05 19:19:24 +0100
commit8b83c8996686072bc743b112ae5cb3bf93aa33ed (patch)
treeb09ce6a7ff470b05006622f19914b3d39d2f7d9f /audio
parent5bcac8580df6fc62323136f756a3a6d1e754fe9c (diff)
parent559a400ac36e75a8d73ba263fd7fa6736df1c2da (diff)
downloadmpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.bz2
mpv-8b83c8996686072bc743b112ae5cb3bf93aa33ed.tar.xz
Merge commit '559a400ac36e75a8d73ba263fd7fa6736df1c2da' into wm4-commits--merge-edition
This bumps libmpv version to 1.103
Diffstat (limited to 'audio')
-rw-r--r--audio/decode/ad_lavc.c6
-rw-r--r--audio/out/ao.c25
-rw-r--r--audio/out/ao.h7
3 files changed, 33 insertions, 5 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 7713a506a6..985fd58084 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -37,6 +37,7 @@
#include "demux/stheader.h"
#include "filters/f_decoder_wrapper.h"
#include "filters/filter_internal.h"
+#include "options/m_config.h"
#include "options/options.h"
struct priv {
@@ -80,8 +81,9 @@ static bool init(struct mp_filter *da, struct mp_codec_params *codec,
const char *decoder)
{
struct priv *ctx = da->priv;
- struct MPOpts *mpopts = da->global->opts;
- struct ad_lavc_params *opts = mpopts->ad_lavc_params;
+ struct MPOpts *mpopts = mp_get_config_group(ctx, da->global, GLOBAL_CONFIG);
+ struct ad_lavc_params *opts =
+ mp_get_config_group(ctx, da->global, &ad_lavc_conf);
AVCodecContext *lavc_context;
AVCodec *lavc_codec;
diff --git a/audio/out/ao.c b/audio/out/ao.c
index b8337d5c16..e7af02276f 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -120,7 +120,7 @@ static bool get_desc(struct m_obj_desc *dst, int index)
}
// For the ao option
-const struct m_obj_list ao_obj_list = {
+static const struct m_obj_list ao_obj_list = {
.get_desc = get_desc,
.description = "audio outputs",
.allow_unknown_entries = true,
@@ -129,13 +129,30 @@ const struct m_obj_list ao_obj_list = {
.use_global_options = true,
};
+#define OPT_BASE_STRUCT struct ao_opts
+const struct m_sub_options ao_conf = {
+ .opts = (const struct m_option[]) {
+ OPT_SETTINGSLIST("ao", audio_driver_list, 0, &ao_obj_list, ),
+ OPT_STRING("audio-device", audio_device, UPDATE_AUDIO),
+ OPT_STRING("audio-client-name", audio_client_name, UPDATE_AUDIO),
+ OPT_DOUBLE("audio-buffer", audio_buffer, M_OPT_MIN | M_OPT_MAX,
+ .min = 0, .max = 10),
+ {0}
+ },
+ .size = sizeof(OPT_BASE_STRUCT),
+ .defaults = &(const OPT_BASE_STRUCT){
+ .audio_buffer = 0.2,
+ .audio_device = "auto",
+ .audio_client_name = "mpv",
+ },
+};
+
static struct ao *ao_alloc(bool probing, struct mpv_global *global,
void (*wakeup_cb)(void *ctx), void *wakeup_ctx,
char *name)
{
assert(wakeup_cb);
- struct MPOpts *opts = global->opts;
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))) {
@@ -143,6 +160,7 @@ static struct ao *ao_alloc(bool probing, struct mpv_global *global,
talloc_free(log);
return NULL;
};
+ struct ao_opts *opts = mp_get_config_group(NULL, global, &ao_conf);
struct ao *ao = talloc_ptrtype(NULL, ao);
talloc_steal(ao, log);
*ao = (struct ao) {
@@ -155,6 +173,7 @@ static struct ao *ao_alloc(bool probing, struct mpv_global *global,
.def_buffer = opts->audio_buffer,
.client_name = talloc_strdup(ao, opts->audio_client_name),
};
+ talloc_free(opts);
ao->priv = m_config_group_from_desc(ao, ao->log, global, &desc, name);
if (!ao->priv)
goto error;
@@ -267,8 +286,8 @@ 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 MPOpts *opts = global->opts;
void *tmp = talloc_new(NULL);
+ struct ao_opts *opts = mp_get_config_group(tmp, global, &ao_conf);
struct mp_log *log = mp_log_new(tmp, global->log, "ao");
struct ao *ao = NULL;
struct m_obj_settings *ao_list = NULL;
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 99a3d0fae0..d66391ef1d 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -83,6 +83,13 @@ struct mpv_global;
struct input_ctx;
struct encode_lavc_context;
+struct ao_opts {
+ struct m_obj_settings *audio_driver_list;
+ char *audio_device;
+ char *audio_client_name;
+ double audio_buffer;
+};
+
struct ao *ao_init_best(struct mpv_global *global,
int init_flags,
void (*wakeup_cb)(void *ctx), void *wakeup_ctx,