summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-09-21 12:48:30 +0200
committerwm4 <wm4@nowhere>2017-09-21 12:48:30 +0200
commitfdb300b983744c522f335ccf64e9788b78f86701 (patch)
treeabd10d97e8c6cb30e1621db8b67d709cbfaeb705 /player/command.c
parent3a2d5e68acb2ac0f8b09b896907a692b1c48c6b3 (diff)
downloadmpv-fdb300b983744c522f335ccf64e9788b78f86701.tar.bz2
mpv-fdb300b983744c522f335ccf64e9788b78f86701.tar.xz
audio: make libaf derived code optional
This code could not be relicensed. The intention was to write new filter code (which could handle both audio and video), but that's a bit of work. Write some code that can do audio conversion (resampling, downmixing, etc.) without the old audio filter chain code in order to speed up the LGPL relicensing. If you build with --disable-libaf, nothing in audio/filter/* is compiled in. It breaks a few features, such as --volume, --af, pitch correction on speed changes, replaygain. Most likely this adds some bugs, even if --disable-libaf is not used. (How the fuck does EOF notification work again anyway?)
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c
index 1147eab14e..1cf8dc2438 100644
--- a/player/command.c
+++ b/player/command.c
@@ -57,8 +57,8 @@
#include "video/out/vo.h"
#include "video/csputils.h"
#include "audio/aframe.h"
+#include "audio/format.h"
#include "audio/out/ao.h"
-#include "audio/filter/af.h"
#include "video/decode/dec_video.h"
#include "audio/decode/dec_audio.h"
#include "video/out/bitmap_packer.h"
@@ -71,6 +71,10 @@
#include "core.h"
+#if HAVE_LIBAF
+#include "audio/filter/af.h"
+#endif
+
#ifdef _WIN32
#include <windows.h>
#endif
@@ -1455,10 +1459,12 @@ static int mp_property_filter_metadata(void *ctx, struct m_property *prop,
struct vf_chain *vf = mpctx->vo_chain->vf;
res = vf_control_by_label(vf, VFCTRL_GET_METADATA, &metadata, key);
} else if (strcmp(type, "af") == 0) {
+#if HAVE_LIBAF
if (!(mpctx->ao_chain && mpctx->ao_chain->af))
return M_PROPERTY_UNAVAILABLE;
struct af_stream *af = mpctx->ao_chain->af;
res = af_control_by_label(af, AF_CONTROL_GET_METADATA, &metadata, key);
+#endif
}
switch (res) {
case CONTROL_UNKNOWN:
@@ -1785,8 +1791,7 @@ static int mp_property_mixer_active(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- struct ao_chain *ao_c = mpctx->ao_chain;
- return m_property_flag_ro(action, arg, ao_c && ao_c->af->initialized > 0);
+ return m_property_flag_ro(action, arg, !!mpctx->ao);
}
/// Volume (RW)
@@ -5491,11 +5496,13 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
return vf_send_command(mpctx->vo_chain->vf, cmd->args[0].v.s,
cmd->args[1].v.s, cmd->args[2].v.s);
+#if HAVE_LIBAF
case MP_CMD_AF_COMMAND:
if (!mpctx->ao_chain)
return -1;
return af_send_command(mpctx->ao_chain->af, cmd->args[0].v.s,
cmd->args[1].v.s, cmd->args[2].v.s);
+#endif
case MP_CMD_SCRIPT_BINDING: {
mpv_event_client_message event = {0};