22:14
I have function for resampling one channel of audio (as a float array):
int resample_and_save(float *audio_input, int input_sample_rate, int output_sample_rate, int input_num_of_samples, const char *output_file)
AVChannelLayout ch_layout = AV_CHANNEL_LAYOUT_MONO;
SwrContext *swr_ctx = swr_alloc();
uint8_t* resampled_data = NULL;
float *audio_output = NULL;
int ret = 0;
if (!swr_ctx)
fprintf(stderr, "Could not allocate resampler context\\n");
return -1;
av_opt_set_chlayout(swr_ctx, "in_chlayout", &ch_layout, 0);
(...)