sdk: Update video stream configuration return type

This commit is contained in:
Koushik Dutta
2024-08-09 09:58:11 -07:00
parent 1cd5c194cc
commit 171b04f267
6 changed files with 185 additions and 14 deletions

4
sdk/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/sdk",
"version": "0.3.50",
"version": "0.3.51",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/sdk",
"version": "0.3.50",
"version": "0.3.51",
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.24.7",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/sdk",
"version": "0.3.50",
"version": "0.3.51",
"description": "",
"main": "dist/src/index.js",
"exports": {

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/types",
"version": "0.3.46",
"version": "0.3.47",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/types",
"version": "0.3.46",
"version": "0.3.47",
"license": "ISC",
"devDependencies": {
"@types/node": "^22.1.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/types",
"version": "0.3.46",
"version": "0.3.47",
"description": "",
"main": "dist/index.js",
"author": "",

View File

@@ -358,11 +358,11 @@ class RequestVideoStreamOptions(TypedDict):
fps: float
h264Info: H264Info
height: float
idrIntervalMillis: float # Key Frame interval in milliseconds.
keyframeInterval: float # Key Frame interval in frames.
maxBitrate: float
minBitrate: float
profile: str
quality: float
width: float
class ScryptedDeviceAccessControl(TypedDict):
@@ -378,6 +378,29 @@ class VideoResource(TypedDict):
thumbnail: Resource
video: Resource
class VideoStreamConfiguration(TypedDict):
bitrate: float
bitrateControl: Any | Any
bitrateControls: list[str]
bitrateRange: tuple[float, float]
codec: str
codecs: list[str]
fps: float
fpsRange: tuple[float, float]
h264Info: H264Info
height: float
keyframeInterval: float # Key Frame interval in frames.
keyframeIntervalRange: tuple[float, float]
maxBitrate: float
minBitrate: float
profile: str
profiles: list[str]
quality: float
qualityRange: tuple[float, float]
resolutions: list[tuple[float, float]]
width: float
class VideoStreamOptions(TypedDict):
bitrate: float
@@ -386,11 +409,11 @@ class VideoStreamOptions(TypedDict):
fps: float
h264Info: H264Info
height: float
idrIntervalMillis: float # Key Frame interval in milliseconds.
keyframeInterval: float # Key Frame interval in frames.
maxBitrate: float
minBitrate: float
profile: str
quality: float
width: float
class ImageFormat(TypedDict):
@@ -596,6 +619,11 @@ class MediaStatus(TypedDict):
metadata: Any
position: float
class MediaStreamConfiguration(TypedDict):
audio: AudioStreamOptions
video: VideoStreamConfiguration
class MediaStreamOptions(TypedDict):
"""Options passed to VideoCamera.getVideoStream to request specific media formats. The audio/video properties may be omitted to indicate no audio/video is available when calling getVideoStreamOptions or no audio/video is requested when calling getVideoStream."""
@@ -1525,7 +1553,7 @@ class VideoCamera:
class VideoCameraConfiguration:
async def setVideoStreamOptions(self, options: MediaStreamOptions) -> None:
async def setVideoStreamOptions(self, options: MediaStreamOptions) -> MediaStreamConfiguration:
pass

View File

@@ -453,10 +453,8 @@ export interface VideoStreamOptions {
minBitrate?: number;
maxBitrate?: number;
fps?: number;
/**
* Key Frame interval in milliseconds.
*/
idrIntervalMillis?: number;
// what the heck is this?
quality?: number;
/**
* Key Frame interval in frames.
*/
@@ -670,8 +668,153 @@ export interface VideoCamera {
getVideoStreamOptions(): Promise<ResponseMediaStreamOptions[]>;
}
// {
// "qualityRange": {
// "min": 0,
// "max": 5
// },
// "H264": {
// "resolutionsAvailable": [
// {
// "width": 1280,
// "height": 720
// },
// {
// "width": 1920,
// "height": 1080
// },
// {
// "width": 2688,
// "height": 1520
// },
// {
// "width": 3072,
// "height": 1728
// },
// {
// "width": 3840,
// "height": 2160
// }
// ],
// "govLengthRange": {
// "min": 1,
// "max": 400
// },
// "frameRateRange": {
// "min": 1,
// "max": 30
// },
// "encodingIntervalRange": {
// "min": 1,
// "max": 1
// },
// "H264ProfilesSupported": [
// "Baseline",
// "Main",
// "High"
// ]
// },
// "extension": {
// "H264": {
// "resolutionsAvailable": [
// {
// "width": 1280,
// "height": 720
// },
// {
// "width": 1920,
// "height": 1080
// },
// {
// "width": 2688,
// "height": 1520
// },
// {
// "width": 3072,
// "height": 1728
// },
// {
// "width": 3840,
// "height": 2160
// }
// ],
// "govLengthRange": {
// "min": 1,
// "max": 400
// },
// "frameRateRange": {
// "min": 1,
// "max": 30
// },
// "encodingIntervalRange": {
// "min": 1,
// "max": 1
// },
// "H264ProfilesSupported": [
// "Baseline",
// "Main",
// "High"
// ],
// "bitrateRange": {
// "min": 32,
// "max": 16384
// }
// }
// }
// }
export interface VideoStreamConfiguration extends VideoStreamOptions {
resolutions?: [number, number][];
fpsRange?: [number, number];
keyframeIntervalRange?: [number, number];
bitrateRange?: [number, number];
qualityRange?: [number, number];
profiles?: string[];
bitrateControls?: string[];
codecs?: string[];
}
// audio streams seem more restrictive around what can be configured.
// {
// "options": [
// {
// "encoding": "G711",
// "bitrateList": {
// "items": 64
// },
// "sampleRateList": {
// "items": 8
// }
// },
// {
// "encoding": "G726",
// "bitrateList": {
// "items": 16
// },
// "sampleRateList": {
// "items": 8
// }
// }
// ]
// }
export interface AudioStreamEncoding {
codec: string;
birates: number[];
sampleRates: number[];
}
export interface AudioStreamConfiguration extends AudioStreamOptions {
encodings?: AudioStreamEncoding[];
}
export interface MediaStreamConfiguration {
video?: VideoStreamConfiguration;
audio?: AudioStreamOptions;
}
// this is really just a mapping around onvif.
export interface VideoCameraConfiguration {
setVideoStreamOptions(options: MediaStreamOptions): Promise<void>;
setVideoStreamOptions(options: MediaStreamOptions): Promise<MediaStreamConfiguration>;
}
export interface RequestRecordingStreamOptions extends RequestMediaStreamOptions {