summaryrefslogtreecommitdiff
path: root/libavformat/flacdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-08-29 11:01:16 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-07 22:06:27 +0200
commitfadefe356ac82cf5ceab12068b9fea6d1d9c70f0 (patch)
tree21a211e0f656c6e392692fbf62912118005281c9 /libavformat/flacdec.c
parent0a0204c48ad11f92e7a7c306d3b7f24bb280e6d0 (diff)
downloadffmpeg-fadefe356ac82cf5ceab12068b9fea6d1d9c70f0.tar.gz
avformat/flacdec: Also set channels when setting channel_layout
This brings the FLAC demuxer in line with all the other demuxers. Furthermore, if it is not done and the FLAC decoder is disabled, the FLAC parser will overwrite the channel layout with the standard channel layout for that number of channels. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/flacdec.c')
-rw-r--r--libavformat/flacdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 04d3cadf1c..3401aebe8d 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavcodec/flac.h"
#include "avformat.h"
#include "flac_picture.h"
@@ -191,6 +192,7 @@ static int flac_read_header(AVFormatContext *s)
"Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
} else {
st->codecpar->channel_layout = mask;
+ st->codecpar->channels = av_get_channel_layout_nb_channels(mask);
av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
}
}