]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavfilter/avfilter.h
Add gnu/kfreebsd to list of recognized operating systems.
[frescor/ffmpeg.git] / libavfilter / avfilter.h
index de1d7ec0e828f9c3e15291e39ac1ba50abeb33af..c8b40072b3ed004607b7b0bd7304ec2e8f4e9f80 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef FFMPEG_AVFILTER_H
-#define FFMPEG_AVFILTER_H
+#ifndef AVFILTER_AVFILTER_H
+#define AVFILTER_AVFILTER_H
 
-#define LIBAVFILTER_VERSION      0.0.0
+#define LIBAVFILTER_VERSION_MAJOR  0
+#define LIBAVFILTER_VERSION_MINOR  5
+#define LIBAVFILTER_VERSION_MICRO  0
+
+#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
+                                               LIBAVFILTER_VERSION_MINOR, \
+                                               LIBAVFILTER_VERSION_MICRO)
+#define LIBAVFILTER_VERSION     AV_VERSION(LIBAVFILTER_VERSION_MAJOR,   \
+                                           LIBAVFILTER_VERSION_MINOR,   \
+                                           LIBAVFILTER_VERSION_MICRO)
+#define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
 
 #include <stddef.h>
-#include "avcodec.h"
+#include "libavcodec/avcodec.h"
+
+/**
+ * Returns the LIBAVFILTER_VERSION_INT constant.
+ */
+unsigned avfilter_version(void);
 
 typedef struct AVFilterContext AVFilterContext;
 typedef struct AVFilterLink    AVFilterLink;
@@ -110,7 +125,7 @@ void avfilter_unref_pic(AVFilterPicRef *ref);
  * list of the formats supported by each input and output pad. The list
  * given for each pad need not be distinct - they may be references to the
  * same list of formats, as is often the case when a filter supports multiple
- * formats, but will always outut the same format as it is given in input.
+ * formats, but will always output the same format as it is given in input.
  *
  * In this way, a list of possible input formats and a list of possible
  * output formats are associated with each link. When a set of formats is
@@ -168,24 +183,61 @@ AVFilterFormats *avfilter_make_format_list(int len, ...);
 AVFilterFormats *avfilter_all_colorspaces(void);
 
 /**
- * If a and b share at least one common format, they are merged into a new
- * format list which is returned.  All the references to a and b are updated
- * to point to this new list, and a and b are deallocated.
+ * Returns a format list which contains the intersection of the formats of
+ * a and b. Also, all the references of a, all the references of b, and
+ * a and b themselves will be deallocated.
  *
  * If a and b do not share any common formats, neither is modified, and NULL
  * is returned.
  */
 AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b);
 
-/** Adds *ref as a new reference to f */
-void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref);
+/**
+ * Adds *ref as a new reference to formats.
+ * That is the pointers will point like in the ascii art below:
+ *   ________
+ *  |formats |<--------.
+ *  |  ____  |     ____|___________________
+ *  | |refs| |    |  __|_
+ *  | |* * | |    | |  | |  AVFilterLink
+ *  | |* *--------->|*ref|
+ *  | |____| |    | |____|
+ *  |________|    |________________________
+ */
+void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
 
 /**
  * Remove *ref as a reference to the format list it currently points to,
  * deallocate that list if this was the last reference, and set *ref to NULL.
+ *
+ *         Before                                 After
+ *   ________                               ________         NULL
+ *  |formats |<--------.                   |formats |         ^
+ *  |  ____  |     ____|________________   |  ____  |     ____|________________
+ *  | |refs| |    |  __|_                  | |refs| |    |  __|_
+ *  | |* * | |    | |  | |  AVFilterLink   | |* * | |    | |  | |  AVFilterLink
+ *  | |* *--------->|*ref|                 | |*   | |    | |*ref|
+ *  | |____| |    | |____|                 | |____| |    | |____|
+ *  |________|    |_____________________   |________|    |_____________________
  */
 void avfilter_formats_unref(AVFilterFormats **ref);
 
+/**
+ *
+ *         Before                                 After
+ *   ________                         ________
+ *  |formats |<---------.            |formats |<---------.
+ *  |  ____  |       ___|___         |  ____  |       ___|___
+ *  | |refs| |      |   |   |        | |refs| |      |   |   |   NULL
+ *  | |* *--------->|*oldref|        | |* *--------->|*newref|     ^
+ *  | |* * | |      |_______|        | |* * | |      |_______|  ___|___
+ *  | |____| |                       | |____| |                |   |   |
+ *  |________|                       |________|                |*oldref|
+ *                                                             |_______|
+ */
+void avfilter_formats_changeref(AVFilterFormats **oldref,
+                                AVFilterFormats **newref);
+
 /**
  * A filter pad used for either input or output.
  */
