Go to the documentation of this file.
19 #ifndef AVFILTER_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
69 #define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0)
74 #define AVFILTERPAD_FLAG_FREE_NAME (1 << 1)
144 void *
arg,
int *
ret,
int nb_jobs)
168 #define FILTER_QUERY_FUNC(func) \
169 .formats.query_func = func, \
170 .formats_state = FF_FILTER_FORMATS_QUERY_FUNC
171 #define FILTER_PIXFMTS_ARRAY(array) \
172 .formats.pixels_list = array, \
173 .formats_state = FF_FILTER_FORMATS_PIXFMT_LIST
174 #define FILTER_SAMPLEFMTS_ARRAY(array) \
175 .formats.samples_list = array, \
176 .formats_state = FF_FILTER_FORMATS_SAMPLEFMTS_LIST
177 #define FILTER_PIXFMTS(...) \
178 FILTER_PIXFMTS_ARRAY(((const enum AVPixelFormat []) { __VA_ARGS__, AV_PIX_FMT_NONE }))
179 #define FILTER_SAMPLEFMTS(...) \
180 FILTER_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE }))
181 #define FILTER_SINGLE_PIXFMT(pix_fmt_) \
182 .formats.pix_fmt = pix_fmt_, \
183 .formats_state = FF_FILTER_FORMATS_SINGLE_PIXFMT
184 #define FILTER_SINGLE_SAMPLEFMT(sample_fmt_) \
185 .formats.sample_fmt = sample_fmt_, \
186 .formats_state = FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
188 #define FILTER_INOUTPADS(inout, array) \
190 .nb_ ## inout = FF_ARRAY_ELEMS(array)
191 #define FILTER_INPUTS(array) FILTER_INOUTPADS(inputs, (array))
192 #define FILTER_OUTPUTS(array) FILTER_INOUTPADS(outputs, (array))
262 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
263 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
264 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
268 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
318 #define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \
319 static const AVClass name##_class = { \
320 .class_name = desc, \
321 .item_name = av_default_item_name, \
323 .version = LIBAVUTIL_VERSION_INT, \
324 .category = AV_CLASS_CATEGORY_FILTER, \
326 #define AVFILTER_DEFINE_CLASS(fname) \
327 AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
334 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
335 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
371 #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0)
391 const char *
arg,
char *res,
int res_len,
int flags);
407 int default_pool_size);
int(* func)(AVBPrint *dst, const char *in, const char *arg)
AVPixelFormat
Pixel format.
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link)
Update the position of a link in the age heap.
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,...
FFFrameQueueGlobal frame_queues
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
This structure describes decoded (raw) audio or video data.
int ff_append_outpad(AVFilterContext *f, AVFilterPad *p)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
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.
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
int ff_filter_activate(AVFilterContext *filter)
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.
Structure to hold global options and statistics for frame queues.
void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the destination filter.
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.
void ff_command_queue_pop(AVFilterContext *filter)
int ff_fmt_is_in(int fmt, const int *fmts)
Tell if an integer is contained in the provided -1-terminated list of integers.
av_warn_unused_result int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx)
Parse a channel layout or a corresponding integer representation.
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
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
av_warn_unused_result int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
Parse a pixel format.
union AVFilterPad::@209 get_buffer
Callback functions to get a video/audio buffers.
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
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.
struct AVFilterCommand * next
avfilter_execute_func * thread_execute
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.
char * arg
optional argument for the command
@ FF_FILTER_FORMATS_PIXFMT_LIST
formats.pixels_list active.
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,...)
char * ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
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.
double time
time expressed in seconds