FFmpeg  1.2.4
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 
36 #include <stddef.h>
37 
38 #include "libavutil/avutil.h"
39 #include "libavutil/dict.h"
40 #include "libavutil/log.h"
41 #include "libavutil/samplefmt.h"
42 #include "libavutil/pixfmt.h"
43 #include "libavutil/rational.h"
44 
45 #include "libavfilter/version.h"
46 
50 unsigned avfilter_version(void);
51 
55 const char *avfilter_configuration(void);
56 
60 const char *avfilter_license(void);
61 
65 const AVClass *avfilter_get_class(void);
66 
68 typedef struct AVFilterLink AVFilterLink;
69 typedef struct AVFilterPad AVFilterPad;
71 
77 typedef struct AVFilterBuffer {
78  uint8_t *data[8];
79 
95  int linesize[8];
96 
98  void *priv;
105  void (*free)(struct AVFilterBuffer *buf);
106 
107  int format;
108  int w, h;
109  unsigned refcount;
111 
112 #define AV_PERM_READ 0x01
113 #define AV_PERM_WRITE 0x02
114 #define AV_PERM_PRESERVE 0x04
115 #define AV_PERM_REUSE 0x08
116 #define AV_PERM_REUSE2 0x10
117 #define AV_PERM_NEG_LINESIZES 0x20
118 #define AV_PERM_ALIGN 0x40
119 
120 #define AVFILTER_ALIGN 16 //not part of ABI
121 
128  uint64_t channel_layout;
131  int channels;
133 
140  int w;
141  int h;
146  int key_frame;
149  int8_t *qp_table;
151 
160 typedef struct AVFilterBufferRef {
162  uint8_t *data[8];
163 
178  int linesize[8];
179 
182 
188  int64_t pts;
189  int64_t pos;
190 
191  int format;
192 
193  int perms;
194 
196 
199 
204 
215 
226 
235 
240 
241 #if FF_API_AVFILTERPAD_PUBLIC
242 
252 struct AVFilterPad {
258  const char *name;
259 
263  enum AVMediaType type;
264 
276  int min_perms;
277 
290  int rej_perms;
291 
295  int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
296 
303  AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
304 
311  AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
312  int nb_samples);
313 
317  int (*end_frame)(AVFilterLink *link);
318 
322  int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
323 
335 
345  int (*poll_frame)(AVFilterLink *link);
346 
356  int (*request_frame)(AVFilterLink *link);
357 
375  int (*config_props)(AVFilterLink *link);
376 
383  int needs_fifo;
384 };
385 #endif
386 
396 const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx);
397 
407 enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx);
408 
413 typedef struct AVFilter {
414  const char *name;
415 
420  const char *description;
421 
424 
425  /*****************************************************************
426  * All fields below this line are not part of the public API. They
427  * may not be used outside of libavfilter and can be changed and
428  * removed at will.
429  * New public fields should be added right above.
430  *****************************************************************
431  */
432 
437  int (*init)(AVFilterContext *ctx, const char *args);
438 
445 
455 
456  int priv_size;
457 
470  int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
471 
477  int (*init_opaque)(AVFilterContext *ctx, const char *args, void *opaque);
478 
480 } AVFilter;
481 
484  const AVClass *av_class;
485 
487 
488  char *name;
489 
492 #if FF_API_FOO_COUNT
493  unsigned input_count;
494 #endif
495  unsigned nb_inputs;
496 
499 #if FF_API_FOO_COUNT
500  unsigned output_count;
501 #endif
502  unsigned nb_outputs;
503 
504  void *priv;
505 
507 };
508 
516 struct AVFilterLink {
519 
522 
524 
525  /* These parameters apply only to video */
526  int w;
527  int h;
529  /* These parameters apply only to audio */
530  uint64_t channel_layout;
532 
533  int format;
534 
543 
544  /*****************************************************************
545  * All fields below this line are not part of the public API. They
546  * may not be used outside of libavfilter and can be changed and
547  * removed at will.
548  * New public fields should be added right above.
549  *****************************************************************
550  */
560 
569 
578 
580  enum {
584  } init_state;
585 
587 
592 
597  int64_t current_pts;
598 
603 
615 
620 
626 
635 
641 
650 
661  int closed;
662 
666  int channels;
667 };
668 
678 int avfilter_link(AVFilterContext *src, unsigned srcpad,
679  AVFilterContext *dst, unsigned dstpad);
680 
684 void avfilter_link_free(AVFilterLink **link);
685 
690 
694 void avfilter_link_set_closed(AVFilterLink *link, int closed);
695 
703 
716 avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms,
717  int w, int h, enum AVPixelFormat format);
718 
734  int linesize,
735  int perms,
736  int nb_samples,
737  enum AVSampleFormat sample_fmt,
738  uint64_t channel_layout);
753  int linesize,
754  int perms,
755  int nb_samples,
756  enum AVSampleFormat sample_fmt,
757  int channels,
758  uint64_t channel_layout);
759 
760 
761 
762 #define AVFILTER_CMD_FLAG_ONE 1
763 #define AVFILTER_CMD_FLAG_FAST 2
764 
765 
769 int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
770 
772 void avfilter_register_all(void);
773 
775 void avfilter_uninit(void);
776 
788 
796 AVFilter *avfilter_get_by_name(const char *name);
797 
805 
815 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
816 
827 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
828 
835 
846  unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
847 
852 #endif /* AVFILTER_AVFILTER_H */