mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #438 from Palakis/feature/remove-dynamic-load-functions
Remove dynloaded functions
This commit is contained in:
commit
3a8703de87
@ -14,6 +14,6 @@ apt-get install -y \
|
|||||||
qtbase5-dev
|
qtbase5-dev
|
||||||
|
|
||||||
# Dirty hack
|
# Dirty hack
|
||||||
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
|
wget -O /usr/include/obs/obs-frontend-api.h https://raw.githubusercontent.com/obsproject/obs-studio/25.0.0/UI/obs-frontend-api/obs-frontend-api.h
|
||||||
|
|
||||||
ldconfig
|
ldconfig
|
||||||
|
@ -831,67 +831,6 @@ void getPauseRecordingFunctions(RecordingPausedFunction* recPausedFuncPtr, Pause
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::RecordingPauseSupported()
|
|
||||||
{
|
|
||||||
RecordingPausedFunction recordingPaused = nullptr;
|
|
||||||
PauseRecordingFunction pauseRecording = nullptr;
|
|
||||||
getPauseRecordingFunctions(&recordingPaused, &pauseRecording);
|
|
||||||
|
|
||||||
return (recordingPaused && pauseRecording);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Utils::RecordingPaused()
|
|
||||||
{
|
|
||||||
RecordingPausedFunction recordingPaused = nullptr;
|
|
||||||
getPauseRecordingFunctions(&recordingPaused, nullptr);
|
|
||||||
|
|
||||||
if (recordingPaused == nullptr) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return recordingPaused();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Utils::PauseRecording(bool pause)
|
|
||||||
{
|
|
||||||
PauseRecordingFunction pauseRecording = nullptr;
|
|
||||||
getPauseRecordingFunctions(nullptr, &pauseRecording);
|
|
||||||
|
|
||||||
if (pauseRecording == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
QString Utils::nsToTimestamp(uint64_t ns)
|
||||||
{
|
{
|
||||||
uint64_t ms = ns / 1000000ULL;
|
uint64_t ms = ns / 1000000ULL;
|
||||||
|
@ -83,12 +83,5 @@ namespace Utils {
|
|||||||
const char* GetFilenameFormatting();
|
const char* GetFilenameFormatting();
|
||||||
bool SetFilenameFormatting(const char* filenameFormatting);
|
bool SetFilenameFormatting(const char* filenameFormatting);
|
||||||
|
|
||||||
bool RecordingPauseSupported();
|
|
||||||
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);
|
QString nsToTimestamp(uint64_t ns);
|
||||||
};
|
};
|
||||||
|
@ -747,7 +747,7 @@ void WSEvents::OnExit() {
|
|||||||
void WSEvents::StreamStatus() {
|
void WSEvents::StreamStatus() {
|
||||||
bool streamingActive = obs_frontend_streaming_active();
|
bool streamingActive = obs_frontend_streaming_active();
|
||||||
bool recordingActive = obs_frontend_recording_active();
|
bool recordingActive = obs_frontend_recording_active();
|
||||||
bool recordingPaused = Utils::RecordingPaused();
|
bool recordingPaused = obs_frontend_recording_paused();
|
||||||
bool replayBufferActive = obs_frontend_replay_buffer_active();
|
bool replayBufferActive = obs_frontend_replay_buffer_active();
|
||||||
|
|
||||||
OBSOutputAutoRelease streamOutput = obs_frontend_get_streaming_output();
|
OBSOutputAutoRelease streamOutput = obs_frontend_get_streaming_output();
|
||||||
@ -831,7 +831,7 @@ void WSEvents::Heartbeat() {
|
|||||||
|
|
||||||
bool streamingActive = obs_frontend_streaming_active();
|
bool streamingActive = obs_frontend_streaming_active();
|
||||||
bool recordingActive = obs_frontend_recording_active();
|
bool recordingActive = obs_frontend_recording_active();
|
||||||
bool recordingPaused = Utils::RecordingPaused();
|
bool recordingPaused = obs_frontend_recording_paused();
|
||||||
|
|
||||||
OBSDataAutoRelease data = obs_data_create();
|
OBSDataAutoRelease data = obs_data_create();
|
||||||
OBSOutputAutoRelease recordOutput = obs_frontend_get_recording_output();
|
OBSOutputAutoRelease recordOutput = obs_frontend_get_recording_output();
|
||||||
|
@ -331,10 +331,6 @@ RpcResponse WSRequestHandler::GetVideoInfo(const RpcRequest& request) {
|
|||||||
* @since unreleased
|
* @since unreleased
|
||||||
*/
|
*/
|
||||||
RpcResponse WSRequestHandler::OpenProjector(const RpcRequest& request) {
|
RpcResponse WSRequestHandler::OpenProjector(const RpcRequest& request) {
|
||||||
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");
|
const char* type = obs_data_get_string(request.parameters(), "type");
|
||||||
|
|
||||||
int monitor = -1;
|
int monitor = -1;
|
||||||
@ -345,6 +341,6 @@ RpcResponse WSRequestHandler::OpenProjector(const RpcRequest& request) {
|
|||||||
const char* geometry = obs_data_get_string(request.parameters(), "geometry");
|
const char* geometry = obs_data_get_string(request.parameters(), "geometry");
|
||||||
const char* name = obs_data_get_string(request.parameters(), "name");
|
const char* name = obs_data_get_string(request.parameters(), "name");
|
||||||
|
|
||||||
Utils::OpenProjector(type, monitor, geometry, name);
|
obs_frontend_open_projector(type, monitor, geometry, name);
|
||||||
return request.success();
|
return request.success();
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ RpcResponse ifCanPause(const RpcRequest& request, std::function<RpcResponse()> c
|
|||||||
return request.failed("recording is not active");
|
return request.failed("recording is not active");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utils::RecordingPauseSupported()) {
|
|
||||||
return request.failed("recording pauses are not available in this version of OBS Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +73,11 @@ RpcResponse WSRequestHandler::StartRecording(const RpcRequest& request) {
|
|||||||
*/
|
*/
|
||||||
RpcResponse WSRequestHandler::PauseRecording(const RpcRequest& request) {
|
RpcResponse WSRequestHandler::PauseRecording(const RpcRequest& request) {
|
||||||
return ifCanPause(request, [request]() {
|
return ifCanPause(request, [request]() {
|
||||||
if (Utils::RecordingPaused()) {
|
if (obs_frontend_recording_paused()) {
|
||||||
return request.failed("recording already paused");
|
return request.failed("recording already paused");
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::PauseRecording(true);
|
obs_frontend_recording_pause(true);
|
||||||
return request.success();
|
return request.success();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -97,11 +93,11 @@ RpcResponse WSRequestHandler::PauseRecording(const RpcRequest& request) {
|
|||||||
*/
|
*/
|
||||||
RpcResponse WSRequestHandler::ResumeRecording(const RpcRequest& request) {
|
RpcResponse WSRequestHandler::ResumeRecording(const RpcRequest& request) {
|
||||||
return ifCanPause(request, [request]() {
|
return ifCanPause(request, [request]() {
|
||||||
if (!Utils::RecordingPaused()) {
|
if (!obs_frontend_recording_paused()) {
|
||||||
return request.failed("recording is not paused");
|
return request.failed("recording is not paused");
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::PauseRecording(false);
|
obs_frontend_recording_pause(false);
|
||||||
return request.success();
|
return request.success();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ RpcResponse WSRequestHandler::GetStreamingStatus(const RpcRequest& request) {
|
|||||||
OBSDataAutoRelease data = obs_data_create();
|
OBSDataAutoRelease data = obs_data_create();
|
||||||
obs_data_set_bool(data, "streaming", obs_frontend_streaming_active());
|
obs_data_set_bool(data, "streaming", obs_frontend_streaming_active());
|
||||||
obs_data_set_bool(data, "recording", obs_frontend_recording_active());
|
obs_data_set_bool(data, "recording", obs_frontend_recording_active());
|
||||||
obs_data_set_bool(data, "recording-paused", Utils::RecordingPaused());
|
obs_data_set_bool(data, "recording-paused", obs_frontend_recording_paused());
|
||||||
obs_data_set_bool(data, "preview-only", false);
|
obs_data_set_bool(data, "preview-only", false);
|
||||||
|
|
||||||
if (obs_frontend_streaming_active()) {
|
if (obs_frontend_streaming_active()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user