diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vd_lavc.c | 14 | ||||
-rw-r--r-- | video/filter/vf_lavfi.c | 15 |
2 files changed, 9 insertions, 20 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index a59fffa790..75f66ce1f1 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -35,7 +35,6 @@ #include "common/msg.h" #include "options/options.h" #include "bstr/bstr.h" -#include "common/av_opts.h" #include "common/av_common.h" #include "common/codecs.h" @@ -79,7 +78,7 @@ struct vd_lavc_params { int threads; int bitexact; int check_hw_profile; - char *avopt; + char **avopts; }; static const struct m_opt_choice_alternatives discard_names[] = { @@ -105,7 +104,7 @@ const struct m_sub_options vd_lavc_conf = { OPT_INTRANGE("threads", threads, 0, 0, 16), OPT_FLAG("bitexact", bitexact, 0), OPT_FLAG("check-hw-profile", check_hw_profile, 0), - OPT_STRING("o", avopt, 0), + OPT_KEYVALUELIST("o", avopts, 0), {0} }, .size = sizeof(struct vd_lavc_params), @@ -383,14 +382,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, avctx->skip_idct = lavc_param->skip_idct; avctx->skip_frame = lavc_param->skip_frame; - if (lavc_param->avopt) { - if (parse_avopts(avctx, lavc_param->avopt) < 0) { - MP_ERR(vd, "Your options /%s/ look like gibberish to me pal\n", - lavc_param->avopt); - uninit_avctx(vd); - return; - } - } + mp_set_avopts(vd->log, avctx, lavc_param->avopts); // Do this after the above avopt handling in case it changes values ctx->skip_frame = avctx->skip_frame; diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index c6f0783460..8f1ee243a2 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -37,9 +37,9 @@ #include <libavfilter/buffersink.h> #include <libavfilter/buffersrc.h> +#include "common/av_common.h" #include "common/msg.h" #include "options/m_option.h" -#include "common/av_opts.h" #include "common/tags.h" #include "video/img_format.h" @@ -78,7 +78,7 @@ struct vf_priv_s { // options char *cfg_graph; int64_t cfg_sws_flags; - char *cfg_avopts; + char **cfg_avopts; }; static const struct vf_priv_s vf_priv_dflt = { @@ -143,11 +143,8 @@ static bool recreate_graph(struct vf_instance *vf, int width, int height, if (!graph) goto error; - if (parse_avopts(graph, p->cfg_avopts) < 0) { - MP_FATAL(vf, "lavfi: could not set opts: '%s'\n", - p->cfg_avopts); + if (mp_set_avopts(vf->log, graph, p->cfg_avopts) < 0) goto error; - } AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); @@ -426,7 +423,7 @@ static void print_help(struct mp_log *log) static const m_option_t vf_opts_fields[] = { OPT_STRING("graph", cfg_graph, M_OPT_MIN, .min = 1), OPT_INT64("sws-flags", cfg_sws_flags, 0), - OPT_STRING("o", cfg_avopts, 0), + OPT_KEYVALUELIST("o", cfg_avopts, 0), {0} }; @@ -445,7 +442,7 @@ const vf_info_t vf_info_lavfi = { struct vf_lw_opts { int enable; int64_t sws_flags; - char *avopts; + char **avopts; }; #undef OPT_BASE_STRUCT @@ -454,7 +451,7 @@ const struct m_sub_options vf_lw_conf = { .opts = (const m_option_t[]) { OPT_FLAG("lavfi", enable, 0), OPT_INT64("lavfi-sws-flags", sws_flags, 0), - OPT_STRING("lavfi-o", avopts, 0), + OPT_KEYVALUELIST("lavfi-o", avopts, 0), {0} }, .defaults = &(const struct vf_lw_opts){ |