]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avfilter.h
Allow NULL for read_header in AVInputFormat. See discussion in "[PATCH] allow
[ffmpeg] / libavfilter / avfilter.h
index fb560fcea4bbfcde4422e8059e3e0541547d32a4..6f6c41155f5aa419c54bf20ca0382bccb2b0dc5b 100644 (file)
 #ifndef FFMPEG_AVFILTER_H
 #define FFMPEG_AVFILTER_H
 
+#define LIBAVFILTER_VERSION_MAJOR  0
+#define LIBAVFILTER_VERSION_MINOR  0
+#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"
 
 typedef struct AVFilterContext AVFilterContext;
 typedef struct AVFilterLink    AVFilterLink;
@@ -166,25 +178,60 @@ 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. And all the references of a and b, and a and b 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.
@@ -202,8 +249,7 @@ 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
@@ -315,9 +361,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.
@@ -325,7 +368,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
 
@@ -360,7 +402,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
 
@@ -379,7 +421,7 @@ 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
@@ -457,7 +499,14 @@ 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 imediately available frames
+ */
+int avfilter_poll_frame(AVFilterLink *link);
 
 /**
  * Notify the next filter of the start of a frame.
@@ -484,7 +533,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);