Răsfoiți Sursa

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>
Andreas Rheinhardt 4 ani în urmă
părinte
comite
fadefe356a
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      libavformat/flacdec.c

+ 2 - 0
libavformat/flacdec.c

@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
  */
 
 
+#include "libavutil/channel_layout.h"
 #include "libavcodec/flac.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
 #include "avformat.h"
 #include "flac_picture.h"
 #include "flac_picture.h"
@@ -191,6 +192,7 @@ static int flac_read_header(AVFormatContext *s)
                                "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
                                "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
                     } else {
                     } else {
                         st->codecpar->channel_layout = mask;
                         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);
                         av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", NULL, 0);
                     }
                     }
                 }
                 }