FFMPEG学习【libavcodec】:音频重采样

1、函数html

废弃:使用 libswresample代替
数组

attribute_deprecated 
ReSampleContext * 
av_audio_resample_init (int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff)
初始化音频重采样上下文

参数:output_channels:输出通道数函数

  input_channels:输入通道数spa

  output_rate:输出采样率指针

  input_rate:输入采样率orm

  sample_fmt_out:请求输出示例格式htm

  sample_fmt_in:输入样品格式ci

  filter_length:滤波器组中每一个FIR滤波器的长度相对于截止频率get

  log2_phase_count:log2的多相滤波器组中的条目数input

  linear:若是1,则所使用的FIR滤波器将在最接近的2之间进行线性内插,若是0将最接近使用

  cutoff:截止频率,1.0对应于输出采样率的一半

返回:分配的ReSampleContext,若是发生错误则为NULL


attribute_deprecated int  audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)

attribute_deprecated void  audio_resample_close (ReSampleContext *s)
自由从新采样上下文。

参数:s:前一个使用av_audio_resample_init()建立的从新抽样上下文的非NULL指针


attribute_deprecated struct 
AVResampleContext * 
av_resample_init (int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff)
初始化音频从新采样器。

注意,若是任一速率不是一个整数,那么简单地将这两个速率缩放到一块儿就能够了。

参数:filter_length:滤波器组中每一个FIR滤波器的长度相对于截止频率

  log2_phase_count:log2的多相滤波器组中的条目数

  linear:若是1,则所使用的FIR滤波器将在最接近的2之间被线性内插,若是0将被使用最接近的

  cutoff:截止频率,1.0对应于输出采样率的一半

  


attribute_deprecated int  av_resample (struct AVResampleContext *c, short *dst, short *srcint *consumed, int src_size, int dst_size, int update_ctx)
使用先前配置的上下文从新采样样本数组。

参数:src:一系列未消耗的样品

  consumed:已经在这里返回已经消耗的src的样本数

  src_size:未使用样品的数量

  dst_size:dst中可用样本的空间量

  update_ctx:若是这是0,那么上下文将不会被修改,这样几个通道能够用相同的上下文从新采样。

返回:若是发生错误,以dst或-1写入的样本数

  


attribute_deprecated void  av_resample_compensate (struct AVResampleContext *cint sample_delta, int compensation_distance)
补偿采样/时间戳漂移。

补偿经过更改从新采样器参数来完成,所以不会发生可听到的点击或相似的失真

参数:sample_delta:应在其上进行补偿的输出样本中的距离

  compensation_distance:应输出的输出样本数量较少

示例:av_resample_compensate(c,10,500)而不是510样本,只输出500个样本

注意,因为四舍五入,实际补偿可能略有不一样,特别是若是补偿距离大,init中使用的in_rate小



attribute_deprecated void  av_resample_close (struct AVResampleContext *c)