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

@ -5,19 +5,19 @@
struct async_sync_test {
obs_source_t *source;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
};
/* middle C */
static const double rate = 261.63/48000.0;
static const double rate = 261.63 / 48000.0;
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
#define M_PI_X2 M_PI*2
#define M_PI_X2 M_PI * 2
static const char *ast_getname(void *unused)
{
@ -44,7 +44,7 @@ static inline void fill_texture(uint32_t *pixels, uint32_t color)
for (y = 0; y < 20; y++) {
for (x = 0; x < 20; x++) {
pixels[y*20 + x] = color;
pixels[y * 20 + x] = color;
}
}
}
@ -56,25 +56,25 @@ static void *video_thread(void *data)
uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio());
uint32_t *pixels = bmalloc(20 * 20 * sizeof(uint32_t));
float *samples = bmalloc(sample_rate * sizeof(float));
float *samples = bmalloc(sample_rate * sizeof(float));
uint64_t cur_time = os_gettime_ns();
bool whitelist = false;
double cos_val = 0.0;
bool whitelist = false;
double cos_val = 0.0;
uint64_t start_time = cur_time;
struct obs_source_frame frame = {
.data = {[0] = (uint8_t*)pixels},
.linesize = {[0] = 20*4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX
.data = {[0] = (uint8_t *)pixels},
.linesize = {[0] = 20 * 4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX,
};
struct obs_source_audio audio = {
.speakers = SPEAKERS_MONO,
.data = {[0] = (uint8_t*)samples},
.speakers = SPEAKERS_MONO,
.data = {[0] = (uint8_t *)samples},
.samples_per_sec = sample_rate,
.frames = sample_rate,
.format = AUDIO_FORMAT_FLOAT
.frames = sample_rate,
.format = AUDIO_FORMAT_FLOAT,
};
while (os_event_try(ast->stop_signal) == EAGAIN) {
@ -133,11 +133,10 @@ static void *ast_create(obs_data_t *settings, obs_source_t *source)
}
struct obs_source_info async_sync_test = {
.id = "async_sync_test",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_ASYNC_VIDEO |
OBS_SOURCE_AUDIO,
.get_name = ast_getname,
.create = ast_create,
.destroy = ast_destroy,
.id = "async_sync_test",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO,
.get_name = ast_getname,
.create = ast_create,
.destroy = ast_destroy,
};

View file

@ -5,29 +5,27 @@
struct buffering_async_sync_test {
obs_source_t *source;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
bool buffer_audio;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
bool buffer_audio;
};
#define CYCLE_COUNT 7
static const double aud_rates[CYCLE_COUNT] = {
220.00/48000.0, /* A */
233.08/48000.0, /* A# */
246.94/48000.0, /* B */
261.63/48000.0, /* C */
277.18/48000.0, /* C# */
293.67/48000.0, /* D */
311.13/48000.0, /* D# */
220.00 / 48000.0, /* A */
233.08 / 48000.0, /* A# */
246.94 / 48000.0, /* B */
261.63 / 48000.0, /* C */
277.18 / 48000.0, /* C# */
293.67 / 48000.0, /* D */
311.13 / 48000.0, /* D# */
};
#define MAKE_COL_CHAN(x, y) (((0xFF / 7) * x) << (y * 8))
#define MAKE_GRAYSCALE(x) \
(MAKE_COL_CHAN(x, 0) | \
MAKE_COL_CHAN(x, 1) | \
MAKE_COL_CHAN(x, 2))
(MAKE_COL_CHAN(x, 0) | MAKE_COL_CHAN(x, 1) | MAKE_COL_CHAN(x, 2))
static const uint32_t vid_colors[CYCLE_COUNT] = {
0xFF000000,
@ -43,7 +41,7 @@ static const uint32_t vid_colors[CYCLE_COUNT] = {
#define M_PI 3.1415926535897932384626433832795
#endif
#define M_PI_X2 M_PI*2
#define M_PI_X2 M_PI * 2
static const char *bast_getname(void *unused)
{
@ -70,7 +68,7 @@ static inline void fill_texture(uint32_t *pixels, uint32_t color)
for (y = 0; y < 20; y++) {
for (x = 0; x < 20; x++) {
pixels[y*20 + x] = color;
pixels[y * 20 + x] = color;
}
}
}
@ -82,27 +80,27 @@ static void *video_thread(void *data)
uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio());
uint32_t *pixels = bmalloc(20 * 20 * sizeof(uint32_t));
float *samples = bmalloc(sample_rate * sizeof(float));
float *samples = bmalloc(sample_rate * sizeof(float));
uint64_t cur_time = os_gettime_ns();
int cur_vid_pos = 0;
int cur_aud_pos = 0;
double cos_val = 0.0;
int cur_vid_pos = 0;
int cur_aud_pos = 0;
double cos_val = 0.0;
uint64_t start_time = cur_time;
bool audio_buffering_enabled = false;
bool audio_buffering_enabled = false;
struct obs_source_frame frame = {
.data = {[0] = (uint8_t*)pixels},
.linesize = {[0] = 20*4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX
.data = {[0] = (uint8_t *)pixels},
.linesize = {[0] = 20 * 4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX,
};
struct obs_source_audio audio = {
.speakers = SPEAKERS_MONO,
.data = {[0] = (uint8_t*)samples},
.speakers = SPEAKERS_MONO,
.data = {[0] = (uint8_t *)samples},
.samples_per_sec = sample_rate,
.frames = sample_rate / 4,
.format = AUDIO_FORMAT_FLOAT
.frames = sample_rate / 4,
.format = AUDIO_FORMAT_FLOAT,
};
while (os_event_try(bast->stop_signal) == EAGAIN) {
@ -123,7 +121,7 @@ static void *video_thread(void *data)
* buffering */
frame.timestamp = cur_time - start_time;
audio.timestamp = cur_time - start_time -
(audio_buffering_enabled ? 1000000000 : 0);
(audio_buffering_enabled ? 1000000000 : 0);
const double rate = aud_rates[cur_aud_pos];
@ -153,7 +151,7 @@ static void *video_thread(void *data)
}
static void bast_buffer_audio(void *data, obs_hotkey_id id,
obs_hotkey_t *hotkey, bool pressed)
obs_hotkey_t *hotkey, bool pressed)
{
struct buffering_async_sync_test *bast = data;
@ -180,7 +178,7 @@ static void *bast_create(obs_data_t *settings, obs_source_t *source)
}
obs_hotkey_register_source(source, "AudioBufferingSyncTest.Buffer",
"Buffer Audio", bast_buffer_audio, bast);
"Buffer Audio", bast_buffer_audio, bast);
bast->initialized = true;
@ -190,11 +188,10 @@ static void *bast_create(obs_data_t *settings, obs_source_t *source)
}
struct obs_source_info buffering_async_sync_test = {
.id = "buffering_async_sync_test",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_ASYNC_VIDEO |
OBS_SOURCE_AUDIO,
.get_name = bast_getname,
.create = bast_create,
.destroy = bast_destroy,
.id = "buffering_async_sync_test",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO,
.get_name = bast_getname,
.create = bast_create,
.destroy = bast_destroy,
};

View file

@ -5,25 +5,25 @@
#include <obs.h>
struct sync_pair_aud {
bool initialized_thread;
pthread_t thread;
os_event_t *event;
bool initialized_thread;
pthread_t thread;
os_event_t *event;
obs_source_t *source;
};
/* middle C */
static const double rate = 261.63/48000.0;
static const double rate = 261.63 / 48000.0;
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
#define M_PI_X2 M_PI*2
#define M_PI_X2 M_PI * 2
extern uint64_t starting_time;
static inline bool whitelist_time(uint64_t ts, uint64_t interval,
uint64_t fps_num, uint64_t fps_den)
uint64_t fps_num, uint64_t fps_den)
{
if (!starting_time)
return false;
@ -53,8 +53,8 @@ static void *sync_pair_aud_thread(void *pdata)
last_time = obs_get_video_frame_time();
for (uint64_t i = 0; i < frames; i++) {
uint64_t ts = last_time +
i * 1000000000ULL / sample_rate;
uint64_t ts =
last_time + i * 1000000000ULL / sample_rate;
if (whitelist_time(ts, interval, fps_num, fps_den)) {
cos_val += rate * M_PI_X2;
@ -68,7 +68,7 @@ static void *sync_pair_aud_thread(void *pdata)
}
struct obs_source_audio data;
data.data[0] = (uint8_t*)samples;
data.data[0] = (uint8_t *)samples;
data.frames = frames;
data.speakers = SPEAKERS_MONO;
data.samples_per_sec = sample_rate;
@ -106,8 +106,7 @@ static void sync_pair_aud_destroy(void *data)
}
}
static void *sync_pair_aud_create(obs_data_t *settings,
obs_source_t *source)
static void *sync_pair_aud_create(obs_data_t *settings, obs_source_t *source)
{
struct sync_pair_aud *spa = bzalloc(sizeof(struct sync_pair_aud));
spa->source = source;
@ -128,10 +127,10 @@ fail:
}
struct obs_source_info sync_audio = {
.id = "sync_audio",
.type = OBS_SOURCE_TYPE_INPUT,
.id = "sync_audio",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_AUDIO,
.get_name = sync_pair_aud_getname,
.create = sync_pair_aud_create,
.destroy = sync_pair_aud_destroy,
.get_name = sync_pair_aud_getname,
.create = sync_pair_aud_create,
.destroy = sync_pair_aud_destroy,
};

View file

@ -39,7 +39,7 @@ static inline void fill_texture(uint32_t *pixels, uint32_t pixel)
for (y = 0; y < 32; y++) {
for (x = 0; x < 32; x++) {
pixels[y*32 + x] = pixel;
pixels[y * 32 + x] = pixel;
}
}
}
@ -57,11 +57,11 @@ static void *sync_pair_vid_create(obs_data_t *settings, obs_source_t *source)
uint8_t *ptr;
uint32_t linesize;
if (gs_texture_map(spv->white, &ptr, &linesize)) {
fill_texture((uint32_t*)ptr, 0xFFFFFFFF);
fill_texture((uint32_t *)ptr, 0xFFFFFFFF);
gs_texture_unmap(spv->white);
}
if (gs_texture_map(spv->black, &ptr, &linesize)) {
fill_texture((uint32_t*)ptr, 0xFF000000);
fill_texture((uint32_t *)ptr, 0xFF000000);
gs_texture_unmap(spv->black);
}
@ -71,7 +71,7 @@ static void *sync_pair_vid_create(obs_data_t *settings, obs_source_t *source)
}
static inline bool whitelist_time(uint64_t ts, uint64_t interval,
uint64_t fps_num, uint64_t fps_den)
uint64_t fps_num, uint64_t fps_den)
{
if (!starting_time)
return false;
@ -120,13 +120,13 @@ static uint32_t sync_pair_vid_size(void *data)
}
struct obs_source_info sync_video = {
.id = "sync_video",
.type = OBS_SOURCE_TYPE_INPUT,
.id = "sync_video",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_VIDEO,
.get_name = sync_pair_vid_getname,
.create = sync_pair_vid_create,
.destroy = sync_pair_vid_destroy,
.get_name = sync_pair_vid_getname,
.create = sync_pair_vid_create,
.destroy = sync_pair_vid_destroy,
.video_render = sync_pair_vid_render,
.get_width = sync_pair_vid_size,
.get_height = sync_pair_vid_size,
.get_width = sync_pair_vid_size,
.get_height = sync_pair_vid_size,
};

