summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
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 /demux/demux_lavf.c
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 'demux/demux_lavf.c')
-rw-r--r--demux/demux_lavf.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 3ccda55d8e..0987508a14 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -44,7 +44,6 @@
#include "options/options.h"
#include "common/msg.h"
#include "common/tags.h"
-#include "common/av_opts.h"
#include "common/av_common.h"
#include "bstr/bstr.h"
@@ -71,7 +70,7 @@ struct demux_lavf_opts {
int allow_mimetype;
char *format;
char *cryptokey;
- char *avopt;
+ char **avopts;
int genptsmode;
};
@@ -87,7 +86,7 @@ const struct m_sub_options demux_lavf_conf = {
OPT_STRING("cryptokey", cryptokey, 0),
OPT_CHOICE("genpts-mode", genptsmode, 0,
({"lavf", 1}, {"no", 0})),
- OPT_STRING("o", avopt, 0),
+ OPT_KEYVALUELIST("o", avopts, 0),
{0}
},
.size = sizeof(struct demux_lavf_opts),
@@ -674,14 +673,6 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
"analyzeduration to %f\n", analyze_duration);
}
- if (lavfdopts->avopt) {
- if (parse_avopts(avfc, lavfdopts->avopt) < 0) {
- MP_ERR(demuxer, "Your options /%s/ look like gibberish to me pal\n",
- lavfdopts->avopt);
- return -1;
- }
- }
-
if ((priv->avif->flags & AVFMT_NOFILE) ||
demuxer->stream->type == STREAMTYPE_AVDEVICE)
{
@@ -715,15 +706,15 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
av_dict_set(&dopts, "rtsp_transport", transport, 0);
}
+ mp_set_avdict(&dopts, lavfdopts->avopts);
+
if (avformat_open_input(&avfc, priv->filename, priv->avif, &dopts) < 0) {
MP_ERR(demuxer, "avformat_open_input() failed\n");
av_dict_free(&dopts);
return -1;
}
- t = NULL;
- while ((t = av_dict_get(dopts, "", t, AV_DICT_IGNORE_SUFFIX)))
- MP_VERBOSE(demuxer, "Could not set demux option %s=%s\n", t->key, t->value);
+ mp_avdict_print_unset(demuxer->log, MSGL_V, dopts);
av_dict_free(&dopts);
priv->avfc = avfc;