AVFilterContext
public final class AVFilterContext
An instance of a filter.
-
Create a new filter instance in a filter graph.
Declaration
Swift
public init(graph: AVFilterGraph, filter: AVFilter, name: String? = nil)Parameters
graphgraph in which the new filter will be used
filterthe filter to create an instance of
nameName to give to the new instance (will be copied to
AVFilterContext.name). This may be used by the caller to identify different filters, libavfilter itself assigns no semantics to this parameter. May benil.Return Value
the context of the newly created filter instance (note that it is also retrievable directly through
AVFilterGraph.filtersor withavfilter_graph_get_filter()). -
The name of this filter instance.
Declaration
Swift
public var name: String { get } -
The input links of this filter instance.
Declaration
Swift
public var inputs: [AVFilterLink] { get } -
The number of input pads.
Declaration
Swift
public var inputCount: Int { get } -
The output links of this filter instance.
Declaration
Swift
public var outputs: [AVFilterLink] { get } -
The number of input pads.
Declaration
Swift
public var outputCount: Int { get } -
The filtergraph this filter belongs to.
Declaration
Swift
public var graph: AVFilterGraph { get } -
Initialize a filter with the supplied parameters.
Throws
AVErrorDeclaration
Swift
public func initialize(args: String? = nil) throwsParameters
argsOptions to initialize the filter with. This must be a ‘:’-separated list of options in the ‘key=value’ form. May be
nilif the options have been set directly using the AVOptions API or there are no options that need to be set. The default isnil. -
Initialize a filter with the supplied dictionary of options.
Note
This function and
avfilter_init_str()do essentially the same thing, the difference is in manner in which the options are passed. It is up to the calling code to choose whichever is more preferable. The two functions also behave differently when some of the provided options are not declared as supported by the filter. In such a case,avfilter_init_str()will fail, but this function will dump those extra options and continue as usual.Throws
AVError
Declaration
Swift
public func initialize(args: [String : String]) throwsParameters
argsA Dictionary filled with options for this filter.
-
Link two filters together.
Throws
AVErrorDeclaration
Swift
@discardableResult public func link( srcPad: UInt = 0, dst: AVFilterContext, dstPad: UInt = 0 ) throws -> AVFilterContextParameters
srcPadThe index of the output pad on the source filter. The default is 0.
dstThe destination filter.
dstPadThe index of the input pad on the destination filter. The default is 0.
Return Value
The destination filter.
-
Undocumented
Declaration
Swift
public static let `class`: AVClass -
Undocumented
Declaration
Swift
public func withUnsafeClassObjectPointer<T>(_ body: (UnsafeMutableRawPointer) throws -> T) rethrows -> T
-
Undocumented
Declaration
Swift
public func withUnsafeObjectPointer<T>(_ body: (UnsafeMutableRawPointer) throws -> T) rethrows -> T
-
Add a frame to the buffer source.
By default, if the frame is reference-counted, this function will take ownership of the reference(s) and reset the frame. Otherwise the frame data will be copied. This can be controlled using the flags.
If this function throws an error, the input frame is not touched.
Throws
AVErrorDeclaration
Swift
public func addFrame(_ frame: AVFrame?, flags: AVBufferSourceFlag = .init(rawValue: 0)) throwsParameters
framea frame, or
nilto mark EOFflagsa combination of
AVBufferSourceFlagflags
-
The media type of the buffer sink.
Declaration
Swift
public var mediaType: AVMediaType { get } -
The timebase of the buffer sink.
Declaration
Swift
public var timebase: AVRational { get } -
The pixel format of the video buffer sink.
Declaration
Swift
public var pixelFormat: AVPixelFormat { get } -
The frame rate of the video buffer sink.
Declaration
Swift
public var frameRate: AVRational { get } -
The width of the video buffer sink.
Declaration
Swift
public var width: Int { get } -
The height of the video buffer sink.
Declaration
Swift
public var height: Int { get } -
The sample aspect ratio of the video buffer sink.
Declaration
Swift
public var sampleAspectRatio: AVRational { get } -
The sample format of the audio buffer sink.
Declaration
Swift
public var sampleFormat: AVSampleFormat { get } -
The sample rate of the audio buffer sink.
Declaration
Swift
public var sampleRate: Int { get } -
The number of channels in the audio buffer sink.
Declaration
Swift
public var channelCount: Int { get } -
The channel layout of the audio buffer sink.
Declaration
Swift
public var channelLayout: AVChannelLayout { get } -
Get a frame with filtered data from sink and put it in frame.
Throws
AVError.tryAgainif no frames are available at this point; more input frames must be added to the filtergraph to get more output.AVError.eofif there will be no more output frames on this sink.- A different
AVErrorin other failure cases.
Declaration
Swift
public func getFrame(_ frame: AVFrame, flags: AVBufferSinkFlag = .init(rawValue: 0)) throwsParameters
framepointer to an allocated frame that will be filled with data. The data must be freed using
av_frame_unref() / av_frame_free().flagsa combination of
AVBufferSinkFlagflags
View on GitHub
Install in Dash
AVFilterContext Class Reference