diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-06-02 18:30:51 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-06-02 18:34:21 +0300 |
commit | 3f076c0fb318b41e91141b7473fdc896e84615b2 (patch) | |
tree | 834e5010851ecbd05a41010030e84d2288fc90ae | |
parent | 57e0904baa78c05e9c7bccdd93aa47fd4d4aedc4 (diff) | |
download | mpv-3f076c0fb318b41e91141b7473fdc896e84615b2.tar.bz2 mpv-3f076c0fb318b41e91141b7473fdc896e84615b2.tar.xz |
options: move -a52drc to option struct
Also allow a range up to 2.
-rw-r--r-- | cfg-common-opts.h | 4 | ||||
-rw-r--r-- | cfg-common.h | 2 | ||||
-rw-r--r-- | libmpcodecs/ad_liba52.c | 17 | ||||
-rw-r--r-- | options.h | 1 |
4 files changed, 10 insertions, 14 deletions
diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 84b4bdeaf3..8b364189ee 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -213,9 +213,7 @@ {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"noignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 1, 0, NULL}, -#ifdef CONFIG_LIBA52 - {"a52drc", &a52_drc_level, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL}, -#endif + OPT_FLOATRANGE("a52drc", drc_level, 0, 0, 2), // ------------------------- codec/vfilter options -------------------- diff --git a/cfg-common.h b/cfg-common.h index b6e4654e8f..e8816c98ed 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -52,8 +52,6 @@ extern int reuse_socket; extern int dvd_speed; /* stream/stream_dvd.c */ -extern float a52_drc_level; - /* defined in libmpdemux: */ extern int hr_mp3_seek; extern const m_option_t demux_rawaudio_opts[]; diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c index 29e546a602..0cc282776d 100644 --- a/libmpcodecs/ad_liba52.c +++ b/libmpcodecs/ad_liba52.c @@ -24,7 +24,7 @@ #include <assert.h> #include "config.h" - +#include "options.h" #include "mp_msg.h" #include "mpbswap.h" @@ -53,8 +53,6 @@ static uint32_t channel_map; /** The output is multiplied by this var. Used for volume control */ static sample_t a52_level = 1; -/** The value of the -a52drc switch. */ -float a52_drc_level = 1.0; static int a52_drc_action = DRC_NO_ACTION; static const ad_info_t info = @@ -135,8 +133,9 @@ int channels=0; static sample_t dynrng_call (sample_t c, void *data) { -// fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, (double)a52_drc_level, (double)pow((double)c, a52_drc_level)); - return pow((double)c, a52_drc_level); + struct MPOpts *opts = data; + //fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, opts->drc_level, pow(c, opts->drc_level)); + return pow(c, opts->drc_level); } @@ -177,6 +176,7 @@ static int a52_resample_float(float *in, int16_t *out) static int init(sh_audio_t *sh_audio) { + struct MPOpts *opts = sh_audio->opts; uint32_t a52_accel=0; sample_t level=a52_level, bias=384; int flags=0; @@ -204,12 +204,11 @@ static int init(sh_audio_t *sh_audio) return 0; } - /* Init a52 dynrng */ - if (a52_drc_level < 0.001) { + if (opts->drc_level < 0.001) { /* level == 0 --> no compression, init library without callback */ a52_drc_action = DRC_NO_COMPRESSION; - } else if (a52_drc_level > 0.999) { + } else if (opts->drc_level > 0.999 || opts->drc_level < 1.001) { /* level == 1 --> full compression, do nothing at all (library default = full compression) */ a52_drc_action = DRC_NO_ACTION; } else { @@ -328,7 +327,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m if (a52_drc_action == DRC_NO_COMPRESSION) a52_dynrng(a52_state, NULL, NULL); else - a52_dynrng(a52_state, dynrng_call, NULL); + a52_dynrng(a52_state, dynrng_call, sh_audio->opts); } len=0; @@ -42,6 +42,7 @@ typedef struct MPOpts { char *audio_lang; char *sub_lang; float playback_speed; + float drc_level; struct m_obj_settings *vf_settings; int softzoom; float movie_aspect; |