FFmpeg
filters.h
Go to the documentation of this file.
1 /*
2  * Filters implementation helper functions
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFILTER_FILTERS_H
22 #define AVFILTER_FILTERS_H
23 
24 /**
25  * Filters implementation helper functions
26  */
27 
28 #include "avfilter.h"
29 
30 /**
31  * Special return code when activate() did not do anything.
32  */
33 #define FFERROR_NOT_READY FFERRTAG('N','R','D','Y')
34 
35 /**
36  * A filter pad used for either input or output.
37  */
38 struct AVFilterPad {
39  /**
40  * Pad name. The name is unique among inputs and among outputs, but an
41  * input may have the same name as an output. This may be NULL if this
42  * pad has no need to ever be referenced by name.
43  */
44  const char *name;
45 
46  /**
47  * AVFilterPad type.
48  */
50 
51  /**
52  * The filter expects writable frames from its input link,
53  * duplicating data buffers if needed.
54  *
55  * input pads only.
56  */
57 #define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0)
58 
59  /**
60  * The pad's name is allocated and should be freed generically.
61  */
62 #define AVFILTERPAD_FLAG_FREE_NAME (1 << 1)
63 
64  /**
65  * A combination of AVFILTERPAD_FLAG_* flags.
66  */
67  int flags;
68 
69  /**
70  * Callback functions to get a video/audio buffers. If NULL,
71  * the filter system will use ff_default_get_video_buffer() for video
72  * and ff_default_get_audio_buffer() for audio.
73  *
74  * The state of the union is determined by type.
75  *
76  * Input pads only.
77  */
78  union {
79  AVFrame *(*video)(AVFilterLink *link, int w, int h);
80  AVFrame *(*audio)(AVFilterLink *link, int nb_samples);
81  } get_buffer;
82 
83  /**
84  * Filtering callback. This is where a filter receives a frame with
85  * audio/video data and should do its processing.
86  *
87  * Input pads only.
88  *
89  * @return >= 0 on success, a negative AVERROR on error. This function
90  * must ensure that frame is properly unreferenced on error if it
91  * hasn't been passed on to another filter.
92  */
94 
95  /**
96  * Frame request callback. A call to this should result in some progress
97  * towards producing output over the given link. This should return zero
98  * on success, and another value on error.
99  *
100  * Output pads only.
101  */
103 
104  /**
105  * Link configuration callback.
106  *
107  * For output pads, this should set the link properties such as
108  * width/height. This should NOT set the format property - that is
109  * negotiated between filters by the filter system using the
110  * query_formats() callback before this function is called.
111  *
112  * For input pads, this should check the properties of the link, and update
113  * the filter's internal state as necessary.
114  *
115  * For both input and output filters, this should return zero on success,
116  * and another value on error.
117  */
119 };
120 
121 /**
122  * Link properties exposed to filter code, but not external callers.
123  *
124  * Cf. AVFilterLink for public properties, FilterLinkInternal for
125  * properties private to the generic layer.
126  */
127 typedef struct FilterLink {
129 
130  /**
131  * Graph the filter belongs to.
132  */
134 
135  /**
136  * Current timestamp of the link, as defined by the most recent
137  * frame(s), in link time_base units.
138  */
140 
141  /**
142  * Current timestamp of the link, as defined by the most recent
143  * frame(s), in AV_TIME_BASE units.
144  */
146 
147  /**
148  * Minimum number of samples to filter at once.
149  *
150  * May be set by the link destination filter in its config_props().
151  * If 0, all related fields are ignored.
152  */
154 
155  /**
156  * Maximum number of samples to filter at once. If filter_frame() is
157  * called with more samples, it will split them.
158  *
159  * May be set by the link destination filter in its config_props().
160  */
162 
163  /**
164  * Number of past frames sent through the link.
165  */
167 
168  /**
169  * Number of past samples sent through the link.
170  */
172 
173  /**
174  * Frame rate of the stream on the link, or 1/0 if unknown or variable.
175  *
176  * May be set by the link source filter in its config_props(); if left to
177  * 0/0, will be automatically copied from the first input of the source
178  * filter if it exists.
179  *
180  * Sources should set it to the best estimation of the real frame rate.
181  * If the source frame rate is unknown or variable, set this to 1/0.
182  * Filters should update it if necessary depending on their function.
183  * Sinks can use it to set a default output frame rate.
184  * It is similar to the r_frame_rate field in AVStream.
185  */
187 
188  /**
189  * For hwaccel pixel formats, this should be a reference to the
190  * AVHWFramesContext describing the frames.
191  *
192  * May be set by the link source filter in its config_props().
193  */
195 } FilterLink;
196 
198 {
199  return (FilterLink*)link;
200 }
201 
202 /**
203  * The filter is aware of hardware frames, and any hardware frame context
204  * should not be automatically propagated through it.
205  */
206 #define FF_FILTER_FLAG_HWFRAME_AWARE (1 << 0)
207 
208 /**
209  * Find the index of a link.
210  *
211  * I.e. find i such that link == ctx->(in|out)puts[i]
212  */
213 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
214 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
215 
217  /**
218  * The default value meaning that this filter supports all formats
219  * and (for audio) sample rates and channel layouts/counts as long
220  * as these properties agree for all inputs and outputs.
221  * This state is only allowed in case all inputs and outputs actually
222  * have the same type.
223  * The union is unused in this state.
224  *
225  * This value must always be zero (for default static initialization).
226  */
228  FF_FILTER_FORMATS_QUERY_FUNC, ///< formats.query active.
229  FF_FILTER_FORMATS_QUERY_FUNC2, ///< formats.query_func2 active.
230  FF_FILTER_FORMATS_PIXFMT_LIST, ///< formats.pixels_list active.
231  FF_FILTER_FORMATS_SAMPLEFMTS_LIST, ///< formats.samples_list active.
232  FF_FILTER_FORMATS_SINGLE_PIXFMT, ///< formats.pix_fmt active
233  FF_FILTER_FORMATS_SINGLE_SAMPLEFMT, ///< formats.sample_fmt active.
234 };
235 
236 #define FILTER_QUERY_FUNC(func) \
237  .formats.query_func = func, \
238  .formats_state = FF_FILTER_FORMATS_QUERY_FUNC
239 #define FILTER_QUERY_FUNC2(func) \
240  .formats.query_func2 = func, \
241  .formats_state = FF_FILTER_FORMATS_QUERY_FUNC2
242 #define FILTER_PIXFMTS_ARRAY(array) \
243  .formats.pixels_list = array, \
244  .formats_state = FF_FILTER_FORMATS_PIXFMT_LIST
245 #define FILTER_SAMPLEFMTS_ARRAY(array) \
246  .formats.samples_list = array, \
247  .formats_state = FF_FILTER_FORMATS_SAMPLEFMTS_LIST
248 #define FILTER_PIXFMTS(...) \
249  FILTER_PIXFMTS_ARRAY(((const enum AVPixelFormat []) { __VA_ARGS__, AV_PIX_FMT_NONE }))
250 #define FILTER_SAMPLEFMTS(...) \
251  FILTER_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE }))
252 #define FILTER_SINGLE_PIXFMT(pix_fmt_) \
253  .formats.pix_fmt = pix_fmt_, \
254  .formats_state = FF_FILTER_FORMATS_SINGLE_PIXFMT
255 #define FILTER_SINGLE_SAMPLEFMT(sample_fmt_) \
256  .formats.sample_fmt = sample_fmt_, \
257  .formats_state = FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
258 
259 #define FILTER_INOUTPADS(inout, array) \
260  .inout = array, \
261  .nb_ ## inout = FF_ARRAY_ELEMS(array)
262 #define FILTER_INPUTS(array) FILTER_INOUTPADS(inputs, (array))
263 #define FILTER_OUTPUTS(array) FILTER_INOUTPADS(outputs, (array))
264 
265 #define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \
266  static const AVClass name##_class = { \
267  .class_name = desc, \
268  .item_name = av_default_item_name, \
269  .option = options, \
270  .version = LIBAVUTIL_VERSION_INT, \
271  .category = AV_CLASS_CATEGORY_FILTER, \
272  }
273 #define AVFILTER_DEFINE_CLASS(fname) \
274  AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
275 
276 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
277 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
278 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
279 
280 /**
281  * Mark a filter ready and schedule it for activation.
282  *
283  * This is automatically done when something happens to the filter (queued
284  * frame, status change, request on output).
285  * Filters implementing the activate callback can call it directly to
286  * perform one more round of processing later.
287  * It is also useful for filters reacting to external or asynchronous
288  * events.
289  */
290 void ff_filter_set_ready(AVFilterContext *filter, unsigned priority);
291 
292 /**
293  * Get the number of frames available on the link.
294  * @return the number of frames available in the link fifo.
295  */
297 
298 /**
299  * Test if a frame is available on the link.
300  * @return >0 if a frame is available
301  */
303 
304 
305 /***
306  * Get the number of samples available on the link.
307  * @return the numer of samples available on the link.
308  */
310 
311 /**
312  * Test if enough samples are available on the link.
313  * @return >0 if enough samples are available
314  * @note on EOF and error, min becomes 1
315  */
317 
318 /**
319  * Take a frame from the link's FIFO and update the link's stats.
320  *
321  * If ff_inlink_check_available_frame() was previously called, the
322  * preferred way of expressing it is "av_assert1(ret);" immediately after
323  * ff_inlink_consume_frame(). Negative error codes must still be checked.
324  *
325  * @note May trigger process_command() and/or update is_disabled.
326  * @return >0 if a frame is available,
327  * 0 and set rframe to NULL if no frame available,
328  * or AVERROR code
329  */
331 
332 /**
333  * Take samples from the link's FIFO and update the link's stats.
334  *
335  * If ff_inlink_check_available_samples() was previously called, the
336  * preferred way of expressing it is "av_assert1(ret);" immediately after
337  * ff_inlink_consume_samples(). Negative error codes must still be checked.
338  *
339  * @note May trigger process_command() and/or update is_disabled.
340  * @return >0 if a frame is available,
341  * 0 and set rframe to NULL if no frame available,
342  * or AVERROR code
343  */
344 int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max,
345  AVFrame **rframe);
346 
347 /**
348  * Access a frame in the link fifo without consuming it.
349  * The first frame is numbered 0; the designated frame must exist.
350  * @return the frame at idx position in the link fifo.
351  */
353 
354 /**
355  * Make sure a frame is writable.
356  * This is similar to av_frame_make_writable() except it uses the link's
357  * buffer allocation callback, and therefore allows direct rendering.
358  */
360 
361 /**
362  * Test and acknowledge the change of status on the link.
363  *
364  * Status means EOF or an error condition; a change from the normal (0)
365  * status to a non-zero status can be queued in a filter's input link, it
366  * becomes relevant after the frames queued in the link's FIFO are
367  * processed. This function tests if frames are still queued and if a queued
368  * status change has not yet been processed. In that case it performs basic
369  * treatment (updating the link's timestamp) and returns a positive value to
370  * let the filter do its own treatments (flushing...).
371  *
372  * Filters implementing the activate callback should call this function when
373  * they think it might succeed (usually after checking unsuccessfully for a
374  * queued frame).
375  * Filters implementing the filter_frame and request_frame callbacks do not
376  * need to call that since the same treatment happens in ff_filter_frame().
377  *
378  * @param[out] rstatus new or current status
379  * @param[out] rpts current timestamp of the link in link time base
380  * @return >0 if status changed, <0 if status already acked, 0 otherwise
381  */
382 int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts);
383 
384 /**
385  * Mark that a frame is wanted on the link.
386  * Unlike ff_filter_frame(), it must not be called when the link has a
387  * non-zero status, and thus does not acknowledge it.
388  * Also it cannot fail.
389  */
391 
392 /**
393  * Set the status on an input link.
394  * Also discard all frames in the link's FIFO.
395  */
397 
398 /**
399  * Test if a frame is wanted on an output link.
400  */
402 
403 /**
404  * Get the status on an output link.
405  */
407 
408 /**
409  * Set the status field of a link from the source filter.
410  * The pts should reflect the timestamp of the status change,
411  * in link time base and relative to the frames timeline.
412  * In particular, for AVERROR_EOF, it should reflect the
413  * end time of the last frame.
414  */
416 
417 /**
418  * Set the status field of a link from the source filter.
419  * The pts should reflect the timestamp of the status change,
420  * in link time base and relative to the frames timeline.
421  * In particular, for AVERROR_EOF, it should reflect the
422  * end time of the last frame.
423  */
425 {
427 }
428 
429 /**
430  * Forward the status on an output link to an input link.
431  * If the status is set, it will discard all queued frames and this macro
432  * will return immediately.
433  */
434 #define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink) do { \
435  int ret = ff_outlink_get_status(outlink); \
436  if (ret) { \
437  ff_inlink_set_status(inlink, ret); \
438  return 0; \
439  } \
440 } while (0)
441 
442 /**
443  * Forward the status on an output link to all input links.
444  * If the status is set, it will discard all queued frames and this macro
445  * will return immediately.
446  */
447 #define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter) do { \
448  int ret = ff_outlink_get_status(outlink); \
449  if (ret) { \
450  unsigned i; \
451  for (i = 0; i < filter->nb_inputs; i++) \
452  ff_inlink_set_status(filter->inputs[i], ret); \
453  return 0; \
454  } \
455 } while (0)
456 
457 /**
458  * Acknowledge the status on an input link and forward it to an output link.
459  * If the status is set, this macro will return immediately.
460  */
461 #define FF_FILTER_FORWARD_STATUS(inlink, outlink) do { \
462  int status; \
463  int64_t pts; \
464  if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { \
465  ff_outlink_set_status(outlink, status, pts); \
466  return 0; \
467  } \
468 } while (0)
469 
470 /**
471  * Acknowledge the status on an input link and forward it to an output link.
472  * If the status is set, this macro will return immediately.
473  */
474 #define FF_FILTER_FORWARD_STATUS_ALL(inlink, filter) do { \
475  int status; \
476  int64_t pts; \
477  if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { \
478  unsigned i; \
479  for (i = 0; i < filter->nb_outputs; i++) \
480  ff_outlink_set_status(filter->outputs[i], status, pts); \
481  return 0; \
482  } \
483 } while (0)
484 
485 /**
486  * Forward the frame_wanted_out flag from an output link to an input link.
487  * If the flag is set, this macro will return immediately.
488  */
489 #define FF_FILTER_FORWARD_WANTED(outlink, inlink) do { \
490  if (ff_outlink_frame_wanted(outlink)) { \
491  ff_inlink_request_frame(inlink); \
492  return 0; \
493  } \
494 } while (0)
495 
496 /**
497  * Check for flow control between input and output.
498  * This is necessary for filters that may produce several output frames for
499  * a single input event, otherwise they may produce them all at once,
500  * causing excessive memory consumption.
501  */
503 
504 /**
505  * Perform any additional setup required for hardware frames.
506  *
507  * link->hw_frames_ctx must be set before calling this function.
508  * Inside link->hw_frames_ctx, the fields format, sw_format, width and
509  * height must be set. If dynamically allocated pools are not supported,
510  * then initial_pool_size must also be set, to the minimum hardware frame
511  * pool size necessary for the filter to work (taking into account any
512  * frames which need to stored for use in operations as appropriate). If
513  * default_pool_size is nonzero, then it will be used as the pool size if
514  * no other modification takes place (this can be used to preserve
515  * compatibility).
516  */
518  int default_pool_size);
519 
520 /**
521  * Generic processing of user supplied commands that are set
522  * in the same way as the filter options.
523  * NOTE: 'enable' option is handled separately, and not by
524  * this function.
525  */
526 int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
527  const char *arg, char *res, int res_len, int flags);
528 
529 /**
530  * Get number of threads for current filter instance.
531  * This number is always same or less than graph->nb_threads.
532  */
534 
535 /**
536  * Send a frame of data to the next filter.
537  *
538  * @param link the output link over which the data is being sent
539  * @param frame a reference to the buffer of data being sent. The
540  * receiving filter will free this reference when it no longer
541  * needs it or pass it on to the next filter.
542  *
543  * @return >= 0 on success, a negative AVERROR on error. The receiving filter
544  * is responsible for unreferencing frame in case of error.
545  */
547 
548 /**
549  * Request an input frame from the filter at the other end of the link.
550  *
551  * This function must not be used by filters using the activate callback,
552  * use ff_link_set_frame_wanted() instead.
553  *
554  * The input filter may pass the request on to its inputs, fulfill the
555  * request from an internal buffer or any other means specific to its function.
556  *
557  * When the end of a stream is reached AVERROR_EOF is returned and no further
558  * frames are returned after that.
559  *
560  * When a filter is unable to output a frame for example due to its sources
561  * being unable to do so or because it depends on external means pushing data
562  * into it then AVERROR(EAGAIN) is returned.
563  * It is important that a AVERROR(EAGAIN) return is returned all the way to the
564  * caller (generally eventually a user application) as this step may (but does
565  * not have to be) necessary to provide the input with the next frame.
566  *
567  * If a request is successful then some progress has been made towards
568  * providing a frame on the link (through ff_filter_frame()). A filter that
569  * needs several frames to produce one is allowed to return success if one
570  * more frame has been processed but no output has been produced yet. A
571  * filter is also allowed to simply forward a success return value.
572  *
573  * @param link the input link
574  * @return zero on success
575  * AVERROR_EOF on end of file
576  * AVERROR(EAGAIN) if the previous filter cannot output a frame
577  * currently and can neither guarantee that EOF has been reached.
578  */
580 
581 /**
582  * Append a new input/output pad to the filter's list of such pads.
583  *
584  * The *_free_name versions will set the AVFILTERPAD_FLAG_FREE_NAME flag
585  * ensuring that the name will be freed generically (even on insertion error).
586  */
591 
592 /**
593  * Tell if an integer is contained in the provided -1-terminated list of integers.
594  * This is useful for determining (for instance) if an AVPixelFormat is in an
595  * array of supported formats.
596  *
597  * @param fmt provided format
598  * @param fmts -1-terminated list of formats
599  * @return 1 if present, 0 if absent
600  */
601 int ff_fmt_is_in(int fmt, const int *fmts);
602 
604  void *arg, int *ret, int nb_jobs);
605 
606 #endif /* AVFILTER_FILTERS_H */
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:475
ff_inlink_make_frame_writable
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
Make sure a frame is writable.
Definition: avfilter.c:1538
ff_filter_set_ready
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition: avfilter.c:239
FF_FILTER_FORMATS_QUERY_FUNC
@ FF_FILTER_FORMATS_QUERY_FUNC
formats.query active.
Definition: filters.h:228
ff_inlink_check_available_samples
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
Definition: avfilter.c:1472
ff_inoutlink_check_flow
int ff_inoutlink_check_flow(AVFilterLink *inlink, AVFilterLink *outlink)
Check for flow control between input and output.
Definition: avfilter.c:1625
avfilter_action_func
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,...
Definition: avfilter.h:764
ff_filter_process_command
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.
Definition: avfilter.c:901
int64_t
long long int64_t
Definition: coverity.c:34
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1667
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
w
uint8_t w
Definition: llviddspenc.c:38
FF_FILTER_FORMATS_SINGLE_PIXFMT
@ FF_FILTER_FORMATS_SINGLE_PIXFMT
formats.pix_fmt active
Definition: filters.h:232
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
max
#define max(a, b)
Definition: cuda_runtime.h:33
av_pure
#define av_pure
Definition: attributes.h:78
FilterFormatsState
FilterFormatsState
Definition: filters.h:216
ff_inlink_peek_frame
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
Definition: avfilter.c:1532
pts
static int64_t pts
Definition: transcode_aac.c:644
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
ff_append_outpad
int ff_append_outpad(AVFilterContext *f, AVFilterPad *p)
Definition: avfilter.c:138
AVFilterPad::request_frame
int(* request_frame)(AVFilterLink *link)
Frame request callback.
Definition: filters.h:102
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:424
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ff_avfilter_link_set_in_status
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.
Definition: avfilter.c:260
ff_fmt_is_in
int ff_fmt_is_in(int fmt, const int *fmts)
Tell if an integer is contained in the provided -1-terminated list of integers.
Definition: formats.c:406
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
Definition: filter_design.txt:23
arg
const char * arg
Definition: jacosubdec.c:67
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1438
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVFilterPad::filter_frame
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
Definition: filters.h:93
ff_inlink_queued_samples
int ff_inlink_queued_samples(AVFilterLink *link)
Definition: avfilter.c:1466
AVFilterGraph
Definition: avfilter.h:781
ff_filter_link
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition: filters.h:197
FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
@ FF_FILTER_FORMATS_SINGLE_SAMPLEFMT
formats.sample_fmt active.
Definition: filters.h:233
AVFilterPad::config_props
int(* config_props)(AVFilterLink *link)
Link configuration callback.
Definition: filters.h:118
f
f
Definition: af_crystalizer.c:122
AVMediaType
AVMediaType
Definition: avutil.h:199
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1062
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1491
FF_FILTER_FORMATS_PASSTHROUGH
@ FF_FILTER_FORMATS_PASSTHROUGH
The default value meaning that this filter supports all formats and (for audio) sample rates and chan...
Definition: filters.h:227
ff_filter_init_hw_frames
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware frames.
Definition: avfilter.c:1639
AVFilterPad::flags
int flags
A combination of AVFILTERPAD_FLAG_* flags.
Definition: filters.h:67
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
ret
ret
Definition: filter_design.txt:187
AVFilterPad::type
enum AVMediaType type
AVFilterPad type.
Definition: filters.h:49
frame
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
Definition: filter_design.txt:264
FF_FILTER_FORMATS_QUERY_FUNC2
@ FF_FILTER_FORMATS_QUERY_FUNC2
formats.query_func2 active.
Definition: filters.h:229
ff_append_inpad_free_name
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition: avfilter.c:132
status
ov_status_e status
Definition: dnn_backend_openvino.c:100
ff_inlink_check_available_frame
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
Definition: avfilter.c:1460
ff_inlink_queued_frames
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
Definition: avfilter.c:1454
ff_outlink_get_status
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition: avfilter.c:1619
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1594
avfilter.h
ff_inlink_set_status
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
Definition: avfilter.c:1603
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
ff_outlink_frame_wanted
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition: avfilter.c:1661
FF_FILTER_FORMATS_SAMPLEFMTS_LIST
@ FF_FILTER_FORMATS_SAMPLEFMTS_LIST
formats.samples_list active.
Definition: filters.h:231
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
ff_inlink_consume_samples
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition: avfilter.c:1511
h
h
Definition: vp9dsp_template.c:2070
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx) av_pure
Get number of threads for current filter instance.
Definition: avfilter.c:841
ff_append_outpad_free_name
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition: avfilter.c:143
AVFilterPad::get_buffer
union AVFilterPad::@321 get_buffer
Callback functions to get a video/audio buffers.
ff_append_inpad
int ff_append_inpad(AVFilterContext *f, AVFilterPad *p)
Append a new input/output pad to the filter's list of such pads.
Definition: avfilter.c:127
FF_FILTER_FORMATS_PIXFMT_LIST
@ FF_FILTER_FORMATS_PIXFMT_LIST
formats.pixels_list active.
Definition: filters.h:230
min
float min
Definition: vorbis_enc_data.h:429