简要分析 ffmpeg最基本的5个过滤器组合 (仅以音频处理为例)
AVFilterContext* [5]: 其实真正意义上的filter只有 abuffer和 abuffersink;
某种意义上说 buffer是数据入口,buffersink是数据出口
AVFilterContext* [0]->name = "Parsed_anull_0"
AVFilterContext* [0]->filter->name = "anull"
AVFilterContext* [0]->filter->description = "Pass the source unchanged to the output."
AVFilterContext* [1]->name = "graph_0_in_0_0"
AVFilterContext* [1]->filter->name = "abuffer"
AVFilterContext* [1]->filter->description = "buffer the audio frames, and make them accessible to the filterchain."
AVFilterContext* [2]->name = "out_0_0"
AVFilterContext* [2]->filter->name = "abuffersink"
AVFilterContext* [2]->filter->description = "buffer the audio frames, and make them avaliable to the end of the filter graph."
AVFilterContext* [3]->name = "format_out_0_0"
AVFilterContext* [3]->filter->name = "aformat"
AVFilterContext* [3]->filter->description = "Convert the input audio to one of the specified formats"
AVFilterContext* [4]->name = "auto_resampler_0"
AVFilterContext* [4]->filter->name = "aresampler"
AVFilterContext* [4]->filter->description = "Resample audio data."
关于 int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags);
从buffersink过滤器,即ctx中读取filters处理过的 raw data 到frame中
flags:
#define AV_BUFFERSINK_FLAG_PEEK 1
: 仅仅是读数据,不会将数据从buffersink中移除,通常用来测试。
#define AV_BUFFERSINK_FLAG_NO_REQUEST 2
:告诉filters入口不要再读数据进来,同时如果buffersink中有数据,那就读取数据(并移除数据)