diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 735a3c2d76..43fa7d8292 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1534,8 +1534,13 @@ typedef struct AVPacket {
 
 
 enum AVSideDataParamChangeFlags {
+#if FF_API_OLD_CHANNEL_LAYOUT
+    /**
+     * @deprecated those are not used by any decoder
+     */
     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
     AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
+#endif
     AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE    = 0x0004,
     AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS     = 0x0008,
 };
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 0883c7209c..809f309b8c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -69,6 +69,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
     flags = bytestream_get_le32(&data);
     size -= 4;
 
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
     if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
         if (size < 4)
             goto fail;
@@ -87,6 +89,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
         avctx->channel_layout = bytestream_get_le64(&data);
         size -= 8;
     }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
         if (size < 4)
             goto fail;
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 56814ff7d2..5dd3b1a87e 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -161,8 +161,11 @@ static void dump_paramchange(void *ctx, AVPacketSideData *sd)
 {
     int size = sd->size;
     const uint8_t *data = sd->data;
-    uint32_t flags, channels, sample_rate, width, height;
+    uint32_t flags, sample_rate, width, height;
+#if FF_API_OLD_CHANNEL_LAYOUT
+    uint32_t channels;
     uint64_t layout;
+#endif
 
     if (!data || sd->size < 4)
         goto fail;
@@ -171,6 +174,8 @@ static void dump_paramchange(void *ctx, AVPacketSideData *sd)
     data += 4;
     size -= 4;
 
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
     if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
         if (size < 4)
             goto fail;
@@ -188,6 +193,8 @@ static void dump_paramchange(void *ctx, AVPacketSideData *sd)
         av_log(ctx, AV_LOG_INFO,
                "channel layout: %s, ", av_get_channel_name(layout));
     }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_OLD_CHANNEL_LAYOUT */
     if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
         if (size < 4)
             goto fail;
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 46dce7722d..94d2e65a37 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -888,6 +888,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
                 break;
             case AV_PKT_DATA_PARAM_CHANGE:
                 flags = bytestream_get_le32(&data);
+#if FF_API_OLD_CHANNEL_LAYOUT
                 if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
                     put_str(dyn_bc, "Channels");
                     put_s(dyn_bc, bytestream_get_le32(&data));
@@ -901,6 +902,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
                     avio_write(dyn_bc, data, 8); data+=8;
                     sm_data_count++;
                 }
+#endif
                 if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
                     put_str(dyn_bc, "SampleRate");
                     put_s(dyn_bc, bytestream_get_le32(&data));
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4d18880acb..b6b5f0f308 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5067,6 +5067,9 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
     uint8_t *data;
     if (!pkt)
         return AVERROR(EINVAL);
+
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
     if (channels) {
         size  += 4;
         flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT;
@@ -5075,6 +5078,8 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
         size  += 8;
         flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT;
     }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     if (sample_rate) {
         size  += 4;
         flags |= AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE;
@@ -5087,10 +5092,14 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
     if (!data)
         return AVERROR(ENOMEM);
     bytestream_put_le32(&data, flags);
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
     if (channels)
         bytestream_put_le32(&data, channels);
     if (channel_layout)
         bytestream_put_le64(&data, channel_layout);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     if (sample_rate)
         bytestream_put_le32(&data, sample_rate);
     if (width || height) {
