Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera AV Stream Management Server Impl #36204

Merged
merged 40 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c3d2dc7
Camera AV Stream Management Server Impl
pidarped Oct 8, 2024
6cf698d
Add Optional Attributes support
pidarped Oct 31, 2024
ddd6177
Add support logic for writable attributes.
pidarped Nov 2, 2024
9cc5160
Remove some attributes to simplify AVStreamMgmt cluster slightly.
pidarped Nov 12, 2024
a2548fc
Remove redundant CurrentSnapshotConfig and CurrentVideoCodecs attributes
pidarped Nov 13, 2024
a32d5dc
Add write support for ImageRotation, ImageFlipHorizontal and ImageFli…
pidarped Nov 15, 2024
2a3cae1
Add handler for the SetStreamPriorities command.
pidarped Nov 16, 2024
dae49dc
Retrieve persistent attributes from storage during initialization.
pidarped Nov 17, 2024
1448590
Miscellaneous syntactic fixes to CameraAVStreamMgmt.
pidarped Dec 4, 2024
5e5bc40
Add persistence for Viewport struct attribute
pidarped Dec 5, 2024
875754f
Make CameraAVStreamMgmt handle list attributes inside cluster server …
pidarped Dec 9, 2024
c8dbcd8
Add Delegate functions for loading pre-allocated streams.
pidarped Dec 15, 2024
1e6dab4
Doc updates and adjustments based on latest Spec changes.
pidarped Dec 22, 2024
f7af377
Address review comments.
pidarped Jan 25, 2025
ba91235
Make watermark and OSD optional args.
pidarped Feb 4, 2025
f3262ed
Fix
pidarped Feb 5, 2025
136f909
Add feature and optional flags check in Init
pidarped Feb 5, 2025
c576a19
Modify SetStreamPriorities
pidarped Feb 8, 2025
1b68974
Add error handling for command params.
pidarped Feb 11, 2025
e04a022
Add CameraAvStreamMgmt cluster partially inside all-clusters-app.zap …
pidarped Feb 12, 2025
9777fce
Add more constraint checking for command params.
pidarped Feb 21, 2025
b4ffd2f
Apply suggestions from code review
pidarped Feb 21, 2025
3dcb16f
Restyle fixes.
pidarped Feb 21, 2025
991a653
Add CameraAVStreamMgmt cluster to EP1 of camera-app.zap.
pidarped Feb 21, 2025
7291665
Remove Enum validation functions.
pidarped Feb 21, 2025
589e0b1
Address review comments
pidarped Feb 22, 2025
7deda0e
Various Fixes
pidarped Feb 24, 2025
bc77a89
Add parameters struct for housing the set of stream allocation parame…
pidarped Feb 26, 2025
72ab375
Add initial delegate implementation in all-clusters-app.
pidarped Feb 27, 2025
4a328e5
Update Camera AVStreamMgmt Server SDK based on Spec changes from Spec…
pidarped Mar 3, 2025
a65437a
Update all-clusters-app and camera-app with attribute changes.
pidarped Mar 4, 2025
29d508d
Updates to CameraAVStreamMgmt delegate.
pidarped Mar 6, 2025
e431853
Fix Command de-allocation comments.
pidarped Mar 6, 2025
ae89dcc
Fix Command code numbering in zap file.
pidarped Mar 7, 2025
bbd02c6
Add SnapshotStreamModify command support.
pidarped Mar 7, 2025
c12e482
Fix persisted storage handling for Viewport and STream Priorities.
pidarped Mar 7, 2025
91665e9
Address review comments.
pidarped Mar 14, 2025
bb43d20
Resolve conflicts in all-clusters-app.matter and camera-app.matter.
pidarped Mar 14, 2025
d97ce09
Update src/app/clusters/camera-av-stream-management-server/camera-av-…
pidarped Mar 14, 2025
34177c7
Address review comments.
pidarped Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
307 changes: 307 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -7014,6 +7014,291 @@ cluster LowPower = 1288 {
command Sleep(): DefaultSuccess = 0;
}