@@ -205,7 +257,7 @@ struct AVFilterPad
     enum CodecType type;
 
     /**
-     * Minimum required permissions on incoming buffers.  Any buffers with
+     * Minimum required permissions on incoming buffers.  Any buffer with
      * insufficient permissions will be automatically copied by the filter
      * system to a new buffer which provides the needed access permissions.
      *
@@ -215,9 +267,10 @@ struct AVFilterPad
 
     /**
      * Permissions which are not accepted on incoming buffers.  Any buffer
-     * which has any of these permissions set be automatically copied by the
-     * filter system to a new buffer which does not have those permissions.
-     * This can be used to easily disallow buffers with AV_PERM_REUSE.
+     * which has any of these permissions set will be automatically copied
+     * by the filter system to a new buffer which does not have those
+     * permissions.  This can be used to easily disallow buffers with
+     * AV_PERM_REUSE.
      *
      * Input pads only.
      */
@@ -294,15 +347,17 @@ struct AVFilterPad
     int (*config_props)(AVFilterLink *link);
 };
 
-/** Default handler for start_frame() for video inputs */
+/** default handler for start_frame() for video inputs */
 void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
-/** Default handler for end_frame() for video inputs */
+/** default handler for draw_slice() for video inputs */
+void avfilter_default_draw_slice(AVFilterLink *link, int y, int h);
+/** default handler for end_frame() for video inputs */
 void avfilter_default_end_frame(AVFilterLink *link);
-/** Default handler for config_props() for video outputs */
+/** default handler for config_props() for video outputs */
 int avfilter_default_config_output_link(AVFilterLink *link);
-/** Default handler for config_props() for video inputs */
+/** default handler for config_props() for video inputs */
 int avfilter_default_config_input_link (AVFilterLink *link);
-/** Default handler for get_video_buffer() for video inputs */
+/** default handler for get_video_buffer() for video inputs */
 AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
                                                   int perms);
 /**
@@ -314,9 +369,6 @@ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
 /** Default handler for query_formats() */
 int avfilter_default_query_formats(AVFilterContext *ctx);
 
-void avfilter_formats_changeref(AVFilterFormats **oldref,
-                                AVFilterFormats **newref);
-
 /**
  * Filter definition.  This defines the pads a filter contains, and all the
  * callback functions used to interact with the filter.
@@ -358,7 +410,7 @@ typedef struct
 /** An instance of a filter */
 struct AVFilterContext
 {
-    AVClass *av_class;              ///< needed for av_log()
+    const AVClass *av_class;              ///< needed for av_log()
 
     AVFilter *filter;               ///< the AVFilter of which this is an instance
 
@@ -377,10 +429,10 @@ struct AVFilterContext
 
 /**
  * A link between two filters.  This contains pointers to the source and
- * destination filters between which this link exists, and the indices of
+ * destination filters between which this link exists, and the indexes of
  * the pads involved.  In addition, this link also contains the parameters
  * which have been negotiated and agreed upon between the filter, such as
- * image dimensions, format, etc
+ * image dimensions, format, etc.
  */
 struct AVFilterLink
 {
@@ -441,7 +493,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
 int avfilter_config_links(AVFilterContext *filter);
 
 /**
- * Request a picture buffer with a specific set of permissions
+ * Request a picture buffer with a specific set of permissions.
  * @param link  the output link to the filter from which the picture will
  *              be requested
  * @param perms the required access permissions
@@ -460,7 +512,8 @@ int avfilter_request_frame(AVFilterLink *link);
 /**
  * Poll a frame from the filter chain.
  * @param  link the input link
- * @return      the number of imediately available frames
+ * @return the number of immediately available frames, a negative
+ * number in case of error
  */
 int avfilter_poll_frame(AVFilterLink *link);
 
@@ -475,7 +528,7 @@ int avfilter_poll_frame(AVFilterLink *link);
 void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
 
 /**
- * Notify the next filter that the current frame has finished
+ * Notify the next filter that the current frame has finished.
  * @param link the output link the frame was sent over
  */
 void avfilter_end_frame(AVFilterLink *link);
@@ -489,10 +542,7 @@ void avfilter_end_frame(AVFilterLink *link);
 void avfilter_draw_slice(AVFilterLink *link, int y, int h);
 
 /** Initialize the filter system.  Registers all builtin filters */
-void avfilter_init(void);
-
-/** Initialize the filter system.  Registers all builtin filters */
-void avfilter_register_all(void)
+void avfilter_register_all(void);
 
 /** Uninitialize the filter system.  Unregisters all filters */
 void avfilter_uninit(void);
@@ -566,7 +616,7 @@ void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
                          AVFilterPad **pads, AVFilterLink ***links,
                          AVFilterPad *newpad);
 
-/** insert a new input pad for the filter */
+/** Insert a new input pad for the filter. */
 static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
                                          AVFilterPad *p)
 {
@@ -574,7 +624,7 @@ static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
                         &f->input_pads, &f->inputs, p);
 }
 
-/** insert a new output pad for the filter */
+/** Insert a new output pad for the filter. */
 static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
                                           AVFilterPad *p)
 {
@@ -582,4 +632,4 @@ static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
                         &f->output_pads, &f->outputs, p);
 }
 
-#endif  /* FFMPEG_AVFILTER_H */
+#endif  /* AVFILTER_AVFILTER_H */