summaryrefslogtreecommitdiffstats
path: root/audio/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-02 03:12:09 +0200
committerwm4 <wm4@nowhere>2014-08-02 03:12:33 +0200
commitd68a759fa4dea2701087039c58961757eb246b4f (patch)
tree07efabb3a1bf1bdcc0b80f6150f996aacf293ca6 /audio/decode
parent0c6c2da8bcdb0f1523c0f10bc117c41057875e34 (diff)
downloadmpv-d68a759fa4dea2701087039c58961757eb246b4f.tar.bz2
mpv-d68a759fa4dea2701087039c58961757eb246b4f.tar.xz
Improve setting AVOptions
Use OPT_KEYVALUELIST() for all places where AVOptions are directly set from mpv command line options. This allows escaping values, better diagnostics (also no more "pal"), and somehow reduces code size. Remove the old crappy option parser (av_opts.c).
Diffstat (limited to 'audio/decode')
-rw-r--r--audio/decode/ad_lavc.c13
1 files changed, 3 insertions, 10 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;