diff mbox series

[FFmpeg-devel] avformat/riffdec: add ch_layout used av_channel_layout_default.

Message ID 20240509022818.132382-1-hiccupzhu@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/riffdec: add ch_layout used av_channel_layout_default. | expand

Commit Message

Hiccup Zhu May 9, 2024, 2:28 a.m. UTC
Signed-off-by: shiqizhu <hiccupzhu@gmail.com>
---
 libavformat/riffdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

James Almer May 9, 2024, 2:30 a.m. UTC | #1
On 5/8/2024 11:28 PM, shiqizhu wrote:
> Signed-off-by: shiqizhu <hiccupzhu@gmail.com>
> ---
>   libavformat/riffdec.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
> index b7a85a6ab2..89267e879d 100644
> --- a/libavformat/riffdec.c
> +++ b/libavformat/riffdec.c
> @@ -197,8 +197,7 @@ int ff_get_wav_header(void *logctx, AVIOContext *pb,
>       /* ignore WAVEFORMATEXTENSIBLE layout if different from channel count */
>       if (channels != par->ch_layout.nb_channels) {
>           av_channel_layout_uninit(&par->ch_layout);
> -        par->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
> -        par->ch_layout.nb_channels = channels;
> +        av_channel_layout_default(&par->ch_layout, channels);

No, guessing is left to the caller. lavf should export what's signaled 
in the file.
diff mbox series

Patch

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index b7a85a6ab2..89267e879d 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -197,8 +197,7 @@  int ff_get_wav_header(void *logctx, AVIOContext *pb,
     /* ignore WAVEFORMATEXTENSIBLE layout if different from channel count */
     if (channels != par->ch_layout.nb_channels) {
         av_channel_layout_uninit(&par->ch_layout);
-        par->ch_layout.order       = AV_CHANNEL_ORDER_UNSPEC;
-        par->ch_layout.nb_channels = channels;
+        av_channel_layout_default(&par->ch_layout, channels);
     }
 
     return 0;