New upstream version 21.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-02-19 20:54:37 +01:00
parent 1f1bbb3518
commit baafb6325b
706 changed files with 49633 additions and 5044 deletions

View file

@ -3,6 +3,7 @@
#include <util/platform.h>
#include <libavutil/log.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <pthread.h>
OBS_DECLARE_MODULE()
@ -13,6 +14,7 @@ extern struct obs_output_info ffmpeg_output;
extern struct obs_output_info ffmpeg_muxer;
extern struct obs_output_info replay_buffer;
extern struct obs_encoder_info aac_encoder_info;
extern struct obs_encoder_info opus_encoder_info;
extern struct obs_encoder_info nvenc_encoder_info;
static DARRAY(struct log_context {
@ -115,13 +117,23 @@ cleanup:
destroy_log_context(log_context);
}
#ifndef __APPLE__
static const char *nvenc_check_name = "nvenc_check";
static bool nvenc_supported(void)
{
av_register_all();
profile_start(nvenc_check_name);
AVCodec *nvenc = avcodec_find_encoder_by_name("nvenc_h264");
void *lib = NULL;
bool success = false;
if (!nvenc)
return false;
if (!nvenc) {
goto cleanup;
}
#if defined(_WIN32)
if (sizeof(void*) == 8) {
@ -132,10 +144,20 @@ static bool nvenc_supported(void)
#else
lib = os_dlopen("libnvidia-encode.so.1");
#endif
os_dlclose(lib);
return !!lib;
/* ------------------------------------------- */
success = !!lib;
cleanup:
if (lib)
os_dlclose(lib);
profile_end(nvenc_check_name);
return success;
}
#endif
bool obs_module_load(void)
{
da_init(active_log_contexts);
@ -148,10 +170,13 @@ bool obs_module_load(void)
obs_register_output(&ffmpeg_muxer);
obs_register_output(&replay_buffer);
obs_register_encoder(&aac_encoder_info);
obs_register_encoder(&opus_encoder_info);
#ifndef __APPLE__
if (nvenc_supported()) {
blog(LOG_INFO, "NVENC supported");
obs_register_encoder(&nvenc_encoder_info);
}
#endif
return true;
}