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) 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) 373 const char *
arg,
char *res,
int res_len,
int flags);
389 int default_pool_size);
This structure describes decoded (raw) audio or video data.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad)
Insert a new pad.
Main libavfilter public API header.
#define FF_QSCALE_TYPE_H264
Libavfilter version macros.
int ff_filter_activate(AVFilterContext *filter)
void ff_avfilter_graph_update_heap(AVFilterGraph *graph, AVFilterLink *link)
Update the position of a link in the age heap.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
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.
AVFilterPad * output_pads
array of output pads
static av_cold int end(AVCodecContext *avctx)
int ff_fmt_is_in(int fmt, const int *fmts)
Tell if an integer is contained in the provided -1-terminated list of integers.
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.
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_update_link_current_pts(AVFilterLink *link, int64_t pts)
A filter pad used for either input or output.
A link between two filters.
AVFilterPad * input_pads
array of input pads
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_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
unsigned nb_outputs
number of output pads
common internal API header
static int request_frame(AVFilterLink *outlink)
av_warn_unused_result int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
Parse a pixel format.
unsigned nb_inputs
number of input pads
struct AVFilterCommand * next
void ff_command_queue_pop(AVFilterContext *filter)
int needs_writable
The filter expects writable frames from its input link, duplicating data buffers if needed...
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
char * ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
Libavcodec external API header.
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.
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
Remove a filter from a graph;.
static int config_props(AVFilterLink *outlink)
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.
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
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
#define FF_QSCALE_TYPE_VP56
AVFilterLink ** outputs
array of pointers to output links
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...
static int filter_frame(DBEContext *s, AVFrame *frame)
#define av_warn_unused_result
#define FF_QSCALE_TYPE_MPEG2
common internal api header.
static int ref[MAX_W *MAX_W]
av_warn_unused_result int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
Parse a sample rate.
avfilter_execute_func * execute
void ff_tlog_ref(void *ctx, AVFrame *ref, int end)
avfilter_execute_func * thread_execute
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
AVFilterContext * ff_filter_alloc(const AVFilter *filter, const char *inst_name)
Allocate a new filter context and return it.
FFFrameQueueGlobal frame_queues
double time
time expressed in seconds
#define FF_QSCALE_TYPE_MPEG1
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
Structure to hold global options and statistics for frame queues.
AVPixelFormat
Pixel format.
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
char * arg
optional argument for the command