summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/decode/ad_lavc.c13
-rw-r--r--audio/filter/af_lavfi.c12
-rw-r--r--audio/filter/af_lavrresample.c10
3 files changed, 12 insertions, 23 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 4ff69c3f20..c4372ba4b3 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -33,7 +33,6 @@
#include "common/codecs.h"
#include "common/msg.h"
#include "options/options.h"
-#include "common/av_opts.h"
#include "ad.h"
#include "audio/fmt-conversion.h"
@@ -55,7 +54,7 @@ struct ad_lavc_params {
float ac3drc;
int downmix;
int threads;
- char *avopt;
+ char **avopts;
};
const struct m_sub_options ad_lavc_conf = {
@@ -63,7 +62,7 @@ const struct m_sub_options ad_lavc_conf = {
OPT_FLOATRANGE("ac3drc", ac3drc, 0, 0, 2),
OPT_FLAG("downmix", downmix, 0),
OPT_INTRANGE("threads", threads, 0, 1, 16),
- OPT_STRING("o", avopt, 0),
+ OPT_KEYVALUELIST("o", avopts, 0),
{0}
},
.size = sizeof(struct ad_lavc_params),
@@ -228,13 +227,7 @@ static int init(struct dec_audio *da, const char *decoder)
av_opt_set_double(lavc_context, "drc_scale", opts->ac3drc,
AV_OPT_SEARCH_CHILDREN);
- if (opts->avopt) {
- if (parse_avopts(lavc_context, opts->avopt) < 0) {
- MP_ERR(da, "setting AVOptions '%s' failed.\n", opts->avopt);
- uninit(da);
- return 0;
- }
- }
+ mp_set_avopts(da->log, lavc_context, opts->avopts);
lavc_context->codec_tag = sh->format;
lavc_context->sample_rate = sh_audio->samplerate;
diff --git a/audio/filter/af_lavfi.c b/audio/filter/af_lavfi.c
index a565e202f4..0b7a619e56 100644
--- a/audio/filter/af_lavfi.c
+++ b/audio/filter/af_lavfi.c
@@ -38,8 +38,9 @@
#include "audio/fmt-conversion.h"
#include "af.h"
+#include "common/av_common.h"
+
#include "options/m_option.h"
-#include "common/av_opts.h"
// FFmpeg and Libav have slightly different APIs, just enough to cause us
// unnecessary pain. <Expletive deleted.>
@@ -62,7 +63,7 @@ struct priv {
// options
char *cfg_graph;
- char *cfg_avopts;
+ char **cfg_avopts;
};
static void destroy_graph(struct af_instance *af)
@@ -90,11 +91,8 @@ static bool recreate_graph(struct af_instance *af, struct mp_audio *config)
if (!graph)
goto error;
- if (parse_avopts(graph, p->cfg_avopts) < 0) {
- MP_FATAL(af, "lavfi: could not set opts: '%s'\n",
- p->cfg_avopts);
+ if (mp_set_avopts(af->log, graph, p->cfg_avopts) < 0)
goto error;
- }
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
@@ -306,7 +304,7 @@ const struct af_info af_info_lavfi = {
.priv_size = sizeof(struct priv),
.options = (const struct m_option[]) {
OPT_STRING("graph", cfg_graph, 0),
- OPT_STRING("o", cfg_avopts, 0),
+ OPT_KEYVALUELIST("o", cfg_avopts, 0),
{0}
},
};
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index 8e33f3b23c..26bbd56de0 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -52,9 +52,9 @@
#error "config.h broken or no resampler found"
#endif
+#include "common/av_common.h"
#include "common/msg.h"
#include "options/m_option.h"
-#include "common/av_opts.h"
#include "audio/filter/af.h"
#include "audio/fmt-conversion.h"
@@ -74,7 +74,7 @@ struct af_resample_opts {
struct af_resample {
int allow_detach;
- char *avopts;
+ char **avopts;
struct AVAudioResampleContext *avrctx;
struct AVAudioResampleContext *avrctx_out; // for output channel reordering
struct af_resample_opts ctx; // opts in the context
@@ -164,10 +164,8 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
av_opt_set_double(s->avrctx, "cutoff", s->ctx.cutoff, 0);
- if (parse_avopts(s->avrctx, s->avopts) < 0) {
- MP_FATAL(af, "af_lavrresample: could not set opts: '%s'\n", s->avopts);
+ if (mp_set_avopts(af->log, s->avrctx, s->avopts) < 0)
return AF_ERROR;
- }
struct mp_chmap map_in = in->channels;
struct mp_chmap map_out = out->channels;
@@ -402,7 +400,7 @@ const struct af_info af_info_lavrresample = {
OPT_FLAG("linear", opts.linear, 0),
OPT_DOUBLE("cutoff", opts.cutoff, M_OPT_RANGE, .min = 0, .max = 1),
OPT_FLAG("detach", allow_detach, 0),
- OPT_STRING("o", avopts, 0),
+ OPT_KEYVALUELIST("o", avopts, 0),
{0}
},
};