prop

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	ChannelCount  int
	Latency       time.Duration
	SampleRate    int
	SampleSize    int
	IsBigEndian   bool
	IsFloat       bool
	IsInterleaved bool
}

Audio represents an audio's constraints

type AudioConstraints

type AudioConstraints struct {
	ChannelCount  IntConstraint
	Latency       DurationConstraint
	SampleRate    IntConstraint
	SampleSize    IntConstraint
	IsBigEndian   BoolConstraint
	IsFloat       BoolConstraint
	IsInterleaved BoolConstraint
}

AudioConstraints represents an audio's constraints

type Bool

type Bool BoolExact

Bool specifies ideal bool value.

func (Bool) Compare

func (b Bool) Compare(o bool) (float64, bool)

Compare implements BoolConstraint.

type BoolConstraint

type BoolConstraint interface {
	Compare(bool) (float64, bool)
	Value() bool
}

BoolConstraint is an interface to represent bool value constraint.

type BoolExact

type BoolExact bool

BoolExact specifies exact bool value.

func (BoolExact) Compare

func (b BoolExact) Compare(o bool) (float64, bool)

Compare implements BoolConstraint.

func (BoolExact) String

func (b BoolExact) String() string

String implements Stringify

func (BoolExact) Value

func (b BoolExact) Value() bool

Value implements BoolConstraint.

type Duration

type Duration time.Duration

Duration specifies ideal duration value. Any value may be selected, but closest value takes priority.

func (Duration) Compare

func (d Duration) Compare(a time.Duration) (float64, bool)

Compare implements DurationConstraint.

func (Duration) String

func (d Duration) String() string

String implements Stringify

func (Duration) Value

func (d Duration) Value() (time.Duration, bool)

Value implements DurationConstraint.

type DurationConstraint

type DurationConstraint interface {
	Compare(time.Duration) (float64, bool)
	Value() (time.Duration, bool)
}

DurationConstraint is an interface to represent time.Duration constraint.

type DurationExact

type DurationExact time.Duration

DurationExact specifies exact duration value.

func (DurationExact) Compare

func (d DurationExact) Compare(a time.Duration) (float64, bool)

Compare implements DurationConstraint.

func (DurationExact) String

func (d DurationExact) String() string

String implements Stringify

func (DurationExact) Value

func (d DurationExact) Value() (time.Duration, bool)

Value implements DurationConstraint.

type DurationOneOf

type DurationOneOf []time.Duration

DurationOneOf specifies list of expected duration values.

func (DurationOneOf) Compare

func (d DurationOneOf) Compare(a time.Duration) (float64, bool)

Compare implements DurationConstraint.

func (DurationOneOf) String

func (d DurationOneOf) String() string

String implements Stringify

func (DurationOneOf) Value

func (DurationOneOf) Value() (time.Duration, bool)

Value implements DurationConstraint.

type DurationRanged

type DurationRanged struct {
	Min   time.Duration
	Max   time.Duration
	Ideal time.Duration
}

DurationRanged specifies range of expected duration value. If Ideal is non-zero, closest value to Ideal takes priority.

func (DurationRanged) Compare

func (d DurationRanged) Compare(a time.Duration) (float64, bool)

Compare implements DurationConstraint.

func (DurationRanged) String

func (d DurationRanged) String() string

String implements Stringify

func (DurationRanged) Value

func (DurationRanged) Value() (time.Duration, bool)

Value implements DurationConstraint.

type Float

type Float float32

Float specifies ideal float value. Any value may be selected, but closest value takes priority.

func (Float) Compare

func (f Float) Compare(a float32) (float64, bool)

Compare implements FloatConstraint.

func (Float) String

func (f Float) String() string

String implements Stringify

func (Float) Value

func (f Float) Value() (float32, bool)

Value implements FloatConstraint.

type FloatConstraint

type FloatConstraint interface {
	Compare(float32) (float64, bool)
	Value() (float32, bool)
}

FloatConstraint is an interface to represent float value constraint.

type FloatExact

type FloatExact float32

FloatExact specifies exact float value.

func (FloatExact) Compare

func (f FloatExact) Compare(a float32) (float64, bool)

Compare implements FloatConstraint.

func (FloatExact) String

func (f FloatExact) String() string

String implements Stringify

func (FloatExact) Value

func (f FloatExact) Value() (float32, bool)

Value implements FloatConstraint.

type FloatOneOf

type FloatOneOf []float32

FloatOneOf specifies list of expected float values.

func (FloatOneOf) Compare

func (f FloatOneOf) Compare(a float32) (float64, bool)

Compare implements FloatConstraint.

func (FloatOneOf) String

func (f FloatOneOf) String() string

String implements Stringify

func (FloatOneOf) Value

func (FloatOneOf) Value() (float32, bool)

Value implements FloatConstraint.

type FloatRanged

type FloatRanged struct {
	Min   float32
	Max   float32
	Ideal float32
}

FloatRanged specifies range of expected float value. If Ideal is non-zero, closest value to Ideal takes priority.

func (FloatRanged) Compare

func (f FloatRanged) Compare(a float32) (float64, bool)

Compare implements FloatConstraint.

func (FloatRanged) String

func (f FloatRanged) String() string

String implements Stringify

func (FloatRanged) Value

func (FloatRanged) Value() (float32, bool)

Value implements FloatConstraint.

type FrameFormat

type FrameFormat frame.Format

FrameFormat specifies expected frame format. Any value may be selected, but matched value takes priority.

func (FrameFormat) Compare

func (f FrameFormat) Compare(a frame.Format) (float64, bool)

Compare implements FrameFormatConstraint.

func (FrameFormat) String

func (f FrameFormat) String() string

String implements Stringify

func (FrameFormat) Value

