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

Unified · Split

libavfilter/avfilter.h+207−47
@@ -39,12 +39,20 @@ typedef struct AVFilterPad AVFilterPad; · 38 unmodified lines
3939 */
4040 typedef struct AVFilterPic
4141 {
42− uint8_t *data[4];
43− int linesize[4]; ///< number of bytes per line
44− enum PixelFormat format;
42+ uint8_t *data[4]; ///< picture data for each plane
43+ int linesize[4]; ///< number of bytes per line
44+ enum PixelFormat format; ///< colorspace
4545
46− unsigned refcount;
46+ unsigned refcount; ///< number of references to this image
47+
48+ /** private data to be used by a custom free function */
4749 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+ */
4856 void (*free)(struct AVFilterPic *pic);
4957 } AVFilterPic;
5058
@@ -58,10 +66,11 @@ typedef struct AVFilterPic · 7 unmodified lines
5866 */
5967 typedef struct AVFilterPicRef
6068 {
61− AVFilterPic *pic;
62− uint8_t *data[4];
63− int linesize[4];
64− int w, h;
69+ AVFilterPic *pic; ///< the picture that this is a reference to
70+ uint8_t *data[4]; ///< picture data for each plane
71+ int linesize[4]; ///< number of bytes per line
72+ int w; ///< image width
73+ int h; ///< image height
6574
6675 int64_t pts; ///< presentation timestamp in milliseconds
6776
@@ -74,9 +83,11 @@ typedef struct AVFilterPicRef · 6 unmodified lines
7483
7584 /**
7685 * Add a new reference to a picture.
77− * @param ref An existing reference to the picture
78− * @param pmask A bitmask containing the allowable permissions in the new reference
79− * @return A new reference to the picture with the same properties as the old
86+ * @param ref An existing reference to the picture
87+ * @param pmask A bitmask containing the allowable permissions in the new
88+ * reference
89+ * @return A new reference to the picture with the same properties as the
90+ * old, excluding any permissions denied by pmask
8091 */
8192 AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);
8293
@@ -87,11 +98,15 @@ AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask); · 4 unmodified lines
8798 */
8899 void avfilter_unref_pic(AVFilterPicRef *ref);
89100
101+/**
102+ * A filter pad used for either input or output
103+ */
90104 struct AVFilterPad
91105 {
92106 /**
93− * Pad name. The name is unique among inputs and among oututs, but an
94− * input may have the same name as an output.
107+ * Pad name. The name is unique among inputs and among outputs, but an
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.
95110 */
96111 char *name;
97112
@@ -100,12 +115,17 @@ struct AVFilterPad · 2 unmodified lines
100115 * add audio in the future.
101116 */
102117 int type;
103−#define AV_PAD_VIDEO 0
118+#define AV_PAD_VIDEO 0 ///< video pad
104119
105120 /**
106121 * 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 and
108− * is required for both.
122+ * be terminated by -1 (see avfilter_make_format_list for an easy way to
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.
109129 */
110130 int *(*query_formats)(AVFilterLink *link);
111131
@@ -113,12 +133,16 @@ struct AVFilterPad · 1 unmodified line
113133 * Callback called before passing the first slice of a new frame. If
114134 * NULL, the filter layer will default to storing a reference to the
115135 * picture inside the link structure.
136+ *
137+ * Input video pads only.
116138 */
117139 void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);
118140
119141 /**
120142 * 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.
122146 */
123147 AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms);
124148
@@ -126,48 +150,69 @@ struct AVFilterPad · 1 unmodified line
126150 * Callback called after the slices of a frame are completely sent. If
127151 * NULL, the filter layer will default to releasing the reference stored
128152 * in the link structure during start_frame().
153+ *
154+ * Input video pads only.
129155 */
130156 void (*end_frame)(AVFilterLink *link);
131157
132158 /**
133159 * 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.
135163 */
136164 void (*draw_slice)(AVFilterLink *link, uint8_t *data[4], int y, int height);
137165
138166 /**
139167 * 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.
141172 */
142173 int (*request_frame)(AVFilterLink *link);
143174
144175 /**
145− * Link configuration callback. For output pads, this should set the link
146− * properties such as width/height. NOTE: this should not set the format
147− * property - that is negotiated between filters by the filter system using
148− * the query_formats() callback.
176+ * Link configuration callback.
177+ *
178+ * For output pads, this should set the link properties such as
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.
149182 *
150183 * For input pads, this should check the properties of the link, and update
151184 * 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.
152188 */
153189 int (*config_props)(AVFilterLink *link);
154190 };
155191
156−/* the default implementations of filter entry points */
192+/** Default handler for start_frame() for video inputs */
157193 void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
194+/** Default handler for end_frame() for video inputs */
158195 void avfilter_default_end_frame(AVFilterLink *link);
196+/** Default handler for config_props() for video outputs */
159197 int avfilter_default_config_output_link(AVFilterLink *link);
198+/** Default handler for config_props() for video inputs */
160199 int avfilter_default_config_input_link (AVFilterLink *link);
200+/** Default handler for query_formats() for video outputs */
161201 int *avfilter_default_query_output_formats(AVFilterLink *link);
202+/** Default handler for get_video_buffer() for video inputs */
162203 AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
163204 int perms);
164205
206+/**
207+ * Filter definition. This defines the pads a filter contains, and all the
208+ * callback functions used to interact with the filter.
209+ */
165210 typedef struct
166211 {
167− char *name;
168− char *author;
212+ char *name; ///< filter name
213+ char *author; ///< filter author
169214
170− int priv_size;
215+ int priv_size; ///< size of private data to allocate for the filter
171216
172217 /**
173218 * Filter initialization function. Args contains the user-supplied
@@ -176,69 +221,184 @@ typedef struct · 2 unmodified lines
176221 * and is used to pass data to the filter.
177222 */
178223 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+ */
179230 void (*uninit)(AVFilterContext *ctx);
180231
181− const AVFilterPad *inputs; /// NULL terminated list of inputs. NULL if none
182− const AVFilterPad *outputs; /// NULL terminated list of outputs. NULL if none
232+ const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none
233+ const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
183234 } AVFilter;
184235
236+/** An instance of a filter */
185237 struct AVFilterContext
186238 {
187− AVClass *av_class;
239+ AVClass *av_class; ///< Needed for av_log()
188240
189− AVFilter *filter;
241+ AVFilter *filter; ///< The AVFilter of which this is an instance
190242
191− char *name;
243+ char *name; ///< name of this filter instance
192244
193− unsigned input_count;
194− AVFilterPad *input_pads;
195− AVFilterLink **inputs;
245+ unsigned input_count; ///< number of input pads
246+ AVFilterPad *input_pads; ///< array of input pads
247+ AVFilterLink **inputs; ///< array of pointers to input links
196248
197− unsigned output_count;
198− AVFilterPad *output_pads;
199− AVFilterLink **outputs;
249+ unsigned output_count; ///< number of output pads
250+ AVFilterPad *output_pads; ///< array of output pads
251+ AVFilterLink **outputs; ///< array of pointers to output links
200252
201− void *priv;
253+ void *priv; ///< private data for use by the filter
202254 };
203255
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+ */
204263 struct AVFilterLink
205264 {
206− AVFilterContext *src;
207− unsigned int srcpad;
265+ AVFilterContext *src; ///< source filter
266+ unsigned int srcpad; ///< index of the output pad on the source filter
208267
209− AVFilterContext *dst;
210− unsigned int dstpad;
268+ AVFilterContext *dst; ///< dest filter
269+ unsigned int dstpad; ///< index of the input pad on the dest filter
211270
212− int w, h;
213− enum PixelFormat format;
271+ int w; ///< agreed upon image width
272+ int h; ///< agreed upon image height
273+ enum PixelFormat format; ///< agreed upon image colorspace
214274
215275 AVFilterPicRef *cur_pic;
216276 AVFilterPicRef *outpic;
217277 };
218278
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+ */
220287 int avfilter_link(AVFilterContext *src, unsigned srcpad,
221288 AVFilterContext *dst, unsigned dstpad);
222289
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+ */
224295 int avfilter_config_link(AVFilterLink *link);
225296
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+ */
226305 AVFilterPicRef *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+ */
227312 int 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+ */
228322 void 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+ */
229328 void 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+ */
230337 void avfilter_draw_slice(AVFilterLink *link, uint8_t *data[4], int y, int h);
231338
339+/** Initialize the filter system. Registers all builtin filters */
232340 void avfilter_init(void);
341+
342+/** Uninitialize the filter system. Unregisters all filters */
233343 void 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+ */
234351 void 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+ */
235359 AVFilter *avfilter_get_by_name(char *name);
236360
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+ */
237367 AVFilterContext *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+ */
238375 AVFilterContext *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+ */
239386 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
387+
388+/**
389+ * Destroy a filter
390+ * @param filter The filter to destroy
391+ */
240392 void avfilter_destroy(AVFilterContext *filter);
241393
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+ */
242402 int *avfilter_make_format_list(int len, ...);
243403
244404 /**

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