I used swresample only to convert format but it looks simple as brick to
me. You can feed any amount of data in and get any amount out, something
like this (pseudocode):
while(1){
int n = src_size-src_pos;
if(n==0) break;
const uint8_t* src[32];
const uint8_t* dst[32];
{for(int i=0; i<frame->channels; i++){
src[i] = frame->extended_data[i] + src_pos*src_linesize;
dst[i] = buf_data[i] + dst_pos*dst_linesize;
}}
int r = swr_convert(swr, dst, dst_size-dst_pos, src, n);
if(!r) break;
dst_pos += r;
src_pos += n;
if(dst_pos>=out_packet_size) handle_output();
}
No need to know anything about format except its bytes per sample:
av_samples_get_buffer_size(&
src_linesize,channels,1,sample_fmt,1);
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user