Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/dfpwmdec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c index 9f935a422a..3bd8bc0e41 100644 --- a/libavformat/dfpwmdec.c +++ b/libavformat/dfpwmdec.c @@ -32,6 +32,7 @@ typedef struct DFPWMAudioDemuxerContext { AVClass *class; int sample_rate; int channels; + AVChannelLayout ch_layout; } DFPWMAudioDemuxerContext; static int dfpwm_read_header(AVFormatContext *s) @@ -48,7 +49,13 @@ static int dfpwm_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; par->sample_rate = s1->sample_rate; - par->ch_layout.nb_channels = s1->channels; + if (s1->channels) + par->ch_layout.nb_channels = s1->channels; + else { + int ret = av_channel_layout_copy(&par->ch_layout, &s1->ch_layout); + if (ret < 0) + return ret; + } par->bits_per_coded_sample = 1; par->block_align = 1; @@ -58,7 +65,8 @@ static int dfpwm_read_header(AVFormatContext *s) static const AVOption dfpwm_options[] = { { "sample_rate", "", offsetof(DFPWMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(DFPWMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "ch_layout", "", offsetof(DFPWMAudioDemuxerContext, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "mono"}, 0, 0, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; static const AVClass dfpwm_demuxer_class = { -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".