avfoundation

package
v0.0.0-...-0bf383f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package avfoundation provides AVFoundation binding for Go

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// UID is a unique identifier for a device
	UID string
	// contains filtered or unexported fields
}

Device represents a metadata that later can be used to retrieve back the underlying device given by AVFoundation

func Devices

func Devices(mediaType MediaType) ([]Device, error)

Devices uses AVFoundation to query a list of devices based on the media type

type MediaType

type MediaType C.AVBindMediaType

type ReadCloser

type ReadCloser struct {
	// contains filtered or unexported fields
}

ReadCloser is a wrapper around the data callback from AVFoundation. The data received from the the underlying callback can be retrieved by calling Read.

func (*ReadCloser) Close

func (rc *ReadCloser) Close()

Close closes the capturing session, and no data will flow anymore

func (*ReadCloser) Read

func (rc *ReadCloser) Read() ([]byte, func(), error)

Read reads raw data, the format is determined by the media type and property:

  • For video, each call will return a frame.
  • For audio, each call will return a chunk which its size configured by Latency

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a capturing session.

func NewSession

func NewSession(device Device) (*Session, error)

NewSession creates a new capturing session

func (*Session) Close

func (session *Session) Close() error

Close stops capturing session and frees up resources

func (*Session) Open

func (session *Session) Open(property prop.Media) (*ReadCloser, error)

Open start capturing session. As soon as it returns successfully, the data will start flowing. The raw data can be retrieved by using ReadCloser's Read method.

func (*Session) Properties

func (session *Session) Properties() []prop.Media

Properties queries a list of properties that device supports

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL