Version 1.2
Fix CMakeLists.txt. Add new feature to "--toggle-recording" from client. Set debug optimization flag to "-Og".
This commit is contained in:
parent
190b013e2d
commit
3a9ac9e58c
4 changed files with 36 additions and 3 deletions
|
@ -1,9 +1,16 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(obs-studio-plugin-unix-socket-control)
|
|
||||||
|
set(obs_usc_VERSION_MAJOR 1)
|
||||||
|
set(obs_usc_VERSION_MINOR 2)
|
||||||
|
set(obs_usc_VERSION_PATCH 0)
|
||||||
|
set(obs_usc_VERSION_STR "${obs_usc_VERSION_MAJOR}.${obs_usc_VERSION_MINOR}.${obs_usc_VERSION_PATCH}")
|
||||||
|
|
||||||
|
project(obs-studio-plugin-unix-socket-control VERSION "${obs_usc_VERSION_STR}")
|
||||||
|
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wall -Wextra -Wpedantic
|
-Wall -Wextra -Wpedantic
|
||||||
$<$<CONFIG:DEBUG>:-O0>
|
$<$<CONFIG:DEBUG>:-Og>
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE)
|
if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
16
src/client.c
16
src/client.c
|
@ -16,6 +16,7 @@ void print_usage(char *name) {
|
||||||
printf(" %s\n", name);
|
printf(" %s\n", name);
|
||||||
printf(" [--start-recording \n");
|
printf(" [--start-recording \n");
|
||||||
printf(" | --stop-recording\n");
|
printf(" | --stop-recording\n");
|
||||||
|
printf(" | --toggle-recording\n");
|
||||||
printf(" | --start-streaming\n");
|
printf(" | --start-streaming\n");
|
||||||
printf(" | --stop-streaming\n");
|
printf(" | --stop-streaming\n");
|
||||||
printf(" | --start-replay-buffer\n");
|
printf(" | --start-replay-buffer\n");
|
||||||
|
@ -40,6 +41,8 @@ int main(int argc, char **argv) {
|
||||||
type = UNIX_SOCKET_EVENT_STOP_RECORDING;
|
type = UNIX_SOCKET_EVENT_STOP_RECORDING;
|
||||||
} else if (strncmp(argv[1], "--start-streaming", 17) == 0) {
|
} else if (strncmp(argv[1], "--start-streaming", 17) == 0) {
|
||||||
type = UNIX_SOCKET_EVENT_START_STREAMING;
|
type = UNIX_SOCKET_EVENT_START_STREAMING;
|
||||||
|
} else if (strncmp(argv[1], "--toggle-recording", 18) == 0) {
|
||||||
|
type = UNIX_SOCKET_EVENT_TOGGLE_RECORDING;
|
||||||
} else if (strncmp(argv[1], "--stop-streaming", 16) == 0) {
|
} else if (strncmp(argv[1], "--stop-streaming", 16) == 0) {
|
||||||
type = UNIX_SOCKET_EVENT_STOP_STREAMING;
|
type = UNIX_SOCKET_EVENT_STOP_STREAMING;
|
||||||
} else if (strncmp(argv[1], "--start-replay-buffer", 21) == 0) {
|
} else if (strncmp(argv[1], "--start-replay-buffer", 21) == 0) {
|
||||||
|
@ -118,6 +121,19 @@ int main(int argc, char **argv) {
|
||||||
case UNIX_SOCKET_EVENT_STOP_RECORDING:
|
case UNIX_SOCKET_EVENT_STOP_RECORDING:
|
||||||
puts("Sent event \"stop recording\"!");
|
puts("Sent event \"stop recording\"!");
|
||||||
break;
|
break;
|
||||||
|
case UNIX_SOCKET_EVENT_TOGGLE_RECORDING:
|
||||||
|
switch(buffer[1]) {
|
||||||
|
case UNIX_SOCKET_EVENT_START_RECORDING:
|
||||||
|
puts("Sent event \"toggle recording\", stream STARTED!\n");
|
||||||
|
break;
|
||||||
|
case UNIX_SOCKET_EVENT_STOP_RECORDING:
|
||||||
|
puts("Sent event \"toggle recording\", stream STOPPED!\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
puts("Sent event \"toggle recording\", stream status UNKNOWN!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case UNIX_SOCKET_EVENT_START_STREAMING:
|
case UNIX_SOCKET_EVENT_START_STREAMING:
|
||||||
puts("Sent event \"start streaming\"!");
|
puts("Sent event \"start streaming\"!");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,7 +12,8 @@ typedef enum UnixSocketEventType {
|
||||||
UNIX_SOCKET_EVENT_GET_STATUS,
|
UNIX_SOCKET_EVENT_GET_STATUS,
|
||||||
UNIX_SOCKET_EVENT_START_REPLAY_BUFFER,
|
UNIX_SOCKET_EVENT_START_REPLAY_BUFFER,
|
||||||
UNIX_SOCKET_EVENT_STOP_REPLAY_BUFFER,
|
UNIX_SOCKET_EVENT_STOP_REPLAY_BUFFER,
|
||||||
UNIX_SOCKET_EVENT_SAVE_REPLAY_BUFFER
|
UNIX_SOCKET_EVENT_SAVE_REPLAY_BUFFER,
|
||||||
|
UNIX_SOCKET_EVENT_TOGGLE_RECORDING
|
||||||
} UnixSocketEventType;
|
} UnixSocketEventType;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,6 +78,15 @@ int unix_socket_handler_thread_function(void *ud) {
|
||||||
} else if (buffer[0] == UNIX_SOCKET_EVENT_STOP_RECORDING) {
|
} else if (buffer[0] == UNIX_SOCKET_EVENT_STOP_RECORDING) {
|
||||||
obs_frontend_recording_stop();
|
obs_frontend_recording_stop();
|
||||||
ret_buffer[0] = UNIX_SOCKET_EVENT_NOP;
|
ret_buffer[0] = UNIX_SOCKET_EVENT_NOP;
|
||||||
|
} else if (buffer[0] == UNIX_SOCKET_EVENT_TOGGLE_RECORDING) {
|
||||||
|
ret_buffer[0] = UNIX_SOCKET_EVENT_TOGGLE_RECORDING;
|
||||||
|
if (obs_frontend_recording_active()) {
|
||||||
|
obs_frontend_recording_stop();
|
||||||
|
ret_buffer[1] = UNIX_SOCKET_EVENT_STOP_RECORDING;
|
||||||
|
} else {
|
||||||
|
obs_frontend_recording_start();
|
||||||
|
ret_buffer[1] = UNIX_SOCKET_EVENT_START_RECORDING;
|
||||||
|
}
|
||||||
} else if (buffer[0] == UNIX_SOCKET_EVENT_START_STREAMING) {
|
} else if (buffer[0] == UNIX_SOCKET_EVENT_START_STREAMING) {
|
||||||
obs_frontend_streaming_start();
|
obs_frontend_streaming_start();
|
||||||
ret_buffer[0] = UNIX_SOCKET_EVENT_NOP;
|
ret_buffer[0] = UNIX_SOCKET_EVENT_NOP;
|
||||||
|
|
Loading…
Reference in a new issue