This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit c6e28adabac09745f3406ffbf3833b8ac7f3f46a
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Tue Aug 11 12:16:59 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Sun Sep 6 00:48:26 2026 +0200

    avcodec: deprecate the PCM output of the DSD decoders
    
    Now that AV_SAMPLE_FMT_DSD exists, the decoders will prefer this output
    and PCM conversion is deprecated and will be removed. Users can use
    libswresample directly.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/dsd.c           |  8 +++++++-
 libavcodec/dsd.h           |  5 +++--
 libavcodec/dsddec.c        |  8 ++++----
 libavcodec/dstdec.c        | 12 ++++++------
 libavcodec/version.h       |  4 ++--
 libavcodec/version_major.h |  1 +
 libavcodec/wavpack.c       | 26 +++++++++++++-------------
 7 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/libavcodec/dsd.c b/libavcodec/dsd.c
index 3d705dc7a3..bae0db8285 100644
--- a/libavcodec/dsd.c
+++ b/libavcodec/dsd.c
@@ -25,7 +25,7 @@
 #include "libavutil/attributes.h"
 #include "dsd.h"
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 #include "libswresample/swresample.h"
 #include "avcodec.h"
 
@@ -48,6 +48,12 @@ av_cold int ff_dsd_to_pcm_init(AVCodecContext *avctx, struct 
SwrContext **swrp)
         return ret;
     }
 
+    av_log(avctx, AV_LOG_WARNING,
+           "Converting DSD to PCM in the decoder is deprecated and will be "
+           "removed. Set request_sample_fmt to AV_SAMPLE_FMT_DSD to receive "
+           "the raw bitstream, and use libswresample to convert it to PCM "
+           "when needed.\n");
+
     *swrp = swr;
     return 0;
 }
diff --git a/libavcodec/dsd.h b/libavcodec/dsd.h
index a65d7d7757..dcabafe5b2 100644
--- a/libavcodec/dsd.h
+++ b/libavcodec/dsd.h
@@ -27,8 +27,9 @@ struct SwrContext;
 
 /**
  * (Re)create a libswresample context converting AV_SAMPLE_FMT_DSD to
- * avctx->sample_fmt at the same sample rate.
- * Only available if CONFIG_SWRESAMPLE.
+ * avctx->sample_fmt at the same sample rate. This is a transitional helper for
+ * the deprecated in-decoder DSD to PCM conversion.
+ * Only available if CONFIG_SWRESAMPLE && FF_API_DSD_PCM.
  */
 int ff_dsd_to_pcm_init(struct AVCodecContext *avctx, struct SwrContext **swrp);
 
diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
index 1f6411e6b2..822e57f8f5 100644
--- a/libavcodec/dsddec.c
+++ b/libavcodec/dsddec.c
@@ -37,7 +37,7 @@
 #include "decode.h"
 #include "dsd.h"
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 #include "libswresample/swresample.h"
 
 typedef struct DSDDecContext {
@@ -58,7 +58,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     avctx->sample_fmt = AV_SAMPLE_FMT_DSD;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     if (avctx->request_sample_fmt != AV_SAMPLE_FMT_DSD)
         avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
 #endif
@@ -68,7 +68,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 static av_cold int decode_close(AVCodecContext *avctx)
 {
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     DSDDecContext *s = avctx->priv_data;
 
     swr_free(&s->swr);
@@ -121,7 +121,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     DSDDecContext *s = avctx->priv_data;
     if (avctx->sample_fmt != AV_SAMPLE_FMT_DSD) {
         if (!s->swr && (ret = ff_dsd_to_pcm_init(avctx, &s->swr)) < 0)
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index 58feb5a593..9bb16058eb 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -38,7 +38,7 @@
 #include "golomb.h"
 #include "dsd.h"
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 #include "libswresample/swresample.h"
 #endif
 
@@ -80,7 +80,7 @@ typedef struct DSTContext {
     Table fsets, probs;
     DECLARE_ALIGNED(16, uint8_t, status)[DST_MAX_CHANNELS][16];
     DECLARE_ALIGNED(16, int16_t, filter)[DST_MAX_ELEMENTS][16][256];
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     struct SwrContext *swr;
     uint8_t *scratch;
     unsigned scratch_size;
@@ -106,7 +106,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     avctx->sample_fmt = AV_SAMPLE_FMT_DSD;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     if (avctx->request_sample_fmt != AV_SAMPLE_FMT_DSD)
         avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
 #endif
@@ -116,7 +116,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
 static av_cold int decode_close(AVCodecContext *avctx)
 {
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     DSTContext *s = avctx->priv_data;
 
     swr_free(&s->swr);
@@ -281,7 +281,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
         return ret;
     dsd = frame->data[0];
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     if (avctx->sample_fmt != AV_SAMPLE_FMT_DSD) {
         if (!s->swr && (ret = ff_dsd_to_pcm_init(avctx, &s->swr)) < 0)
             return ret;
@@ -406,7 +406,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
     }
 
 done:
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     if (s->swr) {
         ret = swr_convert(s->swr, &frame->data[0], frame->nb_samples,
                           (const uint8_t *const []){ s->scratch },
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 9048abdb9a..8b53586be1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  10
-#define LIBAVCODEC_VERSION_MICRO 104
+#define LIBAVCODEC_VERSION_MINOR  11
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 166646eb6d..f30563c117 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -41,5 +41,6 @@
 
 #define FF_API_INTRA_DC_PRECISION  (LIBAVCODEC_VERSION_MAJOR < 64)
 #define FF_API_MJPEG_EXTERN_HUFF   (LIBAVCODEC_VERSION_MAJOR < 64)
+#define FF_API_DSD_PCM             (LIBAVCODEC_VERSION_MAJOR < 64)
 
 #endif /* AVCODEC_VERSION_MAJOR_H */
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index d6864e11d4..e4c3ab1b46 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -37,7 +37,7 @@
 #include "wavpack.h"
 #include "dsd.h"
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 #include "libswresample/swresample.h"
 #endif
 
@@ -115,7 +115,7 @@ typedef struct WavpackContext {
     Modulation modulation;
     int dsd_raw;            ///< output the raw DSD bitstream instead of PCM
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     struct WvDSDSwr *dsd_swr; ///< RefStruct reference, shared between threads
     uint8_t *dsd_scratch;   ///< per-thread frame sized raw DSD buffer
     unsigned dsd_scratch_size;
@@ -125,7 +125,7 @@ typedef struct WavpackContext {
     int dsd_channels;
 } WavpackContext;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 typedef struct WvDSDSwr {
     struct SwrContext *swr;
 } WvDSDSwr;
@@ -1016,7 +1016,7 @@ static av_cold int wv_alloc_frame_context(WavpackContext 
*c)
     return 0;
 }
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
 static void wv_dsd_swr_free(AVRefStructOpaque opaque, void *obj)
 {
     WvDSDSwr *h = obj;
@@ -1030,7 +1030,7 @@ static int wv_dsd_reset(AVCodecContext *avctx, int 
channels)
     WavpackContext *s = avctx->priv_data;
 
     s->dsd_channels = 0;
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     av_refstruct_unref(&s->dsd_swr);
 #endif
     av_refstruct_unref(&s->curr_progress);
@@ -1039,7 +1039,7 @@ static int wv_dsd_reset(AVCodecContext *avctx, int 
channels)
     if (!channels)
         return 0;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     {
         s->dsd_swr = av_refstruct_alloc_ext(sizeof(*s->dsd_swr), 0, NULL,
                                             wv_dsd_swr_free);
@@ -1066,7 +1066,7 @@ static int update_thread_context(AVCodecContext *dst, 
const AVCodecContext *src)
     WavpackContext *fdst = dst->priv_data;
 
     av_refstruct_replace(&fdst->curr_progress, fsrc->curr_progress);
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     av_refstruct_replace(&fdst->dsd_swr, fsrc->dsd_swr);
 #endif
     fdst->dsd_channels = fsrc->dsd_channels;
@@ -1102,7 +1102,7 @@ static av_cold int wavpack_decode_init(AVCodecContext 
*avctx)
     s->fdec_num = 0;
 
     s->dsd_raw = 1;
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     s->dsd_raw = avctx->request_sample_fmt == AV_SAMPLE_FMT_DSD;
 #endif
 
@@ -1132,7 +1132,7 @@ static av_cold int wavpack_decode_end(AVCodecContext 
*avctx)
 
     av_refstruct_pool_uninit(&s->progress_pool);
     wv_dsd_reset(avctx, 0);
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     av_freep(&s->dsd_scratch);
 #endif
 
@@ -1583,7 +1583,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
AVFrame *frame, int block
         }
         av_assert1(new_ch_layout.nb_channels <= WV_MAX_CHANNELS);
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
         /* clear DSD state if stream properties change */
         int reset_dsd = !wc->dsd_raw &&
             ((wc->dsd_swr && !got_dsd) ||
@@ -1596,7 +1596,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
AVFrame *frame, int block
         avctx->sample_fmt          = sample_fmt;
         avctx->bits_per_raw_sample = orig_bpp;
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
         if (reset_dsd) {
             ret = wv_dsd_reset(avctx, got_dsd ? new_ch_layout.nb_channels : 0);
             if (ret < 0) {
@@ -1635,7 +1635,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
AVFrame *frame, int block
     if (got_dsd) {
         // DSD output is interleaved
         stride = avctx->ch_layout.nb_channels;
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
         if (wc->dsd_swr) {
             av_fast_malloc(&wc->dsd_scratch, &wc->dsd_scratch_size,
                            (size_t)s->samples * stride);
@@ -1755,7 +1755,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
         goto error;
     }
 
-#if CONFIG_SWRESAMPLE
+#if CONFIG_SWRESAMPLE && FF_API_DSD_PCM
     if (s->dsd_swr) {
         if (s->prev_progress)
             ff_thread_progress_await(s->prev_progress, INT_MAX);

-- 
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]

Reply via email to