camera

package
v1.9.13 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 5 Imported by: 0

README

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
	CryptoDisabled                = 2
)
View Source
const (
	SessionCommandEnd         = 0
	SessionCommandStart       = 1
	SessionCommandSuspend     = 2
	SessionCommandResume      = 3
	SessionCommandReconfigure = 4
)
View Source
const (
	StreamingStatusAvailable   = 0
	StreamingStatusInUse       = 1
	StreamingStatusUnavailable = 2
)
View Source
const TypeSelectedCameraRecordingConfiguration = "209"
View Source
const TypeSelectedStreamConfiguration = "117"
View Source
const TypeSetupDataStreamTransport = "131"
View Source
const TypeSetupEndpoints = "118"
View Source
const TypeStreamingStatus = "120"
View Source
const TypeSupportedAudioRecordingConfiguration = "207"
View Source
const TypeSupportedAudioStreamConfiguration = "115"
View Source
const TypeSupportedCameraRecordingConfiguration = "205"
View Source
const TypeSupportedDataStreamTransportConfiguration = "130"
View Source
const TypeSupportedRTPConfiguration = "116"
View Source
const TypeSupportedVideoRecordingConfiguration = "206"
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 Address added in v1.9.12

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

type AudioCodecConfiguration added in v1.9.12

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

type AudioCodecParameters added in v1.9.12

type AudioCodecParameters struct {
	Channels    uint8   `tlv8:"1"`
	BitrateMode 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 AudioRecordingCodecConfiguration added in v1.9.12

type AudioRecordingCodecConfiguration struct {
	CodecType   byte                            `tlv8:"1"`
	CodecParams []AudioRecordingCodecParameters `tlv8:"2"`
}

type AudioRecordingCodecParameters added in v1.9.12

type AudioRecordingCodecParameters struct {
	Channels        uint8    `tlv8:"1"`
	BitrateMode     []byte   `tlv8:"2"`
	SampleRate      []byte   `tlv8:"3"`
	MaxAudioBitrate []uint32 `tlv8:"4"`
}

type MediaContainerConfigurations added in v1.9.12

type MediaContainerConfigurations struct {
	MediaContainerType       uint8 `tlv8:"1"`
	MediaContainerParameters `tlv8:"2"`
}

type MediaContainerParameters added in v1.9.12

type MediaContainerParameters struct {
	FragmentLength uint32 `tlv8:"1"`
}

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 SRTPCryptoSuite added in v1.9.12

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

type SelectedCameraRecordingConfiguration added in v1.9.12

type SelectedCameraRecordingConfiguration struct {
	GeneralConfig SupportedCameraRecordingConfiguration `tlv8:"1"`
	VideoConfig   SupportedVideoRecordingConfiguration  `tlv8:"2"`
	AudioConfig   SupportedAudioRecordingConfiguration  `tlv8:"3"`
}

type SelectedStreamConfiguration added in v1.9.12

type SelectedStreamConfiguration struct {
	Control    SessionControl          `tlv8:"1"`
	VideoCodec VideoCodecConfiguration `tlv8:"2"`
	AudioCodec AudioCodecConfiguration `tlv8:"3"`
}

type SessionControl added in v1.7.0

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

type SetupDataStreamTransportRequest added in v1.9.12

type SetupDataStreamTransportRequest struct {
	SessionCommandType byte   `tlv8:"1"`
	TransportType      byte   `tlv8:"2"`
	ControllerKeySalt  string `tlv8:"3"`
}

type SetupDataStreamTransportResponse added in v1.9.12

type SetupDataStreamTransportResponse struct {
	Status                         byte `tlv8:"1"`
	TransportTypeSessionParameters struct {
		TCPListeningPort uint16 `tlv8:"1"`
	} `tlv8:"2"`
	AccessoryKeySalt string `tlv8:"3"`
}

type SetupEndpointsRequest added in v1.9.12

type SetupEndpointsRequest struct {
	SessionID   string          `tlv8:"1"`
	Address     Address         `tlv8:"3"`
	VideoCrypto SRTPCryptoSuite `tlv8:"4"`
	AudioCrypto SRTPCryptoSuite `tlv8:"5"`
}

type SetupEndpointsResponse added in v1.9.12

type SetupEndpointsResponse struct {
	SessionID   string          `tlv8:"1"`
	Status      byte            `tlv8:"2"`
	Address     Address         `tlv8:"3"`
	VideoCrypto SRTPCryptoSuite `tlv8:"4"`
	AudioCrypto SRTPCryptoSuite `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 *VideoCodecConfiguration, audioCodec *AudioCodecConfiguration,
	videoSession, audioSession *srtp.Session, bitrate int,
) (*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 *SelectedStreamConfiguration) error

type StreamingStatus added in v1.7.0

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

type SupportedAudioRecordingConfiguration added in v1.9.12

type SupportedAudioRecordingConfiguration struct {
	CodecConfigs []AudioRecordingCodecConfiguration `tlv8:"1"`
}

type SupportedAudioStreamConfiguration added in v1.9.12

type SupportedAudioStreamConfiguration struct {
	Codecs              []AudioCodecConfiguration `tlv8:"1"`
	ComfortNoiseSupport byte                      `tlv8:"2"`
}

type SupportedCameraRecordingConfiguration added in v1.9.12

type SupportedCameraRecordingConfiguration struct {
	PrebufferLength              uint32 `tlv8:"1"`
	EventTriggerOptions          uint64 `tlv8:"2"`
	MediaContainerConfigurations `tlv8:"3"`
}

type SupportedDataStreamTransportConfiguration added in v1.9.12

type SupportedDataStreamTransportConfiguration struct {
	Configs []TransferTransportConfiguration `tlv8:"1"`
}

type SupportedRTPConfiguration added in v1.9.12

type SupportedRTPConfiguration struct {
	SRTPCryptoType []byte `tlv8:"2"`
}

type SupportedVideoRecordingConfiguration added in v1.9.12

type SupportedVideoRecordingConfiguration struct {
	CodecConfigs []VideoRecordingCodecConfiguration `tlv8:"1"`
}

type SupportedVideoStreamConfiguration added in v1.9.12

type SupportedVideoStreamConfiguration struct {
	Codecs []VideoCodecConfiguration `tlv8:"1"`
}

type TransferTransportConfiguration added in v1.9.12

type TransferTransportConfiguration struct {
	TransportType byte `tlv8:"1"`
}

type VideoCodecAttributes added in v1.9.12

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

type VideoCodecConfiguration added in v1.9.12

type VideoCodecConfiguration struct {
	CodecType   byte                   `tlv8:"1"`
	CodecParams []VideoCodecParameters `tlv8:"2"`
	VideoAttrs  []VideoCodecAttributes `tlv8:"3"`
	RTPParams   []RTPParams            `tlv8:"4"`
}

type VideoCodecParameters added in v1.9.12

type VideoCodecParameters 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"` // ID for CVO RTP extensio
}

type VideoRecordingCodecConfiguration added in v1.9.12

type VideoRecordingCodecConfiguration struct {
	CodecType   uint8                         `tlv8:"1"`
	CodecParams VideoRecordingCodecParameters `tlv8:"2"`
	CodecAttrs  VideoCodecAttributes          `tlv8:"3"`
}

type VideoRecordingCodecParameters added in v1.9.12

type VideoRecordingCodecParameters struct {
	ProfileID      uint8  `tlv8:"1"`
	Level          uint8  `tlv8:"2"`
	Bitrate        uint32 `tlv8:"3"`
	IFrameInterval uint32 `tlv8:"4"`
}

Jump to

Keyboard shortcuts

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