mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Provide info about color space and scaling
This commit is contained in:
parent
d3a7a6ef55
commit
b0512b3ba7
@ -2829,8 +2829,15 @@
|
||||
"subheads": [],
|
||||
"description": "Get basic OBS video information",
|
||||
"return": [
|
||||
"{Number} `base_width` Base (canvas) width",
|
||||
"{Number} `base_height` Base (canvas) height"
|
||||
"{Number} `baseWidth` Base (canvas) width",
|
||||
"{Number} `baseHeight` Base (canvas) height",
|
||||
"{Number} `outputWidth` Output width",
|
||||
"{Number} `outputHeight` Output height",
|
||||
"{String} `scaleType` Scaling method used if output size differs from base size",
|
||||
"{double} `fps` Frames rendered per second",
|
||||
"{String} `videoFormat` Video color format",
|
||||
"{String} `colorSpace` Color space for YUV",
|
||||
"{String} `colorRange` Color range (full or partial)"
|
||||
],
|
||||
"api": "requests",
|
||||
"name": "GetVideoInfo",
|
||||
@ -2839,13 +2846,48 @@
|
||||
"returns": [
|
||||
{
|
||||
"type": "Number",
|
||||
"name": "base_width",
|
||||
"name": "baseWidth",
|
||||
"description": "Base (canvas) width"
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"name": "base_height",
|
||||
"name": "baseHeight",
|
||||
"description": "Base (canvas) height"
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"name": "outputWidth",
|
||||
"description": "Output width"
|
||||
},
|
||||
{
|
||||
"type": "Number",
|
||||
"name": "outputHeight",
|
||||
"description": "Output height"
|
||||
},
|
||||
{
|
||||
"type": "String",
|
||||
"name": "scaleType",
|
||||
"description": "Scaling method used if output size differs from base size"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "fps",
|
||||
"description": "Frames rendered per second"
|
||||
},
|
||||
{
|
||||
"type": "String",
|
||||
"name": "videoFormat",
|
||||
"description": "Video color format"
|
||||
},
|
||||
{
|
||||
"type": "String",
|
||||
"name": "colorSpace",
|
||||
"description": "Color space for YUV"
|
||||
},
|
||||
{
|
||||
"type": "String",
|
||||
"name": "colorRange",
|
||||
"description": "Color range (full or partial)"
|
||||
}
|
||||
],
|
||||
"names": [
|
||||
|
@ -1199,8 +1199,15 @@ _No specified parameters._
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | :---: | ------------|
|
||||
| `base_width` | _Number_ | Base (canvas) width |
|
||||
| `base_height` | _Number_ | Base (canvas) height |
|
||||
| `baseWidth` | _Number_ | Base (canvas) width |
|
||||
| `baseHeight` | _Number_ | Base (canvas) height |
|
||||
| `outputWidth` | _Number_ | Output width |
|
||||
| `outputHeight` | _Number_ | Output height |
|
||||
| `scaleType` | _String_ | Scaling method used if output size differs from base size |
|
||||
| `fps` | _double_ | Frames rendered per second |
|
||||
| `videoFormat` | _String_ | Video color format |
|
||||
| `colorSpace` | _String_ | Color space for YUV |
|
||||
| `colorRange` | _String_ | Color range (full or partial) |
|
||||
|
||||
|
||||
---
|
||||
|
@ -189,7 +189,11 @@ HandlerResponse WSRequestHandler::HandleGetStats(WSRequestHandler* req) {
|
||||
* @return {Number} `baseHeight` Base (canvas) height
|
||||
* @return {Number} `outputWidth` Output width
|
||||
* @return {Number} `outputHeight` Output height
|
||||
* @return {String} `scaleType` Scaling method used if output size differs from base size
|
||||
* @return {double} `fps` Frames rendered per second
|
||||
* @return {String} `videoFormat` Video color format
|
||||
* @return {String} `colorSpace` Color space for YUV
|
||||
* @return {String} `colorRange` Color range (full or partial)
|
||||
*
|
||||
* @api requests
|
||||
* @name GetVideoInfo
|
||||
@ -205,5 +209,56 @@ HandlerResponse WSRequestHandler::HandleGetVideoInfo(WSRequestHandler* req) {
|
||||
obs_data_set_int(response, "outputWidth", ovi.output_width);
|
||||
obs_data_set_int(response, "outputHeight", ovi.output_height);
|
||||
obs_data_set_double(response, "fps", (double)ovi.fps_num / ovi.fps_den);
|
||||
|
||||
switch (ovi.output_format) {
|
||||
#define CASE(x) case x: obs_data_set_string(response, "videoFormat", #x); break;
|
||||
CASE(VIDEO_FORMAT_NONE)
|
||||
CASE(VIDEO_FORMAT_I420)
|
||||
CASE(VIDEO_FORMAT_NV12)
|
||||
CASE(VIDEO_FORMAT_YVYU)
|
||||
CASE(VIDEO_FORMAT_YUY2)
|
||||
CASE(VIDEO_FORMAT_UYVY)
|
||||
CASE(VIDEO_FORMAT_RGBA)
|
||||
CASE(VIDEO_FORMAT_BGRA)
|
||||
CASE(VIDEO_FORMAT_BGRX)
|
||||
CASE(VIDEO_FORMAT_Y800)
|
||||
CASE(VIDEO_FORMAT_I444)
|
||||
#undef CASE
|
||||
default:
|
||||
obs_data_set_int(response, "videoFormat", ovi.output_format);
|
||||
}
|
||||
|
||||
switch (ovi.colorspace) {
|
||||
#define CASE(x) case x: obs_data_set_string(response, "colorSpace", #x); break;
|
||||
CASE(VIDEO_CS_DEFAULT)
|
||||
CASE(VIDEO_CS_601)
|
||||
CASE(VIDEO_CS_709)
|
||||
#undef CASE
|
||||
default:
|
||||
obs_data_set_int(response, "colorSpace", ovi.colorspace);
|
||||
}
|
||||
|
||||
switch (ovi.range) {
|
||||
#define CASE(x) case x: obs_data_set_string(response, "colorRange", #x); break;
|
||||
CASE(VIDEO_RANGE_DEFAULT)
|
||||
CASE(VIDEO_RANGE_PARTIAL)
|
||||
CASE(VIDEO_RANGE_FULL)
|
||||
#undef CASE
|
||||
default:
|
||||
obs_data_set_int(response, "colorRange", ovi.range);
|
||||
}
|
||||
|
||||
switch (ovi.scale_type) {
|
||||
#define CASE(x) case x: obs_data_set_string(response, "scaleType", #x); break;
|
||||
CASE(VIDEO_SCALE_DEFAULT)
|
||||
CASE(VIDEO_SCALE_POINT)
|
||||
CASE(VIDEO_SCALE_FAST_BILINEAR)
|
||||
CASE(VIDEO_SCALE_BILINEAR)
|
||||
CASE(VIDEO_SCALE_BICUBIC)
|
||||
#undef CASE
|
||||
default:
|
||||
obs_data_set_int(response, "scaleType", ovi.scale_type);
|
||||
}
|
||||
|
||||
return req->SendOKResponse(response);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user