Commit 0c7e60bf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

block_t.i_samples -> block_t.i_nb_samples (as aout_buffer_t)

parent 0fbc8087
......@@ -102,7 +102,7 @@ struct block_t
mtime_t i_dts;
mtime_t i_length;
int i_samples; /* Used for audio */
unsigned i_nb_samples; /* Used for audio */
int i_rate;
size_t i_buffer;
......@@ -146,7 +146,7 @@ static inline block_t *block_Duplicate( block_t *p_block )
p_dup->i_flags = p_block->i_flags;
p_dup->i_length = p_block->i_length;
p_dup->i_rate = p_block->i_rate;
p_dup->i_samples = p_block->i_samples;
p_dup->i_nb_samples = p_block->i_nb_samples;
memcpy( p_dup->p_buffer, p_block->p_buffer, p_block->i_buffer );
return p_dup;
......
......@@ -643,14 +643,14 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
block_t *p_out;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples *
i_out_size = p_block->i_nb_samples *
p_filter->fmt_out.audio.i_bitspersample/8 *
aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
......@@ -662,7 +662,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = p_block->i_samples;
p_out->i_nb_samples = p_block->i_nb_samples;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -676,15 +676,15 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
block_Release( p_block );
return p_out;
......
......@@ -459,14 +459,14 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
unsigned int i_samples;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples * p_filter->p_sys->i_bitspersample/8 *
i_out_size = p_block->i_nb_samples * p_filter->p_sys->i_bitspersample/8 *
aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
p_out = p_filter->pf_audio_buffer_new( p_filter, i_out_size );
......@@ -476,7 +476,8 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
block_Release( p_block );
return NULL;
}
p_out->i_samples = (p_block->i_samples / p_filter->p_sys->i_nb_channels) *
p_out->i_nb_samples =
(p_block->i_nb_samples / p_filter->p_sys->i_nb_channels) *
aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
......@@ -490,7 +491,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
#if 0
unsigned int i_in_size = in_buf.i_nb_samples * (p_filter->p_sys->i_bitspersample/8) *
......@@ -504,7 +505,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
memset( p_out->p_buffer, 0, i_out_size );
if( p_filter->p_sys->b_downmix )
......@@ -518,7 +519,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
}
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
block_Release( p_block );
return p_out;
......
......@@ -281,14 +281,14 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
block_t *p_out;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples *
i_out_size = p_block->i_nb_samples *
p_filter->fmt_out.audio.i_bitspersample *
p_filter->fmt_out.audio.i_channels / 8;
......@@ -300,7 +300,7 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = p_block->i_samples;
p_out->i_nb_samples = p_block->i_nb_samples;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -313,17 +313,17 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
block_Release( p_block );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
return p_out;
}
......
......@@ -463,14 +463,14 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
block_t *p_out;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples *
i_out_size = p_block->i_nb_samples *
p_filter->fmt_out.audio.i_bitspersample *
p_filter->fmt_out.audio.i_channels / 8;
......@@ -482,7 +482,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = p_block->i_samples;
p_out->i_nb_samples = p_block->i_nb_samples;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -495,15 +495,15 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
block_Release( p_block );
......
......@@ -428,14 +428,14 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
block_t *p_out;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples *
i_out_size = p_block->i_nb_samples *
p_filter->fmt_out.audio.i_bitspersample *
p_filter->fmt_out.audio.i_channels / 8;
......@@ -447,7 +447,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = p_block->i_samples;
p_out->i_nb_samples = p_block->i_nb_samples;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -460,15 +460,15 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
block_Release( p_block );
......
......@@ -364,14 +364,14 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
block_t *p_out;
int i_out_size;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
return NULL;
}
i_out_size = p_block->i_samples *
i_out_size = p_block->i_nb_samples *
p_filter->fmt_out.audio.i_bitspersample *
p_filter->fmt_out.audio.i_channels / 8;
......@@ -383,7 +383,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = p_block->i_samples;
p_out->i_nb_samples = p_block->i_nb_samples;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -397,17 +397,17 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.b_discontinuity = false;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
block_Release( p_block );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
return p_out;
}
......@@ -341,7 +341,7 @@ static block_t *S24toFloat32( filter_t *p_filter, block_t *p_block )
p_in += 3; p_out++;
}
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -410,7 +410,7 @@ static block_t *S16toFloat32( filter_t *p_filter, block_t *p_block )
p_in++; p_out++;
}
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -443,7 +443,7 @@ static block_t *U16toFloat32( filter_t *p_filter, block_t *p_block )
*p_out++ = (float)(*p_in++ - 32768) / 32768.0;
}
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -483,7 +483,7 @@ static block_t *S16toS24( filter_t *p_filter, block_t *p_block )
#endif
}
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -618,7 +618,7 @@ static block_t *S8toU16( filter_t *p_filter, block_t *p_block )
for( i = p_block->i_buffer; i--; )
*p_out++ = ((*p_in++) + 128) << 8;
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -649,7 +649,7 @@ static block_t *U8toS16( filter_t *p_filter, block_t *p_block )
for( i = p_block->i_buffer; i--; )
*p_out++ = ((*p_in++) - 128) << 8;
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -681,7 +681,7 @@ static block_t *S8toS16( filter_t *p_filter, block_t *p_block )
for( i = p_block->i_buffer; i--; )
*p_out++ = (*p_in++) << 8;
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......@@ -712,7 +712,7 @@ static block_t *U8toU16( filter_t *p_filter, block_t *p_block )
for( i = p_block->i_buffer; i--; )
*p_out++ = (*p_in++) << 8;
p_block_out->i_samples = p_block->i_samples;
p_block_out->i_nb_samples = p_block->i_nb_samples;
p_block_out->i_dts = p_block->i_dts;
p_block_out->i_pts = p_block->i_pts;
p_block_out->i_length = p_block->i_length;
......
......@@ -547,7 +547,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
int i_out_size;
int i_bytes_per_frame;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
......@@ -557,7 +557,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
i_bytes_per_frame = p_filter->fmt_out.audio.i_channels *
p_filter->fmt_out.audio.i_bitspersample / 8;
i_out_size = i_bytes_per_frame * ( 1 + ( p_block->i_samples *
i_out_size = i_bytes_per_frame * ( 1 + ( p_block->i_nb_samples *
p_filter->fmt_out.audio.i_rate /
p_filter->fmt_in.audio.i_rate) ) +
p_filter->p_sys->i_buf_size;
......@@ -570,7 +570,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = i_out_size / i_bytes_per_frame;
p_out->i_nb_samples = i_out_size / i_bytes_per_frame;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -587,17 +587,17 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = in_buf.i_size = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = out_buf.i_size = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
block_Release( p_block );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
return p_out;
}
......
......@@ -304,7 +304,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
int i_out_size;
int i_bytes_per_frame;
if( !p_block || !p_block->i_samples )
if( !p_block || !p_block->i_nb_samples )
{
if( p_block )
block_Release( p_block );
......@@ -314,7 +314,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
i_bytes_per_frame = p_filter->fmt_out.audio.i_channels *
p_filter->fmt_out.audio.i_bitspersample / 8;
i_out_size = i_bytes_per_frame * ( 1 + (p_block->i_samples *
i_out_size = i_bytes_per_frame * ( 1 + (p_block->i_nb_samples *
p_filter->fmt_out.audio.i_rate / p_filter->fmt_in.audio.i_rate));
p_out = p_filter->pf_audio_buffer_new( p_filter, i_out_size );
......@@ -325,7 +325,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
return NULL;
}
p_out->i_samples = i_out_size / i_bytes_per_frame;
p_out->i_nb_samples = i_out_size / i_bytes_per_frame;
p_out->i_dts = p_block->i_dts;
p_out->i_pts = p_block->i_pts;
p_out->i_length = p_block->i_length;
......@@ -337,17 +337,17 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_nb_bytes = p_block->i_buffer;
in_buf.i_nb_samples = p_block->i_samples;
in_buf.i_nb_samples = p_block->i_nb_samples;
out_buf.p_buffer = p_out->p_buffer;
out_buf.i_nb_bytes = p_out->i_buffer;
out_buf.i_nb_samples = p_out->i_samples;
out_buf.i_nb_samples = p_out->i_nb_samples;
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
block_Release( p_block );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
p_out->i_nb_samples = out_buf.i_nb_samples;
return p_out;
}
......@@ -216,7 +216,7 @@ static block_t *EncodeFrame( encoder_t *p_enc, aout_buffer_t *p_block )
start_date += p_mp3_block->i_length;
p_mp3_block->i_dts = p_mp3_block->i_pts = start_date;
p_mp3_block->i_samples = SAMP_PER_FRAME1;
p_mp3_block->i_nb_samples = SAMP_PER_FRAME1;
block_ChainAppend( &p_chain, p_mp3_block );
......
......@@ -368,7 +368,7 @@ static int SendAudio( sout_stream_t *p_stream, sout_stream_id_t *id,
vlc_memcpy( p_pcm_buffer, p_buffer->p_buffer, i_size );
/* Calling the postrender callback to tell the user his buffer is ready */
p_sys->pf_audio_postrender_callback( id->p_data, p_pcm_buffer,
id->format->audio.i_channels, id->format->audio.i_rate, p_buffer->i_samples,
id->format->audio.i_channels, id->format->audio.i_rate, p_buffer->i_nb_samples,
id->format->audio.i_bitspersample, i_size, p_buffer->i_pts );
block_ChainRelease( p_buffer );
return VLC_SUCCESS;
......
......@@ -1314,7 +1314,7 @@ static int transcode_audio_process( sout_stream_t *p_stream,
p_audio_buf->i_pts;
p_audio_block->i_length = p_audio_buf->end_date -
p_audio_buf->i_pts;
p_audio_block->i_samples = p_audio_buf->i_nb_samples;
p_audio_block->i_nb_samples = p_audio_buf->i_nb_samples;
/* Run filter chain */
if( id->p_uf_chain )
......@@ -1328,7 +1328,7 @@ static int transcode_audio_process( sout_stream_t *p_stream,
p_audio_buf->p_buffer = p_audio_block->p_buffer;
p_audio_buf->i_nb_bytes = p_audio_block->i_buffer;
p_audio_buf->i_nb_samples = p_audio_block->i_samples;
p_audio_buf->i_nb_samples = p_audio_block->i_nb_samples;
p_audio_buf->i_pts = p_audio_block->i_dts;
p_audio_buf->end_date = p_audio_block->i_dts + p_audio_block->i_length;
......@@ -1374,7 +1374,7 @@ static aout_buffer_t *audio_new_buffer( decoder_t *p_dec, int i_samples )
p_buffer->p_buffer = p_block->p_buffer;
p_buffer->i_size = p_buffer->i_nb_bytes = p_block->i_buffer;
p_buffer->i_nb_samples = i_samples;
p_block->i_samples = i_samples;
p_block->i_nb_samples = i_samples;
return p_buffer;
}
......
......@@ -1173,7 +1173,7 @@ static void TsStoragePopCmd( ts_storage_t *p_storage, ts_cmd_t *p_cmd, bool b_fl
p_block->i_flags = block.i_flags;
p_block->i_length = block.i_length;
p_block->i_rate = block.i_rate;
p_block->i_samples = block.i_samples;
p_block->i_nb_samples = block.i_nb_samples;
p_block->i_buffer = fread( p_block->p_buffer, 1, block.i_buffer, p_storage->p_filer );
}
p_cmd->send.p_block = p_block;
......
......@@ -65,7 +65,7 @@ void block_Init( block_t *restrict b, void *buf, size_t size )
b->i_dts = VLC_TS_INVALID;
b->i_length = 0;
b->i_rate = 0;
b->i_samples = 0;
b->i_nb_samples = 0;
b->p_buffer = buf;
b->i_buffer = size;
#ifndef NDEBUG
......@@ -86,7 +86,7 @@ static void BlockMetaCopy( block_t *restrict out, const block_t *in )
out->i_flags = in->i_flags;
out->i_length = in->i_length;
out->i_rate = in->i_rate;
out->i_samples = in->i_samples;
out->i_nb_samples = in->i_nb_samples;
}
/* Memory alignment */
......
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