diff mbox series

[FFmpeg-devel,2/7,v2] avformat/pcmdec: add support to set channel layout in sln demuxer

Message ID 20220320193619.51185-2-jamrial@gmail.com
State Accepted
Commit e42e54fa4e9df258df77e9f3f2e78f6a6a44e686
Headers show
Series [FFmpeg-devel,1/7] avformat/pcmdec: deprecate channels option | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

James Almer March 20, 2022, 7:36 p.m. UTC
Deprecate the channels option, and ensure ch_layout has priority if set over
channels, until the latter is gone.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/pcmdec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 962faad4a7..be45188999 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -180,7 +180,12 @@  PCMDEF(vidc,  "PCM Archimedes VIDC",                            NULL,  VIDC)
 #if CONFIG_SLN_DEMUXER
 static const AVOption sln_options[] = {
     { "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
-    { "channels",    "", offsetof(PCMAudioDemuxerContext, channels),    AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+#if FF_API_OLD_CHANNEL_LAYOUT
+    { "channels",    "", offsetof(PCMAudioDemuxerContext, channels),    AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_DEPRECATED },
+    { "ch_layout",   "", offsetof(PCMAudioDemuxerContext, ch_layout),   AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#else
+    { "ch_layout",   "", offsetof(PCMAudioDemuxerContext, ch_layout),   AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+#endif
     { NULL },
 };