camera

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VideoCodecTypeH264 = 0

	VideoCodecProfileConstrainedBaseline = 0
	VideoCodecProfileMain                = 1
	VideoCodecProfileHigh                = 2

	VideoCodecLevel31 = 0
	VideoCodecLevel32 = 1
	VideoCodecLevel40 = 2

	VideoCodecPacketizationModeNonInterleaved = 0

	VideoCodecCvoNotSuppported = 0
	VideoCodecCvoSuppported    = 1
)
View Source
const (
	AudioCodecTypePCMU   = 0
	AudioCodecTypePCMA   = 1
	AudioCodecTypeAACELD = 2
	AudioCodecTypeOpus   = 3
	AudioCodecTypeMSBC   = 4
	AudioCodecTypeAMR    = 5
	AudioCodecTypeARMWB  = 6

	AudioCodecBitrateVariable = 0
	AudioCodecBitrateConstant = 1

	AudioCodecSampleRate8Khz  = 0
	AudioCodecSampleRate16Khz = 1
	AudioCodecSampleRate24Khz = 2

	RTPTimeAACELD8  = 60 // 8000/1000*60=480
	RTPTimeAACELD16 = 30 // 16000/1000*30=480
	RTPTimeAACELD24 = 20 // 24000/1000*20=480
	RTPTimeAACLD16  = 60 // 16000/1000*60=960
	RTPTimeAACLD24  = 40 // 24000/1000*40=960
)
View Source
const (
	CryptoAES_CM_128_HMAC_SHA1_80 = 0
	CryptoAES_CM_256_HMAC_SHA1_80 = 1
	CryptoNone                    = 2
)
View Source
const (
	SessionCommandEnd         = 0
	SessionCommandStart       = 1
	SessionCommandSuspend     = 2
	SessionCommandResume      = 3
	SessionCommandReconfigure = 4
)
View Source
const (
	StreamingStatusAvailable   = 0
	StreamingStatusBusy        = 1
	StreamingStatusUnavailable = 2
)
View Source
const TypeSelectedStreamConfiguration = "117"
View Source
const TypeSetupEndpoints = "118"
View Source
const TypeStreamingStatus = "120"
View Source
const TypeSupportedAudioStreamConfiguration = "115"
View Source
const TypeSupportedRTPConfiguration = "116"
View Source
const TypeSupportedVideoStreamConfiguration = "114"

Variables

This section is empty.

Functions

func NewAccessory added in v1.7.0

func NewAccessory(manuf, model, name, serial, firmware string) *hap.Accessory

func ServiceCameraRTPStreamManagement added in v1.7.0

func ServiceCameraRTPStreamManagement() *hap.Service

func ServiceMicrophone added in v1.7.0

func ServiceMicrophone() *hap.Service

Types

type Addr added in v1.7.0

type Addr struct {
	IPVersion    byte   `tlv8:"1"`
	IPAddr       string `tlv8:"2"`
	VideoRTPPort uint16 `tlv8:"3"`
	AudioRTPPort uint16 `tlv8:"4"`
}

type AudioCodec added in v1.7.0

type AudioCodec struct {
	CodecType    byte          `tlv8:"1"`
	CodecParams  []AudioParams `tlv8:"2"`
	RTPParams    []RTPParams   `tlv8:"3"`
	ComfortNoise []byte        `tlv8:"4"`
}

type AudioParams added in v1.7.0

type AudioParams struct {
	Channels   uint8   `tlv8:"1"`
	Bitrate    byte    `tlv8:"2"` // 0 - variable, 1 - constant
	SampleRate []byte  `tlv8:"3"` // 0 - 8000, 1 - 16000, 2 - 24000
	RTPTime    []uint8 `tlv8:"4"` // 20, 30, 40, 60
}

type CryptoSuite added in v1.7.0

type CryptoSuite struct {
	CryptoType byte   `tlv8:"1"`
	MasterKey  string `tlv8:"2"` // 16 (AES_CM_128) or 32 (AES_256_CM)
	MasterSalt string `tlv8:"3"` // 14 byte
}

