Commit 3bbe18fd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

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

parent 56655ea8
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment