Skip to content

Commit 0b42e3d

Browse files
PalakisStéphane L
authored andcommitted
outputs: add more info fields
1 parent 2b746d1 commit 0b42e3d

1 file changed

Lines changed: 32 additions & 7 deletions

File tree

src/WSRequestHandler_Outputs.cpp

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@
44
* @typedef {Object} `Output`
55
* @property {String} `name` Output name
66
* @property {String} `type` Output type/kind
7+
* @property {int} `width` Video output width
8+
* @property {int} `height` Video output height
9+
* @property {Object} `flags` Output flags
10+
* @property {int} `flags.rawValue` Raw flags value
11+
* @property {boolean} `flags.audio` Output uses audio
12+
* @property {boolean} `flags.video` Output uses video
13+
* @property {boolean} `flags.encoded` Output is encoded
14+
* @property {boolean} `flags.multiTrack` Output uses several audio tracks
15+
* @property {boolean} `flags.service` Output uses a service
716
* @property {Object} `settings` Output name
817
* @property {boolean} `active` Output status (active or not)
18+
* @property {boolean} `reconnecting` Output reconnection status (reconnecting or not)
919
* @property {double} `congestion` Output congestion
20+
* @property {int} `totalFrames` Number of frames sent
21+
* @property {int} `droppedFrames` Number of frames dropped
22+
* @property {int} `totalBytes` Total bytes sent
1023
*/
1124
obs_data_t* getOutputInfo(obs_output_t* output)
1225
{
@@ -16,22 +29,34 @@ obs_data_t* getOutputInfo(obs_output_t* output)
1629

1730
OBSDataAutoRelease settings = obs_output_get_settings(output);
1831

32+
uint32_t rawFlags = obs_output_get_flags(output);
33+
OBSDataAutoRelease flags = obs_data_create();
34+
obs_data_set_int(flags, "rawValue", rawFlags);
35+
obs_data_set_bool(flags, "audio", rawFlags & OBS_OUTPUT_AUDIO);
36+
obs_data_set_bool(flags, "video", rawFlags & OBS_OUTPUT_VIDEO);
37+
obs_data_set_bool(flags, "encoded", rawFlags & OBS_OUTPUT_ENCODED);
38+
obs_data_set_bool(flags, "multiTrack", rawFlags & OBS_OUTPUT_MULTI_TRACK);
39+
obs_data_set_bool(flags, "service", rawFlags & OBS_OUTPUT_SERVICE);
40+
1941
obs_data_t* data = obs_data_create();
42+
2043
obs_data_set_string(data, "name", obs_output_get_name(output));
2144
obs_data_set_string(data, "type", obs_output_get_id(output));
22-
// TODO flags
45+
obs_data_set_int(data, "width", obs_output_get_width(output));
46+
obs_data_set_int(data, "height", obs_output_get_height(output));
47+
obs_data_set_obj(data, "flags", flags);
2348
obs_data_set_obj(data, "settings", settings);
49+
2450
obs_data_set_bool(data, "active", obs_output_active(output));
25-
// TODO reconnecting
51+
obs_data_set_bool(data, "reconnecting", obs_output_reconnecting(output));
2652
obs_data_set_double(data, "congestion", obs_output_get_congestion(output));
27-
// TODO width
28-
// TODO height
53+
obs_data_set_int(data, "totalFrames", obs_output_get_total_frames(output));
54+
obs_data_set_int(data, "droppedFrames", obs_output_get_frames_dropped(output));
55+
obs_data_set_int(data, "totalBytes", obs_output_get_total_bytes(output));
2956
// TODO delay
3057
// TODO active delay
58+
3159
// TODO connect time ms
32-
// TODO total frames
33-
// TODO frames dropped
34-
// TODO total bytes
3560
return data;
3661
}
3762

0 commit comments

Comments
 (0)