Skip to content

audio: add DSD-over-PCM pass-through - #18312

Merged
kasper93 merged 8 commits into
mpv-player:masterfrom
kasper93:dsd
Sep 5, 2026
Merged

audio: add DSD-over-PCM pass-through#18312
kasper93 merged 8 commits into
mpv-player:masterfrom
kasper93:dsd

Conversation

@kasper93

Copy link
Copy Markdown
Member

For DST playback, need https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23939 patch. DSD doesn't need it.

@kasper93
kasper93 force-pushed the dsd branch 2 times, most recently from 4388555 to 7173b58 Compare July 29, 2026 19:11
@kasper93 kasper93 added this to the Release v0.42.0 milestone Aug 23, 2026
AF_FORMAT_S_DOP carries pre-packed DoP frames: a marker byte and 16 DSD
bits per channel in the 24 MSBs of 32-bit samples, at 1/16th of the DSD
bit rate. Similar to IEC61937 formats, it's meant to be exclusive not
touched pass-through.
Generalize the spdif PCM fallback and the output format verification to
any bitstream format instead of only IEC61937 formats.
@kasper93
kasper93 force-pushed the dsd branch 2 times, most recently from 806f73e to affb724 Compare September 5, 2026 23:07
Map FFmpeg's AV_SAMPLE_FMT_DSD to AF_FORMAT_DSD.
FFmpeg's DSD decoders convert to PCM by default, but that conversion is
deprecated. Request AV_SAMPLE_FMT_DSD instead, will be converted by SWR,
when needed.
FFmpeg's DSD decoders convert to PCM by default, which is deprecated and
logs a warning. Pass request_sample_fmt=dsd for the DSD codecs, the same
thing ad_lavc does when decoding.
Map AF_FORMAT_S_DOP to 24 bits in 32-bit PCM containers, which is
how DoP is transported over WASAPI in exclusive mode. Force exclusive
mode for any non-PCM format, and don't try alternative formats for DoP.

set_ao_format() now also checks the requested format before touching
the ao configuration, because the DoP wire format reverse-maps to a
plain PCM sample format.
Add ad_dsd, a pass-through decoder converting raw DSD audio to DoP frames, enabled with --audio-spdif=dsd. DST compressed audio is losslessly decompressed to DSD first.

DoP output requires an AO with support for the format (currently
ao_wasapi in exclusive mode) and a DoP capable DAC. Will fallback to PCM
if not supported.
@kasper93
kasper93 merged commit 876ba7b into mpv-player:master Sep 5, 2026
30 checks passed
@kasper93
kasper93 deleted the dsd branch September 5, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant