yading@10: /* yading@10: * filter layer yading@10: * Copyright (c) 2007 Bobby Bingham yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVFILTER_AVFILTER_H yading@10: #define AVFILTER_AVFILTER_H yading@10: yading@10: /** yading@10: * @file yading@10: * @ingroup lavfi yading@10: * external API header yading@10: */ yading@10: yading@10: /** yading@10: * @defgroup lavfi Libavfilter yading@10: * @{ yading@10: */ yading@10: yading@10: #include yading@10: yading@10: #include "libavutil/avutil.h" yading@10: #include "libavutil/dict.h" yading@10: #include "libavutil/frame.h" yading@10: #include "libavutil/log.h" yading@10: #include "libavutil/samplefmt.h" yading@10: #include "libavutil/pixfmt.h" yading@10: #include "libavutil/rational.h" yading@10: yading@10: #include "libavfilter/version.h" yading@10: yading@10: /** yading@10: * Return the LIBAVFILTER_VERSION_INT constant. yading@10: */ yading@10: unsigned avfilter_version(void); yading@10: yading@10: /** yading@10: * Return the libavfilter build-time configuration. yading@10: */ yading@10: const char *avfilter_configuration(void); yading@10: yading@10: /** yading@10: * Return the libavfilter license. yading@10: */ yading@10: const char *avfilter_license(void); yading@10: yading@10: typedef struct AVFilterContext AVFilterContext; yading@10: typedef struct AVFilterLink AVFilterLink; yading@10: typedef struct AVFilterPad AVFilterPad; yading@10: typedef struct AVFilterFormats AVFilterFormats; yading@10: yading@10: #if FF_API_AVFILTERBUFFER yading@10: /** yading@10: * A reference-counted buffer data type used by the filter system. Filters yading@10: * should not store pointers to this structure directly, but instead use the yading@10: * AVFilterBufferRef structure below. yading@10: */ yading@10: typedef struct AVFilterBuffer { yading@10: uint8_t *data[8]; ///< buffer data for each plane/channel yading@10: yading@10: /** yading@10: * pointers to the data planes/channels. yading@10: * yading@10: * For video, this should simply point to data[]. yading@10: * yading@10: * For planar audio, each channel has a separate data pointer, and yading@10: * linesize[0] contains the size of each channel buffer. yading@10: * For packed audio, there is just one data pointer, and linesize[0] yading@10: * contains the total size of the buffer for all channels. yading@10: * yading@10: * Note: Both data and extended_data will always be set, but for planar yading@10: * audio with more channels that can fit in data, extended_data must be used yading@10: * in order to access all channels. yading@10: */ yading@10: uint8_t **extended_data; yading@10: int linesize[8]; ///< number of bytes per line yading@10: yading@10: /** private data to be used by a custom free function */ yading@10: void *priv; yading@10: /** yading@10: * A pointer to the function to deallocate this buffer if the default yading@10: * function is not sufficient. This could, for example, add the memory yading@10: * back into a memory pool to be reused later without the overhead of yading@10: * reallocating it from scratch. yading@10: */ yading@10: void (*free)(struct AVFilterBuffer *buf); yading@10: yading@10: int format; ///< media format yading@10: int w, h; ///< width and height of the allocated buffer yading@10: unsigned refcount; ///< number of references to this buffer yading@10: } AVFilterBuffer; yading@10: yading@10: #define AV_PERM_READ 0x01 ///< can read from the buffer yading@10: #define AV_PERM_WRITE 0x02 ///< can write to the buffer yading@10: #define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer yading@10: #define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time yading@10: #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time yading@10: #define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes yading@10: #define AV_PERM_ALIGN 0x40 ///< the buffer must be aligned yading@10: yading@10: #define AVFILTER_ALIGN 16 //not part of ABI yading@10: yading@10: /** yading@10: * Audio specific properties in a reference to an AVFilterBuffer. Since yading@10: * AVFilterBufferRef is common to different media formats, audio specific yading@10: * per reference properties must be separated out. yading@10: */ yading@10: typedef struct AVFilterBufferRefAudioProps { yading@10: uint64_t channel_layout; ///< channel layout of audio buffer yading@10: int nb_samples; ///< number of audio samples per channel yading@10: int sample_rate; ///< audio buffer sample rate yading@10: int channels; ///< number of channels (do not access directly) yading@10: } AVFilterBufferRefAudioProps; yading@10: yading@10: /** yading@10: * Video specific properties in a reference to an AVFilterBuffer. Since yading@10: * AVFilterBufferRef is common to different media formats, video specific yading@10: * per reference properties must be separated out. yading@10: */ yading@10: typedef struct AVFilterBufferRefVideoProps { yading@10: int w; ///< image width yading@10: int h; ///< image height yading@10: AVRational sample_aspect_ratio; ///< sample aspect ratio yading@10: int interlaced; ///< is frame interlaced yading@10: int top_field_first; ///< field order yading@10: enum AVPictureType pict_type; ///< picture type of the frame yading@10: int key_frame; ///< 1 -> keyframe, 0-> not yading@10: int qp_table_linesize; ///< qp_table stride yading@10: int qp_table_size; ///< qp_table size yading@10: int8_t *qp_table; ///< array of Quantization Parameters yading@10: } AVFilterBufferRefVideoProps; yading@10: yading@10: /** yading@10: * A reference to an AVFilterBuffer. Since filters can manipulate the origin of yading@10: * a buffer to, for example, crop image without any memcpy, the buffer origin yading@10: * and dimensions are per-reference properties. Linesize is also useful for yading@10: * image flipping, frame to field filters, etc, and so is also per-reference. yading@10: * yading@10: * TODO: add anything necessary for frame reordering yading@10: */ yading@10: typedef struct AVFilterBufferRef { yading@10: AVFilterBuffer *buf; ///< the buffer that this is a reference to yading@10: uint8_t *data[8]; ///< picture/audio data for each plane yading@10: /** yading@10: * pointers to the data planes/channels. yading@10: * yading@10: * For video, this should simply point to data[]. yading@10: * yading@10: * For planar audio, each channel has a separate data pointer, and yading@10: * linesize[0] contains the size of each channel buffer. yading@10: * For packed audio, there is just one data pointer, and linesize[0] yading@10: * contains the total size of the buffer for all channels. yading@10: * yading@10: * Note: Both data and extended_data will always be set, but for planar yading@10: * audio with more channels that can fit in data, extended_data must be used yading@10: * in order to access all channels. yading@10: */ yading@10: uint8_t **extended_data; yading@10: int linesize[8]; ///< number of bytes per line yading@10: yading@10: AVFilterBufferRefVideoProps *video; ///< video buffer specific properties yading@10: AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties yading@10: yading@10: /** yading@10: * presentation timestamp. The time unit may change during yading@10: * filtering, as it is specified in the link and the filter code yading@10: * may need to rescale the PTS accordingly. yading@10: */ yading@10: int64_t pts; yading@10: int64_t pos; ///< byte position in stream, -1 if unknown yading@10: yading@10: int format; ///< media format yading@10: yading@10: int perms; ///< permissions, see the AV_PERM_* flags yading@10: yading@10: enum AVMediaType type; ///< media type of buffer data yading@10: yading@10: AVDictionary *metadata; ///< dictionary containing metadata key=value tags yading@10: } AVFilterBufferRef; yading@10: yading@10: /** yading@10: * Copy properties of src to dst, without copying the actual data yading@10: */ yading@10: attribute_deprecated yading@10: void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src); yading@10: yading@10: /** yading@10: * Add a new reference to a buffer. yading@10: * yading@10: * @param ref an existing reference to the buffer yading@10: * @param pmask a bitmask containing the allowable permissions in the new yading@10: * reference yading@10: * @return a new reference to the buffer with the same properties as the yading@10: * old, excluding any permissions denied by pmask yading@10: */ yading@10: attribute_deprecated yading@10: AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask); yading@10: yading@10: /** yading@10: * Remove a reference to a buffer. If this is the last reference to the yading@10: * buffer, the buffer itself is also automatically freed. yading@10: * yading@10: * @param ref reference to the buffer, may be NULL yading@10: * yading@10: * @note it is recommended to use avfilter_unref_bufferp() instead of this yading@10: * function yading@10: */ yading@10: attribute_deprecated yading@10: void avfilter_unref_buffer(AVFilterBufferRef *ref); yading@10: yading@10: /** yading@10: * Remove a reference to a buffer and set the pointer to NULL. yading@10: * If this is the last reference to the buffer, the buffer itself yading@10: * is also automatically freed. yading@10: * yading@10: * @param ref pointer to the buffer reference yading@10: */ yading@10: attribute_deprecated yading@10: void avfilter_unref_bufferp(AVFilterBufferRef **ref); yading@10: #endif yading@10: yading@10: /** yading@10: * Get the number of channels of a buffer reference. yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_ref_get_channels(AVFilterBufferRef *ref); yading@10: yading@10: #if FF_API_AVFILTERPAD_PUBLIC yading@10: /** yading@10: * A filter pad used for either input or output. yading@10: * yading@10: * See doc/filter_design.txt for details on how to implement the methods. yading@10: * yading@10: * @warning this struct might be removed from public API. yading@10: * users should call avfilter_pad_get_name() and avfilter_pad_get_type() yading@10: * to access the name and type fields; there should be no need to access yading@10: * any other fields from outside of libavfilter. yading@10: */ yading@10: struct AVFilterPad { yading@10: /** yading@10: * Pad name. The name is unique among inputs and among outputs, but an yading@10: * input may have the same name as an output. This may be NULL if this yading@10: * pad has no need to ever be referenced by name. yading@10: */ yading@10: const char *name; yading@10: yading@10: /** yading@10: * AVFilterPad type. yading@10: */ yading@10: enum AVMediaType type; yading@10: yading@10: /** yading@10: * Input pads: yading@10: * Minimum required permissions on incoming buffers. Any buffer with yading@10: * insufficient permissions will be automatically copied by the filter yading@10: * system to a new buffer which provides the needed access permissions. yading@10: * yading@10: * Output pads: yading@10: * Guaranteed permissions on outgoing buffers. Any buffer pushed on the yading@10: * link must have at least these permissions; this fact is checked by yading@10: * asserts. It can be used to optimize buffer allocation. yading@10: */ yading@10: attribute_deprecated int min_perms; yading@10: yading@10: /** yading@10: * Input pads: yading@10: * Permissions which are not accepted on incoming buffers. Any buffer yading@10: * which has any of these permissions set will be automatically copied yading@10: * by the filter system to a new buffer which does not have those yading@10: * permissions. This can be used to easily disallow buffers with yading@10: * AV_PERM_REUSE. yading@10: * yading@10: * Output pads: yading@10: * Permissions which are automatically removed on outgoing buffers. It yading@10: * can be used to optimize buffer allocation. yading@10: */ yading@10: attribute_deprecated int rej_perms; yading@10: yading@10: /** yading@10: * @deprecated unused yading@10: */ yading@10: int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref); yading@10: yading@10: /** yading@10: * Callback function to get a video buffer. If NULL, the filter system will yading@10: * use ff_default_get_video_buffer(). yading@10: * yading@10: * Input video pads only. yading@10: */ yading@10: AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h); yading@10: yading@10: /** yading@10: * Callback function to get an audio buffer. If NULL, the filter system will yading@10: * use ff_default_get_audio_buffer(). yading@10: * yading@10: * Input audio pads only. yading@10: */ yading@10: AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples); yading@10: yading@10: /** yading@10: * @deprecated unused yading@10: */ yading@10: int (*end_frame)(AVFilterLink *link); yading@10: yading@10: /** yading@10: * @deprecated unused yading@10: */ yading@10: int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir); yading@10: yading@10: /** yading@10: * Filtering callback. This is where a filter receives a frame with yading@10: * audio/video data and should do its processing. yading@10: * yading@10: * Input pads only. yading@10: * yading@10: * @return >= 0 on success, a negative AVERROR on error. This function yading@10: * must ensure that frame is properly unreferenced on error if it yading@10: * hasn't been passed on to another filter. yading@10: */ yading@10: int (*filter_frame)(AVFilterLink *link, AVFrame *frame); yading@10: yading@10: /** yading@10: * Frame poll callback. This returns the number of immediately available yading@10: * samples. It should return a positive value if the next request_frame() yading@10: * is guaranteed to return one frame (with no delay). yading@10: * yading@10: * Defaults to just calling the source poll_frame() method. yading@10: * yading@10: * Output pads only. yading@10: */ yading@10: int (*poll_frame)(AVFilterLink *link); yading@10: yading@10: /** yading@10: * Frame request callback. A call to this should result in at least one yading@10: * frame being output over the given link. This should return zero on yading@10: * success, and another value on error. yading@10: * See ff_request_frame() for the error codes with a specific yading@10: * meaning. yading@10: * yading@10: * Output pads only. yading@10: */ yading@10: int (*request_frame)(AVFilterLink *link); yading@10: yading@10: /** yading@10: * Link configuration callback. yading@10: * yading@10: * For output pads, this should set the following link properties: yading@10: * video: width, height, sample_aspect_ratio, time_base yading@10: * audio: sample_rate. yading@10: * yading@10: * This should NOT set properties such as format, channel_layout, etc which yading@10: * are negotiated between filters by the filter system using the yading@10: * query_formats() callback before this function is called. yading@10: * yading@10: * For input pads, this should check the properties of the link, and update yading@10: * the filter's internal state as necessary. yading@10: * yading@10: * For both input and output pads, this should return zero on success, yading@10: * and another value on error. yading@10: */ yading@10: int (*config_props)(AVFilterLink *link); yading@10: yading@10: /** yading@10: * The filter expects a fifo to be inserted on its input link, yading@10: * typically because it has a delay. yading@10: * yading@10: * input pads only. yading@10: */ yading@10: int needs_fifo; yading@10: yading@10: int needs_writable; yading@10: }; yading@10: #endif yading@10: yading@10: /** yading@10: * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. yading@10: * AVFilter.inputs/outputs). yading@10: */ yading@10: int avfilter_pad_count(const AVFilterPad *pads); yading@10: yading@10: /** yading@10: * Get the name of an AVFilterPad. yading@10: * yading@10: * @param pads an array of AVFilterPads yading@10: * @param pad_idx index of the pad in the array it; is the caller's yading@10: * responsibility to ensure the index is valid yading@10: * yading@10: * @return name of the pad_idx'th pad in pads yading@10: */ yading@10: const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx); yading@10: yading@10: /** yading@10: * Get the type of an AVFilterPad. yading@10: * yading@10: * @param pads an array of AVFilterPads yading@10: * @param pad_idx index of the pad in the array; it is the caller's yading@10: * responsibility to ensure the index is valid yading@10: * yading@10: * @return type of the pad_idx'th pad in pads yading@10: */ yading@10: enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); yading@10: yading@10: /** yading@10: * The number of the filter inputs is not determined just by AVFilter.inputs. yading@10: * The filter might add additional inputs during initialization depending on the yading@10: * options supplied to it. yading@10: */ yading@10: #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0) yading@10: /** yading@10: * The number of the filter outputs is not determined just by AVFilter.outputs. yading@10: * The filter might add additional outputs during initialization depending on yading@10: * the options supplied to it. yading@10: */ yading@10: #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) yading@10: yading@10: /** yading@10: * Filter definition. This defines the pads a filter contains, and all the yading@10: * callback functions used to interact with the filter. yading@10: */ yading@10: typedef struct AVFilter { yading@10: const char *name; ///< filter name yading@10: yading@10: /** yading@10: * A description for the filter. You should use the yading@10: * NULL_IF_CONFIG_SMALL() macro to define it. yading@10: */ yading@10: const char *description; yading@10: yading@10: const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none yading@10: const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none yading@10: yading@10: /** yading@10: * A class for the private data, used to access filter private yading@10: * AVOptions. yading@10: */ yading@10: const AVClass *priv_class; yading@10: yading@10: /** yading@10: * A combination of AVFILTER_FLAG_* yading@10: */ yading@10: int flags; yading@10: yading@10: /***************************************************************** yading@10: * All fields below this line are not part of the public API. They yading@10: * may not be used outside of libavfilter and can be changed and yading@10: * removed at will. yading@10: * New public fields should be added right above. yading@10: ***************************************************************** yading@10: */ yading@10: yading@10: /** yading@10: * Filter initialization function. Called when all the options have been yading@10: * set. yading@10: */ yading@10: int (*init)(AVFilterContext *ctx); yading@10: yading@10: /** yading@10: * Should be set instead of init by the filters that want to pass a yading@10: * dictionary of AVOptions to nested contexts that are allocated in yading@10: * init. yading@10: */ yading@10: int (*init_dict)(AVFilterContext *ctx, AVDictionary **options); yading@10: yading@10: /** yading@10: * Filter uninitialization function. Should deallocate any memory held yading@10: * by the filter, release any buffer references, etc. This does not need yading@10: * to deallocate the AVFilterContext->priv memory itself. yading@10: */ yading@10: void (*uninit)(AVFilterContext *ctx); yading@10: yading@10: /** yading@10: * Queries formats/layouts supported by the filter and its pads, and sets yading@10: * the in_formats/in_chlayouts for links connected to its output pads, yading@10: * and out_formats/out_chlayouts for links connected to its input pads. yading@10: * yading@10: * @return zero on success, a negative value corresponding to an yading@10: * AVERROR code otherwise yading@10: */ yading@10: int (*query_formats)(AVFilterContext *); yading@10: yading@10: int priv_size; ///< size of private data to allocate for the filter yading@10: yading@10: struct AVFilter *next; yading@10: yading@10: /** yading@10: * Make the filter instance process a command. yading@10: * yading@10: * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only yading@10: * @param arg the argument for the command yading@10: * @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported. yading@10: * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be yading@10: * time consuming then a filter should treat it like an unsupported command yading@10: * yading@10: * @returns >=0 on success otherwise an error code. yading@10: * AVERROR(ENOSYS) on unsupported commands yading@10: */ yading@10: int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags); yading@10: yading@10: /** yading@10: * Filter initialization function, alternative to the init() yading@10: * callback. Args contains the user-supplied parameters, opaque is yading@10: * used for providing binary data. yading@10: */ yading@10: int (*init_opaque)(AVFilterContext *ctx, void *opaque); yading@10: } AVFilter; yading@10: yading@10: /** An instance of a filter */ yading@10: struct AVFilterContext { yading@10: const AVClass *av_class; ///< needed for av_log() yading@10: yading@10: const AVFilter *filter; ///< the AVFilter of which this is an instance yading@10: yading@10: char *name; ///< name of this filter instance yading@10: yading@10: AVFilterPad *input_pads; ///< array of input pads yading@10: AVFilterLink **inputs; ///< array of pointers to input links yading@10: #if FF_API_FOO_COUNT yading@10: unsigned input_count; ///< @deprecated use nb_inputs yading@10: #endif yading@10: unsigned nb_inputs; ///< number of input pads yading@10: yading@10: AVFilterPad *output_pads; ///< array of output pads yading@10: AVFilterLink **outputs; ///< array of pointers to output links yading@10: #if FF_API_FOO_COUNT yading@10: unsigned output_count; ///< @deprecated use nb_outputs yading@10: #endif yading@10: unsigned nb_outputs; ///< number of output pads yading@10: yading@10: void *priv; ///< private data for use by the filter yading@10: yading@10: struct AVFilterGraph *graph; ///< filtergraph this filter belongs to yading@10: yading@10: struct AVFilterCommand *command_queue; yading@10: }; yading@10: yading@10: /** yading@10: * A link between two filters. This contains pointers to the source and yading@10: * destination filters between which this link exists, and the indexes of yading@10: * the pads involved. In addition, this link also contains the parameters yading@10: * which have been negotiated and agreed upon between the filter, such as yading@10: * image dimensions, format, etc. yading@10: */ yading@10: struct AVFilterLink { yading@10: AVFilterContext *src; ///< source filter yading@10: AVFilterPad *srcpad; ///< output pad on the source filter yading@10: yading@10: AVFilterContext *dst; ///< dest filter yading@10: AVFilterPad *dstpad; ///< input pad on the dest filter yading@10: yading@10: enum AVMediaType type; ///< filter media type yading@10: yading@10: /* These parameters apply only to video */ yading@10: int w; ///< agreed upon image width yading@10: int h; ///< agreed upon image height yading@10: AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio yading@10: /* These parameters apply only to audio */ yading@10: uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h) yading@10: int sample_rate; ///< samples per second yading@10: yading@10: int format; ///< agreed upon media format yading@10: yading@10: /** yading@10: * Define the time base used by the PTS of the frames/samples yading@10: * which will pass through this link. yading@10: * During the configuration stage, each filter is supposed to yading@10: * change only the output timebase, while the timebase of the yading@10: * input link is assumed to be an unchangeable property. yading@10: */ yading@10: AVRational time_base; yading@10: yading@10: /***************************************************************** yading@10: * All fields below this line are not part of the public API. They yading@10: * may not be used outside of libavfilter and can be changed and yading@10: * removed at will. yading@10: * New public fields should be added right above. yading@10: ***************************************************************** yading@10: */ yading@10: /** yading@10: * Lists of formats and channel layouts supported by the input and output yading@10: * filters respectively. These lists are used for negotiating the format yading@10: * to actually be used, which will be loaded into the format and yading@10: * channel_layout members, above, when chosen. yading@10: * yading@10: */ yading@10: AVFilterFormats *in_formats; yading@10: AVFilterFormats *out_formats; yading@10: yading@10: /** yading@10: * Lists of channel layouts and sample rates used for automatic yading@10: * negotiation. yading@10: */ yading@10: AVFilterFormats *in_samplerates; yading@10: AVFilterFormats *out_samplerates; yading@10: struct AVFilterChannelLayouts *in_channel_layouts; yading@10: struct AVFilterChannelLayouts *out_channel_layouts; yading@10: yading@10: /** yading@10: * Audio only, the destination filter sets this to a non-zero value to yading@10: * request that buffers with the given number of samples should be sent to yading@10: * it. AVFilterPad.needs_fifo must also be set on the corresponding input yading@10: * pad. yading@10: * Last buffer before EOF will be padded with silence. yading@10: */ yading@10: int request_samples; yading@10: yading@10: /** stage of the initialization of the link properties (dimensions, etc) */ yading@10: enum { yading@10: AVLINK_UNINIT = 0, ///< not started yading@10: AVLINK_STARTINIT, ///< started, but incomplete yading@10: AVLINK_INIT ///< complete yading@10: } init_state; yading@10: yading@10: struct AVFilterPool *pool; yading@10: yading@10: /** yading@10: * Graph the filter belongs to. yading@10: */ yading@10: struct AVFilterGraph *graph; yading@10: yading@10: /** yading@10: * Current timestamp of the link, as defined by the most recent yading@10: * frame(s), in AV_TIME_BASE units. yading@10: */ yading@10: int64_t current_pts; yading@10: yading@10: /** yading@10: * Index in the age array. yading@10: */ yading@10: int age_index; yading@10: yading@10: /** yading@10: * Frame rate of the stream on the link, or 1/0 if unknown; yading@10: * if left to 0/0, will be automatically be copied from the first input yading@10: * of the source filter if it exists. yading@10: * yading@10: * Sources should set it to the best estimation of the real frame rate. yading@10: * Filters should update it if necessary depending on their function. yading@10: * Sinks can use it to set a default output frame rate. yading@10: * It is similar to the r_frame_rate field in AVStream. yading@10: */ yading@10: AVRational frame_rate; yading@10: yading@10: /** yading@10: * Buffer partially filled with samples to achieve a fixed/minimum size. yading@10: */ yading@10: AVFrame *partial_buf; yading@10: yading@10: /** yading@10: * Size of the partial buffer to allocate. yading@10: * Must be between min_samples and max_samples. yading@10: */ yading@10: int partial_buf_size; yading@10: yading@10: /** yading@10: * Minimum number of samples to filter at once. If filter_frame() is yading@10: * called with fewer samples, it will accumulate them in partial_buf. yading@10: * This field and the related ones must not be changed after filtering yading@10: * has started. yading@10: * If 0, all related fields are ignored. yading@10: */ yading@10: int min_samples; yading@10: yading@10: /** yading@10: * Maximum number of samples to filter at once. If filter_frame() is yading@10: * called with more samples, it will split them. yading@10: */ yading@10: int max_samples; yading@10: yading@10: /** yading@10: * The buffer reference currently being received across the link by the yading@10: * destination filter. This is used internally by the filter system to yading@10: * allow automatic copying of buffers which do not have sufficient yading@10: * permissions for the destination. This should not be accessed directly yading@10: * by the filters. yading@10: */ yading@10: AVFilterBufferRef *cur_buf_copy; yading@10: yading@10: /** yading@10: * True if the link is closed. yading@10: * If set, all attemps of start_frame, filter_frame or request_frame yading@10: * will fail with AVERROR_EOF, and if necessary the reference will be yading@10: * destroyed. yading@10: * If request_frame returns AVERROR_EOF, this flag is set on the yading@10: * corresponding link. yading@10: * It can be set also be set by either the source or the destination yading@10: * filter. yading@10: */ yading@10: int closed; yading@10: yading@10: /** yading@10: * Number of channels. yading@10: */ yading@10: int channels; yading@10: yading@10: /** yading@10: * True if a frame is being requested on the link. yading@10: * Used internally by the framework. yading@10: */ yading@10: unsigned frame_requested; yading@10: yading@10: /** yading@10: * Link processing flags. yading@10: */ yading@10: unsigned flags; yading@10: }; yading@10: yading@10: /** yading@10: * Link two filters together. yading@10: * yading@10: * @param src the source filter yading@10: * @param srcpad index of the output pad on the source filter yading@10: * @param dst the destination filter yading@10: * @param dstpad index of the input pad on the destination filter yading@10: * @return zero on success yading@10: */ yading@10: int avfilter_link(AVFilterContext *src, unsigned srcpad, yading@10: AVFilterContext *dst, unsigned dstpad); yading@10: yading@10: /** yading@10: * Free the link in *link, and set its pointer to NULL. yading@10: */ yading@10: void avfilter_link_free(AVFilterLink **link); yading@10: yading@10: /** yading@10: * Get the number of channels of a link. yading@10: */ yading@10: int avfilter_link_get_channels(AVFilterLink *link); yading@10: yading@10: /** yading@10: * Set the closed field of a link. yading@10: */ yading@10: void avfilter_link_set_closed(AVFilterLink *link, int closed); yading@10: yading@10: /** yading@10: * Negotiate the media format, dimensions, etc of all inputs to a filter. yading@10: * yading@10: * @param filter the filter to negotiate the properties for its inputs yading@10: * @return zero on successful negotiation yading@10: */ yading@10: int avfilter_config_links(AVFilterContext *filter); yading@10: yading@10: #if FF_API_AVFILTERBUFFER yading@10: /** yading@10: * Create a buffer reference wrapped around an already allocated image yading@10: * buffer. yading@10: * yading@10: * @param data pointers to the planes of the image to reference yading@10: * @param linesize linesizes for the planes of the image to reference yading@10: * @param perms the required access permissions yading@10: * @param w the width of the image specified by the data and linesize arrays yading@10: * @param h the height of the image specified by the data and linesize arrays yading@10: * @param format the pixel format of the image specified by the data and linesize arrays yading@10: */ yading@10: attribute_deprecated yading@10: AVFilterBufferRef * yading@10: avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms, yading@10: int w, int h, enum AVPixelFormat format); yading@10: yading@10: /** yading@10: * Create an audio buffer reference wrapped around an already yading@10: * allocated samples buffer. yading@10: * yading@10: * See avfilter_get_audio_buffer_ref_from_arrays_channels() for a version yading@10: * that can handle unknown channel layouts. yading@10: * yading@10: * @param data pointers to the samples plane buffers yading@10: * @param linesize linesize for the samples plane buffers yading@10: * @param perms the required access permissions yading@10: * @param nb_samples number of samples per channel yading@10: * @param sample_fmt the format of each sample in the buffer to allocate yading@10: * @param channel_layout the channel layout of the buffer yading@10: */ yading@10: attribute_deprecated yading@10: AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data, yading@10: int linesize, yading@10: int perms, yading@10: int nb_samples, yading@10: enum AVSampleFormat sample_fmt, yading@10: uint64_t channel_layout); yading@10: /** yading@10: * Create an audio buffer reference wrapped around an already yading@10: * allocated samples buffer. yading@10: * yading@10: * @param data pointers to the samples plane buffers yading@10: * @param linesize linesize for the samples plane buffers yading@10: * @param perms the required access permissions yading@10: * @param nb_samples number of samples per channel yading@10: * @param sample_fmt the format of each sample in the buffer to allocate yading@10: * @param channels the number of channels of the buffer yading@10: * @param channel_layout the channel layout of the buffer, yading@10: * must be either 0 or consistent with channels yading@10: */ yading@10: attribute_deprecated yading@10: AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data, yading@10: int linesize, yading@10: int perms, yading@10: int nb_samples, yading@10: enum AVSampleFormat sample_fmt, yading@10: int channels, yading@10: uint64_t channel_layout); yading@10: yading@10: #endif yading@10: yading@10: yading@10: #define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically yading@10: #define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw) yading@10: yading@10: /** yading@10: * Make the filter instance process a command. yading@10: * It is recommended to use avfilter_graph_send_command(). yading@10: */ yading@10: int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags); yading@10: yading@10: /** Initialize the filter system. Register all builtin filters. */ yading@10: void avfilter_register_all(void); yading@10: yading@10: #if FF_API_OLD_FILTER_REGISTER yading@10: /** Uninitialize the filter system. Unregister all filters. */ yading@10: attribute_deprecated yading@10: void avfilter_uninit(void); yading@10: #endif yading@10: yading@10: /** yading@10: * Register a filter. This is only needed if you plan to use yading@10: * avfilter_get_by_name later to lookup the AVFilter structure by name. A yading@10: * filter can still by instantiated with avfilter_graph_alloc_filter even if it yading@10: * is not registered. yading@10: * yading@10: * @param filter the filter to register yading@10: * @return 0 if the registration was successful, a negative value yading@10: * otherwise yading@10: */ yading@10: int avfilter_register(AVFilter *filter); yading@10: yading@10: /** yading@10: * Get a filter definition matching the given name. yading@10: * yading@10: * @param name the filter name to find yading@10: * @return the filter definition, if any matching one is registered. yading@10: * NULL if none found. yading@10: */ yading@10: AVFilter *avfilter_get_by_name(const char *name); yading@10: yading@10: /** yading@10: * Iterate over all registered filters. yading@10: * @return If prev is non-NULL, next registered filter after prev or NULL if yading@10: * prev is the last filter. If prev is NULL, return the first registered filter. yading@10: */ yading@10: const AVFilter *avfilter_next(const AVFilter *prev); yading@10: yading@10: #if FF_API_OLD_FILTER_REGISTER yading@10: /** yading@10: * If filter is NULL, returns a pointer to the first registered filter pointer, yading@10: * if filter is non-NULL, returns the next pointer after filter. yading@10: * If the returned pointer points to NULL, the last registered filter yading@10: * was already reached. yading@10: * @deprecated use avfilter_next() yading@10: */ yading@10: attribute_deprecated yading@10: AVFilter **av_filter_next(AVFilter **filter); yading@10: #endif yading@10: yading@10: #if FF_API_AVFILTER_OPEN yading@10: /** yading@10: * Create a filter instance. yading@10: * yading@10: * @param filter_ctx put here a pointer to the created filter context yading@10: * on success, NULL on failure yading@10: * @param filter the filter to create an instance of yading@10: * @param inst_name Name to give to the new instance. Can be NULL for none. yading@10: * @return >= 0 in case of success, a negative error code otherwise yading@10: * @deprecated use avfilter_graph_alloc_filter() instead yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); yading@10: #endif yading@10: yading@10: yading@10: #if FF_API_AVFILTER_INIT_FILTER yading@10: /** yading@10: * Initialize a filter. yading@10: * yading@10: * @param filter the filter to initialize yading@10: * @param args A string of parameters to use when initializing the filter. yading@10: * The format and meaning of this string varies by filter. yading@10: * @param opaque Any extra non-string data needed by the filter. The meaning yading@10: * of this parameter varies by filter. yading@10: * @return zero on success yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque); yading@10: #endif yading@10: yading@10: /** yading@10: * Initialize a filter with the supplied parameters. yading@10: * yading@10: * @param ctx uninitialized filter context to initialize yading@10: * @param args Options to initialize the filter with. This must be a yading@10: * ':'-separated list of options in the 'key=value' form. yading@10: * May be NULL if the options have been set directly using the yading@10: * AVOptions API or there are no options that need to be set. yading@10: * @return 0 on success, a negative AVERROR on failure yading@10: */ yading@10: int avfilter_init_str(AVFilterContext *ctx, const char *args); yading@10: yading@10: /** yading@10: * Initialize a filter with the supplied dictionary of options. yading@10: * yading@10: * @param ctx uninitialized filter context to initialize yading@10: * @param options An AVDictionary filled with options for this filter. On yading@10: * return this parameter will be destroyed and replaced with yading@10: * a dict containing options that were not found. This dictionary yading@10: * must be freed by the caller. yading@10: * May be NULL, then this function is equivalent to yading@10: * avfilter_init_str() with the second parameter set to NULL. yading@10: * @return 0 on success, a negative AVERROR on failure yading@10: * yading@10: * @note This function and avfilter_init_str() do essentially the same thing, yading@10: * the difference is in manner in which the options are passed. It is up to the yading@10: * calling code to choose whichever is more preferable. The two functions also yading@10: * behave differently when some of the provided options are not declared as yading@10: * supported by the filter. In such a case, avfilter_init_str() will fail, but yading@10: * this function will leave those extra options in the options AVDictionary and yading@10: * continue as usual. yading@10: */ yading@10: int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options); yading@10: yading@10: /** yading@10: * Free a filter context. This will also remove the filter from its yading@10: * filtergraph's list of filters. yading@10: * yading@10: * @param filter the filter to free yading@10: */ yading@10: void avfilter_free(AVFilterContext *filter); yading@10: yading@10: /** yading@10: * Insert a filter in the middle of an existing link. yading@10: * yading@10: * @param link the link into which the filter should be inserted yading@10: * @param filt the filter to be inserted yading@10: * @param filt_srcpad_idx the input pad on the filter to connect yading@10: * @param filt_dstpad_idx the output pad on the filter to connect yading@10: * @return zero on success yading@10: */ yading@10: int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, yading@10: unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); yading@10: yading@10: #if FF_API_AVFILTERBUFFER yading@10: /** yading@10: * Copy the frame properties of src to dst, without copying the actual yading@10: * image data. yading@10: * yading@10: * @return 0 on success, a negative number on error. yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); yading@10: yading@10: /** yading@10: * Copy the frame properties and data pointers of src to dst, without copying yading@10: * the actual data. yading@10: * yading@10: * @return 0 on success, a negative number on error. yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); yading@10: #endif yading@10: yading@10: /** yading@10: * @return AVClass for AVFilterContext. yading@10: * yading@10: * @see av_opt_find(). yading@10: */ yading@10: const AVClass *avfilter_get_class(void); yading@10: yading@10: typedef struct AVFilterGraph { yading@10: const AVClass *av_class; yading@10: #if FF_API_FOO_COUNT yading@10: attribute_deprecated yading@10: unsigned filter_count_unused; yading@10: #endif yading@10: AVFilterContext **filters; yading@10: #if !FF_API_FOO_COUNT yading@10: unsigned nb_filters; yading@10: #endif yading@10: yading@10: char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters yading@10: char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters yading@10: #if FF_API_FOO_COUNT yading@10: unsigned nb_filters; yading@10: #endif yading@10: char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions yading@10: yading@10: /** yading@10: * Private fields yading@10: * yading@10: * The following fields are for internal use only. yading@10: * Their type, offset, number and semantic can change without notice. yading@10: */ yading@10: yading@10: AVFilterLink **sink_links; yading@10: int sink_links_count; yading@10: yading@10: unsigned disable_auto_convert; yading@10: } AVFilterGraph; yading@10: yading@10: /** yading@10: * Allocate a filter graph. yading@10: */ yading@10: AVFilterGraph *avfilter_graph_alloc(void); yading@10: yading@10: /** yading@10: * Create a new filter instance in a filter graph. yading@10: * yading@10: * @param graph graph in which the new filter will be used yading@10: * @param filter the filter to create an instance of yading@10: * @param name Name to give to the new instance (will be copied to yading@10: * AVFilterContext.name). This may be used by the caller to identify yading@10: * different filters, libavfilter itself assigns no semantics to yading@10: * this parameter. May be NULL. yading@10: * yading@10: * @return the context of the newly created filter instance (note that it is yading@10: * also retrievable directly through AVFilterGraph.filters or with yading@10: * avfilter_graph_get_filter()) on success or NULL or failure. yading@10: */ yading@10: AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, yading@10: const AVFilter *filter, yading@10: const char *name); yading@10: yading@10: /** yading@10: * Get a filter instance with name name from graph. yading@10: * yading@10: * @return the pointer to the found filter instance or NULL if it yading@10: * cannot be found. yading@10: */ yading@10: AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name); yading@10: yading@10: #if FF_API_AVFILTER_OPEN yading@10: /** yading@10: * Add an existing filter instance to a filter graph. yading@10: * yading@10: * @param graphctx the filter graph yading@10: * @param filter the filter to be added yading@10: * yading@10: * @deprecated use avfilter_graph_alloc_filter() to allocate a filter in a yading@10: * filter graph yading@10: */ yading@10: attribute_deprecated yading@10: int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter); yading@10: #endif yading@10: yading@10: /** yading@10: * Create and add a filter instance into an existing graph. yading@10: * The filter instance is created from the filter filt and inited yading@10: * with the parameters args and opaque. yading@10: * yading@10: * In case of success put in *filt_ctx the pointer to the created yading@10: * filter instance, otherwise set *filt_ctx to NULL. yading@10: * yading@10: * @param name the instance name to give to the created filter instance yading@10: * @param graph_ctx the filter graph yading@10: * @return a negative AVERROR error code in case of failure, a non yading@10: * negative value otherwise yading@10: */ yading@10: int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, yading@10: const char *name, const char *args, void *opaque, yading@10: AVFilterGraph *graph_ctx); yading@10: yading@10: /** yading@10: * Enable or disable automatic format conversion inside the graph. yading@10: * yading@10: * Note that format conversion can still happen inside explicitly inserted yading@10: * scale and aresample filters. yading@10: * yading@10: * @param flags any of the AVFILTER_AUTO_CONVERT_* constants yading@10: */ yading@10: void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags); yading@10: yading@10: enum { yading@10: AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */ yading@10: AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */ yading@10: }; yading@10: yading@10: /** yading@10: * Check validity and configure all the links and formats in the graph. yading@10: * yading@10: * @param graphctx the filter graph yading@10: * @param log_ctx context used for logging yading@10: * @return 0 in case of success, a negative AVERROR code otherwise yading@10: */ yading@10: int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); yading@10: yading@10: /** yading@10: * Free a graph, destroy its links, and set *graph to NULL. yading@10: * If *graph is NULL, do nothing. yading@10: */ yading@10: void avfilter_graph_free(AVFilterGraph **graph); yading@10: yading@10: /** yading@10: * A linked-list of the inputs/outputs of the filter chain. yading@10: * yading@10: * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(), yading@10: * where it is used to communicate open (unlinked) inputs and outputs from and yading@10: * to the caller. yading@10: * This struct specifies, per each not connected pad contained in the graph, the yading@10: * filter context and the pad index required for establishing a link. yading@10: */ yading@10: typedef struct AVFilterInOut { yading@10: /** unique name for this input/output in the list */ yading@10: char *name; yading@10: yading@10: /** filter context associated to this input/output */ yading@10: AVFilterContext *filter_ctx; yading@10: yading@10: /** index of the filt_ctx pad to use for linking */ yading@10: int pad_idx; yading@10: yading@10: /** next input/input in the list, NULL if this is the last */ yading@10: struct AVFilterInOut *next; yading@10: } AVFilterInOut; yading@10: yading@10: /** yading@10: * Allocate a single AVFilterInOut entry. yading@10: * Must be freed with avfilter_inout_free(). yading@10: * @return allocated AVFilterInOut on success, NULL on failure. yading@10: */ yading@10: AVFilterInOut *avfilter_inout_alloc(void); yading@10: yading@10: /** yading@10: * Free the supplied list of AVFilterInOut and set *inout to NULL. yading@10: * If *inout is NULL, do nothing. yading@10: */ yading@10: void avfilter_inout_free(AVFilterInOut **inout); yading@10: yading@10: /** yading@10: * Add a graph described by a string to a graph. yading@10: * yading@10: * @param graph the filter graph where to link the parsed graph context yading@10: * @param filters string to be parsed yading@10: * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. yading@10: * If non-NULL, *inputs is updated to contain the list of open inputs yading@10: * after the parsing, should be freed with avfilter_inout_free(). yading@10: * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. yading@10: * If non-NULL, *outputs is updated to contain the list of open outputs yading@10: * after the parsing, should be freed with avfilter_inout_free(). yading@10: * @return non negative on success, a negative AVERROR code on error yading@10: */ yading@10: int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, yading@10: AVFilterInOut **inputs, AVFilterInOut **outputs, yading@10: void *log_ctx); yading@10: yading@10: /** yading@10: * Add a graph described by a string to a graph. yading@10: * yading@10: * @param[in] graph the filter graph where to link the parsed graph context yading@10: * @param[in] filters string to be parsed yading@10: * @param[out] inputs a linked list of all free (unlinked) inputs of the yading@10: * parsed graph will be returned here. It is to be freed yading@10: * by the caller using avfilter_inout_free(). yading@10: * @param[out] outputs a linked list of all free (unlinked) outputs of the yading@10: * parsed graph will be returned here. It is to be freed by the yading@10: * caller using avfilter_inout_free(). yading@10: * @return zero on success, a negative AVERROR code on error yading@10: * yading@10: * @note the difference between avfilter_graph_parse2() and yading@10: * avfilter_graph_parse() is that in avfilter_graph_parse(), the caller provides yading@10: * the lists of inputs and outputs, which therefore must be known before calling yading@10: * the function. On the other hand, avfilter_graph_parse2() \em returns the yading@10: * inputs and outputs that are left unlinked after parsing the graph and the yading@10: * caller then deals with them. Another difference is that in yading@10: * avfilter_graph_parse(), the inputs parameter describes inputs of the yading@10: * already existing part of the graph; i.e. from the point of view of yading@10: * the newly created part, they are outputs. Similarly the outputs parameter yading@10: * describes outputs of the already existing filters, which are provided as yading@10: * inputs to the parsed filters. yading@10: * avfilter_graph_parse2() takes the opposite approach -- it makes no reference yading@10: * whatsoever to already existing parts of the graph and the inputs parameter yading@10: * will on return contain inputs of the newly parsed part of the graph. yading@10: * Analogously the outputs parameter will contain outputs of the newly created yading@10: * filters. yading@10: */ yading@10: int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, yading@10: AVFilterInOut **inputs, yading@10: AVFilterInOut **outputs); yading@10: yading@10: /** yading@10: * Send a command to one or more filter instances. yading@10: * yading@10: * @param graph the filter graph yading@10: * @param target the filter(s) to which the command should be sent yading@10: * "all" sends to all filters yading@10: * otherwise it can be a filter or filter instance name yading@10: * which will send the command to all matching filters. yading@10: * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only yading@10: * @param arg the argument for the command yading@10: * @param res a buffer with size res_size where the filter(s) can return a response. yading@10: * yading@10: * @returns >=0 on success otherwise an error code. yading@10: * AVERROR(ENOSYS) on unsupported commands yading@10: */ yading@10: int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags); yading@10: yading@10: /** yading@10: * Queue a command for one or more filter instances. yading@10: * yading@10: * @param graph the filter graph yading@10: * @param target the filter(s) to which the command should be sent yading@10: * "all" sends to all filters yading@10: * otherwise it can be a filter or filter instance name yading@10: * which will send the command to all matching filters. yading@10: * @param cmd the command to sent, for handling simplicity all commands must be alphanummeric only yading@10: * @param arg the argument for the command yading@10: * @param ts time at which the command should be sent to the filter yading@10: * yading@10: * @note As this executes commands after this function returns, no return code yading@10: * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported. yading@10: */ yading@10: int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts); yading@10: yading@10: yading@10: /** yading@10: * Dump a graph into a human-readable string representation. yading@10: * yading@10: * @param graph the graph to dump yading@10: * @param options formatting options; currently ignored yading@10: * @return a string, or NULL in case of memory allocation failure; yading@10: * the string must be freed using av_free yading@10: */ yading@10: char *avfilter_graph_dump(AVFilterGraph *graph, const char *options); yading@10: yading@10: /** yading@10: * Request a frame on the oldest sink link. yading@10: * yading@10: * If the request returns AVERROR_EOF, try the next. yading@10: * yading@10: * Note that this function is not meant to be the sole scheduling mechanism yading@10: * of a filtergraph, only a convenience function to help drain a filtergraph yading@10: * in a balanced way under normal circumstances. yading@10: * yading@10: * Also note that AVERROR_EOF does not mean that frames did not arrive on yading@10: * some of the sinks during the process. yading@10: * When there are multiple sink links, in case the requested link yading@10: * returns an EOF, this may cause a filter to flush pending frames yading@10: * which are sent to another sink link, although unrequested. yading@10: * yading@10: * @return the return value of ff_request_frame(), yading@10: * or AVERROR_EOF if all links returned AVERROR_EOF yading@10: */ yading@10: int avfilter_graph_request_oldest(AVFilterGraph *graph); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: #endif /* AVFILTER_AVFILTER_H */