summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/af.rst5
-rw-r--r--audio/decode/ad.h6
-rw-r--r--audio/decode/dec_audio.c12
-rw-r--r--audio/filter/af.c4
-rw-r--r--audio/filter/af_volume.c8
-rw-r--r--audio/filter/control.h5
6 files changed, 9 insertions, 31 deletions
diff --git a/DOCS/man/en/af.rst b/DOCS/man/en/af.rst
index 2eaeabed0c..759476a1c7 100644
--- a/DOCS/man/en/af.rst
+++ b/DOCS/man/en/af.rst
@@ -219,7 +219,7 @@ format[=format]
rule that are also valid format specifiers: u8, s8, floatle, floatbe,
floatne, mpeg2, and ac3.
-volume[=v[:sc]]
+volume[=v[:sc[:fast]]]
Implements software volume control. Use this filter with caution since it
can reduce the signal to noise ratio of the sound. In most cases it is
best to set the level for the PCM sound to max, leave this filter out and
@@ -250,6 +250,9 @@ volume[=v[:sc]]
*WARNING*: This feature creates distortion and should be considered a
last resort.
+ <fast>
+ Force S16 sample format if set to 1. Lower quality, but might be faster
+ in some situations.
*EXAMPLE*:
diff --git a/audio/decode/ad.h b/audio/decode/ad.h
index 3bc3e39267..de1bc33aba 100644
--- a/audio/decode/ad.h
+++ b/audio/decode/ad.h
@@ -48,10 +48,4 @@ extern const ad_functions_t * const mpcodecs_ad_drivers[];
// fallback if ADCTRL_SKIP not implemented: ds_fill_buffer(sh_audio->ds);
#define ADCTRL_SKIP_FRAME 2 // skip block/frame, called while seeking
-// fallback if ADCTRL_QUERY_FORMAT not implemented: sh_audio->sample_format
-#define ADCTRL_QUERY_FORMAT 3 // test for availabilty of a format
-
-// fallback: use hw mixer in libao
-#define ADCTRL_SET_VOLUME 4 // not used at the moment
-
#endif /* MPLAYER_AD_H */
diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c
index cac33a9a31..69ca3f110c 100644
--- a/audio/decode/dec_audio.c
+++ b/audio/decode/dec_audio.c
@@ -47,16 +47,8 @@ static int init_audio_codec(sh_audio_t *sh_audio, const char *decoder)
{
assert(!sh_audio->initialized);
resync_audio_stream(sh_audio);
- sh_audio->samplesize = 2;
- sh_audio->sample_format = AF_FORMAT_S16_NE;
- if ((af_cfg.force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) {
- int fmt = AF_FORMAT_FLOAT_NE;
- if (sh_audio->ad_driver->control(sh_audio, ADCTRL_QUERY_FORMAT,
- &fmt) == CONTROL_TRUE) {
- sh_audio->sample_format = fmt;
- sh_audio->samplesize = 4;
- }
- }
+ sh_audio->samplesize = 4;
+ sh_audio->sample_format = AF_FORMAT_FLOAT_NE;
sh_audio->audio_out_minsize = 8192; // default, preinit() may change it
if (!sh_audio->ad_driver->preinit(sh_audio)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Audio decoder preinit failed.\n");
diff --git a/audio/filter/af.c b/audio/filter/af.c
index c36c8f6e8f..d6d09158ef 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -154,9 +154,7 @@ static struct af_instance *af_create(struct af_stream *s,
mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Adding filter %s \n", name);
// Initialize the new filter
- if (AF_OK == new->info->open(new) &&
- AF_ERROR < new->control(new, AF_CONTROL_POST_CREATE, &s->cfg))
- {
+ if (AF_OK == new->info->open(new)) {
if (cmdline) {
if (AF_ERROR >= new->control(new, AF_CONTROL_COMMAND_LINE, cmdline))
goto err_out;
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c
index ecf181c8b8..474ad72777 100644
--- a/audio/filter/af_volume.c
+++ b/audio/filter/af_volume.c
@@ -87,14 +87,10 @@ static int control(struct af_instance* af, int cmd, void* arg)
float v=0.0;
float vol[AF_NCH];
int i;
- sscanf((char*)arg,"%f:%i", &v, &s->soft);
+ sscanf((char*)arg,"%f:%i:%i", &v, &s->soft, &s->fast);
for(i=0;i<AF_NCH;i++) vol[i]=v;
return control(af,AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, vol);
}
- case AF_CONTROL_POST_CREATE:
- s->fast = ((((struct af_cfg*)arg)->force & AF_INIT_FORMAT_MASK) ==
- AF_INIT_FLOAT) ? 0 : 1;
- return AF_OK;
case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_SET:
memcpy(s->enable,(int*)arg,AF_NCH*sizeof(int));
return AF_OK;
@@ -122,7 +118,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
for(i=0;i<AF_NCH;i++)
m=max(m,s->max[i]);
af_to_dB(1, &m, &m, 10.0);
- mp_msg(MSGT_AFILTER, MSGL_INFO, "[volume] The maximum volume was %0.2fdB \n", m);
+ mp_msg(MSGT_AFILTER, MSGL_V, "[volume] The maximum volume was %0.2fdB \n", m);
}
return AF_OK;
}
diff --git a/audio/filter/control.h b/audio/filter/control.h
index 323b9a3924..1342d5f299 100644
--- a/audio/filter/control.h
+++ b/audio/filter/control.h
@@ -98,11 +98,6 @@ typedef struct af_control_ext_s{
// OPTIONAL CALLS
-/* Called just after creation with the af_cfg for the stream in which
- the filter resides as input parameter this call can be used by the
- filter to initialize itself */
-#define AF_CONTROL_POST_CREATE 0x00000100 | AF_CONTROL_OPTIONAL
-
// Called just before destruction of a filter
#define AF_CONTROL_PRE_DESTROY 0x00000200 | AF_CONTROL_OPTIONAL