Commit 1e686fd2 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Sync with trunk.

parent 6ae7bd00
......@@ -2,7 +2,7 @@
* linear.c : linear interpolation resampler
*****************************************************************************
* Copyright (C) 2002, 2006 the VideoLAN team
* $Id$
* $Id: 72cebf385e30a02f5e5b7803ad0aa2a4f12c424d $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Sigmund Augdal Helberg <dnumgis@videolan.org>
......@@ -81,7 +81,7 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
struct filter_sys_t * p_sys;
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_physical_channels
......@@ -108,6 +108,7 @@ static int Create( vlc_object_t *p_this )
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
aout_DateInit( &p_sys->end_date, p_filter->output.i_rate );
p_filter->pf_do_work = DoWork;
......@@ -125,7 +126,7 @@ static void Close( vlc_object_t * p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
free( p_sys->p_prev_sample );
free( p_sys );
}
......@@ -268,7 +269,7 @@ static int OpenFilter( vlc_object_t *p_this )
{
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the module's structure */
p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_sys == NULL )
......@@ -285,6 +286,7 @@ static int OpenFilter( vlc_object_t *p_this )
free( p_sys );
return VLC_ENOMEM;
}
aout_DateInit( &p_sys->end_date, p_filter->fmt_in.audio.i_rate );
p_filter->pf_audio_filter = Resample;
......@@ -328,11 +330,11 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
if( p_block ) p_block->pf_release( p_block );
return NULL;
}
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_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 );
......@@ -363,7 +365,7 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
p_block->pf_release( p_block );
p_out->i_buffer = out_buf.i_nb_bytes;
p_out->i_samples = out_buf.i_nb_samples;
......
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