libavfilter/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/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/timestamp.h"
#include "internal.h"
#include "bufferqueue.h"
#include "drawutils.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  OverlayContext

Defines

#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 OFFSET(x)   offsetof(OverlayContext, x)
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define FAST_DIV255(x)   ((((x) + 128) * 257) >> 16)

Enumerations

enum  var_name {
  VAR_B1, VAR_B2, VAR_S1, VAR_S2,
  VAR_T1, VAR_T2, VAR_NB, VAR_N,
  VAR_T, VAR_S, VAR_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_VARS_NB,
  VAR_AVTB, VAR_INTB, VAR_SR, VAR_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_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_VARS_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_MAIN_W,
  VAR_MW, VAR_MAIN_H, VAR_MH, 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_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, 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_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_N,
  VAR_SELECTED_N, VAR_PREV_SELECTED_N, VAR_KEY, VAR_POS,
  VAR_SCENE, VAR_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
}

Functions

 AVFILTER_DEFINE_CLASS (overlay)
static av_cold int init (AVFilterContext *ctx, const char *args)
static av_cold void uninit (AVFilterContext *ctx)
static int query_formats (AVFilterContext *ctx)
static int config_input_main (AVFilterLink *inlink)
static int config_input_overlay (AVFilterLink *inlink)
static int config_output (AVFilterLink *outlink)
static AVFilterBufferRefget_video_buffer (AVFilterLink *link, int perms, int w, int h)
static void blend_slice (AVFilterContext *ctx, AVFilterBufferRef *dst, AVFilterBufferRef *src, int x, int y, int w, int h, int slice_y, int slice_w, int slice_h)
static int try_start_frame (AVFilterContext *ctx, AVFilterBufferRef *mainpic)
static int try_start_next_frame (AVFilterContext *ctx)
static int try_push_frame (AVFilterContext *ctx)
static int flush_frames (AVFilterContext *ctx)
static int start_frame_main (AVFilterLink *inlink, AVFilterBufferRef *inpicref)
static int draw_slice_main (AVFilterLink *inlink, int y, int h, int slice_dir)
static int end_frame_main (AVFilterLink *inlink)
static int start_frame_over (AVFilterLink *inlink, AVFilterBufferRef *inpicref)
static int end_frame_over (AVFilterLink *inlink)
static int request_frame (AVFilterLink *outlink)
static int null_draw_slice (AVFilterLink *inlink, int y, int h, int slice_dir)

Variables

static const char *const var_names []
static const AVOption overlay_options []
static enum PixelFormat alpha_pix_fmts []
AVFilter avfilter_vf_overlay


Detailed Description

overlay one video on top of another

Definition in file vf_overlay.c.


Define Documentation

#define A   3

Definition at line 67 of file vf_overlay.c.

#define B   2

Definition at line 66 of file vf_overlay.c.

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

Definition at line 308 of file vf_overlay.c.

Referenced by blend_slice(), and fill_picture_rgb().

#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM

Definition at line 99 of file vf_overlay.c.

#define G   1

Definition at line 65 of file vf_overlay.c.

#define MAIN   0

#define OFFSET (  )     offsetof(OverlayContext, x)

Definition at line 98 of file vf_overlay.c.

#define OVERLAY   1

#define R   0

Definition at line 64 of file vf_overlay.c.

#define U   1

Definition at line 70 of file vf_overlay.c.

#define V   2

Definition at line 71 of file vf_overlay.c.

#define Y   0

Definition at line 69 of file vf_overlay.c.


Enumeration Type Documentation

enum var_name

Enumerator:
VAR_B1 
VAR_B2 
VAR_S1 
VAR_S2 
VAR_T1 
VAR_T2 
VAR_NB 
VAR_N 
VAR_T 
VAR_S 
VAR_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_VARS_NB 
VAR_AVTB 
VAR_INTB 
VAR_SR 
VAR_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_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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 of file vf_overlay.c.


