#ifndef FFMPEG_AVFILTER_H
#define FFMPEG_AVFILTER_H
+#include <stddef.h>
#include "avcodec.h"
typedef struct AVFilterContext AVFilterContext;
int (*config_props)(AVFilterLink *link);
};
-/* the default implementations of start_frame() and end_frame() */
+/* the default implementations of filter entry points */
void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
void avfilter_default_end_frame(AVFilterLink *link);
+int avfilter_default_config_output_link(AVFilterLink *link);
+int avfilter_default_config_input_link (AVFilterLink *link);
+int *avfilter_default_query_output_formats(AVFilterLink *link);
+AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
+ int perms);
typedef struct
{
* opaque is data provided by the code requesting creation of the filter,
* and is used to pass data to the filter.
*/
- int (*init)(AVFilterContext *ctx, const char *args, const void *opaque);
+ int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
void (*uninit)(AVFilterContext *ctx);
const AVFilterPad *inputs; /// NULL terminated list of inputs. NULL if none
char *name;
+ unsigned input_count;
+ AVFilterPad *input_pads;
AVFilterLink **inputs;
+
+ unsigned output_count;
+ AVFilterPad *output_pads;
AVFilterLink **outputs;
void *priv;
int avfilter_link(AVFilterContext *src, unsigned srcpad,
AVFilterContext *dst, unsigned dstpad);
+/** Configure the colorspace, dimensions, etc of a link */
+int avfilter_config_link(AVFilterLink *link);
+
AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms);
void avfilter_request_frame(AVFilterLink *link);
void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
int *avfilter_make_format_list(int len, ...);
+/**
+ * Insert a new pad
+ * @param idx Insertion point. Pad is inserted at the end if this point
+ * is beyond the end of the list of pads.
+ * @param count Pointer to the number of pads in the list
+ * @param padidx_off Offset within an AVFilterLink structure to the element
+ * to increment when inserting a new pad causes link
+ * numbering to change
+ * @param pads Pointer to the pointer to the beginning of the list of pads
+ * @param links Pointer to the pointer to the beginning of the list of links
+ * @param newpad The new pad to add. A copy is made when adding.
+ */
+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 */
+static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
+ AVFilterPad *p)
+{
+ avfilter_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
+ &f->input_pads, &f->inputs, p);
+}
+
+/** insert a new output pad for the filter */
+static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
+ AVFilterPad *p)
+{
+ avfilter_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
+ &f->output_pads, &f->outputs, p);
+}
+
#endif /* FFMPEG_AVFILTER_H */