type RTPParams added in v1.7.0

type RTPParams struct {
	PayloadType             uint8    `tlv8:"1"`
	SSRC                    uint32   `tlv8:"2"`
	MaxBitrate              uint16   `tlv8:"3"`
	RTCPInterval            float32  `tlv8:"4"`
	MaxMTU                  []uint16 `tlv8:"5"`
	ComfortNoisePayloadType []uint8  `tlv8:"6"`
}

type SelectedStreamConfig added in v1.7.0

type SelectedStreamConfig struct {
	Control    SessionControl `tlv8:"1"`
	VideoCodec VideoCodec     `tlv8:"2"`
	AudioCodec AudioCodec     `tlv8:"3"`
}

type SessionControl added in v1.7.0

type SessionControl struct {
	SessionID string `tlv8:"1"`
	Command   byte   `tlv8:"2"`
}

type SetupEndpoints added in v1.7.0

type SetupEndpoints struct {
	SessionID   string      `tlv8:"1"`
	Status      []byte      `tlv8:"2"`
	Address     Addr        `tlv8:"3"`
	VideoCrypto CryptoSuite `tlv8:"4"`
	AudioCrypto CryptoSuite `tlv8:"5"`
	VideoSSRC   []uint32    `tlv8:"6"`
	AudioSSRC   []uint32    `tlv8:"7"`
}

type Stream added in v1.7.0

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

func NewStream added in v1.7.0

func NewStream(
	client *hap.Client, videoCodec *VideoCodec, audioCodec *AudioCodec, videoSession, audioSession *srtp.Session,
) (*Stream, error)

func (*Stream) Close added in v1.7.0

func (s *Stream) Close() error

func (*Stream) ExchangeEndpoints added in v1.7.0

func (s *Stream) ExchangeEndpoints(videoSession, audioSession *srtp.Session) error

func (*Stream) GetFreeStream added in v1.7.0

func (s *Stream) GetFreeStream() error

GetFreeStream search free streaming service. Usual every HomeKit camera can stream only to two clients simultaniosly. So it has two similar services for streaming.

func (*Stream) SetStreamConfig added in v1.7.0

func (s *Stream) SetStreamConfig(config *SelectedStreamConfig) error

type StreamingStatus added in v1.7.0

type StreamingStatus struct {
	Status byte `tlv8:"1"`
}

type SupportedAudioStreamConfig added in v1.7.0

type SupportedAudioStreamConfig struct {
	Codecs       []AudioCodec `tlv8:"1"`
	ComfortNoise byte         `tlv8:"2"`
}

type SupportedRTPConfig added in v1.7.0

type SupportedRTPConfig struct {
	CryptoType []byte `tlv8:"2"`
}

type SupportedVideoStreamConfig added in v1.7.0

type SupportedVideoStreamConfig struct {
	Codecs []VideoCodec `tlv8:"1"`
}

type VideoAttrs added in v1.7.0

type VideoAttrs struct {
	Width     uint16 `tlv8:"1"`
	Height    uint16 `tlv8:"2"`
	Framerate uint8  `tlv8:"3"`
}

type VideoCodec added in v1.7.0

type VideoCodec struct {
	CodecType   byte          `tlv8:"1"`
	CodecParams []VideoParams `tlv8:"2"`
	VideoAttrs  []VideoAttrs  `tlv8:"3"`
	RTPParams   []RTPParams   `tlv8:"4"`
}

type VideoParams added in v1.7.0

type VideoParams struct {
	ProfileID         []byte `tlv8:"1"` // 0 - baseline, 1 - main, 2 - high
	Level             []byte `tlv8:"2"` // 0 - 3.1, 1 - 3.2, 2 - 4.0
	PacketizationMode byte   `tlv8:"3"` // only 0 - non interleaved
	CVOEnabled        []byte `tlv8:"4"` // 0 - not supported, 1 - supported
	CVOID             []byte `tlv8:"5"` // ???
}

Jump to

Keyboard shortcuts

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