From e3e62c3903f7142bad93042abc4b660fa0c945bd Mon Sep 17 00:00:00 2001 From: tt2468 Date: Fri, 15 May 2020 16:52:08 -0700 Subject: [PATCH 1/3] General: Fix a few warnings Fix a few build warnings on windows because im ocd --- src/WSEvents.cpp | 4 ++-- src/WSRequestHandler_Scenes.cpp | 2 +- src/WSRequestHandler_Sources.cpp | 2 +- src/WSRequestHandler_Streaming.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/WSEvents.cpp b/src/WSEvents.cpp index 37ada8ee..38257bb1 100644 --- a/src/WSEvents.cpp +++ b/src/WSEvents.cpp @@ -348,7 +348,7 @@ void WSEvents::hookTransitionPlaybackEvents() { obs_frontend_source_list transitions = {}; obs_frontend_get_transitions(&transitions); - for (int i = 0; i < transitions.sources.num; i++) { + for (uint i = 0; i < transitions.sources.num; i++) { obs_source_t* transition = transitions.sources.array[i]; signal_handler_t* sh = obs_source_get_signal_handler(transition); signal_handler_disconnect(sh, "transition_start", OnTransitionBegin, this); @@ -366,7 +366,7 @@ void WSEvents::unhookTransitionPlaybackEvents() { obs_frontend_source_list transitions = {}; obs_frontend_get_transitions(&transitions); - for (int i = 0; i < transitions.sources.num; i++) { + for (uint i = 0; i < transitions.sources.num; i++) { obs_source_t* transition = transitions.sources.array[i]; signal_handler_t* sh = obs_source_get_signal_handler(transition); signal_handler_disconnect(sh, "transition_start", OnTransitionBegin, this); diff --git a/src/WSRequestHandler_Scenes.cpp b/src/WSRequestHandler_Scenes.cpp index 40693a78..5fffdb51 100644 --- a/src/WSRequestHandler_Scenes.cpp +++ b/src/WSRequestHandler_Scenes.cpp @@ -121,7 +121,7 @@ RpcResponse WSRequestHandler::ReorderSceneItems(const RpcRequest& request) { struct obs_sceneitem_order_info info; size_t itemCount = obs_data_array_count(ctx->items); - for (int i = 0; i < itemCount; i++) { + for (uint i = 0; i < itemCount; i++) { OBSDataAutoRelease item = obs_data_array_item(ctx->items, i); OBSSceneItemAutoRelease sceneItem = Utils::GetSceneItemFromItem(scene, item); diff --git a/src/WSRequestHandler_Sources.cpp b/src/WSRequestHandler_Sources.cpp index a9ef5bef..c5d1cf9f 100644 --- a/src/WSRequestHandler_Sources.cpp +++ b/src/WSRequestHandler_Sources.cpp @@ -1633,7 +1633,7 @@ RpcResponse WSRequestHandler::TakeSourceScreenshot(const RpcRequest& request) { gs_stage_texture(stagesurface, gs_texrender_get_texture(texrender)); if (gs_stagesurface_map(stagesurface, &videoData, &videoLinesize)) { int linesize = sourceImage.bytesPerLine(); - for (int y = 0; y < imgHeight; y++) { + for (uint y = 0; y < imgHeight; y++) { memcpy(sourceImage.scanLine(y), videoData + (y * videoLinesize), linesize); } gs_stagesurface_unmap(stagesurface); diff --git a/src/WSRequestHandler_Streaming.cpp b/src/WSRequestHandler_Streaming.cpp index 744a691f..c8f5732e 100644 --- a/src/WSRequestHandler_Streaming.cpp +++ b/src/WSRequestHandler_Streaming.cpp @@ -103,10 +103,10 @@ RpcResponse WSRequestHandler::StartStreaming(const RpcRequest& request) { && obs_data_has_user_value(newSettings, "key")) { const char* key = obs_data_get_string(newSettings, "key"); - int keylen = strlen(key); + size_t keylen = strlen(key); bool hasQuestionMark = false; - for (int i = 0; i < keylen; i++) { + for (size_t i = 0; i < keylen; i++) { if (key[i] == '?') { hasQuestionMark = true; break; From 7bb91da1d094efc8f00a8d1aa26f4b6198bcd775 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Fri, 15 May 2020 16:30:01 -0700 Subject: [PATCH 2/3] Events: Add sourceType string to SourceRenamed Since sources in OBS are also scenes, provide the user a string so that they can differentiate. --- src/WSEvents.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/WSEvents.cpp b/src/WSEvents.cpp index 37ada8ee..4cf069d3 100644 --- a/src/WSEvents.cpp +++ b/src/WSEvents.cpp @@ -1177,6 +1177,7 @@ void WSEvents::OnSourceAudioMixersChanged(void* param, calldata_t* data) { * * @return {String} `previousName` Previous source name * @return {String} `newName` New source name + * @return {String} `sourceType` Type of source (input, scene, filter, transition) * * @api events * @name SourceRenamed @@ -1201,6 +1202,8 @@ void WSEvents::OnSourceRename(void* param, calldata_t* data) { OBSDataAutoRelease fields = obs_data_create(); obs_data_set_string(fields, "previousName", previousName); obs_data_set_string(fields, "newName", newName); + obs_data_set_string(fields, "sourceType", + sourceTypeToString(obs_source_get_type(source))); // TODO: Split into dedicated events for source/scene. Only doing it this way for backwards compatability until 5.0 self->broadcastUpdate("SourceRenamed", fields); } From 1f75b305c34be783c531016e8cbb45f275ba509f Mon Sep 17 00:00:00 2001 From: Azure CI <> Date: Tue, 26 May 2020 07:42:47 +0000 Subject: [PATCH 3/3] docs(ci): Update protocol.md - 0802d03 [skip ci] --- docs/generated/comments.json | 8 +++++++- docs/generated/protocol.md | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/generated/comments.json b/docs/generated/comments.json index a6e24f82..5c74beb4 100644 --- a/docs/generated/comments.json +++ b/docs/generated/comments.json @@ -2198,7 +2198,8 @@ "description": "A source has been renamed.", "return": [ "{String} `previousName` Previous source name", - "{String} `newName` New source name" + "{String} `newName` New source name", + "{String} `sourceType` Type of source (input, scene, filter, transition)" ], "api": "events", "name": "SourceRenamed", @@ -2214,6 +2215,11 @@ "type": "String", "name": "newName", "description": "New source name" + }, + { + "type": "String", + "name": "sourceType", + "description": "Type of source (input, scene, filter, transition)" } ], "names": [ diff --git a/docs/generated/protocol.md b/docs/generated/protocol.md index b7ff296b..5ea71f45 100644 --- a/docs/generated/protocol.md +++ b/docs/generated/protocol.md @@ -930,6 +930,7 @@ A source has been renamed. | ---- | :---: | ------------| | `previousName` | _String_ | Previous source name | | `newName` | _String_ | New source name | +| `sourceType` | _String_ | Type of source (input, scene, filter, transition) | ---