0

将采样率从 AV_SAMPLE_FMT_FLTP 转换为 AV_SAMPLE_FMT_S16 并播放 openAL,得到以下错误(http://joxi.ru/B_JkUdg5CbDrWhe9oNI

CONV_FUNC (AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16 (lrintf (* (const float *) pi * (1 << 15))))

在文件 audioconvert.c

我的代码

swrContext = swr_alloc();
av_opt_set_int(swrContext, "in_channel_layout",  cc->channel_layout, 0);
av_opt_set_int(swrContext, "out_channel_layout", cc->channel_layout,  0);
av_opt_set_int(swrContext, "in_sample_rate",     cc->sample_rate, 0);
av_opt_set_int(swrContext, "out_sample_rate",    cc->sample_rate, 0);
av_opt_set_sample_fmt(swrContext, "in_sample_fmt",  cc->sample_fmt, 0);
av_opt_set_sample_fmt(swrContext, "out_sample_fmt", AV_SAMPLE_FMT_S16P,  0);
swr_init(swrContext);

uint8_t *output;
int out_samples = (int)av_rescale_rnd(swr_get_delay(swrContext, 44100) + (int64_t)decoded_frame->nb_samples, 44100, 44100, AV_ROUND_UP);
swr_convert(swrContext, &output, out_samples, (const uint8_t **)decoded_frame->extended_data, decoded_frame->nb_samples); //error
alBufferData(BufID,AL_FORMAT_STEREO16,output, decsize,44100);

可能有其他解决方案?

可能有其他解决方案?我正在研究如何将采样率从 AV_SAMPLE_FMT_FLTP 转换为 AV_SAMPLE_FMT_S16?

4

1 回答 1

0

赶到问题出问题了

uint8_t * output [x];
  • 错误消失
于 2013-04-10T12:07:06.473 回答