yolobs-studio/plugins/obs-outputs/obs-outputs.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
1.7 KiB
C
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
#include <obs-module.h>
2018-02-19 19:54:37 +00:00
#include "obs-outputs-config.h"
2016-02-23 23:16:51 +00:00
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
2020-10-01 20:15:25 +00:00
#include <mbedtls/threading.h>
2016-02-23 23:16:51 +00:00
#endif
OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-outputs", "en-US")
2019-07-27 12:47:10 +00:00
MODULE_EXPORT const char *obs_module_description(void)
{
return "OBS core RTMP/FLV/null/FTL outputs";
}
2016-02-23 23:16:51 +00:00
extern struct obs_output_info rtmp_output_info;
2017-06-29 19:01:10 +00:00
extern struct obs_output_info null_output_info;
2016-02-23 23:16:51 +00:00
extern struct obs_output_info flv_output_info;
2018-02-19 19:54:37 +00:00
#if COMPILE_FTL
extern struct obs_output_info ftl_output_info;
#endif
2016-02-23 23:16:51 +00:00
2020-10-01 20:15:25 +00:00
#if defined(_WIN32) && defined(MBEDTLS_THREADING_ALT)
void mbed_mutex_init(mbedtls_threading_mutex_t *m)
{
CRITICAL_SECTION *c = bzalloc(sizeof(CRITICAL_SECTION));
*m = c;
InitializeCriticalSection(c);
}
void mbed_mutex_free(mbedtls_threading_mutex_t *m)
{
CRITICAL_SECTION *c = *m;
DeleteCriticalSection(c);
bfree(*m);
*m = NULL;
}
int mbed_mutex_lock(mbedtls_threading_mutex_t *m)
{
CRITICAL_SECTION *c = *m;
EnterCriticalSection(c);
return 0;
}
int mbed_mutex_unlock(mbedtls_threading_mutex_t *m)
{
CRITICAL_SECTION *c = *m;
LeaveCriticalSection(c);
return 0;
}
#endif
2016-02-23 23:16:51 +00:00
bool obs_module_load(void)
{
#ifdef _WIN32
WSADATA wsad;
WSAStartup(MAKEWORD(2, 2), &wsad);
#endif
2020-10-01 20:15:25 +00:00
#if defined(_WIN32) && defined(MBEDTLS_THREADING_ALT)
mbedtls_threading_set_alt(mbed_mutex_init, mbed_mutex_free,
mbed_mutex_lock, mbed_mutex_unlock);
#endif
2016-02-23 23:16:51 +00:00
obs_register_output(&rtmp_output_info);
2017-06-29 19:01:10 +00:00
obs_register_output(&null_output_info);
2016-02-23 23:16:51 +00:00
obs_register_output(&flv_output_info);
2018-02-19 19:54:37 +00:00
#if COMPILE_FTL
obs_register_output(&ftl_output_info);
#endif
2016-02-23 23:16:51 +00:00
return true;
}
void obs_module_unload(void)
{
#ifdef _WIN32
2020-10-01 20:15:25 +00:00
#ifdef MBEDTLS_THREADING_ALT
mbedtls_threading_free_alt();
#endif
2016-02-23 23:16:51 +00:00
WSACleanup();
#endif
}