camera

package
v0.0.0-...-fab637b Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Type = eng.DefineComponentType("v4l2.camera",
	eng.ComponentFactoryFunc(func(ref v0.ComponentRef) (v0.Component, error) {
		return NewComponent(ref)
	})).
	Describe("[V4L2] Camera").
	Register()

Type is the Component type

Functions

func NewComponent

func NewComponent(ref v0.ComponentRef) (v0.Component, error)

NewComponent creates a Component

Types

type Camera

type Camera struct {
	Options
	// contains filtered or unexported fields
}

Camera is camera device

func (*Camera) Close

func (s *Camera) Close() error

Close closes the camera

func (*Camera) GetFrame

func (s *Camera) GetFrame() ([]byte, error)

GetFrame reads one frame

func (*Camera) Open

func (s *Camera) Open() error

Open opens the camera device

type Component

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

Component is the implementation

func (*Component) Endpoints

func (s *Component) Endpoints() (endpoints []mqhub.Endpoint)

Endpoints implements v0.Stateful

func (*Component) Ref

func (s *Component) Ref() v0.ComponentRef

Ref implements v0.Component

func (*Component) Start

func (s *Component) Start() error

Start implements v0.LifecycleCtl

func (*Component) Stop

func (s *Component) Stop() error

Stop implements v0.LifecycleCtl

func (*Component) Type

func (s *Component) Type() v0.ComponentType

Type implements v0.Component

type Config

type Config struct {
	Device  string            `map:"device"`
	Width   int               `map:"width"`
	Height  int               `map:"height"`
	Format  string            `map:"format"`
	Quality *int              `map:"quality"`
	AutoOn  bool              `map:"auto-on"`
	WithSeq bool              `map:"with-seq"`
	SeqSrc  string            `map:"seq-source"`
	Casts   map[string]string `map:"cast"`
}

Config defines camera configuration

type FourCC

type FourCC uint32

FourCC is V4L2 fourcc format

const (
	FourCCMJPG FourCC = 0x47504a4d
	FourCCYUYV FourCC = 0x56595559
)

FourCC formats

func ParseFourCC

func ParseFourCC(str string) (FourCC, error)

ParseFourCC parses FourCC from a string

func (FourCC) MarshalJSON

func (cc FourCC) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (FourCC) String

func (cc FourCC) String() (s string)

String returns the string represent of fourcc

func (*FourCC) UnmarshalJSON

func (cc *FourCC) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Options

type Options struct {
	Device  string
	Width   int
	Height  int
	FourCC  FourCC
	Quality *int
	WithSeq bool
	SeqSrc  string
}

Options is camera options

type State

type State struct {
	On     bool   `json:"on"`
	Width  int    `json:"width,omitempty"`
	Height int    `json:"height,omitempty"`
	FourCC FourCC `json:"fourcc"`
}

State defines camera state

type Stream

type Stream struct {
	Casts []cmn.CastTarget
	// contains filtered or unexported fields
}

Stream is camera streamer

func (*Stream) Do

func (s *Stream) Do(fn func() error) error

Do runs an operation in stream task

func (*Stream) Off

func (s *Stream) Off() error

Off turns off camera

func (*Stream) On

func (s *Stream) On(settings Options) (opts Options, err error)

On turns on camera

func (*Stream) Start

func (s *Stream) Start()

Start starts the background streamer

func (*Stream) Stop

func (s *Stream) Stop()

Stop stops the background streamer

Jump to

Keyboard shortcuts

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