FFmpeg
Loading...
Searching...
No Matches
vf_xfade_opencl.c File Reference
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.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)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  XFadeTransitions {
  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 []
 
const FFFilter ff_vf_xfade_opencl
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 386 of file vf_xfade_opencl.c.

◆ FLAGS

Definition at line 387 of file vf_xfade_opencl.c.

Enumeration Type Documentation

◆ XFadeTransitions

Enumerator
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
NB_TRANSITIONS 

Definition at line 29 of file vf_xfade_opencl.c.

Function Documentation

◆ xfade_opencl_load()

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

Definition at line 69 of file vf_xfade_opencl.c.

Referenced by xfade_frame().

◆ xfade_frame()

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

Definition at line 137 of file vf_xfade_opencl.c.

Referenced by xfade_opencl_activate().

◆ xfade_opencl_config_output()

static int xfade_opencl_config_output ( AVFilterLink * outlink)
static

Definition at line 212 of file vf_xfade_opencl.c.

◆ xfade_opencl_activate()

static int xfade_opencl_activate ( AVFilterContext * avctx)
static

Definition at line 259 of file vf_xfade_opencl.c.

◆ xfade_opencl_uninit()

static av_cold void xfade_opencl_uninit ( AVFilterContext * avctx)
static

Definition at line 355 of file vf_xfade_opencl.c.

◆ get_video_buffer()

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

Definition at line 377 of file vf_xfade_opencl.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( xfade_opencl )

Variable Documentation

◆ xfade_opencl_options

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, .unit = "transition" },
{ "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, .unit = "transition" },
{ "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, .unit = "transition" },
{ "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, .unit = "transition" },
{ "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, .unit = "transition" },
{ "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, .unit = "transition" },
{ "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, .unit = "transition" },
{ "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, .unit = "transition" },
{ "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, .unit = "transition" },
{ "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, .unit = "transition" },
{ "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, .unit = "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 FADE(name, type)
Definition af_afade.c:185
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
static int64_t duration
Definition ffplay.c:330
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition opt.h:318
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
unsigned offset
Definition libaomenc.c:763
@ WIPELEFT
Definition vf_xfade.c:32
@ SLIDEUP
Definition vf_xfade.c:38
@ SLIDEDOWN
Definition vf_xfade.c:39
@ WIPEDOWN
Definition vf_xfade.c:35
@ CUSTOM
Definition vf_xfade.c:30
@ NB_TRANSITIONS
Definition vf_xfade.c:89
@ WIPERIGHT
Definition vf_xfade.c:33
@ SLIDELEFT
Definition vf_xfade.c:36
@ SLIDERIGHT
Definition vf_xfade.c:37
@ WIPEUP
Definition vf_xfade.c:34

Definition at line 389 of file vf_xfade_opencl.c.

◆ xfade_opencl_inputs

const AVFilterPad xfade_opencl_inputs[]
static
Initial value:
= {
{
.name = "main",
.get_buffer.video = get_video_buffer,
},
{
.name = "xfade",
.get_buffer.video = get_video_buffer,
},
}
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition avf_concat.c:205
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
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:46

Definition at line 410 of file vf_xfade_opencl.c.

◆ xfade_opencl_outputs

const AVFilterPad xfade_opencl_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = &xfade_opencl_config_output,
},
}
static int xfade_opencl_config_output(AVFilterLink *outlink)

Definition at line 425 of file vf_xfade_opencl.c.

◆ ff_vf_xfade_opencl

const FFFilter ff_vf_xfade_opencl
Initial value:
= {
.p.name = "xfade_opencl",
.p.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
.p.priv_class = &xfade_opencl_class,
.priv_size = sizeof(XFadeOpenCLContext),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition filters.h:208
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition opencl.c:135
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition pixfmt.h:358
static const AVFilterPad xfade_opencl_inputs[]
static const AVFilterPad xfade_opencl_outputs[]
static int xfade_opencl_activate(AVFilterContext *avctx)
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)

Definition at line 433 of file vf_xfade_opencl.c.