New upstream version 24.0.1+dfsg1

This commit is contained in:
Sebastian Ramacher 2019-09-22 23:19:10 +02:00
parent b14f9eae6d
commit 5a730d6ec3
842 changed files with 42245 additions and 33385 deletions

View file

@ -1,8 +1,8 @@
#include <obs-module.h>
#include <util/circlebuf.h>
#define S_DELAY_MS "delay_ms"
#define T_DELAY_MS obs_module_text("DelayMs")
#define S_DELAY_MS "delay_ms"
#define T_DELAY_MS obs_module_text("DelayMs")
struct frame {
gs_texrender_t *render;
@ -10,14 +10,14 @@ struct frame {
};
struct gpu_delay_filter_data {
obs_source_t *context;
struct circlebuf frames;
uint64_t delay_ns;
uint64_t interval_ns;
uint32_t cx;
uint32_t cy;
bool target_valid;
bool processed_frame;
obs_source_t *context;
struct circlebuf frames;
uint64_t delay_ns;
uint64_t interval_ns;
uint32_t cx;
uint32_t cy;
bool target_valid;
bool processed_frame;
};
static const char *gpu_delay_filter_get_name(void *unused)
@ -44,7 +44,7 @@ static size_t num_frames(struct circlebuf *buf)
}
static void update_interval(struct gpu_delay_filter_data *f,
uint64_t new_interval_ns)
uint64_t new_interval_ns)
{
if (!f->target_valid) {
free_textures(f);
@ -62,9 +62,10 @@ static void update_interval(struct gpu_delay_filter_data *f,
circlebuf_upsize(&f->frames, num * sizeof(struct frame));
for (size_t i = prev_num; i < num; i++) {
struct frame *frame = circlebuf_data(&f->frames,
i * sizeof(*frame));
frame->render = gs_texrender_create(GS_RGBA, GS_ZS_NONE);
struct frame *frame =
circlebuf_data(&f->frames, i * sizeof(*frame));
frame->render =
gs_texrender_create(GS_RGBA, GS_ZS_NONE);
}
obs_leave_graphics();
@ -89,8 +90,8 @@ static inline void check_interval(struct gpu_delay_filter_data *f)
obs_get_video_info(&ovi);
interval_ns = (uint64_t)ovi.fps_den * 1000000000ULL /
(uint64_t)ovi.fps_num;
interval_ns =
(uint64_t)ovi.fps_den * 1000000000ULL / (uint64_t)ovi.fps_num;
if (interval_ns != f->interval_ns)
update_interval(f, interval_ns);
@ -147,13 +148,16 @@ static obs_properties_t *gpu_delay_filter_properties(void *data)
{
obs_properties_t *props = obs_properties_create();
obs_properties_add_int(props, S_DELAY_MS, T_DELAY_MS, 0, 500, 1);
obs_property_t *p = obs_properties_add_int(props, S_DELAY_MS,
T_DELAY_MS, 0, 500, 1);
obs_property_int_set_suffix(p, " ms");
UNUSED_PARAMETER(data);
return props;
}
static void *gpu_delay_filter_create(obs_data_t *settings, obs_source_t *context)
static void *gpu_delay_filter_create(obs_data_t *settings,
obs_source_t *context)
{
struct gpu_delay_filter_data *f = bzalloc(sizeof(*f));
f->context = context;
@ -232,8 +236,8 @@ static void gpu_delay_filter_render(void *data, gs_effect_t *effect)
vec4_zero(&clear_color);
gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0);
gs_ortho(0.0f, (float)f->cx, 0.0f, (float)f->cy,
-100.0f, 100.0f);
gs_ortho(0.0f, (float)f->cx, 0.0f, (float)f->cy, -100.0f,
100.0f);
if (target == parent && !custom_draw && !async)
obs_source_default_render(target);
@ -253,14 +257,14 @@ static void gpu_delay_filter_render(void *data, gs_effect_t *effect)
}
struct obs_source_info gpu_delay_filter = {
.id = "gpu_delay",
.type = OBS_SOURCE_TYPE_FILTER,
.output_flags = OBS_SOURCE_VIDEO,
.get_name = gpu_delay_filter_get_name,
.create = gpu_delay_filter_create,
.destroy = gpu_delay_filter_destroy,
.update = gpu_delay_filter_update,
.get_properties = gpu_delay_filter_properties,
.video_tick = gpu_delay_filter_tick,
.video_render = gpu_delay_filter_render
.id = "gpu_delay",
.type = OBS_SOURCE_TYPE_FILTER,
.output_flags = OBS_SOURCE_VIDEO,
.get_name = gpu_delay_filter_get_name,
.create = gpu_delay_filter_create,
.destroy = gpu_delay_filter_destroy,
.update = gpu_delay_filter_update,
.get_properties = gpu_delay_filter_properties,
.video_tick = gpu_delay_filter_tick,
.video_render = gpu_delay_filter_render,
};