AVBSFContext

public final class AVBSFContext

The bitstream filter state.

  • Get null/pass-through bitstream filter.

    Declaration

    Swift

    public init()
  • Allocate a context for a given bitstream filter. The caller must fill in the context parameters as described in the documentation and then call initialize() before sending any data to the filter.

    Declaration

    Swift

    public init(filter: AVBitStreamFilter)

    Parameters

    filter

    the filter for which to allocate an instance.

  • Parse string describing list of bitstream filters and create single AVBSFContext describing the whole chain of bitstream filters.

    Declaration

    Swift

    public init(str: String)

    Parameters

    str

    String describing chain of bitstream filters in format bsf1[=opt1=val1:opt2=val2][,bsf2].

  • Prepare the filter for use, after all the parameters and options have been set.

    Declaration

    Swift

    public func initialize() throws
  • Submit a packet for filtering.

    After sending each packet, the filter must be completely drained by calling receivePacket(_:) repeatedly until it returns AVError.tryAgain or AVError.eof.

    Throws

    AVError

    Declaration

    Swift

    public func sendPacket(_ packet: AVPacket?) throws

    Parameters

    packet

    the packet to filter. The bitstream filter will take ownership of the packet and reset the contents of pkt. pkt is not touched if an error occurs. This parameter may be nil, which signals the end of the stream (i.e. no more packets will be sent). That will cause the filter to output any packets it may have buffered internally.

  • Retrieve a filtered packet.

    Note

    one input packet may result in several output packets, so after sending a packet with sendPacket(_:), this function needs to be called repeatedly until it stops returning 0. It is also possible for a filter to output fewer packets than were sent to it, so this function may return AVError.tryAgain immediately after a successful sendPacket(_:) call.

    Throws

    AVError

    Throws

    Throws:

    Declaration

    Swift

    public func receivePacket(_ packet: AVPacket) throws

    Parameters

    packet

    this struct will be filled with the contents of the filtered packet. It is owned by the caller and must be freed using AVPacket.unref() when it is no longer needed. This parameter should be clean (i.e. freshly allocated with AVPacket.init() or unreffed with AVPacket.unref()) when this function is called. If this function returns successfully, the contents of pkt will be completely overwritten by the returned data. On failure, pkt is not touched.

  • Reset the internal bitstream filter state / flush internal buffers.

    Declaration

    Swift

    public func flush()
  • 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