Imported Upstream version 0.14.2+dfsg1
This commit is contained in:
parent
fb3990e9e5
commit
41a01dbf05
529 changed files with 25112 additions and 2336 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include <obs-module.h>
|
||||
#include <util/darray.h>
|
||||
#include <util/platform.h>
|
||||
#include <libavutil/log.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <pthread.h>
|
||||
|
||||
OBS_DECLARE_MODULE()
|
||||
|
|
@ -10,6 +12,7 @@ extern struct obs_source_info ffmpeg_source;
|
|||
extern struct obs_output_info ffmpeg_output;
|
||||
extern struct obs_output_info ffmpeg_muxer;
|
||||
extern struct obs_encoder_info aac_encoder_info;
|
||||
extern struct obs_encoder_info nvenc_encoder_info;
|
||||
|
||||
static DARRAY(struct log_context {
|
||||
void *context;
|
||||
|
|
@ -111,6 +114,27 @@ cleanup:
|
|||
destroy_log_context(log_context);
|
||||
}
|
||||
|
||||
static bool nvenc_supported(void)
|
||||
{
|
||||
AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264");
|
||||
void *lib = NULL;
|
||||
|
||||
if (!nvenc)
|
||||
return false;
|
||||
|
||||
#if defined(_WIN32)
|
||||
if (sizeof(void*) == 8) {
|
||||
lib = os_dlopen("nvEncodeAPI64.dll");
|
||||
} else {
|
||||
lib = os_dlopen("nvEncodeAPI.dll");
|
||||
}
|
||||
#else
|
||||
lib = os_dlopen("libnvidia-encode.so.1");
|
||||
#endif
|
||||
os_dlclose(lib);
|
||||
return !!lib;
|
||||
}
|
||||
|
||||
bool obs_module_load(void)
|
||||
{
|
||||
da_init(active_log_contexts);
|
||||
|
|
@ -122,6 +146,10 @@ bool obs_module_load(void)
|
|||
obs_register_output(&ffmpeg_output);
|
||||
obs_register_output(&ffmpeg_muxer);
|
||||
obs_register_encoder(&aac_encoder_info);
|
||||
if (nvenc_supported()) {
|
||||
blog(LOG_INFO, "NVENC supported");
|
||||
obs_register_encoder(&nvenc_encoder_info);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue