New upstream version 0.16.2+dfsg1
This commit is contained in:
parent
67704ac59c
commit
6efda2859e
377 changed files with 7938 additions and 696 deletions
|
|
@ -13,6 +13,9 @@ endif()
|
|||
|
||||
if(UNIX)
|
||||
find_package(DBus QUIET)
|
||||
if (NOT APPLE)
|
||||
find_package(X11_XCB REQUIRED)
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_DBUS "0")
|
||||
endif()
|
||||
|
|
@ -125,6 +128,14 @@ elseif(UNIX)
|
|||
${DBUS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${X11_XCB_INCLUDE_DIRS})
|
||||
add_definitions(
|
||||
${X11_XCB_DEFINITIONS})
|
||||
set(libobs_PLATFORM_DEPS
|
||||
${libobs_PLATFORM_DEPS}
|
||||
${X11_XCB_LIBRARIES})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
# use the sysinfo compatibility library on bsd
|
||||
find_package(Libsysinfo REQUIRED)
|
||||
|
|
|
|||
|
|
@ -962,6 +962,32 @@ static inline void build_sprite_norm(struct gs_vb_data *data, float fcx,
|
|||
build_sprite(data, fcx, fcy, start_u, end_u, start_v, end_v);
|
||||
}
|
||||
|
||||
static inline void build_subsprite_norm(struct gs_vb_data *data,
|
||||
float fsub_x, float fsub_y, float fsub_cx, float fsub_cy,
|
||||
float fcx, float fcy, uint32_t flip)
|
||||
{
|
||||
float start_u, end_u;
|
||||
float start_v, end_v;
|
||||
|
||||
if ((flip & GS_FLIP_U) == 0) {
|
||||
start_u = fsub_x / fcx;
|
||||
end_u = (fsub_x + fsub_cx) / fcx;
|
||||
} else {
|
||||
start_u = (fsub_x + fsub_cx) / fcx;
|
||||
end_u = fsub_x / fcx;
|
||||
}
|
||||
|
||||
if ((flip & GS_FLIP_V) == 0) {
|
||||
start_v = fsub_y / fcy;
|
||||
end_v = (fsub_y + fsub_cy) / fcy;
|
||||
} else {
|
||||
start_v = (fsub_y + fsub_cy) / fcy;
|
||||
end_v = fsub_y / fcy;
|
||||
}
|
||||
|
||||
build_sprite(data, fsub_cx, fsub_cy, start_u, end_u, start_v, end_v);
|
||||
}
|
||||
|
||||
static inline void build_sprite_rect(struct gs_vb_data *data, gs_texture_t *tex,
|
||||
float fcx, float fcy, uint32_t flip)
|
||||
{
|
||||
|
|
@ -1011,6 +1037,37 @@ void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width,
|
|||
gs_draw(GS_TRISTRIP, 0, 0);
|
||||
}
|
||||
|
||||
void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip,
|
||||
uint32_t sub_x, uint32_t sub_y,
|
||||
uint32_t sub_cx, uint32_t sub_cy)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
float fcx, fcy;
|
||||
struct gs_vb_data *data;
|
||||
|
||||
if (tex) {
|
||||
if (gs_get_texture_type(tex) != GS_TEXTURE_2D) {
|
||||
blog(LOG_ERROR, "A sprite must be a 2D texture");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fcx = (float)gs_texture_get_width(tex);
|
||||
fcy = (float)gs_texture_get_height(tex);
|
||||
|
||||
data = gs_vertexbuffer_get_data(graphics->sprite_buffer);
|
||||
build_subsprite_norm(data,
|
||||
(float)sub_x, (float)sub_y,
|
||||
(float)sub_cx, (float)sub_cy,
|
||||
fcx, fcy, flip);
|
||||
|
||||
gs_vertexbuffer_flush(graphics->sprite_buffer);
|
||||
gs_load_vertexbuffer(graphics->sprite_buffer);
|
||||
gs_load_indexbuffer(NULL);
|
||||
|
||||
gs_draw(GS_TRISTRIP, 0, 0);
|
||||
}
|
||||
|
||||
void gs_draw_cube_backdrop(gs_texture_t *cubetex, const struct quat *rot,
|
||||
float left, float right, float top, float bottom, float znear)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -525,6 +525,9 @@ EXPORT uint8_t *gs_create_texture_file_data(const char *file,
|
|||
EXPORT void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
EXPORT void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip,
|
||||
uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
|
||||
|
||||
EXPORT void gs_draw_cube_backdrop(gs_texture_t *cubetex, const struct quat *rot,
|
||||
float left, float right, float top, float bottom, float znear);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,12 +94,7 @@ const uint8_t *obs_avc_find_startcode(const uint8_t *p, const uint8_t *end)
|
|||
|
||||
static inline int get_drop_priority(int priority)
|
||||
{
|
||||
switch (priority) {
|
||||
case OBS_NAL_PRIORITY_DISPOSABLE: return OBS_NAL_PRIORITY_DISPOSABLE;
|
||||
case OBS_NAL_PRIORITY_LOW: return OBS_NAL_PRIORITY_LOW;
|
||||
}
|
||||
|
||||
return OBS_NAL_PRIORITY_HIGHEST;
|
||||
return priority;
|
||||
}
|
||||
|
||||
static void serialize_avc_data(struct serializer *s, const uint8_t *data,
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@
|
|||
*
|
||||
* Reset to zero each major version
|
||||
*/
|
||||
#define LIBOBS_API_MINOR_VER 15
|
||||
#define LIBOBS_API_MINOR_VER 16
|
||||
|
||||
/*
|
||||
* Increment if backward-compatible bug fix
|
||||
*
|
||||
* Reset to zero each major or minor version
|
||||
*/
|
||||
#define LIBOBS_API_PATCH_VER 4
|
||||
#define LIBOBS_API_PATCH_VER 2
|
||||
|
||||
#define MAKE_SEMANTIC_VERSION(major, minor, patch) \
|
||||
((major << 24) | \
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ struct obs_core_video {
|
|||
int cur_texture;
|
||||
|
||||
uint64_t video_time;
|
||||
double video_fps;
|
||||
video_t *video;
|
||||
pthread_t video_thread;
|
||||
uint32_t total_frames;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ MODULE_EXPORT void obs_module_free_locale(void);
|
|||
text_lookup_getstr(obs_module_lookup, val, &out); \
|
||||
return out; \
|
||||
} \
|
||||
bool obs_module_get_string(const char *val, const char **out) \
|
||||
{ \
|
||||
return text_lookup_getstr(obs_module_lookup, val, out); \
|
||||
} \
|
||||
void obs_module_set_locale(const char *locale) \
|
||||
{ \
|
||||
if (obs_module_lookup) text_lookup_destroy(obs_module_lookup); \
|
||||
|
|
@ -127,6 +131,11 @@ MODULE_EXPORT void obs_module_free_locale(void);
|
|||
/** Helper function for looking up locale if default locale handler was used */
|
||||
MODULE_EXTERN const char *obs_module_text(const char *lookup_string);
|
||||
|
||||
/** Helper function for looking up locale if default locale handler was used,
|
||||
* returns true if text found, otherwise false */
|
||||
MODULE_EXTERN bool obs_module_get_string(const char *lookup_string,
|
||||
const char **translated_string);
|
||||
|
||||
/** Helper function that returns the current module */
|
||||
MODULE_EXTERN obs_module_t *obs_current_module(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ void obs_output_actual_stop(obs_output_t *output, bool force, uint64_t ts)
|
|||
bool call_stop = true;
|
||||
bool was_reconnecting = false;
|
||||
|
||||
if (stopping(output))
|
||||
if (stopping(output) && !force)
|
||||
return;
|
||||
os_event_reset(output->stopping_event);
|
||||
|
||||
|
|
@ -391,8 +391,8 @@ void obs_output_force_stop(obs_output_t *output)
|
|||
if (!stopping(output)) {
|
||||
output->stop_code = 0;
|
||||
do_output_signal(output, "stopping");
|
||||
obs_output_actual_stop(output, true, 0);
|
||||
}
|
||||
obs_output_actual_stop(output, true, 0);
|
||||
}
|
||||
|
||||
bool obs_output_active(const obs_output_t *output)
|
||||
|
|
|
|||
|
|
@ -726,6 +726,30 @@ enum obs_combo_format obs_property_list_format(obs_property_t *p)
|
|||
return data ? data->format : OBS_COMBO_FORMAT_INVALID;
|
||||
}
|
||||
|
||||
void obs_property_int_set_limits(obs_property_t *p,
|
||||
int min, int max, int step)
|
||||
{
|
||||
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
data->min = min;
|
||||
data->max = max;
|
||||
data->step = step;
|
||||
}
|
||||
|
||||
void obs_property_float_set_limits(obs_property_t *p,
|
||||
double min, double max, double step)
|
||||
{
|
||||
struct float_data *data = get_type_data(p, OBS_PROPERTY_INT);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
data->min = min;
|
||||
data->max = max;
|
||||
data->step = step;
|
||||
}
|
||||
|
||||
void obs_property_list_clear(obs_property_t *p)
|
||||
{
|
||||
struct list_data *data = get_list_data(p);
|
||||
|
|
|
|||
|
|
@ -262,6 +262,11 @@ EXPORT const char * obs_property_path_default_path(obs_property_t *p);
|
|||
EXPORT enum obs_combo_type obs_property_list_type(obs_property_t *p);
|
||||
EXPORT enum obs_combo_format obs_property_list_format(obs_property_t *p);
|
||||
|
||||
EXPORT void obs_property_int_set_limits(obs_property_t *p,
|
||||
int min, int max, int step);
|
||||
EXPORT void obs_property_float_set_limits(obs_property_t *p,
|
||||
double min, double max, double step);
|
||||
|
||||
EXPORT void obs_property_list_clear(obs_property_t *p);
|
||||
|
||||
EXPORT size_t obs_property_list_add_string(obs_property_t *p,
|
||||
|
|
|
|||
|
|
@ -115,6 +115,11 @@ enum obs_source_type {
|
|||
*/
|
||||
#define OBS_SOURCE_DO_NOT_DUPLICATE (1<<7)
|
||||
|
||||
/**
|
||||
* Source is deprecated and should not be used
|
||||
*/
|
||||
#define OBS_SOURCE_DEPRECATED (1<<8)
|
||||
|
||||
/** @} */
|
||||
|
||||
typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
|
||||
|
|
|
|||
|
|
@ -573,6 +573,8 @@ void *obs_video_thread(void *param)
|
|||
{
|
||||
uint64_t last_time = 0;
|
||||
uint64_t interval = video_output_get_frame_time(obs->video.video);
|
||||
uint64_t fps_total_ns = 0;
|
||||
uint32_t fps_total_frames = 0;
|
||||
|
||||
obs->video.video_time = os_gettime_ns();
|
||||
|
||||
|
|
@ -603,6 +605,16 @@ void *obs_video_thread(void *param)
|
|||
profile_reenable_thread();
|
||||
|
||||
video_sleep(&obs->video, &obs->video.video_time, interval);
|
||||
|
||||
fps_total_ns += (obs->video.video_time - last_time);
|
||||
fps_total_frames++;
|
||||
|
||||
if (fps_total_ns >= 1000000000ULL) {
|
||||
obs->video.video_fps = (double)fps_total_frames /
|
||||
((double)fps_total_ns / 1000000000.0);
|
||||
fps_total_ns = 0;
|
||||
fps_total_frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED_PARAMETER(param);
|
||||
|
|
|
|||
|
|
@ -172,13 +172,27 @@ static void log_available_memory(void)
|
|||
note);
|
||||
}
|
||||
|
||||
static bool is_64_bit_windows(void)
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
return true;
|
||||
#elif defined(_WIN32)
|
||||
BOOL b64 = false;
|
||||
return IsWow64Process(GetCurrentProcess(), &b64) && b64;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void log_windows_version(void)
|
||||
{
|
||||
struct win_version_info ver;
|
||||
get_win_ver(&ver);
|
||||
|
||||
blog(LOG_INFO, "Windows Version: %d.%d Build %d (revision: %d)",
|
||||
ver.major, ver.minor, ver.build, ver.revis);
|
||||
bool b64 = is_64_bit_windows();
|
||||
const char *windows_bitness = b64 ? "64" : "32";
|
||||
|
||||
blog(LOG_INFO, "Windows Version: %d.%d Build %d (revision: %d; %s-bit)",
|
||||
ver.major, ver.minor, ver.build, ver.revis,
|
||||
windows_bitness);
|
||||
}
|
||||
|
||||
static void log_admin_status(void)
|
||||
|
|
|
|||
29
libobs/obs.c
29
libobs/obs.c
|
|
@ -820,6 +820,8 @@ void obs_shutdown(void)
|
|||
obs_free_graphics();
|
||||
proc_handler_destroy(obs->procs);
|
||||
signal_handler_destroy(obs->signals);
|
||||
obs->procs = NULL;
|
||||
obs->signals = NULL;
|
||||
|
||||
module = obs->first_module;
|
||||
while (module) {
|
||||
|
|
@ -923,14 +925,35 @@ int obs_reset_video(struct obs_video_info *ovi)
|
|||
}
|
||||
}
|
||||
|
||||
const char *scale_type_name = "";
|
||||
switch (ovi->scale_type) {
|
||||
case OBS_SCALE_DISABLE:
|
||||
scale_type_name = "Disabled";
|
||||
break;
|
||||
case OBS_SCALE_POINT:
|
||||
scale_type_name = "Point";
|
||||
break;
|
||||
case OBS_SCALE_BICUBIC:
|
||||
scale_type_name = "Bicubic";
|
||||
break;
|
||||
case OBS_SCALE_BILINEAR:
|
||||
scale_type_name = "Bilinear";
|
||||
break;
|
||||
case OBS_SCALE_LANCZOS:
|
||||
scale_type_name = "Lanczos";
|
||||
break;
|
||||
}
|
||||
|
||||
blog(LOG_INFO, "---------------------------------");
|
||||
blog(LOG_INFO, "video settings reset:\n"
|
||||
"\tbase resolution: %dx%d\n"
|
||||
"\toutput resolution: %dx%d\n"
|
||||
"\tdownscale filter: %s\n"
|
||||
"\tfps: %d/%d\n"
|
||||
"\tformat: %s",
|
||||
ovi->base_width, ovi->base_height,
|
||||
ovi->output_width, ovi->output_height,
|
||||
scale_type_name,
|
||||
ovi->fps_num, ovi->fps_den,
|
||||
get_video_format_name(ovi->output_format));
|
||||
|
||||
|
|
@ -1219,6 +1242,7 @@ void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), void *param)
|
|||
(obs_source_t*)source->context.next;
|
||||
|
||||
if ((source->info.type == OBS_SOURCE_TYPE_INPUT) != 0 &&
|
||||
!source->context.private &&
|
||||
!enum_proc(param, source))
|
||||
break;
|
||||
|
||||
|
|
@ -1816,6 +1840,11 @@ uint64_t obs_get_video_frame_time(void)
|
|||
return obs ? obs->video.video_time : 0;
|
||||
}
|
||||
|
||||
double obs_get_active_fps(void)
|
||||
{
|
||||
return obs ? obs->video.video_fps : 0.0;
|
||||
}
|
||||
|
||||
enum obs_obj_type obs_obj_get_type(void *obj)
|
||||
{
|
||||
struct obs_context_data *context = obj;
|
||||
|
|
|
|||
|
|
@ -610,6 +610,8 @@ EXPORT void obs_view_render(obs_view_t *view);
|
|||
|
||||
EXPORT uint64_t obs_get_video_frame_time(void);
|
||||
|
||||
EXPORT double obs_get_active_fps(void);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Display context */
|
||||
|
|
|
|||
|
|
@ -84,9 +84,24 @@ void *os_dlopen(const char *path)
|
|||
if (wpath_slash)
|
||||
SetDllDirectoryW(NULL);
|
||||
|
||||
if (!h_library)
|
||||
blog(LOG_INFO, "LoadLibrary failed for '%s', error: %ld",
|
||||
path, GetLastError());
|
||||
if (!h_library) {
|
||||
DWORD error = GetLastError();
|
||||
char *message = NULL;
|
||||
|
||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||
NULL, error,
|
||||
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
||||
(LPSTR)&message, 0, NULL);
|
||||
|
||||
blog(LOG_INFO, "LoadLibrary failed for '%s': %s (%lu)",
|
||||
path, message, error);
|
||||
|
||||
if (message)
|
||||
LocalFree(message);
|
||||
}
|
||||
|
||||
|
||||
return h_library;
|
||||
}
|
||||
|
|
@ -717,7 +732,7 @@ bool get_dll_ver(const wchar_t *lib, struct win_version_info *ver_info)
|
|||
}
|
||||
|
||||
data = bmalloc(size);
|
||||
if (!get_file_version_info(L"kernel32", 0, size, data)) {
|
||||
if (!get_file_version_info(lib, 0, size, data)) {
|
||||
blog(LOG_ERROR, "Failed to get windows version info");
|
||||
bfree(data);
|
||||
return false;
|
||||
|
|
@ -739,6 +754,8 @@ bool get_dll_ver(const wchar_t *lib, struct win_version_info *ver_info)
|
|||
return true;
|
||||
}
|
||||
|
||||
#define WINVER_REG_KEY L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
|
||||
|
||||
void get_win_ver(struct win_version_info *info)
|
||||
{
|
||||
static struct win_version_info ver = {0};
|
||||
|
|
@ -750,6 +767,26 @@ void get_win_ver(struct win_version_info *info)
|
|||
if (!got_version) {
|
||||
get_dll_ver(L"kernel32", &ver);
|
||||
got_version = true;
|
||||
|
||||
if (ver.major == 10 && ver.revis == 0) {
|
||||
HKEY key;
|
||||
DWORD size, win10_revision;
|
||||
LSTATUS status;
|
||||
|
||||
status = RegOpenKeyW(HKEY_LOCAL_MACHINE,
|
||||
WINVER_REG_KEY, &key);
|
||||
if (status != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
size = sizeof(win10_revision);
|
||||
|
||||
status = RegQueryValueExW(key, L"UBR", NULL, NULL,
|
||||
(LPBYTE)&win10_revision, &size);
|
||||
if (status == ERROR_SUCCESS)
|
||||
ver.revis = (int)win10_revision;
|
||||
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
*info = ver;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ size_t os_fread_mbs(FILE *file, char **pstr)
|
|||
size_t os_fread_utf8(FILE *file, char **pstr)
|
||||
{
|
||||
size_t size = 0;
|
||||
size_t size_read;
|
||||
size_t len = 0;
|
||||
|
||||
*pstr = NULL;
|
||||
|
|
@ -177,11 +176,13 @@ size_t os_fread_utf8(FILE *file, char **pstr)
|
|||
char *utf8str;
|
||||
off_t offset;
|
||||
|
||||
bom[0] = 0;
|
||||
bom[1] = 0;
|
||||
bom[2] = 0;
|
||||
|
||||
/* remove the ghastly BOM if present */
|
||||
fseek(file, 0, SEEK_SET);
|
||||
size_read = fread(bom, 1, 3, file);
|
||||
if (size_read != 3)
|
||||
return 0;
|
||||
fread(bom, 1, 3, file);
|
||||
|
||||
offset = (astrcmp_n(bom, "\xEF\xBB\xBF", 3) == 0) ? 3 : 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue