Go to the documentation of this file.
19 #ifndef AVFILTER_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
52 #define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0)
57 #define AVFILTERPAD_FLAG_FREE_NAME (1 << 1)
135 void *
arg,
int *
ret,
int nb_jobs)
159 #define FILTER_QUERY_FUNC(func) \
160 .formats.query_func = func, \
161 .formats_state = FF_FILTER_FORMATS_QUERY_FUNC
162 #define FILTER_PIXFMTS_ARRAY(array) \
163 .formats.pixels_list = array, \
164 .formats_state = FF_FILTER_FORMATS_PIXFMT_LIST
165 #define FILTER_SAMPLEFMTS_ARRAY(array) \
166 .formats.samples_list = array, \
167 .formats_state = FF_FILTER_FORMATS_SAMPLEFMTS_LIST
168 #define FILTER_PIXFMTS(...) \
169 FILTER_PIXFMTS_ARRAY(((const enum AVPixelFormat []) { __VA_ARGS__, AV_PIX_FMT_NONE }))
170 #define FILTER_SAMPLEFMTS(...) \
171 FILTER_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE }))
172 #define FILTER_SINGLE_PIXFMT(pix_fmt_) \
173 .formats.pix_fmt = pix_fmt_, \
174 .formats_state = FF_FILTER_FORMATS_SINGLE_PIXFMT
175 #define FILTER_SINGLE_SAMPLEFMT(sample_fmt_) \
176 .formats.sample_fmt = sample_fmt_, \
177 .formats_state = FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
179 #define FILTER_INOUTPADS(inout, array) \
181 .nb_ ## inout = FF_ARRAY_ELEMS(array)
182 #define FILTER_INPUTS(array) FILTER_INOUTPADS(inputs, (array))
183 #define FILTER_OUTPUTS(array) FILTER_INOUTPADS(outputs, (array))
257 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
258 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
259 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
263 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
268 #define ff_tlog_link(ctx, link, end) do { } while(0)
315 #define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \
316 static const AVClass name##_class = { \
317 .class_name = desc, \
318 .item_name = av_default_item_name, \
320 .version = LIBAVUTIL_VERSION_INT, \
321 .category = AV_CLASS_CATEGORY_FILTER, \
323 #define AVFILTER_DEFINE_CLASS(fname) \
324 AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
331 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
332 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
351 #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0)
371 const char *
arg,
char *res,
int res_len,
int flags);
387 int default_pool_size);
int(* func)(AVBPrint *dst, const char *in, const char *arg)
AVPixelFormat
Pixel format.
int() avfilter_action_func(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times,...
This structure describes decoded (raw) audio or video data.
int ff_append_outpad(AVFilterContext *f, AVFilterPad *p)
int ff_filter_config_links(AVFilterContext *filter)
Negotiate the media format, dimensions, etc of all inputs to a filter.
void(* filter)(uint8_t *src, int stride, int qscale)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
A link between two filters.
@ FF_FILTER_FORMATS_SAMPLEFMTS_LIST
formats.samples_list active.
union AVFilterPad::@311 get_buffer
Callback functions to get a video/audio buffers.
AVFilterContext p
The public AVFilterContext.
A filter pad used for either input or output.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
@ FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
formats.sample_fmt active.
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware frames.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
int ff_fmt_is_in(int fmt, const int *fmts)
Tell if an integer is contained in the provided -1-terminated list of integers.
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
av_warn_unused_result int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
Parse a pixel format.
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
int ff_fmt_is_regular_yuv(enum AVPixelFormat fmt)
Returns true if a pixel format is "regular YUV", which includes all pixel formats that are affected b...
#define ff_tlog_link(ctx, link, end)
int(* config_props)(AVFilterLink *link)
Link configuration callback.
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
An AVChannelLayout holds information about the channel layout of audio data.
int() avfilter_execute_func(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
A function executing multiple jobs, possibly in parallel.
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
#define av_warn_unused_result
av_warn_unused_result int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
Parse a sample rate.
@ FF_FILTER_FORMATS_PASSTHROUGH
The default value meaning that this filter supports all formats and (for audio) sample rates and chan...
int flags
A combination of AVFILTERPAD_FLAG_* flags.
const char * name
Pad name.
enum AVMediaType type
AVFilterPad type.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
avfilter_execute_func * execute
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
@ FF_FILTER_FORMATS_PIXFMT_LIST
formats.pixels_list active.
av_warn_unused_result int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg, void *log_ctx)
Parse a channel layout or a corresponding integer representation.
int ff_append_inpad(AVFilterContext *f, AVFilterPad *p)
Append a new input/output pad to the filter's list of such pads.
@ FF_FILTER_FORMATS_QUERY_FUNC
formats.query active.
#define flags(name, subs,...)
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
@ FF_FILTER_FORMATS_SINGLE_PIXFMT
formats.pix_fmt active
int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure
Get number of threads for current filter instance.
static FFFilterContext * fffilterctx(AVFilterContext *ctx)