#define AVFILTER_AVFILTER_H
#include "libavutil/avutil.h"
+#include "libavutil/frame.h"
#include "libavutil/log.h"
#include "libavutil/samplefmt.h"
#include "libavutil/pixfmt.h"
typedef struct AVFilterPad AVFilterPad;
typedef struct AVFilterFormats AVFilterFormats;
+#if FF_API_AVFILTERBUFFER
/**
* A reference-counted buffer data type used by the filter system. Filters
* should not store pointers to this structure directly, but instead use the
/**
* Copy properties of src to dst, without copying the actual data
*/
+attribute_deprecated
void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src);
/**
* @return a new reference to the buffer with the same properties as the
* old, excluding any permissions denied by pmask
*/
+attribute_deprecated
AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
/**
* @note it is recommended to use avfilter_unref_bufferp() instead of this
* function
*/
+attribute_deprecated
void avfilter_unref_buffer(AVFilterBufferRef *ref);
/**
*
* @param ref pointer to the buffer reference
*/
+attribute_deprecated
void avfilter_unref_bufferp(AVFilterBufferRef **ref);
+#endif
#if FF_API_AVFILTERPAD_PUBLIC
/**
*
* Input pads only.
*/
- int min_perms;
+ attribute_deprecated int min_perms;
/**
* Permissions which are not accepted on incoming buffers. Any buffer
*
* Input pads only.
*/
- int rej_perms;
+ attribute_deprecated int rej_perms;
/**
- * Callback called before passing the first slice of a new frame. If
- * NULL, the filter layer will default to storing a reference to the
- * picture inside the link structure.
- *
- * Input video pads only.
- *
- * @return >= 0 on success, a negative AVERROR on error. picref will be
- * unreferenced by the caller in case of error.
+ * @deprecated unused
*/
int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
*
* Input video pads only.
*/
- AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
+ AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h);
/**
* Callback function to get an audio buffer. If NULL, the filter system will
*
* Input audio pads only.
*/
- AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
- int nb_samples);
+ AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples);
/**
- * Callback called after the slices of a frame are completely sent. If
- * NULL, the filter layer will default to releasing the reference stored
- * in the link structure during start_frame().
- *
- * Input video pads only.
- *
- * @return >= 0 on success, a negative AVERROR on error.
+ * @deprecated unused
*/
int (*end_frame)(AVFilterLink *link);
/**
- * Slice drawing callback. This is where a filter receives video data
- * and should do its processing.
- *
- * Input video pads only.
- *
- * @return >= 0 on success, a negative AVERROR on error.
+ * @deprecated unused
*/
int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
/**
- * Samples filtering callback. This is where a filter receives audio data
- * and should do its processing.
+ * Filtering callback. This is where a filter receives a frame with
+ * audio/video data and should do its processing.
*
- * Input audio pads only.
+ * Input pads only.
*
* @return >= 0 on success, a negative AVERROR on error. This function
* must ensure that samplesref is properly unreferenced on error if it
* hasn't been passed on to another filter.
*/
- int (*filter_samples)(AVFilterLink *link, AVFilterBufferRef *samplesref);
+ int (*filter_frame)(AVFilterLink *link, AVFrame *frame);
/**
* Frame poll callback. This returns the number of immediately available
* input pads only.
*/
int needs_fifo;
+
+ int needs_writable;
};
#endif
AVLINK_STARTINIT, ///< started, but incomplete
AVLINK_INIT ///< complete
} init_state;
-
- /**
- * The buffer reference currently being sent across the link by the source
- * filter. This is used internally by the filter system to allow
- * automatic copying of buffers which do not have sufficient permissions
- * for the destination. This should not be accessed directly by the
- * filters.
- */
- AVFilterBufferRef *src_buf;
-
- AVFilterBufferRef *cur_buf;
- AVFilterBufferRef *out_buf;
};
/**
*/
int avfilter_config_links(AVFilterContext *filter);
+#if FF_API_AVFILTERBUFFER
/**
* Create a buffer reference wrapped around an already allocated image
* buffer.
* @param h the height of the image specified by the data and linesize arrays
* @param format the pixel format of the image specified by the data and linesize arrays
*/
+attribute_deprecated
AVFilterBufferRef *
avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
int w, int h, enum AVPixelFormat format);
* @param sample_fmt the format of each sample in the buffer to allocate
* @param channel_layout the channel layout of the buffer
*/
+attribute_deprecated
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
int linesize,
int perms,
int nb_samples,
enum AVSampleFormat sample_fmt,
uint64_t channel_layout);
+#endif
/** Initialize the filter system. Register all builtin filters. */
void avfilter_register_all(void);
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
+#if FF_API_AVFILTERBUFFER
/**
* Copy the frame properties of src to dst, without copying the actual
* image data.
*
* @return 0 on success, a negative number on error.
*/
+attribute_deprecated
int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
/**
*
* @return 0 on success, a negative number on error.
*/
+attribute_deprecated
int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
+#endif
#endif /* AVFILTER_AVFILTER_H */