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.
This commit is contained in:
TheM14 committed 2026-11-13 15:55:59 +08:00
1 parent 9f698ad694
commit 7bab2c0c3c
1 file changed
+9 -2
+9 -2
View File
@@ -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 =