History

Add many new and improve existing doxy comments.

Commited in SoC by Bobby Bingham on 2007-08-14 16:39:26 Originally committed as revision 12095 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak committed 18 years ago

Commit 13ff8fd1 parent 63f64e61 file · +207 −47Browse files

Showing the changes to libavfilter/avfilter.h (1 of 1 file). Show all

Unified · Split

libavfilter/avfilter.h+207−47
@@ -39,12 +39,20 @@ typedef struct AVFilterPad AVFilterPad; · 38 unmodified lines
39 */39 */
40typedef struct AVFilterPic40typedef struct AVFilterPic
41{41{
42 uint8_t *data[4];42 uint8_t *data[4]; ///< picture data for each plane
43 int linesize[4]; ///< number of bytes per line43 int linesize[4]; ///< number of bytes per line
44 enum PixelFormat format;44 enum PixelFormat format; ///< colorspace
45 45
46 unsigned refcount;46 unsigned refcount; ///< number of references to this image
47
48 /** private data to be used by a custom free function */
47 void *priv;49 void *priv;
50 /**
51 * A pointer to the function to deallocate this image if the default
52 * function is not sufficient. This could, for example, add the memory
53 * back into a memory pool to be reused later without the overhead of
54 * reallocating it from scratch.
55 */
48 void (*free)(struct AVFilterPic *pic);56 void (*free)(struct AVFilterPic *pic);
49} AVFilterPic;57} AVFilterPic;
50 58
@@ -58,10 +66,11 @@ typedef struct AVFilterPic · 7 unmodified lines
58 */66 */
59typedef struct AVFilterPicRef67typedef struct AVFilterPicRef
60{68{
61 AVFilterPic *pic;69 AVFilterPic *pic; ///< the picture that this is a reference to
62 uint8_t *data[4];70 uint8_t *data[4]; ///< picture data for each plane
63 int linesize[4];71 int linesize[4]; ///< number of bytes per line
64 int w, h;72 int w; ///< image width
73 int h; ///< image height
65 74
66 int64_t pts; ///< presentation timestamp in milliseconds75 int64_t pts; ///< presentation timestamp in milliseconds
67 76
@@ -74,9 +83,11 @@ typedef struct AVFilterPicRef · 6 unmodified lines
74 83
75/**84/**
76 * Add a new reference to a picture.85 * Add a new reference to a picture.
77 * @param ref An existing reference to the picture86 * @param ref An existing reference to the picture
78 * @param pmask A bitmask containing the allowable permissions in the new reference87 * @param pmask A bitmask containing the allowable permissions in the new
79 * @return A new reference to the picture with the same properties as the old88 * reference
89 * @return A new reference to the picture with the same properties as the
90 * old, excluding any permissions denied by pmask
80 */91 */
81AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);92AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);
82 93
@@ -87,11 +98,15 @@ AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask); · 4 unmodified lines
87 */98 */
88void avfilter_unref_pic(AVFilterPicRef *ref);99void avfilter_unref_pic(AVFilterPicRef *ref);
89 100
101/**
102 * A filter pad used for either input or output
103 */
90struct AVFilterPad104struct AVFilterPad
91{105{
92 /**106 /**
93 * Pad name. The name is unique among inputs and among oututs, but an107 * Pad name. The name is unique among inputs and among outputs, but an
94 * input may have the same name as an output.108 * input may have the same name as an output. This may be NULL if this
109 * pad has no need to ever be referenced by name.
95 */110 */
96 char *name;111 char *name;
97 112
@@ -100,12 +115,17 @@ struct AVFilterPad · 2 unmodified lines
100 * add audio in the future.115 * add audio in the future.
101 */116 */
102 int type;117 int type;
103#define AV_PAD_VIDEO 0118#define AV_PAD_VIDEO 0 ///< video pad
104 119
105 /**120 /**
106 * Callback to get a list of supported formats. The returned list should121 * Callback to get a list of supported formats. The returned list should
107 * be terminated by -1. This is used for both input and output pads and122 * be terminated by -1 (see avfilter_make_format_list for an easy way to
108 * is required for both.123 * create such a list).
124 *
125 * This is used for both input and output pads. If ommitted from an output
126 * pad, it is assumed that the only format supported is the same format
127 * that is being used for the filter's first input. If the filter has no
128 * inputs, then this may not be ommitted for its output pads.
109 */129 */
110 int *(*query_formats)(AVFilterLink *link);130 int *(*query_formats)(AVFilterLink *link);
111 131
@@ -113,12 +133,16 @@ struct AVFilterPad · 1 unmodified line
113 * Callback called before passing the first slice of a new frame. If133 * Callback called before passing the first slice of a new frame. If
114 * NULL, the filter layer will default to storing a reference to the134 * NULL, the filter layer will default to storing a reference to the
115 * picture inside the link structure.135 * picture inside the link structure.
136 *
137 * Input video pads only.
116 */138 */
117 void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);139 void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);
118 140
119 /**141 /**
120 * Callback function to get a buffer. If NULL, the filter system will142 * Callback function to get a buffer. If NULL, the filter system will
121 * handle buffer requests. Only required for input video pads.143 * handle buffer requests.
144 *
145 * Input video pads only.
122 */146 */
123 AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms);147 AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms);
124 148
@@ -126,48 +150,69 @@ struct AVFilterPad · 1 unmodified line
126 * Callback called after the slices of a frame are completely sent. If150 * Callback called after the slices of a frame are completely sent. If
127 * NULL, the filter layer will default to releasing the reference stored151 * NULL, the filter layer will default to releasing the reference stored
128 * in the link structure during start_frame().152 * in the link structure during start_frame().
153 *
154 * Input video pads only.
129 */155 */
130 void (*end_frame)(AVFilterLink *link);156 void (*end_frame)(AVFilterLink *link);
131 157
132 /**158 /**
133 * Slice drawing callback. This is where a filter receives video data159 * Slice drawing callback. This is where a filter receives video data
134 * and should do its processing. Only required for input video pads.160 * and should do its processing.
161 *
162 * Input video pads only.
135 */163 */
136 void (*draw_slice)(AVFilterLink *link, uint8_t *data[4], int y, int height);164 void (*draw_slice)(AVFilterLink *link, uint8_t *data[4], int y, int height);
137 165
138 /**166 /**
139 * Frame request callback. A call to this should result in at least one167 * Frame request callback. A call to this should result in at least one
140 * frame being output over the given link. Video output pads only.168 * frame being output over the given link. This should return zero on
169 * success, and another value on error.
170 *
171 * Output video pads only.
141 */172 */
142 int (*request_frame)(AVFilterLink *link);173 int (*request_frame)(AVFilterLink *link);
143 174
144 /**175 /**
145 * Link configuration callback. For output pads, this should set the link176 * Link configuration callback.
146 * properties such as width/height. NOTE: this should not set the format177 *
147 * property - that is negotiated between filters by the filter system using178 * For output pads, this should set the link properties such as
148 * the query_formats() callback.179 * width/height. This should NOT set the format property - that is
180 * negotiated between filters by the filter system using the
181 * query_formats() callback before this function is called.
149 *182 *
150 * For input pads, this should check the properties of the link, and update183 * For input pads, this should check the properties of the link, and update
151 * the filter's internal state as necessary.184 * the filter's internal state as necessary.
185 *
186 * For both input and output filters, this should return zero on success,
187 * and another value on error.
152 */188 */
153 int (*config_props)(AVFilterLink *link);189 int (*config_props)(AVFilterLink *link);
154};190};
155 191
156/* the default implementations of filter entry points */192/** Default handler for start_frame() for video inputs */
157void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);193void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
194/** Default handler for end_frame() for video inputs */
158void avfilter_default_end_frame(AVFilterLink *link);195void avfilter_default_end_frame(AVFilterLink *link);
196/** Default handler for config_props() for video outputs */
159int avfilter_default_config_output_link(AVFilterLink *link);197int avfilter_default_config_output_link(AVFilterLink *link);
198/** Default handler for config_props() for video inputs */
160int avfilter_default_config_input_link (AVFilterLink *link);199int avfilter_default_config_input_link (AVFilterLink *link);
200/** Default handler for query_formats() for video outputs */
161int *avfilter_default_query_output_formats(AVFilterLink *link);201int *avfilter_default_query_output_formats(AVFilterLink *link);
202/** Default handler for get_video_buffer() for video inputs */
162AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,203AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
163 int perms);204 int perms);
164 205
206/**
207 * Filter definition. This defines the pads a filter contains, and all the
208 * callback functions used to interact with the filter.
209 */
165typedef struct210typedef struct
166{211{
167 char *name;212 char *name; ///< filter name
168 char *author;213 char *author; ///< filter author
169 214
170 int priv_size;215 int priv_size; ///< size of private data to allocate for the filter
171 216
172 /**217 /**
173 * Filter initialization function. Args contains the user-supplied218 * Filter initialization function. Args contains the user-supplied
@@ -176,69 +221,184 @@ typedef struct · 2 unmodified lines
176 * and is used to pass data to the filter.221 * and is used to pass data to the filter.
177 */222 */
178 int (*init)(AVFilterContext *ctx, const char *args, void *opaque);223 int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
224
225 /**
226 * Filter uninitialization function. Should deallocate any memory held
227 * by the filter, release any picture references, etc. This does not need
228 * to deallocate the AVFilterContext->priv memory itself.
229 */
179 void (*uninit)(AVFilterContext *ctx);230 void (*uninit)(AVFilterContext *ctx);
180 231
181 const AVFilterPad *inputs; /// NULL terminated list of inputs. NULL if none232 const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none
182 const AVFilterPad *outputs; /// NULL terminated list of outputs. NULL if none233 const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
183} AVFilter;234} AVFilter;
184 235
236/** An instance of a filter */
185struct AVFilterContext237struct AVFilterContext
186{238{
187 AVClass *av_class;239 AVClass *av_class; ///< Needed for av_log()
188 240
189 AVFilter *filter;241 AVFilter *filter; ///< The AVFilter of which this is an instance
190 242
191 char *name;243 char *name; ///< name of this filter instance
192 244
193 unsigned input_count;245 unsigned input_count; ///< number of input pads
194 AVFilterPad *input_pads;246 AVFilterPad *input_pads; ///< array of input pads
195 AVFilterLink **inputs;247 AVFilterLink **inputs; ///< array of pointers to input links
196 248
197 unsigned output_count;249 unsigned output_count; ///< number of output pads
198 AVFilterPad *output_pads;250 AVFilterPad *output_pads; ///< array of output pads
199 AVFilterLink **outputs;251 AVFilterLink **outputs; ///< array of pointers to output links
200 252
201 void *priv;253 void *priv; ///< private data for use by the filter
202};254};
203 255
256/**
257 * A links between two filters. This contains pointers to the source and
258 * destination filters between which this link exists, and the indices of
259 * the pads involved. In addition, this link also contains the parameters
260 * which have been negotiated and agreed upon between the filter, such as
261 * image dimensions, format, etc
262 */
204struct AVFilterLink263struct AVFilterLink
205{264{
206 AVFilterContext *src;265 AVFilterContext *src; ///< source filter
207 unsigned int srcpad;266 unsigned int srcpad; ///< index of the output pad on the source filter
208 267
209 AVFilterContext *dst;268 AVFilterContext *dst; ///< dest filter
210 unsigned int dstpad;269 unsigned int dstpad; ///< index of the input pad on the dest filter
211 270
212 int w, h;271 int w; ///< agreed upon image width
213 enum PixelFormat format;272 int h; ///< agreed upon image height
273 enum PixelFormat format; ///< agreed upon image colorspace
214 274
215 AVFilterPicRef *cur_pic;275 AVFilterPicRef *cur_pic;
216 AVFilterPicRef *outpic;276 AVFilterPicRef *outpic;
217};277};
218 278
219/** Link two filters together */279/**
280 * Link two filters together
281 * @param src The source filter
282 * @param srcpad Index of the output pad on the source filter
283 * @param dst The destination filter
284 * @param dstpad Index of the input pad on the destination filter
285 * @return Zero on success
286 */
220int avfilter_link(AVFilterContext *src, unsigned srcpad,287int avfilter_link(AVFilterContext *src, unsigned srcpad,
221 AVFilterContext *dst, unsigned dstpad);288 AVFilterContext *dst, unsigned dstpad);
222 289
223/** Configure the colorspace, dimensions, etc of a link */290/**
291 * Negotiate the colorspace, dimensions, etc of a link
292 * @param link The link to negotiate the properties of
293 * @return Zero on successful negotiation
294 */
224int avfilter_config_link(AVFilterLink *link);295int avfilter_config_link(AVFilterLink *link);
225 296
297/**
298 * Request a picture buffer with a specific set of permissions
299 * @param link The output link to the filter from which the picture will
300 * be requested
301 * @param perms The required access permissions
302 * @return A reference to the picture. This must be unreferenced with
303 * avfilter_unref_pic when you are finished with it.
304 */
226AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms);305AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms);
306
307/**
308 * Request an input frame from the filter at the other end of the link.
309 * @param link The input link
310 * @return Zero on success
311 */
227int avfilter_request_frame(AVFilterLink *link);312int avfilter_request_frame(AVFilterLink *link);
313
314/**
315 * Notofy the next filter of the start of a frame.
316 * @param link The output link the frame will be sent over
317 * @param picref A reference to the frame about to be sent. The data for this
318 * frame need only be valid once draw_slice() is called for that
319 * portion. The receiving filter will free this reference when
320 * it no longer needs it.
321 */
228void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);322void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
323
324/**
325 * Notify the next filter that the current frame has finished
326 * @param link The output link the frame was sent over
327 */
229void avfilter_end_frame(AVFilterLink *link);328void avfilter_end_frame(AVFilterLink *link);
329
330/**
331 * Send a slice to the next filter
332 * @param link The output link over which the frame is being sent
333 * @param data Start of the picture data for this slice
334 * @param y Offset in pixels from the top of the image for this slice
335 * @param h Height of this slice in pixels
336 */
230void avfilter_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h);337void avfilter_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h);
231 338
339/** Initialize the filter system. Registers all builtin filters */
232void avfilter_init(void);340void avfilter_init(void);
341
342/** Uninitialize the filter system. Unregisters all filters */
233void avfilter_uninit(void);343void avfilter_uninit(void);
344
345/**
346 * Register a filter. This is only needed if you plan to create an instance of
347 * this filter by name later with avfilter_create_by_name. A filter can still
348 * by created with acfilter_create even if it is not registered.
349 * @param filter The filter to register
350 */
234void avfilter_register(AVFilter *filter);351void avfilter_register(AVFilter *filter);
352
353/**
354 * Gets a filter definition matching the given name
355 * @param name The filter name to find
356 * @return The filter definition, if any matching one is registered.
357 * NULL if none found.
358 */
235AVFilter *avfilter_get_by_name(char *name);359AVFilter *avfilter_get_by_name(char *name);
236 360
361/**
362 * Create a filter instance
363 * @param filter The filter to create an instance of
364 * @param inst_name Name to give to the new instance. Can be NULL for none.
365 * @return Pointer to the new instance on success. NULL on failure.
366 */
237AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name);367AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name);
368
369/**
370 * Creates a filter instace
371 * @param name The name of the filter type which is to be instantiated
372 * @param inst_name Name to give to the new instance. Can be NULL for none.
373 * @return Pointer to the new instance on success. NULL in failure.
374 */
238AVFilterContext *avfilter_create_by_name(char *name, char *inst_name);375AVFilterContext *avfilter_create_by_name(char *name, char *inst_name);
376
377/**
378 * Initialize a filter
379 * @param filter The filter to initialize
380 * @param args A string of parameters to use when initializing the filter.
381 * The format and meaning of this string varies by filter.
382 * @param opaque Any extra non-string data needed by the filter. The meaning
383 * of this parameter varies by filter.
384 * @return Zero on success
385 */
239int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);386int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
387
388/**
389 * Destroy a filter
390 * @param filter The filter to destroy
391 */
240void avfilter_destroy(AVFilterContext *filter);392void avfilter_destroy(AVFilterContext *filter);
241 393
394/**
395 * Helper function to create a list of supported formats. This is intended
396 * for use in AVFilterPad->query_formats().
397 * @param len The number of formats supported
398 * @param ... A list of the supported formats
399 * @return The format list in a form suitable for returning from
400 * AVFilterPad->query_formats()
401 */
242int *avfilter_make_format_list(int len, ...);402int *avfilter_make_format_list(int len, ...);
243 403
244/**404/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t