界面与品牌 - 默认 UI 语言固定为英文,不再跟随系统区域设置自动切换(frontend/OBSApp.cpp),用户仍可在设置中手动切换 - 程序图标更换为 CAIIC logo:exe 图标 obs-studio.ico 及界面/托盘/About 图标 obs.png - About 窗口精简为 logo + 名称 + 版本号,移除项目介绍、赞助名单、Authors/License 标签页 - 版本号定为 1.0.0(构建参数 OBS_VERSION_OVERRIDE=1.0.0) 分辨率支持 - 移除首次启动将画布强制限制为 1920x1080 的逻辑,默认使用显示器原生分辨率 - 设置-视频 与自动配置向导新增 3840x2160 / 2560x1440 预设 - 自动配置向导性能测试上限放宽至 4K60(软硬件编码数据率上限及起始分辨率钳制) 插件 - 集成 obs-shaderfilter 2.6.0(绿幕抠图/自定义着色器滤镜),并适配新版 libobs 的 gs_image_file_ex API - 补齐缺失的源码:obs-browser、obs-websocket、libdshowcapture(含 external/capture-device-support) 工程 - 新增 .gitignore,排除 deploy/ 发布目录与构建日志
80 lines
2.6 KiB
C
80 lines
2.6 KiB
C
/*
|
|
obs-websocket
|
|
Copyright (C) 2020-2021 Kyle Manning <tt2468@gmail.com>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
with this program. If not, see <https://www.gnu.org/licenses/>
|
|
*/
|
|
|
|
// Similar example code can be found in ../../src/obs-websocket.cpp
|
|
// You can test that sample code by specifying -DPLUGIN_TESTS=TRUE
|
|
|
|
#include <obs-module.h>
|
|
|
|
#include "../obs-websocket-api.h"
|
|
|
|
OBS_DECLARE_MODULE()
|
|
OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US")
|
|
|
|
obs_websocket_vendor vendor;
|
|
|
|
bool obs_module_load(void)
|
|
{
|
|
blog(LOG_INFO, "Example obs-websocket-api plugin loaded!");
|
|
return true;
|
|
}
|
|
|
|
void example_request_cb(obs_data_t *request_data, obs_data_t *response_data, void *priv_data);
|
|
void obs_module_post_load(void)
|
|
{
|
|
vendor = obs_websocket_register_vendor("api_example_plugin");
|
|
if (!vendor) {
|
|
blog(LOG_ERROR, "Vendor registration failed! (obs-websocket should have logged something if installed properly.)");
|
|
return;
|
|
}
|
|
|
|
if (!obs_websocket_vendor_register_request(vendor, "example_request", example_request_cb, NULL))
|
|
blog(LOG_ERROR, "Failed to register `example_request` request with obs-websocket.");
|
|
|
|
uint api_version = obs_websocket_get_api_version();
|
|
if (api_version == 0) {
|
|
blog(LOG_ERROR, "Unable to fetch obs-websocket plugin API version.");
|
|
return;
|
|
} else if (api_version == 1) {
|
|
blog(LOG_WARNING, "Unsupported obs-websocket plugin API version for calling requests.");
|
|
return;
|
|
}
|
|
|
|
struct obs_websocket_request_response *response = obs_websocket_call_request("GetVersion");
|
|
if (!response) {
|
|
blog(LOG_ERROR, "Failed to call GetVersion due to obs-websocket not being installed.");
|
|
return;
|
|
}
|
|
blog(LOG_INFO, "[obs_module_post_load] Called GetVersion. Status Code: %u | Comment: %s | Response Data: %s",
|
|
response->status_code, response->comment, response->response_data);
|
|
obs_websocket_request_response_free(response);
|
|
}
|
|
|
|
void obs_module_unload(void)
|
|
{
|
|
blog(LOG_INFO, "Example obs-websocket-api plugin unloaded!");
|
|
}
|
|
|
|
void example_request_cb(obs_data_t *request_data, obs_data_t *response_data, void *priv_data)
|
|
{
|
|
if (obs_data_has_user_value(request_data, "ping"))
|
|
obs_data_set_bool(response_data, "pong", true);
|
|
|
|
UNUSED_PARAMETER(priv_data);
|
|
}
|