diff options
Diffstat (limited to 'libavfilter/avfilter.h')
-rw-r--r-- | libavfilter/avfilter.h | 94 |
1 files changed, 66 insertions, 28 deletions
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f8295e77c5..226d7beacb 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -2,20 +2,20 @@ * filter layer * Copyright (c) 2007 Bobby Bingham * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -29,8 +29,8 @@ #include "libavutil/rational.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 4 -#define LIBAVFILTER_VERSION_MICRO 0 +#define LIBAVFILTER_VERSION_MINOR 24 +#define LIBAVFILTER_VERSION_MICRO 3 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ LIBAVFILTER_VERSION_MINOR, \ @@ -101,8 +101,7 @@ typedef struct AVFilterBuffer { */ typedef struct AVFilterBufferRefAudioProps { int64_t channel_layout; ///< channel layout of audio buffer - int nb_samples; ///< number of audio samples - int size; ///< audio buffer size + int nb_samples; ///< number of audio samples per channel uint32_t sample_rate; ///< audio buffer sample rate int planar; ///< audio buffer - planar or packed } AVFilterBufferRefAudioProps; @@ -115,7 +114,7 @@ typedef struct AVFilterBufferRefAudioProps { typedef struct AVFilterBufferRefVideoProps { int w; ///< image width int h; ///< image height - AVRational pixel_aspect; ///< pixel aspect ratio + AVRational sample_aspect_ratio; ///< sample aspect ratio int interlaced; ///< is frame interlaced int top_field_first; ///< field order enum AVPictureType pict_type; ///< picture type of the frame @@ -163,6 +162,7 @@ static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilt switch (src->type) { case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; + default: break; } } @@ -227,7 +227,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref); */ typedef struct AVFilterFormats { unsigned format_count; ///< number of formats - int *formats; ///< list of media formats + int64_t *formats; ///< list of media formats unsigned refcount; ///< number of references to this list struct AVFilterFormats ***refs; ///< references to this list @@ -237,10 +237,12 @@ typedef struct AVFilterFormats { * Create a list of supported formats. This is intended for use in * AVFilter->query_formats(). * - * @param fmts list of media formats, terminated by -1 + * @param fmts list of media formats, terminated by -1. If NULL an + * empty list is created. * @return the format list, with no existing references */ AVFilterFormats *avfilter_make_format_list(const int *fmts); +AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts); /** * Add fmt to the list of media formats contained in *avff. @@ -250,14 +252,19 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts); * @return a non negative value in case of success, or a negative * value corresponding to an AVERROR code in case of error */ -int avfilter_add_format(AVFilterFormats **avff, int fmt); +int avfilter_add_format(AVFilterFormats **avff, int64_t fmt); /** - * Return a list of all formats supported by Libav for the given media type. + * Return a list of all formats supported by FFmpeg for the given media type. */ AVFilterFormats *avfilter_all_formats(enum AVMediaType type); /** + * Return a list of all channel layouts supported by FFmpeg. + */ +AVFilterFormats *avfilter_all_channel_layouts(void); + +/** * Return 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. @@ -375,7 +382,7 @@ struct AVFilterPad { * Input audio pads only. */ AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int nb_samples, int64_t channel_layout, int planar); /** @@ -464,15 +471,17 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, /** default handler for get_audio_buffer() for audio inputs */ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int nb_samples, int64_t channel_layout, int planar); /** - * A helper for query_formats() which sets all links to the same list of - * formats. If there are no links hooked to this filter, the list of formats is - * freed. + * Helpers for query_formats() which set all links to the same list of + * formats/layouts. If there are no links hooked to this filter, the list + * of formats is freed. */ -void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_pixel_formats(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *formats); +void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats); /** Default handler for query_formats() */ int avfilter_default_query_formats(AVFilterContext *ctx); @@ -523,9 +532,9 @@ typedef struct AVFilter { void (*uninit)(AVFilterContext *ctx); /** - * Queries formats supported by the filter and its pads, and sets the - * in_formats for links connected to its output pads, and out_formats - * for links connected to its input pads. + * Queries formats/layouts supported by the filter and its pads, and sets + * the in_formats/in_chlayouts for links connected to its output pads, + * and out_formats/out_chlayouts for links connected to its input pads. * * @return zero on success, a negative value corresponding to an * AVERROR code otherwise @@ -595,13 +604,18 @@ struct AVFilterLink { int format; ///< agreed upon media format /** - * Lists of formats supported by the input and output filters respectively. - * These lists are used for negotiating the format to actually be used, - * which will be loaded into the format member, above, when chosen. + * Lists of formats and channel layouts supported by the input and output + * filters respectively. These lists are used for negotiating the format + * to actually be used, which will be loaded into the format and + * channel_layout members, above, when chosen. + * */ AVFilterFormats *in_formats; AVFilterFormats *out_formats; + AVFilterFormats *in_chlayouts; + AVFilterFormats *out_chlayouts; + /** * The buffer reference currently being sent across the link by the source * filter. This is used internally by the filter system to allow @@ -622,6 +636,8 @@ struct AVFilterLink { * input link is assumed to be an unchangeable property. */ AVRational time_base; + + struct AVFilterPool *pool; }; /** @@ -637,6 +653,11 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad); /** + * Free the link in *link, and set its pointer to NULL. + */ +void avfilter_link_free(AVFilterLink **link); + +/** * Negotiate the media format, dimensions, etc of all inputs to a filter. * * @param filter the filter to negotiate the properties for its inputs @@ -670,7 +691,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, * @param format the pixel format of the image specified by the data and linesize arrays */ AVFilterBufferRef * -avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms, +avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms, int w, int h, enum PixelFormat format); /** @@ -680,17 +701,34 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int * be requested * @param perms the required access permissions * @param sample_fmt the format of each sample in the buffer to allocate - * @param size the buffer size in bytes + * @param nb_samples the number of samples per channel * @param channel_layout the number and type of channels per sample in the buffer to allocate * @param planar audio data layout - planar or packed * @return A reference to the samples. This must be unreferenced with * avfilter_unref_buffer when you are finished with it. */ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, - enum AVSampleFormat sample_fmt, int size, + enum AVSampleFormat sample_fmt, int nb_samples, int64_t channel_layout, int planar); /** + * Create an audio buffer reference wrapped around an already + * allocated samples buffer. + * + * @param data pointers to the samples plane buffers + * @param linesize linesize for the samples plane buffers + * @param perms the required access permissions + * @param nb_samples number of samples per channel + * @param sample_fmt the format of each sample in the buffer to allocate + * @param channel_layout the channel layout of the buffer + * @param planar audio data layout - planar or packed + */ +AVFilterBufferRef * +avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8], int linesize[8], int perms, + int nb_samples, enum AVSampleFormat sample_fmt, + int64_t channel_layout, int planar); + +/** * Request an input frame from the filter at the other end of the link. * * @param link the input link |