diff mbox series

[FFmpeg-devel,v2,02/10] avformat/flacdec: Also set channels when setting channel_layout

Message ID AM7PR03MB6660E2E6D01BEA02B6193BD58FCC9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,v2,01/10] tests/fate-run: Allow multiple inputs for transcode() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 31, 2021, 12:42 p.m. UTC
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>
---
 libavformat/flacdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paul B Mahol Sept. 1, 2021, 6:28 a.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 2060b48c69..d52434d2f9 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"
@@ -192,6 +193,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);
                     }
                 }