summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-11 01:39:51 +0200
committerwm4 <wm4@nowhere>2014-06-11 01:39:51 +0200
commit7f7aa03eda33c10264d72a674e6e7eadff052254 (patch)
tree396b00eae6c425b25822a8269e95dbae9dbedfc1
parent14983eb37d5aea4db27f62b2d72293318387424f (diff)
downloadmpv-7f7aa03eda33c10264d72a674e6e7eadff052254.tar.bz2
mpv-7f7aa03eda33c10264d72a674e6e7eadff052254.tar.xz
ad_lavc: make option struct local
Similar to previous commit.
-rw-r--r--audio/decode/ad_lavc.c32
-rw-r--r--options/options.c10
-rw-r--r--options/options.h8
3 files changed, 26 insertions, 24 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index fff3a92380..404cf19560 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -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
-
-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}
+#define OPT_BASE_STRUCT struct ad_lavc_params
+struct ad_lavc_params {
+ float ac3drc;
+ int downmix;
+ int threads;
+ char *avopt;
+};
+
+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;
diff --git a/options/options.c b/options/options.c
index e10ac8d69c..3875a38c89 100644
--- a/options/options.c
+++ b/options/options.c
@@ -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,
},
diff --git a/options/options.h b/options/options.h
index 6bf7a2bf2b..f6e330d8c7 100644
--- a/options/options.h
+++ b/options/options.h
@@ -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;