mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge branch 'bugfix/openprojector-build-error' into 4.x-current
This commit is contained in:
commit
4e19e41460
@ -14,6 +14,6 @@ apt-get install -y \
|
||||
qtbase5-dev
|
||||
|
||||
# Dirty hack
|
||||
wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/master/UI/obs-frontend-api/obs-frontend-api.h
|
||||
wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/24.0.3/UI/obs-frontend-api/obs-frontend-api.h
|
||||
|
||||
ldconfig
|
||||
|
@ -798,8 +798,6 @@ void getPauseRecordingFunctions(RecordingPausedFunction* recPausedFuncPtr, Pause
|
||||
if (pauseRecFuncPtr) {
|
||||
*pauseRecFuncPtr = (PauseRecordingFunction)os_dlsym(frontendApi, "obs_frontend_recording_pause");
|
||||
}
|
||||
|
||||
os_dlclose(frontendApi);
|
||||
}
|
||||
|
||||
bool Utils::RecordingPauseSupported()
|
||||
@ -835,6 +833,34 @@ void Utils::PauseRecording(bool pause)
|
||||
pauseRecording(pause);
|
||||
}
|
||||
|
||||
bool Utils::OpenProjectorSupported()
|
||||
{
|
||||
void* frontendApi = os_dlopen("obs-frontend-api");
|
||||
if (!frontendApi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void* openProjectorFunc = os_dlsym(frontendApi, "obs_frontend_open_projector");
|
||||
return (openProjectorFunc != nullptr);
|
||||
}
|
||||
|
||||
void Utils::OpenProjector(const char* type, int monitor, const char* geometry, const char* name)
|
||||
{
|
||||
typedef void(*OpenProjectorFunc)(const char*, int monitor, const char* geometry, const char* name);
|
||||
|
||||
void* frontendApi = os_dlopen("obs-frontend-api");
|
||||
if (!frontendApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
OpenProjectorFunc openProjectorFunc = (OpenProjectorFunc)os_dlsym(frontendApi, "obs_frontend_open_projector");
|
||||
if (!openProjectorFunc) {
|
||||
return;
|
||||
}
|
||||
|
||||
openProjectorFunc(type, monitor, geometry, name);
|
||||
}
|
||||
|
||||
QString Utils::nsToTimestamp(uint64_t ns)
|
||||
{
|
||||
uint64_t ms = ns / 1000000ULL;
|
||||
|
@ -86,5 +86,8 @@ namespace Utils {
|
||||
bool RecordingPaused();
|
||||
void PauseRecording(bool pause);
|
||||
|
||||
bool OpenProjectorSupported();
|
||||
void OpenProjector(const char* type, int monitor, const char* geometry, const char* name);
|
||||
|
||||
QString nsToTimestamp(uint64_t ns);
|
||||
};
|
||||
|
@ -331,17 +331,20 @@ RpcResponse WSRequestHandler::GetVideoInfo(const RpcRequest& request) {
|
||||
* @since unreleased
|
||||
*/
|
||||
RpcResponse WSRequestHandler::OpenProjector(const RpcRequest& request) {
|
||||
#if LIBOBS_API_VER >= 0x18000004
|
||||
const char *type = obs_data_get_string(request.parameters(), "type");
|
||||
if (!Utils::OpenProjectorSupported()) {
|
||||
return request.failed("Projector opening requires OBS 24.0.4 or newer.");
|
||||
}
|
||||
|
||||
const char* type = obs_data_get_string(request.parameters(), "type");
|
||||
|
||||
int monitor = -1;
|
||||
if (request.hasField("monitor")) {
|
||||
monitor = obs_data_get_int(request.parameters(), "monitor");
|
||||
}
|
||||
const char *geometry = obs_data_get_string(request.parameters(), "geometry");
|
||||
const char *name = obs_data_get_string(request.parameters(), "name");
|
||||
obs_frontend_open_projector(type, monitor, geometry, name);
|
||||
|
||||
const char* geometry = obs_data_get_string(request.parameters(), "geometry");
|
||||
const char* name = obs_data_get_string(request.parameters(), "name");
|
||||
|
||||
Utils::OpenProjector(type, monitor, geometry, name);
|
||||
return request.success();
|
||||
#else
|
||||
return request.failed("Projector opening requires libobs v24.0.4 or newer.");
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user