Replace tabs with 4 spaces

This commit is contained in:
dec05eba 2023-04-18 18:34:23 +02:00
parent e985e8e18e
commit 7749ba8327
3 changed files with 26 additions and 26 deletions

View File

@ -26,30 +26,30 @@ static int load_shader_y(gsr_shader *shader, gsr_egl *egl, float rotation) {
"in vec2 texcoords; \n" "in vec2 texcoords; \n"
"out vec2 texcoords_out; \n" "out vec2 texcoords_out; \n"
ROTATE_Z ROTATE_Z
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" texcoords_out = texcoords; \n" " texcoords_out = texcoords; \n"
" gl_Position = vec4(pos.x, pos.y, 0.0, 1.0) * rotate_z(%f); \n" " gl_Position = vec4(pos.x, pos.y, 0.0, 1.0) * rotate_z(%f); \n"
"} \n", rotation); "} \n", rotation);
char fragment_shader[] = char fragment_shader[] =
"#version 300 es \n" "#version 300 es \n"
"precision mediump float; \n" "precision mediump float; \n"
"in vec2 texcoords_out; \n" "in vec2 texcoords_out; \n"
"uniform sampler2D tex1; \n" "uniform sampler2D tex1; \n"
"out vec4 FragColor; \n" "out vec4 FragColor; \n"
RGB_TO_YUV RGB_TO_YUV
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" FragColor.x = (RGBtoYUV * vec4(texture(tex1, texcoords_out).rgb, 1.0)).x; \n" " FragColor.x = (RGBtoYUV * vec4(texture(tex1, texcoords_out).rgb, 1.0)).x; \n"
"} \n"; "} \n";
if(gsr_shader_init(shader, egl, vertex_shader, fragment_shader) != 0) if(gsr_shader_init(shader, egl, vertex_shader, fragment_shader) != 0)
return -1; return -1;
gsr_shader_bind_attribute_location(shader, "pos", 0); gsr_shader_bind_attribute_location(shader, "pos", 0);
gsr_shader_bind_attribute_location(shader, "texcoords", 1); gsr_shader_bind_attribute_location(shader, "texcoords", 1);
return 0; return 0;
} }
static unsigned int load_shader_uv(gsr_shader *shader, gsr_egl *egl, float rotation) { static unsigned int load_shader_uv(gsr_shader *shader, gsr_egl *egl, float rotation) {
@ -60,30 +60,30 @@ static unsigned int load_shader_uv(gsr_shader *shader, gsr_egl *egl, float rotat
"in vec2 texcoords; \n" "in vec2 texcoords; \n"
"out vec2 texcoords_out; \n" "out vec2 texcoords_out; \n"
ROTATE_Z ROTATE_Z
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" texcoords_out = texcoords; \n" " texcoords_out = texcoords; \n"
" gl_Position = vec4(pos.x, pos.y, 0.0, 1.0) * rotate_z(%f) * vec4(0.5, 0.5, 1.0, 1.0) - vec4(0.5, 0.5, 0.0, 0.0); \n" " gl_Position = vec4(pos.x, pos.y, 0.0, 1.0) * rotate_z(%f) * vec4(0.5, 0.5, 1.0, 1.0) - vec4(0.5, 0.5, 0.0, 0.0); \n"
"} \n", rotation); "} \n", rotation);
char fragment_shader[] = char fragment_shader[] =
"#version 300 es \n" "#version 300 es \n"
"precision mediump float; \n" "precision mediump float; \n"
"in vec2 texcoords_out; \n" "in vec2 texcoords_out; \n"
"uniform sampler2D tex1; \n" "uniform sampler2D tex1; \n"
"out vec4 FragColor; \n" "out vec4 FragColor; \n"
RGB_TO_YUV RGB_TO_YUV
"void main() \n" "void main() \n"
"{ \n" "{ \n"
" FragColor.xy = (RGBtoYUV * vec4(texture(tex1, texcoords_out).rgb, 1.0)).zy; \n" " FragColor.xy = (RGBtoYUV * vec4(texture(tex1, texcoords_out).rgb, 1.0)).zy; \n"
"} \n"; "} \n";
if(gsr_shader_init(shader, egl, vertex_shader, fragment_shader) != 0) if(gsr_shader_init(shader, egl, vertex_shader, fragment_shader) != 0)
return -1; return -1;
gsr_shader_bind_attribute_location(shader, "pos", 0); gsr_shader_bind_attribute_location(shader, "pos", 0);
gsr_shader_bind_attribute_location(shader, "texcoords", 1); gsr_shader_bind_attribute_location(shader, "texcoords", 1);
return 0; return 0;
} }
static int loader_framebuffers(gsr_color_conversion *self) { static int loader_framebuffers(gsr_color_conversion *self) {

View File

@ -98,7 +98,7 @@ static void receive_frames(AVCodecContext *av_codec_context, int stream_index, A
std::deque<AVPacket> &frame_data_queue, std::deque<AVPacket> &frame_data_queue,
int replay_buffer_size_secs, int replay_buffer_size_secs,
bool &frames_erased, bool &frames_erased,
std::mutex &write_output_mutex) { std::mutex &write_output_mutex) {
for (;;) { for (;;) {
// TODO: Use av_packet_alloc instead because sizeof(av_packet) might not be future proof(?) // TODO: Use av_packet_alloc instead because sizeof(av_packet) might not be future proof(?)
AVPacket av_packet; AVPacket av_packet;
@ -246,7 +246,7 @@ static AVCodecContext* create_audio_codec_context(int fps, AudioCodec audio_code
AVCodecContext *codec_context = avcodec_alloc_context3(codec); AVCodecContext *codec_context = avcodec_alloc_context3(codec);
assert(codec->type == AVMEDIA_TYPE_AUDIO); assert(codec->type == AVMEDIA_TYPE_AUDIO);
codec_context->codec_id = codec->id; codec_context->codec_id = codec->id;
codec_context->sample_fmt = audio_codec_get_sample_format(audio_codec, codec); codec_context->sample_fmt = audio_codec_get_sample_format(audio_codec, codec);
codec_context->bit_rate = audio_codec_get_get_bitrate(audio_codec); codec_context->bit_rate = audio_codec_get_get_bitrate(audio_codec);
codec_context->sample_rate = 48000; codec_context->sample_rate = 48000;
@ -984,9 +984,9 @@ static int init_filter_graph(AVCodecContext *audio_codec_context, AVFilterGraph
char args[512]; char args[512];
snprintf(args, sizeof(args), "inputs=%d", (int)num_sources); snprintf(args, sizeof(args), "inputs=%d", (int)num_sources);
AVFilterContext *mix_ctx; AVFilterContext *mix_ctx;
err = avfilter_graph_create_filter(&mix_ctx, mix_filter, "amix", err = avfilter_graph_create_filter(&mix_ctx, mix_filter, "amix",
args, NULL, filter_graph); args, NULL, filter_graph);
if (err < 0) { if (err < 0) {
@ -1972,7 +1972,7 @@ int main(int argc, char **argv) {
usleep(sleep_time * 1000.0 * 1000.0); usleep(sleep_time * 1000.0 * 1000.0);
} }
running = 0; running = 0;
if(save_replay_thread.valid()) { if(save_replay_thread.valid()) {
save_replay_thread.get(); save_replay_thread.get();

View File

@ -57,9 +57,9 @@ int window_texture_on_resize(WindowTexture *self) {
EGLImage image = NULL; EGLImage image = NULL;
const intptr_t pixmap_attrs[] = { const intptr_t pixmap_attrs[] = {
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
EGL_NONE, EGL_NONE,
}; };
pixmap = XCompositeNameWindowPixmap(self->display, self->window); pixmap = XCompositeNameWindowPixmap(self->display, self->window);
if(!pixmap) { if(!pixmap) {