FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_coreimage.m File Reference

Video processing based on Apple's CoreImage API. More...

#import <QuartzCore/CoreImage.h>
#import <AppKit/AppKit.h>
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Data Structures

struct  CoreImageContext
 

Macros

#define CLAMP_WARNING
 
#define SafeCFRelease(ptr)
 
#define OFFSET(x)   offsetof(CoreImageContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define GENERATOR_OPTIONS
 
#define FILTER_OPTIONS
 

Functions

static int config_output (AVFilterLink *link)
 
static int config_input (AVFilterLink *link)
 Determine image properties from input link of filter chain. More...
 
static void list_filters (CoreImageContext *ctx)
 Print a list of all available filters including options and respective value ranges and defaults. More...
 
static int query_formats (AVFilterContext *fctx)
 
static int query_formats_src (AVFilterContext *fctx)
 
static int apply_filter (CoreImageContext *ctx, AVFilterLink *link, AVFrame *frame)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 Apply all valid filters successively to the input image. More...
 
static int request_frame (AVFilterLink *link)
 
static void set_option (CoreImageContext *ctx, CIFilter *filter, const char *key, const char *value)
 Set an option of the given filter to the provided key-value pair. More...
 
static CIFilter * create_filter (CoreImageContext *ctx, const char *filter_name, AVDictionary *filter_options)
 Create a filter object by a given name and set all options to defaults. More...
 
static av_cold int init (AVFilterContext *fctx)
 
static av_cold int init_src (AVFilterContext *fctx)
 
static av_cold void uninit (AVFilterContext *fctx)
 
 AVFILTER_DEFINE_CLASS (coreimage)
 
 AVFILTER_DEFINE_CLASS (coreimagesrc)
 

Variables

static const AVFilterPad vf_coreimage_inputs []
 
static const AVFilterPad vf_coreimage_outputs []
 
static const AVFilterPad vsrc_coreimagesrc_outputs []
 
static const AVOption coreimage_options []
 
AVFilter ff_vf_coreimage
 
static const AVOption coreimagesrc_options []
 
AVFilter ff_vsrc_coreimagesrc
 

Detailed Description

Video processing based on Apple's CoreImage API.

Definition in file vf_coreimage.m.

Macro Definition Documentation

#define CLAMP_WARNING
Value:
do { \
av_log(ctx, AV_LOG_WARNING, "Value of \"%f\" for option \"%s\" is out of range [%f %f], clamping to \"%f\".\n", \
input, \
[input_key UTF8String], \
min_value.floatValue, \
max_value.floatValue, \
used_value.floatValue); \
} while(0)
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define av_log(a,...)
AVFormatContext * ctx
Definition: movenc.c:48

Referenced by set_option().

#define SafeCFRelease (   ptr)
Value:
do { \
if (ptr) { \
CFRelease(ptr); \
ptr = NULL; \
} \
} while (0)
#define NULL
Definition: coverity.c:32
if(ret< 0)
Definition: vf_mcdeint.c:282

Referenced by uninit().

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

Definition at line 630 of file vf_coreimage.m.

Definition at line 631 of file vf_coreimage.m.

