Go to the documentation of this file.
19 #ifndef AVFILTER_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
68 #define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0)
73 #define AVFILTERPAD_FLAG_FREE_NAME (1 << 1)
147 void *
arg,
int *
ret,
int nb_jobs)
171 #define FILTER_QUERY_FUNC(func) \
172 .formats.query_func = func, \
173 .formats_state = FF_FILTER_FORMATS_QUERY_FUNC
174 #define FILTER_PIXFMTS_ARRAY(array) \
175 .formats.pixels_list = array, \
176 .formats_state = FF_FILTER_FORMATS_PIXFMT_LIST
177 #define FILTER_SAMPLEFMTS_ARRAY(array) \
178 .formats.samples_list = array, \
179 .formats_state = FF_FILTER_FORMATS_SAMPLEFMTS_LIST
180 #define FILTER_PIXFMTS(...) \
181 FILTER_PIXFMTS_ARRAY(((const enum AVPixelFormat []) { __VA_ARGS__, AV_PIX_FMT_NONE }))
182 #define FILTER_SAMPLEFMTS(...) \
183 FILTER_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE }))
184 #define FILTER_SINGLE_PIXFMT(pix_fmt_) \
185 .formats.pix_fmt = pix_fmt_, \
186 .formats_state = FF_FILTER_FORMATS_SINGLE_PIXFMT
187 #define FILTER_SINGLE_SAMPLEFMT(sample_fmt_) \
188 .formats.sample_fmt = sample_fmt_, \
189 .formats_state = FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
191 #define FILTER_INOUTPADS(inout, array) \
193 .nb_ ## inout = FF_ARRAY_ELEMS(array)
194 #define FILTER_INPUTS(array) FILTER_INOUTPADS(inputs, (array))
195 #define FILTER_OUTPUTS(array) FILTER_INOUTPADS(outputs, (array))
263 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
264 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
265 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
269 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
274 #define ff_tlog_link(ctx, link, end) do { } while(0)
321 #define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \
322 static const AVClass name##_class = { \
323 .class_name = desc, \
324 .item_name = av_default_item_name, \
326 .version = LIBAVUTIL_VERSION_INT, \
327 .category = AV_CLASS_CATEGORY_FILTER, \
329 #define AVFILTER_DEFINE_CLASS(fname) \
330 AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
337 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
338 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
374 #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0)
394 const char *
arg,
char *res,
int res_len,
int flags);
410 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
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.
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
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
Describe the class of an AVClass context structure.
av_warn_unused_result int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
Parse a pixel format.
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
#define ff_tlog_link(ctx, link, end)
int(* config_props)(AVFilterLink *link)
Link configuration callback.
const OptionDef options[]
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.
struct AVFilterCommand * next
int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, AVDictionary **options, const char *args)
Parse filter options into a dictionary.
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.
union AVFilterPad::@229 get_buffer
Callback functions to get a video/audio buffers.
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.
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.
double time
time expressed in seconds