26#include "config_components.h"
77 for (
int j = 0; j < (*fmts)->nb_formats; j++) {
78 if (allfmts->
formats[
i] == (*fmts)->formats[j]) {
94#define DEFINE_PARSE(name, Type, get, descr, extra_test) \
95static int parse_##name(enum Type *ret, const char *arg, void *log_ctx) \
100 val = strtol(arg, &tail, 0); \
101 if (*tail || extra_test) { \
102 av_log(log_ctx, AV_LOG_ERROR, "Invalid " descr " '%s'\n", arg); \
103 return AVERROR(EINVAL); \
126 #define PARSE_LIST(strfield, fmtfield, tvar, parse) \
127 for (char *sep, *cur = s->strfield; cur; cur = sep) { \
128 sep = strchr(cur, '|'); \
131 if ((ret = parse(&tvar, cur, ctx)) < 0 || \
132 (ret = ff_add_format(&s->fmtfield, tvar)) < 0) \
137 PARSE_LIST(csps, color_spaces, csp, parse_color_space)
138 PARSE_LIST(ranges, color_ranges, crg, parse_color_range)
139 PARSE_LIST(alphamodes, alpha_modes, alm, parse_alpha_mode)
140 PARSE_LIST(chromalocations, chroma_locations, cloc, parse_chroma_location)
142 if (!strcmp(
ctx->filter->name,
"noformat")) {
143 if (
s->chroma_locations &&
156 s->color_spaces && (ret =
ff_formats_ref(
s->color_spaces, &
s->color_spaces)) < 0 ||
157 s->color_ranges && (ret =
ff_formats_ref(
s->color_ranges, &
s->color_ranges)) < 0 ||
159 s->chroma_locations && (ret =
ff_formats_ref(
s->chroma_locations, &
s->chroma_locations)) < 0)
183#define OFFSET(x) offsetof(FormatContext, x)
203#if CONFIG_FORMAT_FILTER
206 .p.description =
NULL_IF_CONFIG_SMALL(
"Convert the input video to one of the specified pixel formats."),
207 .p.priv_class = &format_class,
223#if CONFIG_NOFORMAT_FILTER
225 .p.name =
"noformat",
226 .p.description =
NULL_IF_CONFIG_SMALL(
"Force libavfilter not to use any of the specified pixel formats for the input to the next filter."),
227 .p.priv_class = &format_class,
static double val(void *priv, double ch)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const AVFilterPad inputs[]
static const char *const format[]
const FFFilter ff_vf_noformat
const FFFilter ff_vf_format
static AVFormatContext * ctx
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
static int parse_pixel_format(AVCodecContext *avctx)
static enum AVPixelFormat pix_fmt
int(* init)(AVBSFContext *ctx)
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
#define AV_OPT_FLAG_VIDEO_PARAM
@ 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...
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define AVFILTER_DEFINE_CLASS_EXT(name, desc, options)
#define FILTER_QUERY_FUNC2(func)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
int av_color_space_from_name(const char *name)
int av_chroma_location_from_name(const char *name)
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
int av_color_range_from_name(const char *name)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
enum AVAlphaMode av_alpha_mode_from_name(const char *name)
AVChromaLocation
Location of chroma samples.
@ AVCHROMA_LOC_UNSPECIFIED
AVColorRange
Visual content value range.
AVAlphaMode
Correlation between the alpha channel and color values.
AVPixelFormat
Pixel format.
AVColorSpace
YUV colorspace type.
Describe the class of an AVClass context structure.
A filter pad used for either input or output.
AVFilterFormats * alpha_modes
parsed from alphamodes
AVFilterFormats * color_ranges
parsed from ranges
AVFilterFormats * color_spaces
parsed from csps
AVFilterFormats * chroma_locations
parsed from chromalocations
AVFilterFormats * formats
parsed from pix_fmts
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.