1.首先进入libavfilter目录,新建一个名为 vf_vlflip.c的文件。
2.我模仿 vf_vflip.c 的代码,将以下代码写入 vf_vlflip.c 文件。
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
typedef struct FlipContext {
const AVClass *class;
int vsub;
} FlipContext;
static const AVOption vlflip_options[] = {
{ NULL }
};
AVFILTER_DEFINE_CLASS(vlflip);
static int config_input(AVFilterLink *link)
{
FlipContext *flip = link->dst->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
flip->vsub = desc->log2_chroma_h;
return 0;
}
static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
{
FlipContext *flip = link->dst->priv;
AVFrame *frame;
int i;
frame = ff_get_video_buffer(link->dst->outputs[0], w, h);
if (!frame)
return NULL;
for