Go to the documentation of this file.
85 double var_values[
VARS_NB], res;
132 ctx->thickness = var_values[
VAR_T] = res;
143 ctx->outer_rect.x =
ctx->x;
144 ctx->outer_rect.y =
ctx->y;
145 ctx->outer_rect.width =
ctx->w;
146 ctx->outer_rect.height =
ctx->h;
148 if (
ctx->outer_rect.width <=
ctx->thickness * 2 ||
149 ctx->outer_rect.height <=
ctx->thickness * 2) {
153 ctx->inner_rect.x =
ctx->outer_rect.x +
ctx->thickness;
154 ctx->inner_rect.y =
ctx->outer_rect.y +
ctx->thickness;
155 ctx->inner_rect.width =
ctx->outer_rect.width -
ctx->thickness * 2;
156 ctx->inner_rect.height =
ctx->outer_rect.height -
ctx->thickness * 2;
167 if (!
ctx->outer_frames_ref) {
175 ctx->outer_frames->width =
ctx->outer_rect.width;
176 ctx->outer_frames->height =
ctx->outer_rect.height;
182 "Error when evaluating the expression '%s'.\n",
194 VAProcPipelineParameterBuffer box_params;
195 VAProcPipelineParameterBuffer params[3];
196 VABlendState blend_state = {
197 .flags = VA_BLEND_GLOBAL_ALPHA,
200 int err, nb_params = 0;
227 blend_state.global_alpha = 0.0f;
228 box_params.surface_region = &drawbox_ctx->
outer_rect;
229 box_params.blend_state = &blend_state;
230 box_params.output_background_color = (drawbox_ctx->
drawbox_rgba[3] << 24 |
258 box[0].width =
link->w;
260 params[nb_params].surface_region = &box[0];
261 params[nb_params].output_background_color = 0;
272 params[nb_params].blend_state = &blend_state;
274 params[nb_params].output_region = &box[1];
275 params[nb_params].output_background_color = 0;
278 if (!drawbox_ctx->
fill) {
280 params[nb_params] = params[0];
281 params[nb_params].surface_region = &box[2];
282 params[nb_params].output_region = &box[3];
283 params[nb_params].output_background_color = 0;
321 #define OFFSET(x) offsetof(DrawboxVAAPIContext, x)
322 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
359 .
name =
"drawbox_vaapi",
362 .priv_class = &drawbox_vaapi_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
AVHWFramesContext * outer_frames
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
AVHWFramesContext * input_frames
int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params_list, int cout, AVFrame *output_frame)
const char * name
Filter name.
A link between two filters.
int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const AVFilterPad drawbox_vaapi_outputs[]
void * priv
private data for use by the filter
static int drawbox_vaapi_config_output(AVFilterLink *outlink)
A filter pad used for either input or output.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVFILTER_DEFINE_CLASS(drawbox_vaapi)
enum AVPixelFormat output_format
#define FILTER_OUTPUTS(array)
static const AVFilterPad drawbox_vaapi_inputs[]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
static av_cold int drawbox_vaapi_init(AVFilterContext *avctx)
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static av_cold void drawbox_vaapi_uninit(AVFilterContext *avctx)
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
AVFilterLink ** inputs
array of pointers to input links
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int(* init)(AVBSFContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
AVFilterContext * src
source filter
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
AVBufferRef * outer_frames_ref
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
static void uninit(AVBSFContext *ctx)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
#define FILTER_QUERY_FUNC2(func)
const char * name
Pad name.
This struct describes a set or pool of "hardware" frames (i.e.
static const int NUM_EXPR_EVALS
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int h
agreed upon image height
void(* pipeline_uninit)(AVFilterContext *avctx)
A reference to a data buffer.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
const AVFilter ff_vf_drawbox_vaapi
static const char *const var_names[]
@ 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...
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
static int drawbox_vaapi_filter_frame(AVFilterLink *link, AVFrame *input_frame)
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
AVFilterLink ** outputs
array of pointers to output links
static const AVOption drawbox_vaapi_options[]