View file

@ -53,7 +53,7 @@ static void filter_render(void *data, gs_effect_t *effect)
struct test_filter *tf = data;
if (!obs_source_process_filter_begin(tf->source, GS_RGBA,
OBS_ALLOW_DIRECT_RENDERING))
OBS_ALLOW_DIRECT_RENDERING))
return;
obs_source_process_filter_end(tf->source, tf->whatever, 0, 0);
@ -62,11 +62,11 @@ static void filter_render(void *data, gs_effect_t *effect)
}
struct obs_source_info test_filter = {
.id = "test_filter",
.type = OBS_SOURCE_TYPE_FILTER,
.id = "test_filter",
.type = OBS_SOURCE_TYPE_FILTER,
.output_flags = OBS_SOURCE_VIDEO,
.get_name = filter_getname,
.create = filter_create,
.destroy = filter_destroy,
.video_render = filter_render
.get_name = filter_getname,
.create = filter_create,
.destroy = filter_destroy,
.video_render = filter_render,
};

View file

@ -5,9 +5,9 @@
struct random_tex {
obs_source_t *source;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
};
static const char *random_getname(void *unused)
@ -38,28 +38,28 @@ static inline void fill_texture(uint32_t *pixels)
for (y = 0; y < 20; y++) {
for (x = 0; x < 20; x++) {
uint32_t pixel = 0;
pixel |= (rand()%256);
pixel |= (rand()%256) << 8;
pixel |= (rand()%256) << 16;
pixel |= (rand() % 256);
pixel |= (rand() % 256) << 8;
pixel |= (rand() % 256) << 16;
//pixel |= (rand()%256) << 24;
//pixel |= 0xFFFFFFFF;
pixels[y*20 + x] = pixel;
pixels[y * 20 + x] = pixel;
}
}
}
static void *video_thread(void *data)
{
struct random_tex *rt = data;
uint32_t pixels[20*20];
uint64_t cur_time = os_gettime_ns();
struct random_tex *rt = data;
uint32_t pixels[20 * 20];
uint64_t cur_time = os_gettime_ns();
struct obs_source_frame frame = {
.data = {[0] = (uint8_t*)pixels},
.linesize = {[0] = 20*4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX
.data = {[0] = (uint8_t *)pixels},
.linesize = {[0] = 20 * 4},
.width = 20,
.height = 20,
.format = VIDEO_FORMAT_BGRX,
};
while (os_event_try(rt->stop_signal) == EAGAIN) {
@ -98,10 +98,10 @@ static void *random_create(obs_data_t *settings, obs_source_t *source)
}
struct obs_source_info test_random = {
.id = "random",
.type = OBS_SOURCE_TYPE_INPUT,
.id = "random",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_ASYNC_VIDEO,
.get_name = random_getname,
.create = random_create,
.destroy = random_destroy,
.get_name = random_getname,
.create = random_create,
.destroy = random_destroy,
};

View file

@ -5,20 +5,20 @@
#include <obs.h>
struct sinewave_data {
bool initialized_thread;
pthread_t thread;
os_event_t *event;
bool initialized_thread;
pthread_t thread;
os_event_t *event;
obs_source_t *source;
};
/* middle C */
static const double rate = 261.63/48000.0;
static const double rate = 261.63 / 48000.0;
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
#define M_PI_X2 M_PI*2
#define M_PI_X2 M_PI * 2
static void *sinewave_thread(void *pdata)
{
@ -38,7 +38,7 @@ static void *sinewave_thread(void *pdata)
cos_val -= M_PI_X2;
double wave = cos(cos_val) * 0.5;
bytes[i] = (uint8_t)((wave+1.0)*0.5 * 255.0);
bytes[i] = (uint8_t)((wave + 1.0) * 0.5 * 255.0);
}
struct obs_source_audio data;
@ -80,8 +80,7 @@ static void sinewave_destroy(void *data)
}
}
static void *sinewave_create(obs_data_t *settings,
obs_source_t *source)
static void *sinewave_create(obs_data_t *settings, obs_source_t *source)
{
struct sinewave_data *swd = bzalloc(sizeof(struct sinewave_data));
swd->source = source;
@ -102,10 +101,10 @@ fail:
}
struct obs_source_info test_sinewave = {
.id = "test_sinewave",
.type = OBS_SOURCE_TYPE_INPUT,
.id = "test_sinewave",
.type = OBS_SOURCE_TYPE_INPUT,
.output_flags = OBS_SOURCE_AUDIO,
.get_name = sinewave_getname,
.create = sinewave_create,
.destroy = sinewave_destroy,
.get_name = sinewave_getname,
.create = sinewave_create,
.destroy = sinewave_destroy,
};