• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavfilter/avfilter.h

Go to the documentation of this file.
00001 /*
00002  * filter layer
00003  * copyright (c) 2007 Bobby Bingham
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef AVFILTER_AVFILTER_H
00023 #define AVFILTER_AVFILTER_H
00024 
00025 #include "libavutil/avutil.h"
00026 
00027 #define LIBAVFILTER_VERSION_MAJOR  1
00028 #define LIBAVFILTER_VERSION_MINOR 19
00029 #define LIBAVFILTER_VERSION_MICRO  0
00030 
00031 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
00032                                                LIBAVFILTER_VERSION_MINOR, \
00033                                                LIBAVFILTER_VERSION_MICRO)
00034 #define LIBAVFILTER_VERSION     AV_VERSION(LIBAVFILTER_VERSION_MAJOR,   \
00035                                            LIBAVFILTER_VERSION_MINOR,   \
00036                                            LIBAVFILTER_VERSION_MICRO)
00037 #define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
00038 
00039 #include <stddef.h>
00040 #include "libavcodec/avcodec.h"
00041 
00045 unsigned avfilter_version(void);
00046 
00050 const char *avfilter_configuration(void);
00051 
00055 const char *avfilter_license(void);
00056 
00057 
00058 typedef struct AVFilterContext AVFilterContext;
00059 typedef struct AVFilterLink    AVFilterLink;
00060 typedef struct AVFilterPad     AVFilterPad;
00061 
00062 /* TODO: look for other flags which may be useful in this structure (interlace
00063  * flags, etc)
00064  */
00070 typedef struct AVFilterPic
00071 {
00072     uint8_t *data[4];           
00073     int linesize[4];            
00074     enum PixelFormat format;    
00075 
00076     unsigned refcount;          
00077 
00079     void *priv;
00086     void (*free)(struct AVFilterPic *pic);
00087 
00088     int w, h;                  
00089 } AVFilterPic;
00090 
00099 typedef struct AVFilterPicRef
00100 {
00101     AVFilterPic *pic;           
00102     uint8_t *data[4];           
00103     int linesize[4];            
00104     int w;                      
00105     int h;                      
00106 
00107     int64_t pts;                
00108     int64_t pos;                
00109 
00110     AVRational pixel_aspect;    
00111 
00112     int perms;                  
00113 #define AV_PERM_READ     0x01   ///< can read from the buffer
00114 #define AV_PERM_WRITE    0x02   ///< can write to the buffer
00115 #define AV_PERM_PRESERVE 0x04   ///< nobody else can overwrite the buffer
00116 #define AV_PERM_REUSE    0x08   ///< can output the buffer multiple times, with the same contents each time
00117 #define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
00118 } AVFilterPicRef;
00119 
00128 AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);
00129 
00135 void avfilter_unref_pic(AVFilterPicRef *ref);
00136 
00177 typedef struct AVFilterFormats AVFilterFormats;
00178 struct AVFilterFormats
00179 {
00180     unsigned format_count;      
00181     enum PixelFormat *formats;  
00182 
00183     unsigned refcount;          
00184     AVFilterFormats ***refs;    
00185 };
00186 
00193 AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
00194 
00203 int avfilter_add_colorspace(AVFilterFormats **avff, enum PixelFormat pix_fmt);
00204 
00208 AVFilterFormats *avfilter_all_colorspaces(void);
00209 
00218 AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b);
00219 
00232 void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
00233 
00249 void avfilter_formats_unref(AVFilterFormats **ref);
00250 
00264 void avfilter_formats_changeref(AVFilterFormats **oldref,
00265                                 AVFilterFormats **newref);
00266 
00270 struct AVFilterPad
00271 {
00277     const char *name;
00278 
00283     enum AVMediaType type;
00284 
00292     int min_perms;
00293 
00303     int rej_perms;
00304 
00312     void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);
00313 
00320     AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
00321 
00329     void (*end_frame)(AVFilterLink *link);
00330 
00337     void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
00338 
00348     int (*poll_frame)(AVFilterLink *link);
00349 
00357     int (*request_frame)(AVFilterLink *link);
00358 
00373     int (*config_props)(AVFilterLink *link);
00374 };
00375 
00377 void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
00379 void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
00381 void avfilter_default_end_frame(AVFilterLink *link);
00383 int avfilter_default_config_output_link(AVFilterLink *link);
00385 int avfilter_default_config_input_link (AVFilterLink *link);
00387 AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
00388                                                   int perms, int w, int h);
00394 void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
00396 int avfilter_default_query_formats(AVFilterContext *ctx);
00397 
00399 void avfilter_null_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
00400 
00402 void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
00403 
00405 void avfilter_null_end_frame(AVFilterLink *link);
00406 
00408 AVFilterPicRef *avfilter_null_get_video_buffer(AVFilterLink *link,
00409                                                   int perms, int w, int h);
00410 
00415 typedef struct AVFilter
00416 {
00417     const char *name;         
00418 
00419     int priv_size;      
00420 
00427     int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
00428 
00434     void (*uninit)(AVFilterContext *ctx);
00435 
00444     int (*query_formats)(AVFilterContext *);
00445 
00446     const AVFilterPad *inputs;  
00447     const AVFilterPad *outputs; 
00448 
00453     const char *description;
00454 } AVFilter;
00455 
00457 struct AVFilterContext
00458 {
00459     const AVClass *av_class;              
00460 
00461     AVFilter *filter;               
00462 
00463     char *name;                     
00464 
00465     unsigned input_count;           
00466     AVFilterPad   *input_pads;      
00467     AVFilterLink **inputs;          
00468 
00469     unsigned output_count;          
00470     AVFilterPad   *output_pads;     
00471     AVFilterLink **outputs;         
00472 
00473     void *priv;                     
00474 };
00475 
00483 struct AVFilterLink
00484 {
00485     AVFilterContext *src;       
00486     unsigned int srcpad;        
00487 
00488     AVFilterContext *dst;       
00489     unsigned int dstpad;        
00490 
00492     enum {
00493         AVLINK_UNINIT = 0,      
00494         AVLINK_STARTINIT,       
00495         AVLINK_INIT             
00496     } init_state;
00497 
00498     int w;                      
00499     int h;                      
00500     enum PixelFormat format;    
00501 
00507     AVFilterFormats *in_formats;
00508     AVFilterFormats *out_formats;
00509 
00517     AVFilterPicRef *srcpic;
00518 
00519     AVFilterPicRef *cur_pic;
00520     AVFilterPicRef *outpic;
00521 };
00522 
00531 int avfilter_link(AVFilterContext *src, unsigned srcpad,
00532                   AVFilterContext *dst, unsigned dstpad);
00533 
00539 int avfilter_config_links(AVFilterContext *filter);
00540 
00551 AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
00552                                           int w, int h);
00553 
00559 int avfilter_request_frame(AVFilterLink *link);
00560 
00567 int avfilter_poll_frame(AVFilterLink *link);
00568 
00577 void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
00578 
00583 void avfilter_end_frame(AVFilterLink *link);
00584 
00600 void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
00601 
00603 void avfilter_register_all(void);
00604 
00606 void avfilter_uninit(void);
00607 
00617 int avfilter_register(AVFilter *filter);
00618 
00625 AVFilter *avfilter_get_by_name(const char *name);
00626 
00633 AVFilter **av_filter_next(AVFilter **filter);
00634 
00641 AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name);
00642 
00652 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
00653 
00658 void avfilter_destroy(AVFilterContext *filter);
00659 
00668 int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
00669                            unsigned in, unsigned out);
00670 
00683 void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
00684                          AVFilterPad **pads, AVFilterLink ***links,
00685                          AVFilterPad *newpad);
00686 
00688 static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
00689                                          AVFilterPad *p)
00690 {
00691     avfilter_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
00692                         &f->input_pads, &f->inputs, p);
00693 }
00694 
00696 static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
00697                                           AVFilterPad *p)
00698 {
00699     avfilter_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
00700                         &f->output_pads, &f->outputs, p);
00701 }
00702 
00703 #endif  /* AVFILTER_AVFILTER_H */

Generated on Fri Sep 16 2011 17:17:47 for FFmpeg by  doxygen 1.7.1