/** The Camera AV Stream Management cluster is used to allow clients to manage, control, and configure various audio, video, and snapshot streams on a camera. */
provisional cluster CameraAvStreamManagement = 1361 {
revision 1;

enum AudioCodecEnum : enum8 {
kOPUS = 0;
kAACLC = 1;
}

enum ImageCodecEnum : enum8 {
kJPEG = 0;
}

enum StreamUsageEnum : enum8 {
kInternal = 0;
kRecording = 1;
kAnalysis = 2;
kLiveView = 3;
}

enum TriStateAutoEnum : enum8 {
kOff = 0;
kOn = 1;
kAuto = 2;
}

enum TwoWayTalkSupportTypeEnum : enum8 {
kNotSupported = 0;
kHalfDuplex = 1;
kFullDuplex = 2;
}

enum VideoCodecEnum : enum8 {
kH264 = 0;
kHEVC = 1;
kVVC = 2;
kAV1 = 3;
}

bitmap Feature : bitmap32 {
kAudio = 0x1;
kVideo = 0x2;
kSnapshot = 0x4;
kPrivacy = 0x8;
kSpeaker = 0x10;
kImageControl = 0x20;
kWatermark = 0x40;
kOnScreenDisplay = 0x80;
kLocalStorage = 0x100;
kHighDynamicRange = 0x200;
}

struct VideoResolutionStruct {
int16u width = 0;
int16u height = 1;
}

struct VideoStreamStruct {
int16u videoStreamID = 0;
StreamUsageEnum streamUsage = 1;
VideoCodecEnum videoCodec = 2;
int16u minFrameRate = 3;
int16u maxFrameRate = 4;
VideoResolutionStruct minResolution = 5;
VideoResolutionStruct maxResolution = 6;
int32u minBitRate = 7;
int32u maxBitRate = 8;
int16u minFragmentLen = 9;
int16u maxFragmentLen = 10;
optional boolean watermarkEnabled = 11;
optional boolean OSDEnabled = 12;
int8u referenceCount = 13;
}

struct SnapshotStreamStruct {
int16u snapshotStreamID = 0;
ImageCodecEnum imageCodec = 1;
int16u frameRate = 2;
int32u bitRate = 3;
VideoResolutionStruct minResolution = 4;
VideoResolutionStruct maxResolution = 5;
int8u quality = 6;
int8u referenceCount = 7;
}

struct SnapshotParamsStruct {
VideoResolutionStruct resolution = 0;
int16u maxFrameRate = 1;
ImageCodecEnum imageCodec = 2;
}

struct RateDistortionTradeOffPointsStruct {
VideoCodecEnum codec = 0;
VideoResolutionStruct resolution = 1;
int32u minBitRate = 2;
}

struct AudioCapabilitiesStruct {
int8u maxNumberOfChannels = 0;
AudioCodecEnum supportedCodecs[] = 1;
int32u supportedSampleRates[] = 2;
int8u supportedBitDepths[] = 3;
}

struct AudioStreamStruct {
int16u audioStreamID = 0;
StreamUsageEnum streamUsage = 1;
AudioCodecEnum audioCodec = 2;
int8u channelCount = 3;
int32u sampleRate = 4;
int32u bitRate = 5;
int8u bitDepth = 6;
int8u referenceCount = 7;
}

struct VideoSensorParamsStruct {
int16u sensorWidth = 0;
int16u sensorHeight = 1;
int16u maxFPS = 2;
optional int16u maxHDRFPS = 3;
}

struct ViewportStruct {
int16u x1 = 0;
int16u y1 = 1;
int16u x2 = 2;
int16u y2 = 3;
}

readonly attribute optional int8u maxConcurrentVideoEncoders = 0;
readonly attribute optional int32u maxEncodedPixelRate = 1;
readonly attribute optional VideoSensorParamsStruct videoSensorParams = 2;
readonly attribute optional boolean nightVisionCapable = 3;
readonly attribute optional VideoResolutionStruct minViewport = 4;
readonly attribute optional RateDistortionTradeOffPointsStruct rateDistortionTradeOffPoints[] = 5;
readonly attribute int32u maxContentBufferSize = 6;
readonly attribute optional AudioCapabilitiesStruct microphoneCapabilities = 7;
readonly attribute optional AudioCapabilitiesStruct speakerCapabilities = 8;
readonly attribute optional TwoWayTalkSupportTypeEnum twoWayTalkSupport = 9;
readonly attribute optional SnapshotParamsStruct supportedSnapshotParams[] = 10;
readonly attribute int32u maxNetworkBandwidth = 11;
readonly attribute optional int16u currentFrameRate = 12;
attribute access(read: manage, write: manage) optional boolean HDRModeEnabled = 13;
readonly attribute StreamUsageEnum supportedStreamUsages[] = 14;
readonly attribute optional VideoStreamStruct allocatedVideoStreams[] = 15;
readonly attribute optional AudioStreamStruct allocatedAudioStreams[] = 16;
readonly attribute optional SnapshotStreamStruct allocatedSnapshotStreams[] = 17;
readonly attribute optional StreamUsageEnum rankedVideoStreamPrioritiesList[] = 18;
attribute optional boolean softRecordingPrivacyModeEnabled = 19;
attribute optional boolean softLivestreamPrivacyModeEnabled = 20;
readonly attribute optional boolean hardPrivacyModeOn = 21;
attribute access(read: manage, write: manage) optional TriStateAutoEnum nightVision = 22;
attribute access(read: manage, write: manage) optional TriStateAutoEnum nightVisionIllum = 23;
attribute access(read: manage, write: manage) optional ViewportStruct viewport = 24;
attribute access(read: manage, write: manage) optional boolean speakerMuted = 25;
attribute access(read: manage, write: manage) optional int8u speakerVolumeLevel = 26;
readonly attribute access(read: manage) optional int8u speakerMaxLevel = 27;
readonly attribute access(read: manage) optional int8u speakerMinLevel = 28;
attribute access(read: manage, write: manage) optional boolean microphoneMuted = 29;
attribute access(read: manage, write: manage) optional int8u microphoneVolumeLevel = 30;
readonly attribute access(read: manage) optional int8u microphoneMaxLevel = 31;
readonly attribute access(read: manage) optional int8u microphoneMinLevel = 32;
attribute access(read: manage, write: manage) optional boolean microphoneAGCEnabled = 33;
attribute access(read: manage, write: manage) optional int16u imageRotation = 34;
attribute access(read: manage, write: manage) optional boolean imageFlipHorizontal = 35;
attribute access(read: manage, write: manage) optional boolean imageFlipVertical = 36;
attribute access(read: manage, write: manage) optional boolean localVideoRecordingEnabled = 37;
attribute access(read: manage, write: manage) optional boolean localSnapshotRecordingEnabled = 38;
attribute access(read: manage, write: manage) optional boolean statusLightEnabled = 39;
attribute access(read: manage, write: manage) optional ThreeLevelAutoEnum statusLightBrightness = 40;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct AudioStreamAllocateRequest {
StreamUsageEnum streamUsage = 0;
AudioCodecEnum audioCodec = 1;
int8u channelCount = 2;
int32u sampleRate = 3;
int32u bitRate = 4;
int8u bitDepth = 5;
}

response struct AudioStreamAllocateResponse = 1 {
int16u audioStreamID = 0;
}

request struct AudioStreamDeallocateRequest {
int16u audioStreamID = 0;
}

request struct VideoStreamAllocateRequest {
StreamUsageEnum streamUsage = 0;
VideoCodecEnum videoCodec = 1;
int16u minFrameRate = 2;
int16u maxFrameRate = 3;
VideoResolutionStruct minResolution = 4;
VideoResolutionStruct maxResolution = 5;
int32u minBitRate = 6;
int32u maxBitRate = 7;
int16u minFragmentLen = 8;
int16u maxFragmentLen = 9;
optional boolean watermarkEnabled = 10;
optional boolean OSDEnabled = 11;
}

response struct VideoStreamAllocateResponse = 4 {
int16u videoStreamID = 0;
}

request struct VideoStreamModifyRequest {
int16u videoStreamID = 0;
optional boolean watermarkEnabled = 1;
optional boolean OSDEnabled = 2;
}

request struct VideoStreamDeallocateRequest {
int16u videoStreamID = 0;
}

request struct SnapshotStreamAllocateRequest {
ImageCodecEnum imageCodec = 0;
int16u maxFrameRate = 1;
int32u bitRate = 2;
VideoResolutionStruct minResolution = 3;
VideoResolutionStruct maxResolution = 4;
int8u quality = 5;
optional boolean watermarkEnabled = 6;
optional boolean OSDEnabled = 7;
}

response struct SnapshotStreamAllocateResponse = 8 {
int16u snapshotStreamID = 0;
}

request struct SnapshotStreamModifyRequest {
int16u snapshotStreamID = 0;
optional boolean watermarkEnabled = 1;
optional boolean OSDEnabled = 2;
}

request struct SnapshotStreamDeallocateRequest {
int16u snapshotStreamID = 0;
}

request struct SetStreamPrioritiesRequest {
StreamUsageEnum streamPriorities[] = 0;
}

request struct CaptureSnapshotRequest {
int16u snapshotStreamID = 0;
VideoResolutionStruct requestedResolution = 1;
}

response struct CaptureSnapshotResponse = 13 {
octet_string data = 0;
ImageCodecEnum imageCodec = 1;
VideoResolutionStruct resolution = 2;
}

/** This command SHALL allocate an audio stream on the camera and return an allocated audio stream identifier. */
command access(invoke: manage) AudioStreamAllocate(AudioStreamAllocateRequest): AudioStreamAllocateResponse = 0;
/** This command SHALL deallocate an audio stream on the camera, corresponding to the given audio stream identifier. */
command access(invoke: manage) AudioStreamDeallocate(AudioStreamDeallocateRequest): DefaultSuccess = 2;
/** This command SHALL allocate a video stream on the camera and return an allocated video stream identifier. */
command access(invoke: manage) VideoStreamAllocate(VideoStreamAllocateRequest): VideoStreamAllocateResponse = 3;
/** This command SHALL be used to modify a stream specified by the VideoStreamID. */
command access(invoke: manage) VideoStreamModify(VideoStreamModifyRequest): DefaultSuccess = 5;
/** This command SHALL deallocate a video stream on the camera, corresponding to the given video stream identifier. */
command access(invoke: manage) VideoStreamDeallocate(VideoStreamDeallocateRequest): DefaultSuccess = 6;
/** This command SHALL allocate a snapshot stream on the device and return an allocated snapshot stream identifier. */
command access(invoke: manage) SnapshotStreamAllocate(SnapshotStreamAllocateRequest): SnapshotStreamAllocateResponse = 7;
/** This command SHALL be used to modify a stream specified by the VideoStreamID. */
command access(invoke: manage) SnapshotStreamModify(SnapshotStreamModifyRequest): DefaultSuccess = 9;
/** This command SHALL deallocate an snapshot stream on the camera, corresponding to the given snapshot stream identifier. */
command access(invoke: manage) SnapshotStreamDeallocate(SnapshotStreamDeallocateRequest): DefaultSuccess = 10;
/** This command SHALL set the relative priorities of the various stream usages on the camera. */
command access(invoke: administer) SetStreamPriorities(SetStreamPrioritiesRequest): DefaultSuccess = 11;
/** This command SHALL return a Snapshot from the camera. */
command CaptureSnapshot(CaptureSnapshotRequest): CaptureSnapshotResponse = 12;
}

/** This cluster provides facilities to configure and play Chime sounds, such as those used in a doorbell. */
provisional cluster Chime = 1366 {
revision 1;
Expand Down Expand Up @@ -9313,6 +9598,28 @@ endpoint 1 {
handle command Sleep;
}

server cluster CameraAvStreamManagement {
callback attribute maxContentBufferSize;
callback attribute supportedSnapshotParams;
callback attribute maxNetworkBandwidth;
callback attribute supportedStreamUsages;
callback attribute allocatedSnapshotStreams;
callback attribute nightVision;
callback attribute nightVisionIllum;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute attributeList;
callback attribute featureMap;
ram attribute clusterRevision default = 1;

handle command SnapshotStreamAllocate;
handle command SnapshotStreamAllocateResponse;
handle command SnapshotStreamDeallocate;
handle command SetStreamPriorities;
handle command CaptureSnapshot;
handle command CaptureSnapshotResponse;
}

server cluster Chime {
callback attribute installedChimeSounds;
callback attribute selectedChime;
Expand Down
Loading
Loading