From 14983eb37d5aea4db27f62b2d72293318387424f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Jun 2014 01:35:39 +0200 Subject: vd_lavc: make option struct local Removes specifics from options.h and options.c, and puts everything into vd_lavc.c. --- options/options.c | 8 ++------ options/options.h | 12 +----------- video/decode/vd_lavc.c | 49 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/options/options.c b/options/options.c index c9a3a59203..e10ac8d69c 100644 --- a/options/options.c +++ b/options/options.c @@ -62,6 +62,7 @@ extern const struct m_sub_options stream_dvb_conf; extern const struct m_sub_options sws_conf; extern const struct m_sub_options demux_rawaudio_conf; extern const struct m_sub_options demux_rawvideo_conf; +extern const struct m_sub_options vd_lavc_conf; extern const m_option_t lavfdopts_conf[]; @@ -80,7 +81,6 @@ static const m_option_t screenshot_conf[] = { {0}, }; -extern const m_option_t lavc_decode_opts_conf[]; extern const m_option_t ad_lavc_decode_opts_conf[]; extern const m_option_t mp_input_opts[]; @@ -277,7 +277,7 @@ const m_option_t mp_opts[] = { OPT_CHOICE("field-dominance", field_dominance, 0, ({"auto", -1}, {"top", 0}, {"bottom", 1})), - {"vd-lavc", (void *) lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG}, + OPT_SUBSTRUCT("vd-lavc", vd_lavc_params, vd_lavc_conf, 0), {"ad-lavc", (void *) ad_lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG}, {"demuxer-lavf", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG}, @@ -655,10 +655,6 @@ const struct MPOpts mp_default_opts = { .lavfdopts = { .allow_mimetype = 1, }, - .lavc_param = { - .show_all = 0, - .check_hw_profile = 1, - }, .input = { .key_fifo_size = 7, .doubleclick_time = 300, diff --git a/options/options.h b/options/options.h index 6aed93f8c7..6bf7a2bf2b 100644 --- a/options/options.h +++ b/options/options.h @@ -259,17 +259,7 @@ typedef struct MPOpts { struct demux_rawaudio_opts *demux_rawaudio; struct demux_rawvideo_opts *demux_rawvideo; - struct lavc_param { - int fast; - int show_all; - char *skip_loop_filter_str; - char *skip_idct_str; - char *skip_frame_str; - int threads; - int bitexact; - int check_hw_profile; - char *avopt; - } lavc_param; + struct vd_lavc_params *vd_lavc_params; struct ad_lavc_param { float ac3drc; diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 5b8cdc3e50..f5e025be97 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -68,19 +68,38 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx, static void uninit(struct dec_video *vd); -#define OPT_BASE_STRUCT struct MPOpts - -const m_option_t lavc_decode_opts_conf[] = { - OPT_FLAG_CONSTANTS("fast", lavc_param.fast, 0, 0, CODEC_FLAG2_FAST), - OPT_FLAG("show-all", lavc_param.show_all, 0), - OPT_STRING("skiploopfilter", lavc_param.skip_loop_filter_str, 0), - OPT_STRING("skipidct", lavc_param.skip_idct_str, 0), - OPT_STRING("skipframe", lavc_param.skip_frame_str, 0), - OPT_INTRANGE("threads", lavc_param.threads, 0, 0, 16), - OPT_FLAG_CONSTANTS("bitexact", lavc_param.bitexact, 0, 0, CODEC_FLAG_BITEXACT), - OPT_FLAG("check-hw-profile", lavc_param.check_hw_profile, 0), - OPT_STRING("o", lavc_param.avopt, 0), - {NULL, NULL, 0, 0, 0, 0, NULL} +#define OPT_BASE_STRUCT struct vd_lavc_params + +struct vd_lavc_params { + int fast; + int show_all; + char *skip_loop_filter_str; + char *skip_idct_str; + char *skip_frame_str; + int threads; + int bitexact; + int check_hw_profile; + char *avopt; +}; + +const struct m_sub_options vd_lavc_conf = { + .opts = (const m_option_t[]){ + OPT_FLAG_CONSTANTS("fast", fast, 0, 0, CODEC_FLAG2_FAST), + OPT_FLAG("show-all", show_all, 0), + OPT_STRING("skiploopfilter", skip_loop_filter_str, 0), + OPT_STRING("skipidct", skip_idct_str, 0), + OPT_STRING("skipframe", skip_frame_str, 0), + OPT_INTRANGE("threads", threads, 0, 0, 16), + OPT_FLAG_CONSTANTS("bitexact", bitexact, 0, 0, CODEC_FLAG_BITEXACT), + OPT_FLAG("check-hw-profile", check_hw_profile, 0), + OPT_STRING("o", avopt, 0), + {0} + }, + .size = sizeof(struct vd_lavc_params), + .defaults = &(const struct vd_lavc_params){ + .show_all = 0, + .check_hw_profile = 1, + }, }; const struct vd_lavc_hwdec mp_vd_lavc_vdpau; @@ -142,7 +161,7 @@ const struct hwdec_profile_entry *hwdec_find_profile( struct lavc_ctx *ctx, const struct hwdec_profile_entry *table) { assert(AV_CODEC_ID_NONE == 0); - struct lavc_param *lavc_param = &ctx->opts->lavc_param; + struct vd_lavc_params *lavc_param = ctx->opts->vd_lavc_params; enum AVCodecID codec = ctx->avctx->codec_id; int profile = ctx->avctx->profile; // Assume nobody cares about these aspects of the profile @@ -303,7 +322,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, struct vd_lavc_hwdec *hwdec) { vd_ffmpeg_ctx *ctx = vd->priv; - struct lavc_param *lavc_param = &vd->opts->lavc_param; + struct vd_lavc_params *lavc_param = vd->opts->vd_lavc_params; bool mp_rawvideo = false; struct sh_stream *sh = vd->header; -- cgit v1.2.3