From 54aea7d5de13735bad291c0f1d9ba93b17a6321e Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 28 Dec 2014 09:38:22 +0100 Subject: 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. --- wscript_build.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'wscript_build.py') 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') -- cgit v1.2.3