FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_overlay.c File Reference

overlay one video on top of another More...

#include "avfilter.h"
#include "formats.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/avstring.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "internal.h"
#include "drawutils.h"
#include "framesync.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  OverlayContext
 

Macros

#define MAIN   0
 
#define OVERLAY   1
 
#define R   0
 
#define G   1
 
#define B   2
 
#define A   3
 
#define Y   0
 
#define U   1
 
#define V   2
 
#define FAST_DIV255(x)   ((((x) + 128) * 257) >> 16)
 
#define UNPREMULTIPLY_ALPHA(x, y)   ((((x) << 16) - ((x) << 9) + (x)) / ((((x) + (y)) << 8) - ((x) + (y)) - (y) * (x)))
 
#define OFFSET(x)   offsetof(OverlayContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  var_name {
  VAR_CH, VAR_N, VAR_NB_IN_CHANNELS, VAR_NB_OUT_CHANNELS,
  VAR_T, VAR_S, VAR_VARS_NB, VAR_VALUE1,
  VAR_VALUE2, VAR_VARS_NB, VAR_TB, VAR_PTS,
  VAR_START_PTS, VAR_PREV_PTS, VAR_PREV_SELECTED_PTS, VAR_T,
  VAR_START_T, VAR_PREV_T, VAR_PREV_SELECTED_T, VAR_PICT_TYPE,
  VAR_I, VAR_P, VAR_B, VAR_S,
  VAR_SI, VAR_SP, VAR_BI, VAR_PICT_TYPE_I,
  VAR_PICT_TYPE_P, VAR_PICT_TYPE_B, VAR_PICT_TYPE_S, VAR_PICT_TYPE_SI,
  VAR_PICT_TYPE_SP, VAR_PICT_TYPE_BI, VAR_INTERLACE_TYPE, VAR_INTERLACE_TYPE_P,
  VAR_INTERLACE_TYPE_T, VAR_INTERLACE_TYPE_B, VAR_CONSUMED_SAMPLES_N, VAR_SAMPLES_N,
  VAR_SAMPLE_RATE, VAR_N, VAR_SELECTED_N, VAR_PREV_SELECTED_N,
  VAR_KEY, VAR_POS, VAR_SCENE, VAR_CONCATDEC_SELECT,
  VAR_VARS_NB, VAR_PI, VAR_PHI, VAR_E,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_OHSUB, VAR_OVSUB, VARS_NB,
  VAR_FRAME_RATE, VAR_INTERLACED, VAR_N, VAR_NB_CONSUMED_SAMPLES,
  VAR_NB_SAMPLES, VAR_POS, VAR_PREV_INPTS, VAR_PREV_INT,
  VAR_PREV_OUTPTS, VAR_PREV_OUTT, VAR_PTS, VAR_SAMPLE_RATE,
  VAR_STARTPTS, VAR_STARTT, VAR_T, VAR_TB,
  VAR_RTCTIME, VAR_RTCSTART, VAR_S, VAR_SR,
  VAR_VARS_NB, VAR_AVTB, VAR_INTB, VAR_SR,
  VAR_VARS_NB, VAR_W, VAR_H, VAR_A,
  VAR_DAR, VAR_SAR, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_W, VAR_H, VAR_CW,
  VAR_CH, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_X, VAR_Y, VAR_N,
  VAR_POS, VAR_T, VAR_VARS_NB, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_IN_H, VAR_IH,
  VAR_IN_W, VAR_IW, VAR_SAR, VAR_X,
  VAR_Y, VAR_H, VAR_W, VAR_T,
  VAR_MAX, VARS_NB, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_LINE_H, VAR_LH, VAR_MAIN_H,
  VAR_h, VAR_H, VAR_MAIN_W, VAR_w,
  VAR_W, VAR_MAX_GLYPH_A, VAR_ASCENT, VAR_MAX_GLYPH_D,
  VAR_DESCENT, VAR_MAX_GLYPH_H, VAR_MAX_GLYPH_W, VAR_N,
  VAR_SAR, VAR_T, VAR_TEXT_H, VAR_TH,
  VAR_TEXT_W, VAR_TW, VAR_X, VAR_Y,
  VAR_PICT_TYPE, VAR_VARS_NB, VAR_N, VAR_POS,
  VAR_R, VAR_T, VAR_NB, VAR_N,
  VAR_PTS, VAR_R, VAR_T, VAR_TB,
  VAR_NB, VAR_W, VAR_H, VAR_VAL,
  VAR_MAXVAL, VAR_MINVAL, VAR_NEGVAL, VAR_CLIPVAL,
  VAR_VARS_NB, VAR_W, VAR_H, VAR_X,
  VAR_Y, VAR_BITDEPTHX, VAR_BITDEPTHY, VAR_VARS_NB,
  VAR_MAIN_W, VAR_MW, VAR_MAIN_H, VAR_MH,
  VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H, VAR_OH,
  VAR_HSUB, VAR_VSUB, VAR_X, VAR_Y,
  VAR_N, VAR_POS, VAR_T, VAR_VARS_NB,
  VAR_MAIN_iW, VAR_MW, VAR_MAIN_iH, VAR_MH,
  VAR_OVERLAY_iW, VAR_OVERLAY_iH, VAR_OVERLAY_X, VAR_OX,
  VAR_OVERLAY_Y, VAR_OY, VAR_OVERLAY_W, VAR_OW,
  VAR_OVERLAY_H, VAR_OH, VAR_VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_X,
  VAR_Y, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VARS_NB, VAR_W,
  VAR_H, VAR_VAL, VAR_YMIN, VAR_UMIN,
  VAR_VMIN, VAR_AMIN, VAR_YMAX, VAR_UMAX,
  VAR_VMAX, VAR_AMAX, VAR_VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_HSUB,
  VAR_VSUB, VAR_N, VAR_T, VAR_VARS_NB,
  VAR_PI, VAR_PHI, VAR_E, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_DAR, VAR_SAR, VARS_NB, VAR_W,
  VAR_H, VAR_N, VAR_PTS, VAR_R,
  VAR_T, VAR_TB, VAR_NB, VAR_iW,
  VAR_IN_W, VAR_iH, VAR_IN_H, VAR_oW,
  VAR_OUT_W, VAR_W, VAR_oH, VAR_OUT_H,
  VAR_H, CW, CH, CX,
  CY, VAR_VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_IN, VAR_ON,
  VAR_DURATION, VAR_PDURATION, VAR_TIME, VAR_FRAME,
  VAR_ZOOM, VAR_PZOOM, VAR_X, VAR_PX,
  VAR_Y, VAR_PY, VAR_A, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_OHSUB, VAR_OVSUB, VARS_NB,
  VAR_X, VAR_Y, VAR_W, VAR_H,
  VAR_TIME, VAR_SPEED, VAR_TEMPO, VAR_ORDER,
  VAR_PATTERN, VAR_ROW, VAR_VARS_NB
}
 