#define GENERATOR_OPTIONS
Value:
{"size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS}, \
{"s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS}, \
{"rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS}, \
{"r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS}, \
{"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS}, \
{"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS}, \
{"sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, INT_MAX, FLAGS},
int64_t duration
Definition: movenc.c:63
#define OFFSET(x)
Definition: vf_coreimage.m:630
offset must point to AVRational
Definition: opt.h:235
offset must point to two consecutive integers
Definition: opt.h:232
#define FLAGS
Definition: vf_coreimage.m:631

Definition at line 633 of file vf_coreimage.m.

#define FILTER_OPTIONS
Value:
{"list_filters", "list available filters", OFFSET(list_filters), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, .flags = FLAGS}, \
{"list_generators", "list available generators", OFFSET(list_generators), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, .flags = FLAGS}, \
{"filter", "names and options of filters to apply", OFFSET(filter_string), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS}, \
{"output_rect", "output rectangle within output image", OFFSET(output_rect), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS},
#define NULL
Definition: coverity.c:32
static void list_filters(CoreImageContext *ctx)
Print a list of all available filters including options and respective value ranges and defaults...
Definition: vf_coreimage.m:94
#define OFFSET(x)
Definition: vf_coreimage.m:630
#define FLAGS
Definition: vf_coreimage.m:631

Definition at line 642 of file vf_coreimage.m.

Function Documentation

static int config_output ( AVFilterLink link)
static

Definition at line 65 of file vf_coreimage.m.

static int config_input ( AVFilterLink link)
static

Determine image properties from input link of filter chain.

Definition at line 83 of file vf_coreimage.m.

static void list_filters ( CoreImageContext ctx)
static

Print a list of all available filters including options and respective value ranges and defaults.

Definition at line 94 of file vf_coreimage.m.

Referenced by init().

static int query_formats ( AVFilterContext fctx)
static

Definition at line 138 of file vf_coreimage.m.

static int query_formats_src ( AVFilterContext fctx)
static

Definition at line 160 of file vf_coreimage.m.

static int apply_filter ( CoreImageContext ctx,
AVFilterLink link,
AVFrame frame 
)
static

Definition at line 181 of file vf_coreimage.m.

Referenced by filter_frame(), and request_frame().

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Apply all valid filters successively to the input image.

The final output image is copied from the GPU by "drawing" using a bitmap context.

Definition at line 318 of file vf_coreimage.m.

static int request_frame ( AVFilterLink link)
static

Definition at line 323 of file vf_coreimage.m.

static void set_option ( CoreImageContext ctx,
CIFilter *  filter,
const char *  key,
const char *  value 
)
static

Set an option of the given filter to the provided key-value pair.

Definition at line 358 of file vf_coreimage.m.

Referenced by create_filter().

static CIFilter* create_filter ( CoreImageContext ctx,
const char *  filter_name,
AVDictionary filter_options 
)
static

Create a filter object by a given name and set all options to defaults.

Overwrite any option given by the user to the provided value in filter_options.

Definition at line 451 of file vf_coreimage.m.

Referenced by init().

static av_cold int init ( AVFilterContext fctx)
static

Definition at line 470 of file vf_coreimage.m.

Referenced by init_src().

static av_cold int init_src ( AVFilterContext fctx)
static

Definition at line 565 of file vf_coreimage.m.

static av_cold void uninit ( AVFilterContext fctx)
static

Definition at line 576 of file vf_coreimage.m.

AVFILTER_DEFINE_CLASS ( coreimage  )
AVFILTER_DEFINE_CLASS ( coreimagesrc  )

Variable Documentation

const AVFilterPad vf_coreimage_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *link)
Determine image properties from input link of filter chain.
Definition: vf_coreimage.m:83
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Apply all valid filters successively to the input image.
Definition: vf_coreimage.m:318

Definition at line 602 of file vf_coreimage.m.

const AVFilterPad vf_coreimage_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 612 of file vf_coreimage.m.

const AVFilterPad vsrc_coreimagesrc_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_output(AVFilterLink *link)
Definition: vf_coreimage.m:65
static int request_frame(AVFilterLink *link)
Definition: vf_coreimage.m:323

Definition at line 620 of file vf_coreimage.m.

const AVOption coreimage_options[]
static
Initial value:
= {
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FILTER_OPTIONS
Definition: vf_coreimage.m:642

Definition at line 650 of file vf_coreimage.m.

AVFilter ff_vf_coreimage
Initial value:
= {
.name = "coreimage",
.description = NULL_IF_CONFIG_SMALL("Video filtering using CoreImage API."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(CoreImageContext),
.priv_class = &coreimage_class,
}
static av_cold void uninit(AVFilterContext *fctx)
Definition: vf_coreimage.m:576
static int query_formats(AVFilterContext *fctx)
Definition: vf_coreimage.m:138
static const AVFilterPad vf_coreimage_inputs[]
Definition: vf_coreimage.m:602
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static av_cold int init(AVFilterContext *fctx)
Definition: vf_coreimage.m:470
static const AVFilterPad vf_coreimage_outputs[]
Definition: vf_coreimage.m:612

Definition at line 657 of file vf_coreimage.m.

const AVOption coreimagesrc_options[]
static
Initial value:
= {
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FILTER_OPTIONS
Definition: vf_coreimage.m:642
#define GENERATOR_OPTIONS
Definition: vf_coreimage.m:633

Definition at line 670 of file vf_coreimage.m.

AVFilter ff_vsrc_coreimagesrc
Initial value:
= {
.name = "coreimagesrc",
.description = NULL_IF_CONFIG_SMALL("Video source using image generators of CoreImage API."),
.init = init_src,
.uninit = uninit,
.priv_size = sizeof(CoreImageContext),
.priv_class = &coreimagesrc_class,
}
#define NULL
Definition: coverity.c:32
static av_cold void uninit(AVFilterContext *fctx)
Definition: vf_coreimage.m:576
static int query_formats_src(AVFilterContext *fctx)
Definition: vf_coreimage.m:160
static int query_formats(AVFilterContext *fctx)
Definition: vf_coreimage.m:138
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static av_cold int init_src(AVFilterContext *fctx)
Definition: vf_coreimage.m:565
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static const AVFilterPad vsrc_coreimagesrc_outputs[]
Definition: vf_coreimage.m:620

Definition at line 678 of file vf_coreimage.m.