summaryrefslogtreecommitdiff
path: root/libswresample/swresample.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-11 21:19:39 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-11 22:04:00 +0100
commitae5a55e77a209ebbac6201ffd790dc7841634266 (patch)
treedd6cf348b7bb7ddd239d669ccc6fe734f5dc6087 /libswresample/swresample.c
parent431dcc49d2dca8e01e766a4a36e3aa6becbaeb55 (diff)
swr: move flush into Resampler
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample.c')
-rw-r--r--libswresample/swresample.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index f83e179f0e..d80c0ffdfb 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -662,24 +662,12 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
}
if(!in_arg){
- if(s->in_buffer_count){
- if (s->resample && !s->flushed) {
- AudioData *a= &s->in_buffer;
- int i, j, ret;
- if((ret=swri_realloc_audio(a, s->in_buffer_index + 2*s->in_buffer_count)) < 0)
- return ret;
- av_assert0(a->planar);
- for(i=0; i<a->ch_count; i++){
- for(j=0; j<s->in_buffer_count; j++){
- memcpy(a->ch[i] + (s->in_buffer_index+s->in_buffer_count+j )*a->bps,
- a->ch[i] + (s->in_buffer_index+s->in_buffer_count-j-1)*a->bps, a->bps);
- }
- }
- s->in_buffer_count += (s->in_buffer_count+1)/2;
- s->resample_in_constraint = 0;
- s->flushed = 1;
- }
- }else{
+ if(s->resample){
+ if (!s->flushed)
+ s->resampler->flush(s);
+ s->resample_in_constraint = 0;
+ s->flushed = 1;
+ }else if(!s->in_buffer_count){
return 0;
}
}else