[vlc-commits] [Git][videolan/vlc][3.0.x] demux: avi: interleave 0 samplesize PCM

François Cartegnie (@fcartegnie) gitlab at videolan.org
Fri May 12 13:00:33 UTC 2023



François Cartegnie pushed to branch 3.0.x at VideoLAN / VLC


Commits:
7533c9ee by Francois Cartegnie at 2023-05-12T12:33:58+00:00
demux: avi: interleave 0 samplesize PCM

Avoids sending [a single] montrosample[s]

refs #27393

(cherry picked from commit 4ed9fa53956d77ca6215f42831b0c5a15ce8d6c6)

- - - - -


1 changed file:

- modules/demux/avi/avi.c


Changes:

=====================================
modules/demux/avi/avi.c
=====================================
@@ -36,6 +36,7 @@
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 #include <vlc_input.h>
+#include <vlc_aout.h>
 
 #include <vlc_dialog.h>
 
@@ -535,14 +536,27 @@ static int Open( vlc_object_t * p_this )
                     tk->fmt.i_codec = AVI_FourccGetCodec( AUDIO_ES, p_wf->wFormatTag );
 
                 tk->i_blocksize = p_wf->nBlockAlign;
-                if( tk->i_blocksize == 0 )
+
+                /* Fix blocksize == 0 and force interleaving PCM chunks samplesize == 0 */
+                if( tk->i_samplesize == 0 || tk->i_blocksize == 0 )
                 {
-                    if( p_wf->wFormatTag == 1 )
-                        tk->i_blocksize = p_wf->nChannels * (p_wf->wBitsPerSample/8);
-                    else
+                    vlc_fourcc_t i_codec = vlc_fourcc_GetCodecAudio( tk->fmt.i_codec,
+                                                                     p_wf->wBitsPerSample );
+                    unsigned bps = aout_BitsPerSample( i_codec );
+                    if( bps > 0 ) /* PCM audio */
+                    {
+                        if( tk->i_blocksize == 0 )
+                            tk->i_blocksize = bps * p_wf->nChannels / 8;
+                        if( tk->i_samplesize == 0 )
+                            tk->i_samplesize = tk->i_blocksize;
+                        tk->fmt.b_packetized = true;
+                    }
+                    else if( tk->i_blocksize == 0 )
+                    {
                         tk->i_blocksize = 1;
+                    }
                 }
-                else if( tk->i_samplesize != 0 && tk->i_samplesize != tk->i_blocksize )
+                else if( tk->i_samplesize != tk->i_blocksize )
                 {
                     msg_Warn( p_demux, "track[%u] samplesize=%u and blocksize=%u are not equal."
                                        "Using blocksize as a workaround.",



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7533c9eee9f827ae2da8afb6249e07791d098102

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7533c9eee9f827ae2da8afb6249e07791d098102
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list