diff mbox series

[FFmpeg-devel,3/3] avformat/dvdvideodec: assign mono channel layout explicitly

Message ID 20240306071913.2735832-3-marth64@proxyid.net
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/dvdvideodec: add CLUT utilities and subtitle palette support | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marth64 March 6, 2024, 7:19 a.m. UTC
Signed-off-by: Marth64 <marth64@proxyid.net>
---
 libavformat/dvdvideodec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stefano Sabatini March 6, 2024, 3:10 p.m. UTC | #1
On date Wednesday 2024-03-06 01:19:13 -0600, Marth64 wrote:
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  libavformat/dvdvideodec.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
> index 2c7ffdd148..6136060288 100644
> --- a/libavformat/dvdvideodec.c
> +++ b/libavformat/dvdvideodec.c
> @@ -1142,7 +1142,9 @@ static int dvdvideo_audio_stream_analyze(AVFormatContext *s, audio_attr_t audio_
>          return AVERROR_INVALIDDATA;
>      }
>  
> -    if (nb_channels == 2)
> +    if (nb_channels == 1)
> +        ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_MONO;
> +    else if (nb_channels == 2)
>          ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_STEREO;
>      else if (nb_channels == 6)
>          ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1;

LGTM, but when this is needed?
Marth64 March 6, 2024, 3:37 p.m. UTC | #2
Good morning,
There do exist discs with mono tracks. This was to make the channel
assignment explicit rather than a guess, although if it is not necessary I
am happy to skip it.

Thank you!

On Wed, Mar 6, 2024 at 09:10 Stefano Sabatini <stefasab@gmail.com> wrote:

> On date Wednesday 2024-03-06 01:19:13 -0600, Marth64 wrote:
> > Signed-off-by: Marth64 <marth64@proxyid.net>
> > ---
> >  libavformat/dvdvideodec.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
> > index 2c7ffdd148..6136060288 100644
> > --- a/libavformat/dvdvideodec.c
> > +++ b/libavformat/dvdvideodec.c
> > @@ -1142,7 +1142,9 @@ static int
> dvdvideo_audio_stream_analyze(AVFormatContext *s, audio_attr_t audio_
> >          return AVERROR_INVALIDDATA;
> >      }
> >
> > -    if (nb_channels == 2)
> > +    if (nb_channels == 1)
> > +        ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_MONO;
> > +    else if (nb_channels == 2)
> >          ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_STEREO;
> >      else if (nb_channels == 6)
> >          ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1;
>
> LGTM, but when this is needed?
>
diff mbox series

Patch

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 2c7ffdd148..6136060288 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1142,7 +1142,9 @@  static int dvdvideo_audio_stream_analyze(AVFormatContext *s, audio_attr_t audio_
         return AVERROR_INVALIDDATA;
     }
 
-    if (nb_channels == 2)
+    if (nb_channels == 1)
+        ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_MONO;
+    else if (nb_channels == 2)
         ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_STEREO;
     else if (nb_channels == 6)
         ch_layout = (AVChannelLayout) AV_CHANNEL_LAYOUT_5POINT1;