Go to the documentation of this file.
19 #ifndef AVFILTER_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
207 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
208 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
209 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
213 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
235 int ff_insert_pad(
unsigned idx,
unsigned *count,
size_t padidx_off,
244 &
f->input_pads, &
f->inputs, p);
252 &
f->output_pads, &
f->outputs, p);
288 #define AVFILTER_DEFINE_CLASS(fname) \
289 static const AVClass fname##_class = { \
290 .class_name = #fname, \
291 .item_name = av_default_item_name, \
292 .option = fname##_options, \
293 .version = LIBAVUTIL_VERSION_INT, \
294 .category = AV_CLASS_CATEGORY_FILTER, \
302 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
303 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
339 #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0)
375 const char *
arg,
char *res,
int res_len,
int flags);
391 int default_pool_size);
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.
FFFrameQueueGlobal frame_queues
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
This structure describes decoded (raw) audio or video data.
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.
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
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)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
A filter pad used for either input or output.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
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.
#define FF_QSCALE_TYPE_MPEG2
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.
void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
#define FF_QSCALE_TYPE_MPEG1
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
static int ff_norm_qscale(int qscale, int type)
Normalize the qscale factor FIXME the H264 qscale is a log based scale, mpeg1/2 is not,...
avfilter_execute_func * thread_execute
int needs_writable
The filter expects writable frames from its input link, duplicating data buffers if needed.
int ff_filter_graph_run_once(AVFilterGraph *graph)
Run one round of processing on a filter graph.
#define FF_QSCALE_TYPE_H264
#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.
const char * name
Pad name.
enum AVMediaType type
AVFilterPad type.
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 links
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
avfilter_execute_func * execute
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
static int ref[MAX_W *MAX_W]
char * arg
optional argument for the command
#define FF_QSCALE_TYPE_VP56
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Insert a new pad.
#define flags(name, subs,...)
char * ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
double time
time expressed in seconds