[vlc-commits] Revert "block_t ** parameter is never NULL for audio decoding"

Laurent Aimar git at videolan.org
Tue Sep 6 20:34:12 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Sep  6 20:18:55 2011 +0200| [a8d9ae66fd86d18fefed96829d5238127c7b39fe] | committer: Laurent Aimar

Revert "block_t ** parameter is never NULL for audio decoding"

This reverts commit 48e39d4453616f2b41a55405e11b41407e0b3222.

 It is needed to apply the patch allowing to flush the packetizer/decoders
without having to change the API for now.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8d9ae66fd86d18fefed96829d5238127c7b39fe
---

 modules/codec/adpcm.c         |    6 ++++--
 modules/codec/araw.c          |    5 +++--
 modules/codec/avcodec/audio.c |    6 ++++--
 modules/codec/faad.c          |    6 ++++--
 modules/codec/flac.c          |    9 ++++-----
 modules/codec/fluidsynth.c    |    5 ++++-
 modules/codec/omxil/omxil.c   |    6 ++++--
 modules/codec/quicktime.c     |    5 +++--
 modules/codec/wmafixed/wma.c  |    6 ++++--
 9 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index 0177d07..62fab84 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -268,9 +268,11 @@ static int OpenDecoder( vlc_object_t *p_this )
 static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys  = p_dec->p_sys;
-    block_t *p_block = *pp_block;
+    block_t *p_block;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    p_block = *pp_block;
 
     if( p_block->i_pts > VLC_TS_INVALID &&
         p_block->i_pts != date_Get( &p_sys->end_date ) )
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index ea69966..30c7d15 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -346,9 +346,10 @@ static int DecoderOpen( vlc_object_t *p_this )
 static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    block_t *p_block = *pp_block;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    block_t *p_block = *pp_block;
 
     if( p_block->i_pts > VLC_TS_INVALID &&
         p_block->i_pts != date_Get( &p_sys->end_date ) )
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index bb1343b..33e7418 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -257,10 +257,12 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
     decoder_sys_t *p_sys = p_dec->p_sys;
     int i_used, i_output;
     aout_buffer_t *p_buffer;
-    block_t *p_block = *pp_block;
+    block_t *p_block;
     AVPacket pkt;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    p_block = *pp_block;
 
     if( !p_sys->p_context->extradata_size && p_dec->fmt_in.i_extra &&
         p_sys->b_delayed_open)
diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index 5454d6e..6d1c927 100644
--- a/modules/codec/faad.c
+++ b/modules/codec/faad.c
@@ -203,9 +203,11 @@ static int Open( vlc_object_t *p_this )
 static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    block_t *p_block = *pp_block;
+    block_t *p_block;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    p_block = *pp_block;
 
     if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 9cb441c..519d4c2 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -527,20 +527,19 @@ static void decoder_state_error( decoder_t *p_dec,
 static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    block_t *p_block = *pp_block;
 
-    if( !p_block )
+    if( !pp_block || !*pp_block )
         return NULL;
-    if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
-        block_Release( p_block );
+        block_Release( *pp_block );
         return NULL;
     }
 
     if( !p_sys->b_stream_info )
         ProcessHeader( p_dec );
 
-    p_sys->p_block = p_block;
+    p_sys->p_block = *pp_block;
     *pp_block = NULL;
 
     if( p_sys->p_block->i_pts > VLC_TS_INVALID &&
diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index 27b4b61..4a967c2 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -165,10 +165,13 @@ static void Close (vlc_object_t *p_this)
 
 static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
 {
+    block_t *p_block;
     decoder_sys_t *p_sys = p_dec->p_sys;
-    block_t *p_block = *pp_block;
     aout_buffer_t *p_out = NULL;
 
+    if (pp_block == NULL)
+        return NULL;
+    p_block = *pp_block;
     if (p_block == NULL)
         return NULL;
     *pp_block = NULL;
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index dacf7d6..9b7de2b 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1155,10 +1155,12 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
     aout_buffer_t *p_buffer = 0;
     OMX_BUFFERHEADERTYPE *p_header;
     OMX_ERRORTYPE omx_error;
-    block_t *p_block = *pp_block;
+    block_t *p_block;
     unsigned int i;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    p_block = *pp_block;
 
     /* Check for errors from codec */
     if(p_sys->b_error)
diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
index 7c7d773..55f9bf0 100644
--- a/modules/codec/quicktime.c
+++ b/modules/codec/quicktime.c
@@ -528,7 +528,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    block_t     *p_block = *pp_block;
+    block_t     *p_block;
     int         i_error;
 
 #ifdef LOADER
@@ -547,10 +547,11 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
     }
 #endif
 
-    if( p_block == NULL )
+    if( pp_block == NULL || *pp_block == NULL )
     {
         return NULL;
     }
+    p_block = *pp_block;
 
     if( p_sys->i_out_frames > 0 && p_sys->i_out >= p_sys->i_out_frames )
     {
diff --git a/modules/codec/wmafixed/wma.c b/modules/codec/wmafixed/wma.c
index 8c73c2f..60e4919 100644
--- a/modules/codec/wmafixed/wma.c
+++ b/modules/codec/wmafixed/wma.c
@@ -195,10 +195,12 @@ static int OpenDecoder( vlc_object_t *p_this )
 static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    block_t       *p_block = *pp_block;
+    block_t       *p_block;
     aout_buffer_t *p_aout_buffer = NULL;
 
-    if( !p_block ) return NULL;
+    if( !pp_block || !*pp_block ) return NULL;
+
+    p_block = *pp_block;
 
     if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {



More information about the vlc-commits mailing list