[vlc-commits] avcodec: refer to AVFrame as a pointer, non-functional change

Rémi Denis-Courmont git at videolan.org
Thu Aug 8 20:23:58 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug  8 21:18:37 2013 +0300| [3bbe18fd5f1e958cef0f8b3a7a847fc0ae082a4d] | committer: Rémi Denis-Courmont

avcodec: refer to AVFrame as a pointer, non-functional change

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

 modules/codec/avcodec/audio.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 412152a..6b68f40 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -270,8 +270,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
         p_block->i_flags |= BLOCK_FLAG_PRIVATE_REALLOCATED;
     }
 
-    AVFrame frame;
-    memset( &frame, 0, sizeof( frame ) );
+    AVFrame *frame = &(AVFrame) { };
 
     for( int got_frame = 0; !got_frame; )
     {
@@ -283,7 +282,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
         pkt.data = p_block->p_buffer;
         pkt.size = p_block->i_buffer;
 
-        int used = avcodec_decode_audio4( ctx, &frame, &got_frame, &pkt );
+        int used = avcodec_decode_audio4( ctx, frame, &got_frame, &pkt );
         if( used < 0 )
         {
             msg_Warn( p_dec, "cannot decode one frame (%zu bytes)",
@@ -319,7 +318,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
     }
 
     /* NOTE WELL: Beyond this point, p_block refers to the DECODED block! */
-    p_block = frame.opaque;
+    p_block = frame->opaque;
     SetupOutputFormat( p_dec, true );
     if( decoder_UpdateAudioFormat( p_dec ) )
         goto drop;
@@ -331,7 +330,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
         p_sys->i_reject_count--;
     }
 
-    assert( p_block->i_nb_samples >= (unsigned)frame.nb_samples );
+    assert( p_block->i_nb_samples >= (unsigned)frame->nb_samples );
 
     /* Interleave audio if required */
     if( av_sample_fmt_is_planar( ctx->sample_fmt ) )
@@ -342,37 +341,38 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
 
         const void *planes[ctx->channels];
         for( int i = 0; i < ctx->channels; i++)
-            planes[i] = frame.extended_data[i];
+            planes[i] = frame->extended_data[i];
 
-        aout_Interleave( p_buffer->p_buffer, planes, frame.nb_samples,
+        aout_Interleave( p_buffer->p_buffer, planes, frame->nb_samples,
                          ctx->channels, p_dec->fmt_out.audio.i_format );
         if( ctx->channels > AV_NUM_DATA_POINTERS )
-            free( frame.extended_data );
+            free( frame->extended_data );
         block_Release( p_block );
         p_block = p_buffer;
     }
+    p_block->i_nb_samples = frame->nb_samples;
 
     if (p_sys->b_extract)
     {   /* TODO: do not drop channels... at least not here */
         block_t *p_buffer = block_Alloc( p_dec->fmt_out.audio.i_bytes_per_frame
-                                         * frame.nb_samples );
+                                         * p_block->i_nb_samples );
         if( unlikely(p_buffer == NULL) )
             goto drop;
         aout_ChannelExtract( p_buffer->p_buffer,
                              p_dec->fmt_out.audio.i_channels,
                              p_block->p_buffer, ctx->channels,
-                             frame.nb_samples, p_sys->pi_extraction,
+                             p_block->i_nb_samples, p_sys->pi_extraction,
                              p_dec->fmt_out.audio.i_bitspersample );
+        p_buffer->i_nb_samples = p_block->i_nb_samples;
         block_Release( p_block );
         p_block = p_buffer;
     }
 
-    p_block->i_nb_samples = frame.nb_samples;
-    p_block->i_buffer = frame.nb_samples
+    p_block->i_buffer = p_block->i_nb_samples
                         * p_dec->fmt_out.audio.i_bytes_per_frame;
     p_block->i_pts = date_Get( &p_sys->end_date );
-    p_block->i_length = date_Increment( &p_sys->end_date, frame.nb_samples )
-                        - p_block->i_pts;
+    p_block->i_length = date_Increment( &p_sys->end_date,
+                                      p_block->i_nb_samples ) - p_block->i_pts;
     return p_block;
 
 end:



More information about the vlc-commits mailing list