Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // convert from planar int16 to interleaved float32
- // also change sample rate from 8kHz to 16kHz.
- const int16_t in[2][4] = {{0,1,2,3}, {10, 9, 8, 7}};
- const uint8_t ** in_ptr = (const uint8_t**)in;
- float out[16] = {0};
- uint8_t * out_ptr = (uint8_t*)out;
- swr_context = swr_alloc_set_opts(NULL,
- AV_CH_LAYOUT_STEREO, AV_SAMPLE_FMT_S16P, 8000,
- AV_CH_LAYOUT_STEREO, AV_SAMPLE_FMT_FLT, 16000,
- 0, NULL);
- int res = swr_init(swr_context);
- res = swr_convert(swr_context, &out_ptr, 8, in_ptr, 4);
- // i have a debug point here. context seems fine,
- // but out always contains just 0,0,0,...
- // in remains unmodified.
- printf("DONE");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement