avfilter.h
Go to the documentation of this file.
1 /*
2  * filter layer
3  * Copyright (c) 2007 Bobby Bingham
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
24 
25 #include "libavutil/avutil.h"
26 #include "libavutil/log.h"
27 #include "libavutil/samplefmt.h"
28 #include "libavutil/pixfmt.h"
29 #include "libavutil/rational.h"
30 #include "libavcodec/avcodec.h"
31 
32 #include <stddef.h>
33 
34 #include "libavfilter/version.h"
35 
39 unsigned avfilter_version(void);
40 
44 const char *avfilter_configuration(void);
45 
49 const char *avfilter_license(void);
50 
51 
53 typedef struct AVFilterLink AVFilterLink;
54 typedef struct AVFilterPad AVFilterPad;
56 
62 typedef struct AVFilterBuffer {
63  uint8_t *data[8];
64 
80  int linesize[8];
81 
83  void *priv;
90  void (*free)(struct AVFilterBuffer *buf);
91 
92  int format;
93  int w, h;
94  unsigned refcount;
96 
97 #define AV_PERM_READ 0x01
98 #define AV_PERM_WRITE 0x02
99 #define AV_PERM_PRESERVE 0x04
100 #define AV_PERM_REUSE 0x08
101 #define AV_PERM_REUSE2 0x10
102 #define AV_PERM_NEG_LINESIZES 0x20
103 
104 
110  uint64_t channel_layout;
113  int planar;
115 
122  int w;
123  int h;
128  int key_frame;
130 
139 typedef struct AVFilterBufferRef {
141  uint8_t *data[8];
142 
157  int linesize[8];
158 
161 
167  int64_t pts;
168  int64_t pos;
169 
170  int format;
171 
172  int perms;
173 
176 
181 
192 
203 
212 
213 #if FF_API_AVFILTERPAD_PUBLIC
214 
222 struct AVFilterPad {
228  const char *name;
229 
233  enum AVMediaType type;
234 
242  int min_perms;
243 
253  int rej_perms;
254 
258  int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
259 
266  AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
267 
274  AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
275  int nb_samples);
276 
280  int (*end_frame)(AVFilterLink *link);
281 
285  int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
286 
297  int (*filter_frame)(AVFilterLink *link, AVFilterBufferRef *frame);
298 
308  int (*poll_frame)(AVFilterLink *link);
309 
317  int (*request_frame)(AVFilterLink *link);
318 
333  int (*config_props)(AVFilterLink *link);
334 
341  int needs_fifo;
342 };
343 #endif
344 
354 const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx);
355 
365 enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx);
366 
371 typedef struct AVFilter {
372  const char *name;
373 
378  const char *description;
379 
382 
383  /*****************************************************************
384  * All fields below this line are not part of the public API. They
385  * may not be used outside of libavfilter and can be changed and
386  * removed at will.
387  * New public fields should be added right above.
388  *****************************************************************
389  */
390 
395  int (*init)(AVFilterContext *ctx, const char *args);
396 
403 
413 
414  int priv_size;
415 } AVFilter;
416 
419  const AVClass *av_class;
420 
422 
423  char *name;
424 
427 #if FF_API_FOO_COUNT
428  unsigned input_count;
429 #endif
430  unsigned nb_inputs;
431 
434 #if FF_API_FOO_COUNT
435  unsigned output_count;
436 #endif
437  unsigned nb_outputs;
438 
439  void *priv;
440 };
441 
449 struct AVFilterLink {
452 
455 
457 
458  /* These parameters apply only to video */
459  int w;
460  int h;
462  /* These two parameters apply only to audio */
463  uint64_t channel_layout;
465 
466  int format;
467 
476 
477  /*****************************************************************
478  * All fields below this line are not part of the public API. They
479  * may not be used outside of libavfilter and can be changed and
480  * removed at will.
481  * New public fields should be added right above.
482  *****************************************************************
483  */
491 
500 
509 
511  enum {
515  } init_state;
516 };
517 
527 int avfilter_link(AVFilterContext *src, unsigned srcpad,
528  AVFilterContext *dst, unsigned dstpad);
529 
537 
550 avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
551  int w, int h, enum AVPixelFormat format);
552 
565  int linesize,
566  int perms,
567  int nb_samples,
569  uint64_t channel_layout);
570 
572 void avfilter_register_all(void);
573 
575 void avfilter_uninit(void);
576 
588 
596 AVFilter *avfilter_get_by_name(const char *name);
597 
605 
615 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
616 
627 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
628 
635 
646  unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
647 
655 
663 
664 #endif /* AVFILTER_AVFILTER_H */