ad_lavc: make option struct local

Similar to previous commit.
This commit is contained in:
wm4 2014-06-11 01:39:51 +02:00
parent 14983eb37d
commit 7f7aa03eda
3 changed files with 25 additions and 23 deletions

View File

@ -51,14 +51,28 @@ struct priv {
static void uninit(struct dec_audio *da);
static int decode_new_packet(struct dec_audio *da);
#define OPT_BASE_STRUCT struct MPOpts
#define OPT_BASE_STRUCT struct ad_lavc_params
struct ad_lavc_params {
float ac3drc;
int downmix;
int threads;
char *avopt;
};
const m_option_t ad_lavc_decode_opts_conf[] = {
OPT_FLOATRANGE("ac3drc", ad_lavc_param.ac3drc, 0, 0, 2),
OPT_FLAG("downmix", ad_lavc_param.downmix, 0),
OPT_INTRANGE("threads", ad_lavc_param.threads, 0, 1, 16),
OPT_STRING("o", ad_lavc_param.avopt, 0),
{0}
const struct m_sub_options ad_lavc_conf = {
.opts = (const m_option_t[]) {
OPT_FLOATRANGE("ac3drc", ac3drc, 0, 0, 2),
OPT_FLAG("downmix", downmix, 0),
OPT_INTRANGE("threads", threads, 0, 1, 16),
OPT_STRING("o", avopt, 0),
{0}
},
.size = sizeof(struct ad_lavc_params),
.defaults = &(const struct ad_lavc_params){
.ac3drc = 1.,
.downmix = 1,
.threads = 1,
},
};
struct pcm_map
@ -179,7 +193,7 @@ static void set_from_wf(AVCodecContext *avctx, MP_WAVEFORMATEX *wf)
static int init(struct dec_audio *da, const char *decoder)
{
struct MPOpts *mpopts = da->opts;
struct ad_lavc_param *opts = &mpopts->ad_lavc_param;
struct ad_lavc_params *opts = mpopts->ad_lavc_params;
AVCodecContext *lavc_context;
AVCodec *lavc_codec;
struct sh_stream *sh = da->header;

View File

@ -63,6 +63,7 @@ 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 struct m_sub_options ad_lavc_conf;
extern const m_option_t lavfdopts_conf[];
@ -81,8 +82,6 @@ static const m_option_t screenshot_conf[] = {
{0},
};
extern const m_option_t ad_lavc_decode_opts_conf[];
extern const m_option_t mp_input_opts[];
const m_option_t mp_opts[] = {
@ -278,7 +277,7 @@ const m_option_t mp_opts[] = {
({"auto", -1}, {"top", 0}, {"bottom", 1})),
OPT_SUBSTRUCT("vd-lavc", vd_lavc_params, vd_lavc_conf, 0),
{"ad-lavc", (void *) ad_lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG},
OPT_SUBSTRUCT("ad-lavc", ad_lavc_params, ad_lavc_conf, 0),
{"demuxer-lavf", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG},
OPT_SUBSTRUCT("demuxer-rawaudio", demux_rawaudio, demux_rawaudio_conf, 0),
@ -647,11 +646,6 @@ const struct MPOpts mp_default_opts = {
.mf_fps = 1.0,
.ad_lavc_param = {
.ac3drc = 1.,
.downmix = 1,
.threads = 1,
},
.lavfdopts = {
.allow_mimetype = 1,
},

View File

@ -260,13 +260,7 @@ typedef struct MPOpts {
struct demux_rawvideo_opts *demux_rawvideo;
struct vd_lavc_params *vd_lavc_params;
struct ad_lavc_param {
float ac3drc;
int downmix;
int threads;
char *avopt;
} ad_lavc_param;
struct ad_lavc_params *ad_lavc_params;
struct lavfdopts {
int probesize;