func (f FrameFormat) Value() (frame.Format, bool)

Value implements FrameFormatConstraint.

type FrameFormatConstraint

type FrameFormatConstraint interface {
	Compare(frame.Format) (float64, bool)
	Value() (frame.Format, bool)
}

FrameFormatConstraint is an interface to represent frame format constraint.

type FrameFormatExact

type FrameFormatExact frame.Format

FrameFormatExact specifies exact frame format.

func (FrameFormatExact) Compare

func (f FrameFormatExact) Compare(a frame.Format) (float64, bool)

Compare implements FrameFormatConstraint.

func (FrameFormatExact) String

func (f FrameFormatExact) String() string

String implements Stringify

func (FrameFormatExact) Value

func (f FrameFormatExact) Value() (frame.Format, bool)

Value implements FrameFormatConstraint.

type FrameFormatOneOf

type FrameFormatOneOf []frame.Format

FrameFormatOneOf specifies list of expected frame format.

func (FrameFormatOneOf) Compare

func (f FrameFormatOneOf) Compare(a frame.Format) (float64, bool)

Compare implements FrameFormatConstraint.

func (FrameFormatOneOf) String

func (f FrameFormatOneOf) String() string

String implements Stringify

func (FrameFormatOneOf) Value

func (FrameFormatOneOf) Value() (frame.Format, bool)

Value implements FrameFormatConstraint.

type Int

type Int int

Int specifies ideal int value. Any value may be selected, but closest value takes priority.

func (Int) Compare

func (i Int) Compare(a int) (float64, bool)

Compare implements IntConstraint.

func (Int) String

func (i Int) String() string

String implements Stringify

func (Int) Value

func (i Int) Value() (int, bool)

Value implements IntConstraint.

type IntConstraint

type IntConstraint interface {
	Compare(int) (float64, bool)
	Value() (int, bool)
}

IntConstraint is an interface to represent integer value constraint.

type IntExact

type IntExact int

IntExact specifies exact int value.

func (IntExact) Compare

func (i IntExact) Compare(a int) (float64, bool)

Compare implements IntConstraint.

func (IntExact) String

func (i IntExact) String() string

String implements Stringify

func (IntExact) Value

func (i IntExact) Value() (int, bool)

Value implements IntConstraint.

type IntOneOf

type IntOneOf []int

IntOneOf specifies list of expected float values.

func (IntOneOf) Compare

func (i IntOneOf) Compare(a int) (float64, bool)

Compare implements IntConstraint.

func (IntOneOf) String

func (i IntOneOf) String() string

String implements Stringify

func (IntOneOf) Value

func (IntOneOf) Value() (int, bool)

Value implements IntConstraint.

type IntRanged

type IntRanged struct {
	Min   int
	Max   int
	Ideal int
}

IntRanged specifies range of expected int value. If Ideal is non-zero, closest value to Ideal takes priority.

func (IntRanged) Compare

func (i IntRanged) Compare(a int) (float64, bool)

Compare implements IntConstraint.

func (IntRanged) String

func (i IntRanged) String() string

String implements Stringify

func (IntRanged) Value

func (IntRanged) Value() (int, bool)

Value implements IntConstraint.

type Media

type Media struct {
	DeviceID string
	Video
	Audio
}

Media stores single set of media propaties.

func (*Media) Merge

func (p *Media) Merge(o Media)

func (*Media) MergeConstraints

func (p *Media) MergeConstraints(o MediaConstraints)

func (*Media) String

func (m *Media) String() string

type MediaConstraints

type MediaConstraints struct {
	DeviceID StringConstraint
	VideoConstraints
	AudioConstraints
}

MediaConstraints represents set of media property constraints. Each field constrains property by min/ideal/max range, exact match, or oneof match.

func (*MediaConstraints) FitnessDistance

func (p *MediaConstraints) FitnessDistance(o Media) (float64, bool)

FitnessDistance calculates fitness of media property and media constraints. If no media satisfies given constraints, second return value will be false.

func (*MediaConstraints) String

func (m *MediaConstraints) String() string

type String

type String string

String specifies expected string. Any value may be selected, but matched value takes priority.

func (String) Compare

func (f String) Compare(a string) (float64, bool)

Compare implements StringConstraint.

func (String) String

func (f String) String() string

String implements Stringify

func (String) Value

func (f String) Value() (string, bool)

Value implements StringConstraint.

type StringConstraint

type StringConstraint interface {
	Compare(string) (float64, bool)
	Value() (string, bool)
}

StringConstraint is an interface to represent string constraint.

type StringExact

type StringExact string

StringExact specifies exact string.

func (StringExact) Compare

func (f StringExact) Compare(a string) (float64, bool)

Compare implements StringConstraint.

func (StringExact) String

func (f StringExact) String() string

String implements Stringify

func (StringExact) Value

func (f StringExact) Value() (string, bool)

Value implements StringConstraint.

type StringOneOf

type StringOneOf []string

StringOneOf specifies list of expected string.

func (StringOneOf) Compare

func (f StringOneOf) Compare(a string) (float64, bool)

Compare implements StringConstraint.

func (StringOneOf) String

func (f StringOneOf) String() string

String implements Stringify

func (StringOneOf) Value

func (StringOneOf) Value() (string, bool)

Value implements StringConstraint.

type Video

type Video struct {
	Width, Height          int
	FrameRate              float32
	FrameFormat            frame.Format
	DiscardFramesOlderThan time.Duration
}

Video represents a video's constraints

type VideoConstraints

type VideoConstraints struct {
	Width, Height          IntConstraint
	FrameRate              FloatConstraint
	FrameFormat            FrameFormatConstraint
	DiscardFramesOlderThan time.Duration
}

VideoConstraints represents a video's constraints

Jump to

Keyboard shortcuts

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