summaryrefslogtreecommitdiffstats
path: root/wscript_build.py
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-12-28 09:38:22 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-12-29 17:56:53 +0100
commit54aea7d5de13735bad291c0f1d9ba93b17a6321e (patch)
tree13ca20a462a71329f59f9463c0620df9a620ed70 /wscript_build.py
parent461ba50ed6e8227da034e4ebcb4316f34a720274 (diff)
downloadmpv-54aea7d5de13735bad291c0f1d9ba93b17a6321e.tar.bz2
mpv-54aea7d5de13735bad291c0f1d9ba93b17a6321e.tar.xz
chmap_sel: add multichannel fallback heuristic
Instead of just failing during channel map selection, try to select a close layout that makes most sense and upmix/downmix to that instead of failing AO initialization. The heuristic is rather simple, and uses the following steps: 1) If mono is required always prefer stereo to a multichannel upmix. 2) Search for an upmix that is an exact superset of the required channel map. 3) Search for a downmix that is the exact subset of the required channel map. 4) Search for either an upmix or downmix that is the closest (minimum difference of channels) to the required channel map.
Diffstat (limited to 'wscript_build.py')
-rw-r--r--wscript_build.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/wscript_build.py b/wscript_build.py
index 58925444cf..6c6b6bd3ae 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -33,6 +33,10 @@ def _build_pdf(ctx):
_add_rst_manual_dependencies(ctx)
+def _all_includes(ctx):
+ return [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
+ ctx.dependencies_includes()
+
def build(ctx):
ctx.load('waf_customizations')
ctx.load('generators.sources')
@@ -415,13 +419,21 @@ def build(ctx):
ctx.path.find_node('osdep/mpv.rc'),
ctx.path.find_node(node))
+ if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
+ ctx(
+ target = "objects",
+ source = ctx.filtered_sources(sources),
+ use = ctx.dependencies_use(),
+ includes = _all_includes(ctx),
+ features = "c",
+ )
+
if ctx.dependency_satisfied('cplayer'):
ctx(
target = "mpv",
- source = ctx.filtered_sources(sources) + ["player/main_fn.c"],
- use = ctx.dependencies_use(),
- includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
- ctx.dependencies_includes(),
+ source = "player/main_fn.c",
+ use = 'objects',
+ includes = _all_includes(ctx),
features = "c cprogram",
install_path = ctx.env.BINDIR
)
@@ -443,6 +455,15 @@ def build(ctx):
wrapctx.env.CFLAGS = wrapflags
wrapctx.env.LAST_LINKFLAGS = wrapflags
+ if ctx.dependency_satisfied('test'):
+ for test in ctx.path.ant_glob("test/*.c"):
+ ctx(
+ target = os.path.splitext(test.srcpath())[0],
+ source = test.srcpath(),
+ use = "objects",
+ includes = _all_includes(ctx),
+ features = "c cprogram",
+ )
build_shared = ctx.dependency_satisfied('libmpv-shared')
build_static = ctx.dependency_satisfied('libmpv-static')