enum  EvalMode {
  EVAL_MODE_ONCE, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB,
  EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB
}
 
enum  OverlayFormat {
  OVERLAY_FORMAT_YUV420, OVERLAY_FORMAT_YUV422, OVERLAY_FORMAT_YUV444, OVERLAY_FORMAT_RGB,
  OVERLAY_FORMAT_GBRP, OVERLAY_FORMAT_AUTO, OVERLAY_FORMAT_NB
}
 

Functions

static av_cold void uninit (AVFilterContext *ctx)
 
static int normalize_xy (double d, int chroma_sub)
 
static void eval_expr (AVFilterContext *ctx)
 
static int set_expr (AVExpr **pexpr, const char *expr, const char *option, void *log_ctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input_overlay (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static av_always_inline void blend_image_packed_rgb (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int main_has_alpha, int x, int y, int is_straight)
 Blend image in src to destination buffer dst at position (x, y). More...
 
static av_always_inline void blend_plane (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int src_w, int src_h, int dst_w, int dst_h, int i, int hsub, int vsub, int x, int y, int main_has_alpha, int dst_plane, int dst_offset, int dst_step, int straight, int yuv)
 
static void alpha_composite (const AVFrame *src, const AVFrame *dst, int src_w, int src_h, int dst_w, int dst_h, int x, int y)
 
static av_always_inline void blend_image_yuv (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int hsub, int vsub, int main_has_alpha, int x, int y, int is_straight)
 
static av_always_inline void blend_image_planar_rgb (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int hsub, int vsub, int main_has_alpha, int x, int y, int is_straight)
 
static void blend_image_yuv420 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva420 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuv422 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva422 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuv444 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva444 (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_gbrp (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_gbrap (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuv420_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva420_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuv422_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva422_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuv444_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_yuva444_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_gbrp_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_gbrap_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_rgb (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_rgba (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_rgb_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static void blend_image_rgba_pm (AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y)
 
static int config_input_main (AVFilterLink *inlink)
 
static int do_blend (FFFrameSync *fs)
 
static av_cold int init (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 
 FRAMESYNC_DEFINE_CLASS (overlay, OverlayContext, fs)
 

Variables

static const char *const var_names []
 
static enum AVPixelFormat alpha_pix_fmts []
 
static const AVOption overlay_options []
 
static const AVFilterPad avfilter_vf_overlay_inputs []
 
static const AVFilterPad avfilter_vf_overlay_outputs []
 
AVFilter ff_vf_overlay
 

Detailed Description

overlay one video on top of another

Definition in file vf_overlay.c.

Macro Definition Documentation

#define MAIN   0

Definition at line 73 of file vf_overlay.c.

Referenced by config_input_overlay(), config_output(), and query_formats().

#define OVERLAY   1

Definition at line 74 of file vf_overlay.c.

Referenced by config_input_overlay(), and query_formats().

#define R   0

Definition at line 76 of file vf_overlay.c.

Referenced by blend_image_packed_rgb().

#define G   1

Definition at line 77 of file vf_overlay.c.

Referenced by blend_image_packed_rgb().

#define B   2

Definition at line 78 of file vf_overlay.c.

Referenced by blend_image_packed_rgb().

#define A   3

Definition at line 79 of file vf_overlay.c.

Referenced by blend_image_packed_rgb().

#define Y   0

Definition at line 81 of file vf_overlay.c.

#define U   1

Definition at line 82 of file vf_overlay.c.

#define V   2

Definition at line 83 of file vf_overlay.c.

#define FAST_DIV255 (   x)    ((((x) + 128) * 257) >> 16)

Definition at line 394 of file vf_overlay.c.

Referenced by alpha_composite(), blend_image_packed_rgb(), and blend_plane().

#define UNPREMULTIPLY_ALPHA (   x,
 
)    ((((x) << 16) - ((x) << 9) + (x)) / ((((x) + (y)) << 8) - ((x) + (y)) - (y) * (x)))

Definition at line 400 of file vf_overlay.c.

Referenced by alpha_composite(), blend_image_packed_rgb(), and blend_plane().

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

Definition at line 927 of file vf_overlay.c.

Definition at line 928 of file vf_overlay.c.

Enumeration Type Documentation

enum var_name
Enumerator
VAR_CH 
VAR_N 
VAR_NB_IN_CHANNELS 
VAR_NB_OUT_CHANNELS 
VAR_T 
VAR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VAR_PDURATION 
VAR_TIME 
VAR_FRAME 
VAR_ZOOM 
VAR_PZOOM 
VAR_X 
VAR_PX 
VAR_Y 
VAR_PY 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VARS_NB 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VAR_OHSUB 
VAR_OVSUB 
VARS_NB 
VAR_X 
VAR_Y 
VAR_W 
VAR_H 
VAR_TIME 
VAR_SPEED 
VAR_TEMPO 
VAR_ORDER 
VAR_PATTERN 
VAR_ROW 
VAR_VARS_NB 

Definition at line 58 of file vf_overlay.c.

enum EvalMode
Enumerator
EVAL_MODE_ONCE 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 

Definition at line 85 of file vf_overlay.c.

Enumerator
OVERLAY_FORMAT_YUV420 
OVERLAY_FORMAT_YUV422 
OVERLAY_FORMAT_YUV444 
OVERLAY_FORMAT_RGB 
OVERLAY_FORMAT_GBRP 
OVERLAY_FORMAT_AUTO 
OVERLAY_FORMAT_NB 

Definition at line 91 of file vf_overlay.c.

Function Documentation

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 130 of file vf_overlay.c.

static int normalize_xy ( double  d,
int  chroma_sub 
)
inlinestatic

Definition at line 139 of file vf_overlay.c.

Referenced by eval_expr().

static void eval_expr ( AVFilterContext ctx)
static

Definition at line 146 of file vf_overlay.c.

Referenced by config_input_overlay(), do_blend(), and process_command().

static int set_expr ( AVExpr **  pexpr,
const char *  expr,
const char *  option,
void log_ctx 
)
static

Definition at line 158 of file vf_overlay.c.

Referenced by config_input_overlay(), and process_command().

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 179 of file vf_overlay.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 210 of file vf_overlay.c.

static int config_input_overlay ( AVFilterLink inlink)
static

Definition at line 329 of file vf_overlay.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 376 of file vf_overlay.c.

static av_always_inline void blend_image_packed_rgb ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  main_has_alpha,
int  x,
int  y,
int  is_straight 
)
static

Blend image in src to destination buffer dst at position (x, y).

< the amount of overlay to blend on to main

Definition at line 406 of file vf_overlay.c.

Referenced by blend_image_rgb(), blend_image_rgb_pm(), blend_image_rgba(), and blend_image_rgba_pm().

static av_always_inline void blend_plane ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  src_w,
int  src_h,
int  dst_w,
int  dst_h,
int  i,
int  hsub,
int  vsub,
int  x,
int  y,
int  main_has_alpha,
int  dst_plane,
int  dst_offset,
int  dst_step,
int  straight,
int  yuv 
)
static

Definition at line 487 of file vf_overlay.c.

Referenced by blend_image_planar_rgb(), and blend_image_yuv().

static void alpha_composite ( const AVFrame src,
const AVFrame dst,
int  src_w,
int  src_h,
int  dst_w,
int  dst_h,
int  x,
int  y 
)
inlinestatic

< the amount of overlay to blend on to main

Definition at line 577 of file vf_overlay.c.

Referenced by blend_image_planar_rgb(), and blend_image_yuv().

static av_always_inline void blend_image_yuv ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  hsub,
int  vsub,
int  main_has_alpha,
int  x,
int  y,
int  is_straight 
)
static
static av_always_inline void blend_image_planar_rgb ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  hsub,
int  vsub,
int  main_has_alpha,
int  x,
int  y,
int  is_straight 
)
static
static void blend_image_yuv420 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 667 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva420 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 672 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuv422 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 677 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva422 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 682 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuv444 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 687 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva444 ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 692 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_gbrp ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 697 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_gbrap ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 702 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuv420_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 707 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva420_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 712 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuv422_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 717 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva422_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 722 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuv444_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 727 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_yuva444_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 732 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_gbrp_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 737 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_gbrap_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 742 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_rgb ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 747 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_rgba ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 752 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_rgb_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 757 of file vf_overlay.c.

Referenced by config_input_main().

static void blend_image_rgba_pm ( AVFilterContext ctx,
AVFrame dst,
const AVFrame src,
int  x,
int  y 
)
static

Definition at line 762 of file vf_overlay.c.

Referenced by config_input_main().

static int config_input_main ( AVFilterLink inlink)
static

Definition at line 767 of file vf_overlay.c.

static int do_blend ( FFFrameSync fs)
static

Definition at line 873 of file vf_overlay.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 913 of file vf_overlay.c.

static int activate ( AVFilterContext ctx)
static

Definition at line 921 of file vf_overlay.c.

FRAMESYNC_DEFINE_CLASS ( overlay  ,
OverlayContext  ,
fs   
)

Variable Documentation

const char* const var_names[]
static
Initial value:
= {
"main_w", "W",
"main_h", "H",
"overlay_w", "w",
"overlay_h", "h",
"hsub",
"vsub",
"x",
"y",
"n",
"pos",
"t",
}
#define NULL
Definition: coverity.c:32

Definition at line 43 of file vf_overlay.c.

Referenced by set_expr().

enum AVPixelFormat alpha_pix_fmts[]
static
Initial value:
= {
}
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:97
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:90
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:172
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:91
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:88
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:89
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:173
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:211

Definition at line 204 of file vf_overlay.c.

Referenced by config_input_main(), config_input_overlay(), and query_formats().

const AVOption overlay_options[]
static
Initial value:
= {
{ "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "eof_action", "Action to take when encountering EOF from secondary input ",
OFFSET(fs.opt_eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_REPEAT },
EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, "eof_action" },
{ "repeat", "Repeat the previous frame.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
{ "endall", "End both streams.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
{ "pass", "Pass through the main input.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS }, .flags = FLAGS, "eof_action" },
{ "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" },
{ "frame", "eval expressions per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
{ "shortest", "force termination when the shortest input terminates", OFFSET(fs.opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
{ "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420}, .flags = FLAGS, .unit = "format" },
{ "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, .flags = FLAGS, .unit = "format" },
{ "yuv444", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444}, .flags = FLAGS, .unit = "format" },
{ "rgb", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB}, .flags = FLAGS, .unit = "format" },
{ "gbrp", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP}, .flags = FLAGS, .unit = "format" },
{ "auto", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_AUTO}, .flags = FLAGS, .unit = "format" },
{ "repeatlast", "repeat overlay of the last overlay frame", OFFSET(fs.opt_repeatlast), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ "alpha", "alpha format", OFFSET(alpha_format), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "alpha_format" },
{ "straight", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags = FLAGS, .unit = "alpha_format" },
{ "premultiplied", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags = FLAGS, .unit = "alpha_format" },
{ NULL }
}
#define NULL
Definition: coverity.c:32
static const char * format[]
Definition: af_aiir.c:311
#define OFFSET(x)
Definition: vf_overlay.c:927
#define FLAGS
Definition: vf_overlay.c:928

Definition at line 930 of file vf_overlay.c.

const AVFilterPad avfilter_vf_overlay_inputs[]
static
Initial value:
= {
{
.name = "main",
.config_props = config_input_main,
},
{
.name = "overlay",
.config_props = config_input_overlay,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input_overlay(AVFilterLink *inlink)
Definition: vf_overlay.c:329
static int config_input_main(AVFilterLink *inlink)
Definition: vf_overlay.c:767

Definition at line 959 of file vf_overlay.c.

const AVFilterPad avfilter_vf_overlay_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_output(AVFilterLink *outlink)
Definition: vf_overlay.c:376

Definition at line 973 of file vf_overlay.c.

AVFilter ff_vf_overlay
Initial value:
= {
.name = "overlay",
.description = NULL_IF_CONFIG_SMALL("Overlay a video source on top of the input."),
.preinit = overlay_framesync_preinit,
.init = init,
.uninit = uninit,
.priv_size = sizeof(OverlayContext),
.priv_class = &overlay_class,
}
static int activate(AVFilterContext *ctx)
Definition: vf_overlay.c:921
static const AVFilterPad avfilter_vf_overlay_inputs[]
Definition: vf_overlay.c:959
static int flags
Definition: log.c:55
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad avfilter_vf_overlay_outputs[]
Definition: vf_overlay.c:973
static av_cold int init(AVFilterContext *ctx)
Definition: vf_overlay.c:913
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_overlay.c:130
static int query_formats(AVFilterContext *ctx)
Definition: vf_overlay.c:210
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:133
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_overlay.c:179

Definition at line 982 of file vf_overlay.c.