AVIO

public enum AVIO

Undocumented

  • Allocate a memory block with alignment suitable for all memory accesses (including vectors if available on the CPU).

    Declaration

    Swift

    public static func malloc(size: Int) -> UnsafeMutableRawPointer?

    Parameters

    size

    Size in bytes for the memory block to be allocated

    Return Value

    Pointer to the allocated block, or nil if the block cannot be allocated.

  • Allocate a memory block with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block.

    Declaration

    Swift

    public static func mallocz(size: Int) -> UnsafeMutableRawPointer?

    Parameters

    size

    Size in bytes for the memory block to be allocated

    Return Value

    Pointer to the allocated block, or nil if the block cannot be allocated.

  • Allocate, reallocate, or free a block of memory.

    If ptr is nil and size > 0, allocate a new block. If size is zero, free the memory block pointed to by ptr. Otherwise, expand or shrink that block of memory according to size.

    Warning

    Unlike malloc(size:), the returned pointer is not guaranteed to be correctly aligned.

    Declaration

    Swift

    public static func realloc(_ ptr: UnsafeMutableRawPointer?, size: Int) -> UnsafeMutableRawPointer?

    Parameters

    ptr

    Pointer to a memory block already allocated with realloc(_:size:) or nil

    size

    Size in bytes of the memory block to be allocated or reallocated

    Return Value

    Pointer to a newly-reallocated block or nil if the block cannot be reallocated or the function is used to free the memory block

  • Free a memory block which has been allocated with a function of malloc(size:) or realloc(_:size:) family.

    Note

    ptr = nil is explicitly allowed.

    Note

    It is recommended that you use freep(_:) instead, to prevent leaving behind dangling pointers.

    Declaration

    Swift

    public static func free(_ ptr: UnsafeMutableRawPointer?)

    Parameters

    ptr

    Pointer to the memory block which should be freed.

  • Free a memory block which has been allocated with a function of malloc(size:) or realloc(_:size:) family, and set the pointer pointing to it to nil.

    Note

    *ptr = NULL is safe and leads to no action.

    Declaration

    Swift

    public static func freep(_ ptr: UnsafeMutableRawPointer?)

    Parameters

    ptr

    Pointer to the pointer to the memory block which should be freed

  • Read the file with name, and put its content in a newly allocated buffer or map it with mmap() when available. In case of success set buffer to the read or mmapped buffer, and size to the size in bytes of the buffer. Unlike mmap this function succeeds with zero sized files, in this case *bufptr will be set to nil and *size will be set to 0. The returned buffer must be released with fileUnmap(buffer:size:).

    Throws

    AVError

    Declaration

    Swift

    public static func fileMap(
        filename: String,
        buffer: UnsafeMutablePointer<UnsafeMutablePointer<UInt8>?>,
        size: UnsafeMutablePointer<Int>
    ) throws
  • Unmap or free the buffer bufptr created by fileMap(filename:buffer:size).

    Declaration

    Swift

    public static func fileUnmap(buffer: UnsafeMutablePointer<UInt8>, size: Int)
  • Move or rename a resource.

    Note

    src and dst should share the same protocol and authority.

    Throws

    AVError

    Declaration

    Swift

    public static func move(_ src: String, _ dst: String) throws

    Parameters

    src

    url to resource to be moved

    dst

    new url to resource if the operation succeeded

  • Delete a resource.

    Throws

    AVError

    Declaration

    Swift

    public static func delete(_ url: String) throws

    Parameters

    url

    resource to be deleted.