summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_force.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-22 01:20:43 +0200
committerwm4 <wm4@nowhere>2013-10-23 10:04:12 +0200
commite60b8f181dec744af25c3a52fb88f600cd1b63ea (patch)
tree31ab322709b207dea61d86600d5ce177b318238e /audio/filter/af_force.c
parent33707c6d6394592f528fb200af2dd6e104fc6df6 (diff)
downloadmpv-e60b8f181dec744af25c3a52fb88f600cd1b63ea.tar.bz2
mpv-e60b8f181dec744af25c3a52fb88f600cd1b63ea.tar.xz
audio/filter: split af_format into separate filters, rename af_force
af_format is the old audio conversion filter. It could do all possible conversions supported by the audio chain. However, ever since the addition of af_lavrresample, most conversions are done by libav/swresample, and af_format is used as fallback. Separate out the fallback cases and remove af_format. af_convert24 does 24 bit <-> 32 bit conversions, while af_convertsignendian does sign and endian conversions. Maybe the way the conversions are split sounds a bit odd. But the former changes the size of the audio data, while the latter is fully in-place, so there's at least different buffer management. This requires a quite complicated algorithm to make sure all these "partial" conversion filters can actually get from one format to another. E.g. s24le->s32be always requires convertsignendian and convert24, but af.c has no idea what the intermediate format should be. So I added a graph search (trying every possible format and filter) to determine required format and filter. When I wrote this, it seemed this was still better than messing everything into af_lavrresample, but maybe this is overkill and I'll change my opinion. For now, it seems nice to get rid of af_format though. The AC3->IEC61937 conversion isn't supported anymore, but I don't think this is needed anywhere. Most AOs test all formats explicitly, or use the AF_FORMAT_IS_IEC61937() macro (which includes AC3). One positive consequence of this change is that conversions always include dithering (done by libav/swresample), instead of possibly going through af_format, which doesn't do anything fancy. Rename af_force to af_format. It's essentially compatible with command line uses of af_format. We retain a compatibility alias for af_force.
Diffstat (limited to 'audio/filter/af_force.c')
-rw-r--r--audio/filter/af_force.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/filter/af_force.c b/audio/filter/af_force.c
index adf17c61f2..21af663e81 100644
--- a/audio/filter/af_force.c
+++ b/audio/filter/af_force.c
@@ -72,12 +72,12 @@ static int control(struct af_instance *af, int cmd, void *arg)
if (in->nch != out->nch || in->bps != out->bps) {
mp_msg(MSGT_AFILTER, MSGL_ERR,
- "[af_force] Forced input/output formats are incompatible.\n");
+ "[af_format] Forced input/output formats are incompatible.\n");
return AF_ERROR;
}
if (priv->fail) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[af_force] Failing on purpose.\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[af_format] Failing on purpose.\n");
return AF_ERROR;
}
@@ -116,9 +116,9 @@ static int af_open(struct af_instance *af)
#define OPT_BASE_STRUCT struct priv
-struct af_info af_info_force = {
+struct af_info af_info_format = {
"Force audio format",
- "force",
+ "format",
"",
"",
0,