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 "filters.h"
#include "formats.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 (const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
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 375 of file vf_hwmap.c.

◆ FLAGS

Definition at line 376 of file vf_hwmap.c.

Function Documentation

◆ hwmap_query_formats()

static int hwmap_query_formats ( const AVFilterContext avctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 40 of file vf_hwmap.c.

◆ hwmap_config_output()

static int hwmap_config_output ( AVFilterLink outlink)
static

Definition at line 55 of file vf_hwmap.c.

◆ hwmap_get_buffer()

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

Definition at line 268 of file vf_hwmap.c.

◆ hwmap_filter_frame()

static int hwmap_filter_frame ( AVFilterLink link,
AVFrame input 
)
static

Definition at line 308 of file vf_hwmap.c.

◆ hwmap_uninit()

static av_cold void hwmap_uninit ( AVFilterContext avctx)
static

Definition at line 368 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, .unit = "mode" },
{ "read", "Mapping should be readable",
INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "write", "Mapping should be writeable",
INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "overwrite", "Mapping will always overwrite the entire frame",
INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "direct", "Mapping should not involve any copying",
INT_MIN, INT_MAX, FLAGS, .unit = "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 377 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 408 of file vf_hwmap.c.

◆ hwmap_outputs

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

Definition at line 417 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 425 of file vf_hwmap.c.

HWMapContext
Definition: vf_hwmap.c:30
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
mode
Definition: swscale.c:52
hwmap_outputs
static const AVFilterPad hwmap_outputs[]
Definition: vf_hwmap.c:417
AV_HWFRAME_MAP_WRITE
@ AV_HWFRAME_MAP_WRITE
The mapping must be writeable.
Definition: hwcontext.h:516
hwmap_uninit
static av_cold void hwmap_uninit(AVFilterContext *avctx)
Definition: vf_hwmap.c:368
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:522
AV_HWFRAME_MAP_READ
@ AV_HWFRAME_MAP_READ
The mapping must be readable.
Definition: hwcontext.h:512
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
hwmap_query_formats
static int hwmap_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: vf_hwmap.c:40
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: filters.h:206
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:94
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:173
OFFSET
#define OFFSET(x)
Definition: vf_hwmap.c:375
AV_HWFRAME_MAP_DIRECT
@ AV_HWFRAME_MAP_DIRECT
The mapping must be direct.
Definition: hwcontext.h:528
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
FLAGS
#define FLAGS
Definition: vf_hwmap.c:376
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
hwmap_filter_frame
static int hwmap_filter_frame(AVFilterLink *link, AVFrame *input)
Definition: vf_hwmap.c:308
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
hwmap_config_output
static int hwmap_config_output(AVFilterLink *outlink)
Definition: vf_hwmap.c:55
AV_OPT_TYPE_STRING
@ 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:276
hwmap_inputs
static const AVFilterPad hwmap_inputs[]
Definition: vf_hwmap.c:408
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
hwmap_get_buffer
static AVFrame * hwmap_get_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_hwmap.c:268