Function Documentation

AVFILTER_DEFINE_CLASS ( overlay   ) 

static void blend_slice ( AVFilterContext ctx,
AVFilterBufferRef dst,
AVFilterBufferRef src,
int  x,
int  y,
int  w,
int  h,
int  slice_y,
int  slice_w,
int  slice_h 
) [static]

< the amount of overlay to blend on to main

Definition at line 310 of file vf_overlay.c.

Referenced by draw_slice_main(), and try_push_frame().

static int config_input_main ( AVFilterLink inlink  )  [static]

Definition at line 197 of file vf_overlay.c.

static int config_input_overlay ( AVFilterLink inlink  )  [static]

Definition at line 213 of file vf_overlay.c.

static int config_output ( AVFilterLink outlink  )  [static]

Definition at line 276 of file vf_overlay.c.

static int draw_slice_main ( AVFilterLink inlink,
int  y,
int  h,
int  slice_dir 
) [static]

Definition at line 540 of file vf_overlay.c.

static int end_frame_main ( AVFilterLink inlink  )  [static]

Definition at line 558 of file vf_overlay.c.

static int end_frame_over ( AVFilterLink inlink  )  [static]

Definition at line 575 of file vf_overlay.c.

static int flush_frames ( AVFilterContext ctx  )  [static]

Definition at line 512 of file vf_overlay.c.

Referenced by end_frame_main(), end_frame_over(), and start_frame_main().

static AVFilterBufferRef* get_video_buffer ( AVFilterLink link,
int  perms,
int  w,
int  h 
) [static]

Definition at line 301 of file vf_overlay.c.

static av_cold int init ( AVFilterContext ctx,
const char *  args 
) [static]

Definition at line 110 of file vf_overlay.c.

static int null_draw_slice ( AVFilterLink inlink,
int  y,
int  h,
int  slice_dir 
) [static]

Definition at line 621 of file vf_overlay.c.

static int query_formats ( AVFilterContext ctx  )  [static]

Definition at line 155 of file vf_overlay.c.

static int request_frame ( AVFilterLink outlink  )  [static]

Definition at line 593 of file vf_overlay.c.

static int start_frame_main ( AVFilterLink inlink,
AVFilterBufferRef inpicref 
) [static]

Definition at line 520 of file vf_overlay.c.

static int start_frame_over ( AVFilterLink inlink,
AVFilterBufferRef inpicref 
) [static]

Definition at line 570 of file vf_overlay.c.

static int try_push_frame ( AVFilterContext ctx  )  [static]

Definition at line 492 of file vf_overlay.c.

Referenced by end_frame_over(), flush_frames(), and request_frame().

static int try_start_frame ( AVFilterContext ctx,
AVFilterBufferRef mainpic 
) [static]

Definition at line 440 of file vf_overlay.c.

Referenced by start_frame_main(), and try_start_next_frame().

static int try_start_next_frame ( AVFilterContext ctx  )  [static]

Definition at line 478 of file vf_overlay.c.

Referenced by request_frame(), and try_push_frame().

static av_cold void uninit ( AVFilterContext ctx  )  [static]

Definition at line 143 of file vf_overlay.c.


Variable Documentation

enum PixelFormat alpha_pix_fmts[] [static]

Initial value:

Definition at line 192 of file vf_overlay.c.

Definition at line 626 of file vf_overlay.c.

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 },
    {"rgb", "force packed RGB in input and output", OFFSET(allow_packed_rgb), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
    {NULL},
}

Definition at line 101 of file vf_overlay.c.

const char* const var_names[] [static]

Initial value:

 {
    "main_w",    "W", 
    "main_h",    "H", 
    "overlay_w", "w", 
    "overlay_h", "h", 
    NULL
}

Definition at line 45 of file vf_overlay.c.


Generated on Fri Oct 26 02:50:10 2012 for FFmpeg by  doxygen 1.5.8