This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 655dc1af76bc8a2270710994ba6c95126675e9ae Author: Kacper Michajłow <[email protected]> AuthorDate: Tue Aug 11 11:24:12 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Sun Sep 6 00:48:24 2026 +0200 avutil/samplefmt: add AV_SAMPLE_FMT_DSD DSD (Direct Stream Digital) is one-bit sigma-delta modulated audio, found on Super Audio CDs and in DSF/DSDIFF files. libavcodec has several decoders producing it internally (dsd_*, dst, wavpack DSD), each converting to float PCM as part of decoding, which makes the bitstream itself inaccessible to API users. Add a dedicated sample format so raw DSD can be carried through the pipeline, e.g. for bit-perfect pass-through to DSD capable DACs. The format has no planar variant, altform references itself. Signed-off-by: Kacper Michajłow <[email protected]> --- doc/APIchanges | 3 +++ libavutil/samplefmt.c | 12 +++++++++--- libavutil/samplefmt.h | 8 ++++++++ libavutil/version.h | 2 +- tests/ref/fate/samplefmt | 6 ++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9cf1f85702..2f6a3fc08e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2026-06-23. API changes, most recent first: +2026-09-xx - xxxxxxxxxx - lavu 61.7.100 - samplefmt.h + Add AV_SAMPLE_FMT_DSD. + 2026-09-01 - xxxxxxxxxx - lavc 63.10.100 - avcodec.h Add AVCodecContext.skip_pred. diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index e1be5f0547..663b6ca433 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -46,6 +46,7 @@ static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = { [AV_SAMPLE_FMT_S64P] = { .name = "s64p", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_S64 }, [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT }, [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL }, + [AV_SAMPLE_FMT_DSD] = { .name = "dsd", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_DSD }, }; const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt) @@ -250,9 +251,14 @@ int av_samples_set_silence(uint8_t * const *audio_data, int offset, int nb_sampl int planes = planar ? nb_channels : 1; int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels); int data_size = nb_samples * block_align; - int fill_char = (sample_fmt == AV_SAMPLE_FMT_U8 || - sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00; - int i; + int fill_char, i; + + if (sample_fmt == AV_SAMPLE_FMT_U8 || sample_fmt == AV_SAMPLE_FMT_U8P) + fill_char = 0x80; + else if (sample_fmt == AV_SAMPLE_FMT_DSD) + fill_char = 0x69; // only ultrasonic tones, filtered out on playback + else + fill_char = 0x00; offset *= block_align; diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index 6e55d71140..8240d18eff 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -68,6 +68,14 @@ enum AVSampleFormat { AV_SAMPLE_FMT_S64, ///< signed 64 bits AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar + /** + * DSD (Direct Stream Digital) bitstream, interleaved. Each byte + * carries 8 consecutive one-bit samples, most significant bit first. + * One sample in the API sense is one such byte, so the sample rate + * is 1/8th of the DSD bit rate. + */ + AV_SAMPLE_FMT_DSD, + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically }; diff --git a/libavutil/version.h b/libavutil/version.h index b065c39343..b83c74d755 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 61 -#define LIBAVUTIL_VERSION_MINOR 6 +#define LIBAVUTIL_VERSION_MINOR 7 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/ref/fate/samplefmt b/tests/ref/fate/samplefmt index d35832892b..2d1e31feab 100644 --- a/tests/ref/fate/samplefmt +++ b/tests/ref/fate/samplefmt @@ -11,6 +11,7 @@ Testing name/format round-trip 9: name=dblp roundtrip=OK 10: name=s64 roundtrip=OK 11: name=s64p roundtrip=OK +12: name=dsd roundtrip=OK NONE name: (null) NB name: (null) unknown: -1 @@ -28,6 +29,7 @@ fltp: 4 dblp: 8 s64: 8 s64p: 8 +dsd: 1 NONE: 0 Testing av_sample_fmt_is_planar() @@ -43,6 +45,7 @@ fltp: 1 dblp: 1 s64: 0 s64p: 1 +dsd: 0 NONE: 0 Testing packed/planar conversions @@ -58,6 +61,7 @@ fltp: packed=flt planar=fltp dblp: packed=dbl planar=dblp s64: packed=s64 planar=s64p s64p: packed=s64 planar=s64p +dsd: packed=dsd planar=dsd Testing av_get_alt_sample_fmt() u8: alt_packed=u8 alt_planar=u8p @@ -72,6 +76,7 @@ fltp: alt_packed=flt alt_planar=fltp dblp: alt_packed=dbl alt_planar=dblp s64: alt_packed=s64 alt_planar=s64p s64p: alt_packed=s64 alt_planar=s64p +dsd: alt_packed=dsd alt_planar=dsd Testing av_get_sample_fmt_string() header: name depth @@ -87,6 +92,7 @@ fltp 32 dblp 64 s64 64 s64p 64 +dsd 8 Testing av_samples_get_buffer_size() 2ch 1024smp s16: 4096 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
