FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_xfade_opencl.c File Reference
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "opencl.h"
#include "opencl_source.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  XFadeOpenCLContext
 

Macros

#define OFFSET(x)   offsetof(XFadeOpenCLContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  XFadeTransitions {
  CUSTOM = -1, FADE, WIPELEFT, WIPERIGHT,
  WIPEUP, WIPEDOWN, SLIDELEFT, SLIDERIGHT,
  SLIDEUP, SLIDEDOWN, CIRCLECROP, RECTCROP,
  DISTANCE, FADEBLACK, FADEWHITE, RADIAL,
  SMOOTHLEFT, SMOOTHRIGHT, SMOOTHUP, SMOOTHDOWN,
  CIRCLEOPEN, CIRCLECLOSE, VERTOPEN, VERTCLOSE,
  HORZOPEN, HORZCLOSE, DISSOLVE, PIXELIZE,
  DIAGTL, DIAGTR, DIAGBL, DIAGBR,
  HLSLICE, HRSLICE, VUSLICE, VDSLICE,
  HBLUR, FADEGRAYS, WIPETL, WIPETR,
  WIPEBL, WIPEBR, NB_TRANSITIONS, CUSTOM,
  FADE, WIPELEFT, WIPERIGHT, WIPEUP,
  WIPEDOWN, SLIDELEFT, SLIDERIGHT, SLIDEUP,
  SLIDEDOWN, NB_TRANSITIONS
}
 

Functions

static int xfade_opencl_load (AVFilterContext *avctx, enum AVPixelFormat main_format, enum AVPixelFormat xfade_format)
 
static int xfade_frame (AVFilterContext *avctx, AVFrame *a, AVFrame *b)
 
static int xfade_opencl_config_output (AVFilterLink *outlink)
 
static int xfade_opencl_activate (AVFilterContext *avctx)
 
static av_cold void xfade_opencl_uninit (AVFilterContext *avctx)
 
static AVFrameget_video_buffer (AVFilterLink *inlink, int w, int h)
 
 AVFILTER_DEFINE_CLASS (xfade_opencl)
 

Variables

static const AVOption xfade_opencl_options []
 
static const AVFilterPad xfade_opencl_inputs []
 
static const AVFilterPad xfade_opencl_outputs []
 
AVFilter ff_vf_xfade_opencl
 

Macro Definition Documentation

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

Definition at line 378 of file vf_xfade_opencl.c.

Definition at line 379 of file vf_xfade_opencl.c.

Enumeration Type Documentation

Enumerator
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
CIRCLECROP 
RECTCROP 
DISTANCE 
FADEBLACK 
FADEWHITE 
RADIAL 
SMOOTHLEFT 
SMOOTHRIGHT 
SMOOTHUP 
SMOOTHDOWN 
CIRCLEOPEN 
CIRCLECLOSE 
VERTOPEN 
VERTCLOSE 
HORZOPEN 
HORZCLOSE 
DISSOLVE 
PIXELIZE 
DIAGTL 
DIAGTR 
DIAGBL 
DIAGBR 
HLSLICE 
HRSLICE 
VUSLICE 
VDSLICE 
HBLUR 
FADEGRAYS 
WIPETL 
WIPETR 
WIPEBL 
WIPEBR 
NB_TRANSITIONS 
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
NB_TRANSITIONS 

Definition at line 31 of file vf_xfade_opencl.c.

Function Documentation

static int xfade_opencl_load ( AVFilterContext avctx,
enum AVPixelFormat  main_format,
enum AVPixelFormat  xfade_format 
)
static

Definition at line 71 of file vf_xfade_opencl.c.

Referenced by xfade_frame().

static int xfade_frame ( AVFilterContext avctx,
AVFrame a,
AVFrame b 
)
static

Definition at line 139 of file vf_xfade_opencl.c.

Referenced by xfade_opencl_activate().

static int xfade_opencl_config_output ( AVFilterLink outlink)
static

Definition at line 214 of file vf_xfade_opencl.c.

static int xfade_opencl_activate ( AVFilterContext avctx)
static

Definition at line 259 of file vf_xfade_opencl.c.

static av_cold void xfade_opencl_uninit ( AVFilterContext avctx)
static

Definition at line 347 of file vf_xfade_opencl.c.

static AVFrame* get_video_buffer ( AVFilterLink inlink,
int  w,
int  h 
)
static

Definition at line 369 of file vf_xfade_opencl.c.

AVFILTER_DEFINE_CLASS ( xfade_opencl  )

Variable Documentation

const AVOption xfade_opencl_options[]
static
Initial value:
= {
{ "transition", "set cross fade transition", OFFSET(transition), AV_OPT_TYPE_INT, {.i64=1}, 0, NB_TRANSITIONS-1, FLAGS, "transition" },
{ "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, "transition" },
{ "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, "transition" },
{ "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, "transition" },
{ "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, "transition" },
{ "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, "transition" },
{ "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, "transition" },
{ "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, "transition" },
{ "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, "transition" },
{ "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, "transition" },
{ "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, "transition" },
{ "source", "set OpenCL program source file for custom transition", OFFSET(source_file), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
{ "kernel", "set kernel name in program file for custom transition", OFFSET(kernel_name), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
{ "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
{ "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
#define FLAGS
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
int64_t duration
Definition: movenc.c:63

Definition at line 381 of file vf_xfade_opencl.c.

const AVFilterPad xfade_opencl_inputs[]
static
Initial value:
= {
{
.name = "main",
.get_video_buffer = get_video_buffer,
},
{
.name = "xfade",
.get_video_buffer = get_video_buffer,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
int ff_opencl_filter_config_input(AVFilterLink *inlink)
Check that the input link contains a suitable hardware frames context and extract the device from it...
Definition: opencl.c:60
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)

Definition at line 402 of file vf_xfade_opencl.c.

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

Definition at line 418 of file vf_xfade_opencl.c.

AVFilter ff_vf_xfade_opencl
Initial value:
= {
.name = "xfade_opencl",
.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
.priv_size = sizeof(XFadeOpenCLContext),
.priv_class = &xfade_opencl_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:339
static const AVFilterPad xfade_opencl_outputs[]
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
Definition: opencl.c:28
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:147
static int xfade_opencl_activate(AVFilterContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
filter_frame For filters that do not use the activate() callback
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:153
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
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
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
static const AVFilterPad xfade_opencl_inputs[]

Definition at line 427 of file vf_xfade_opencl.c.