vf_fade.c File Reference

video fade filter based heavily on vf_negate.c by Bobby Bingham More...

#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
#include "internal.h"
#include "formats.h"
#include "video.h"
Include dependency graph for vf_fade.c:

Go to the source code of this file.

Data Structures

struct  FadeContext
 

Macros

#define R   0
 
#define G   1
 
#define B   2
 
#define A   3
 
#define Y   0
 
#define U   1
 
#define V   2
 
#define FADE_IN   0
 
#define FADE_OUT   1
 
#define OFFSET(x)   offsetof(FadeContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *inlink)
 
static void fade_plane (int y, int h, int w, int fade_factor, int black_level, int black_level_scaled, uint8_t offset, uint8_t step, int bytes_per_plane, uint8_t *data, int line_size)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
 AVFILTER_DEFINE_CLASS (fade)
 

Variables

static const enum AVPixelFormat studio_level_pix_fmts []
 
static const AVOption fade_options []
 
static const AVFilterPad avfilter_vf_fade_inputs []
 
static const AVFilterPad avfilter_vf_fade_outputs []
 
AVFilter avfilter_vf_fade
 

Detailed Description

video fade filter based heavily on vf_negate.c by Bobby Bingham

Definition in file vf_fade.c.

Macro Definition Documentation

#define A   3

Definition at line 43 of file vf_fade.c.

Referenced by filter_frame().

#define B   2

Definition at line 42 of file vf_fade.c.

#define FADE_IN   0

Definition at line 49 of file vf_fade.c.

Referenced by init().

#define FADE_OUT   1

Definition at line 50 of file vf_fade.c.

Referenced by init().

Definition at line 202 of file vf_fade.c.

#define G   1

Definition at line 41 of file vf_fade.c.

#define OFFSET (   x)    offsetof(FadeContext, x)

Definition at line 201 of file vf_fade.c.

#define R   0

Definition at line 40 of file vf_fade.c.

#define U   1

Definition at line 46 of file vf_fade.c.

#define V   2

Definition at line 47 of file vf_fade.c.

#define Y   0

Definition at line 45 of file vf_fade.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( fade  )
static int config_props ( AVFilterLink inlink)
static

Definition at line 111 of file vf_fade.c.

static void fade_plane ( int  y,
int  h,
int  w,
int  fade_factor,
int  black_level,
int  black_level_scaled,
uint8_t  offset,
uint8_t  step,
int  bytes_per_plane,
uint8_t data,
int  line_size 
)
static

Definition at line 132 of file vf_fade.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 151 of file vf_fade.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 66 of file vf_fade.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 86 of file vf_fade.c.

Variable Documentation

AVFilter avfilter_vf_fade
Initial value:
= {
.name = "fade",
.description = NULL_IF_CONFIG_SMALL("Fade in/out input video."),
.init = init,
.priv_size = sizeof(FadeContext),
.priv_class = &fade_class,
}
static const AVFilterPad avfilter_vf_fade_outputs[]
Definition: vf_fade.c:235
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static int query_formats(AVFilterContext *ctx)
Definition: vf_fade.c:86
static av_cold int init(AVFilterContext *ctx)
Definition: vf_fade.c:66
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVFilterPad avfilter_vf_fade_inputs[]
Definition: vf_fade.c:223
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 243 of file vf_fade.c.

const AVFilterPad avfilter_vf_fade_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.get_video_buffer = ff_null_get_video_buffer,
.filter_frame = filter_frame,
.needs_writable = 1,
},
{ NULL }
}
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:35
static int config_props(AVFilterLink *inlink)
Definition: vf_fade.c:111
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_fade.c:151
NULL
Definition: eval.c:55

Definition at line 223 of file vf_fade.c.

const AVFilterPad avfilter_vf_fade_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
NULL
Definition: eval.c:55

Definition at line 235 of file vf_fade.c.

const AVOption fade_options[]
static
Initial value:
= {
{ "type", "'in' or 'out' for fade-in/fade-out", OFFSET(type), AV_OPT_TYPE_INT, { .i64 = FADE_IN }, FADE_IN, FADE_OUT, FLAGS, "type" },
{ "t", "'in' or 'out' for fade-in/fade-out", OFFSET(type), AV_OPT_TYPE_INT, { .i64 = FADE_IN }, FADE_IN, FADE_OUT, FLAGS, "type" },
{ "in", "fade-in", 0, AV_OPT_TYPE_CONST, { .i64 = FADE_IN }, .unit = "type" },
{ "out", "fade-out", 0, AV_OPT_TYPE_CONST, { .i64 = FADE_OUT }, .unit = "type" },
{ "start_frame", "Number of the first frame to which to apply the effect.",
OFFSET(start_frame), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "s", "Number of the first frame to which to apply the effect.",
OFFSET(start_frame), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "nb_frames", "Number of frames to which the effect should be applied.",
OFFSET(nb_frames), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
{ "n", "Number of frames to which the effect should be applied.",
OFFSET(nb_frames), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, FLAGS },
{ "alpha", "fade alpha if it is available on the input", OFFSET(alpha), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FLAGS },
{ NULL },
}
#define FLAGS
Definition: vf_fade.c:202
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:86
#define FADE_OUT
Definition: vf_fade.c:50
NULL
Definition: eval.c:55
#define type
#define FADE_IN
Definition: vf_fade.c:49
#define OFFSET(x)
Definition: vf_fade.c:201
Note except for filters that can have queued request_frame does not push and as a the filter_frame method will be called and do the work Legacy the filter_frame method was it was made of start_frame

Definition at line 204 of file vf_fade.c.

const enum AVPixelFormat studio_level_pix_fmts[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:73
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:72
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:74
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:68
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:75
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:103

Definition at line 104 of file vf_fade.c.

Referenced by config_props().