FFmpeg
Data Structures | Macros | Functions | Variables
vf_hwmap.c File Reference
#include "libavutil/buffer.h"
#include "libavutil/hwcontext.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  HWMapContext
 

Macros

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

Functions

static int hwmap_query_formats (AVFilterContext *avctx)
 
static int hwmap_config_output (AVFilterLink *outlink)
 
static AVFramehwmap_get_buffer (AVFilterLink *inlink, int w, int h)
 
static int hwmap_filter_frame (AVFilterLink *link, AVFrame *input)
 
static av_cold void hwmap_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (hwmap)
 

Variables

static const AVOption hwmap_options []
 
static const AVFilterPad hwmap_inputs []
 
static const AVFilterPad hwmap_outputs []
 
const AVFilter ff_vf_hwmap
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 370 of file vf_hwmap.c.

◆ FLAGS

Definition at line 371 of file vf_hwmap.c.

Function Documentation

◆ hwmap_query_formats()

static int hwmap_query_formats ( AVFilterContext avctx)
static

Definition at line 40 of file vf_hwmap.c.

◆ hwmap_config_output()

static int hwmap_config_output ( AVFilterLink outlink)
static

Definition at line 53 of file vf_hwmap.c.

◆ hwmap_get_buffer()

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

Definition at line 264 of file vf_hwmap.c.

◆ hwmap_filter_frame()

static int hwmap_filter_frame ( AVFilterLink link,
AVFrame input 
)
static

Definition at line 303 of file vf_hwmap.c.

◆ hwmap_uninit()

static av_cold void hwmap_uninit ( AVFilterContext avctx)
static

Definition at line 363 of file vf_hwmap.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( hwmap  )

Variable Documentation

◆ hwmap_options

const AVOption hwmap_options[]
static
Initial value:
= {
{ "mode", "Frame mapping mode",
0, INT_MAX, FLAGS, "mode" },
{ "read", "Mapping should be readable",
INT_MIN, INT_MAX, FLAGS, "mode" },
{ "write", "Mapping should be writeable",
INT_MIN, INT_MAX, FLAGS, "mode" },
{ "overwrite", "Mapping will always overwrite the entire frame",
INT_MIN, INT_MAX, FLAGS, "mode" },
{ "direct", "Mapping should not involve any copying",
INT_MIN, INT_MAX, FLAGS, "mode" },
{ "derive_device", "Derive a new device of this type",
OFFSET(derive_device_type), AV_OPT_TYPE_STRING,
{ .str = NULL }, 0, 0, FLAGS },
{ "reverse", "Map in reverse (create and allocate in the sink)",
{ .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
}

Definition at line 372 of file vf_hwmap.c.

◆ hwmap_inputs

const AVFilterPad hwmap_inputs[]
static
Initial value:
= {
{
.name = "default",
.get_buffer.video = hwmap_get_buffer,
.filter_frame = hwmap_filter_frame,
},
}

Definition at line 403 of file vf_hwmap.c.

◆ hwmap_outputs

const AVFilterPad hwmap_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = hwmap_config_output,
},
}

Definition at line 412 of file vf_hwmap.c.

◆ ff_vf_hwmap

const AVFilter ff_vf_hwmap
Initial value:
= {
.name = "hwmap",
.description = NULL_IF_CONFIG_SMALL("Map hardware frames"),
.uninit = hwmap_uninit,
.priv_size = sizeof(HWMapContext),
.priv_class = &hwmap_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 420 of file vf_hwmap.c.

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:364
HWMapContext
Definition: vf_hwmap.c:30
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:169
hwmap_outputs
static const AVFilterPad hwmap_outputs[]
Definition: vf_hwmap.c:412
hwmap_uninit
static av_cold void hwmap_uninit(AVFilterContext *avctx)
Definition: vf_hwmap.c:363
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:192
NULL
#define NULL
Definition: coverity.c:32
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:138
hwmap_query_formats
static int hwmap_query_formats(AVFilterContext *avctx)
Definition: vf_hwmap.c:40
OFFSET
#define OFFSET(x)
Definition: vf_hwmap.c:370
AV_HWFRAME_MAP_WRITE
@ AV_HWFRAME_MAP_WRITE
The mapping must be writeable.
Definition: hwcontext.h:528
FLAGS
#define FLAGS
Definition: vf_hwmap.c:371
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
hwmap_filter_frame
static int hwmap_filter_frame(AVFilterLink *link, AVFrame *input)
Definition: vf_hwmap.c:303
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
AV_HWFRAME_MAP_DIRECT
@ AV_HWFRAME_MAP_DIRECT
The mapping must be direct.
Definition: hwcontext.h:540
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:224
hwmap_config_output
static int hwmap_config_output(AVFilterLink *outlink)
Definition: vf_hwmap.c:53
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
hwmap_inputs
static const AVFilterPad hwmap_inputs[]
Definition: vf_hwmap.c:403
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
hwmap_get_buffer
static AVFrame * hwmap_get_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_hwmap.c:264
AV_HWFRAME_MAP_OVERWRITE
@ AV_HWFRAME_MAP_OVERWRITE
The mapped frame will be overwritten completely in subsequent operations, so the current frame data n...
Definition: hwcontext.h:534
AV_HWFRAME_MAP_READ
@ AV_HWFRAME_MAP_READ
The mapping must be readable.
Definition: hwcontext.h:524