]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avfilter.h
Implement in AVFilterGraph the scale_sws_opts field, and pass its
[ffmpeg] / libavfilter / avfilter.h
index 219ffc88d2b07ff572ca3b88769c84beede14b85..9f455bb4474e3a644697b9c7df12e701e23b694a 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_MAJOR  0
+#define LIBAVFILTER_VERSION_MINOR  4
+#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;
@@ -108,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
@@ -161,32 +178,65 @@ struct AVFilterFormats
 AVFilterFormats *avfilter_make_format_list(int len, ...);
 
 /**
- * Returns a fairly comprehensive list of colorspaces which are supported by
- * many of the included filters. This is not truly "all" the colorspaces, but
- * it is most of them, and it is the most commonly supported large subset.
+ * Returns a list of all colorspaces supported by FFmpeg.
  */
 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);
 
-int avfilter_poll_frame(AVFilterLink *link);
+/**
+ *
+ *         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.
@@ -204,11 +254,10 @@ struct AVFilterPad
      * AVFilterPad type.  Only video supported now, hopefully someone will
      * add audio in the future.
      */
-    int type;
-#define AV_PAD_VIDEO 0      ///< video pad
+    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.
      *
@@ -218,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.
      */
@@ -297,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);
 /**
@@ -317,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.
@@ -327,7 +376,6 @@ void avfilter_formats_changeref(AVFilterFormats **oldref,
 typedef struct
 {
     const char *name;         ///< filter name
-    const char *author;       ///< filter author
 
     int priv_size;      ///< size of private data to allocate for the filter
 
@@ -362,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
 
@@ -381,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
 {
@@ -445,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
@@ -459,7 +507,15 @@ AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms);
  * @param link the input link
  * @return     zero on success
  */
-int  avfilter_request_frame(AVFilterLink *link);
+int avfilter_request_frame(AVFilterLink *link);
+
+/**
+ * Poll a frame from the filter chain.
+ * @param  link the input link
+ * @return the number of immediately available frames, a negative
+ * number in case of error
+ */
+int avfilter_poll_frame(AVFilterLink *link);
 
 /**
  * Notify the next filter of the start of a frame.
@@ -472,7 +528,7 @@ int  avfilter_request_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);
@@ -486,7 +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);
+void avfilter_register_all(void);
 
 /** Uninitialize the filter system.  Unregisters all filters */
 void avfilter_uninit(void);
@@ -560,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)
 {
@@ -568,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)
 {
@@ -576,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 */