From 7bab2c0c3c47b1c1b869b902167f15c9742ecd1b Mon Sep 17 00:00:00 2001 From: TheM14 Date: Fri, 13 Nov 2026 15:55:59 +0800 Subject: [PATCH] Route ad-joc-pcm inputs to ad_joc The generated f_decoder_wrapper patch only switched to ad_joc when the codec was E-AC-3. ad-joc-pcm=yes was read by the decoder but never had any effect, because PCM/FLAC/TrueHD inputs still went to the default lavc decoder. Read ad_joc_params through mp_get_config_group(ad_joc_conf) and include audio/decode/ad_joc.h in f_decoder_wrapper.c. Accessing p->opts for this was wrong: p->opts is dec_wrapper_opts, not the global MPOpts, and the build failed with "struct dec_wrapper_opts has no member named ad_joc_params". With this change, ad-joc-pcm=yes routes non-E-AC-3 codecs into ad_joc; with no or the option absent, PCM is released to the default decoder. E-AC-3 JOC is unchanged. Rebuild mpv after this change; existing binaries still contain the old eac3-only routing. --- fork/tools/apply_edits.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fork/tools/apply_edits.py b/fork/tools/apply_edits.py index 776b22d..97a1703 100644 --- a/fork/tools/apply_edits.py +++ b/fork/tools/apply_edits.py @@ -44,9 +44,16 @@ WRAPPER_BLOCK = """#if HAVE_JOC /* E-AC-3 JOC through the JustOneCacophony core: --ad=joc renders the * objects (binaural or a speaker layout) instead of letting FFmpeg * downmix. Opt-in, so default playback is untouched. */ + bool joc_pcm = false; + if (p->decf) { + struct ad_joc_params *joc_opts = + mp_get_config_group(NULL, p->decf->global, &ad_joc_conf); + joc_pcm = joc_opts && joc_opts->pcm; + if (joc_opts) + talloc_free(joc_opts); + } if (driver == &ad_lavc && p->codec->codec && - (strcmp(p->codec->codec, "eac3") == 0 || - (p->opts->ad_joc_params && p->opts->ad_joc_params->pcm)) && + (strcmp(p->codec->codec, "eac3") == 0 || joc_pcm) && decoder_name_listed(user_list, "joc")) { struct mp_decoder_list *joc_list =