Skip to content

Commit

Permalink
fix color space
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Oct 2, 2023
1 parent 95bd06d commit 926237d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else()
cmake_minimum_required(VERSION 3.18)
endif()

project(obs-shaderfilter VERSION 2.1.0)
project(obs-shaderfilter VERSION 2.1.1)
set(PROJECT_FULL_NAME "OBS Shaderfilter")

# Set new UUIDs when you start to create a new plugin.
Expand Down
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@
}
},
"name": "obs-shaderfilter",
"version": "2.1.0"
"version": "2.1.1"
}
26 changes: 11 additions & 15 deletions obs-shaderfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,11 @@ static void shader_filter_update(void *data, obs_data_t *settings)
obs_data_set_default_int(settings, param_name,
0xffffffff);
}
param->value.i = obs_data_get_int(settings, param_name);
uint32_t c = (uint32_t)obs_data_get_int(settings,
param_name);
struct vec4 color;
vec4_from_rgba_srgb(&color, c);
param->value.i = vec4_to_rgba(&color);
break;
}
case GS_SHADER_PARAM_TEXTURE:
Expand Down Expand Up @@ -1317,25 +1321,17 @@ static enum gs_color_space
shader_filter_get_color_space(void *data, size_t count,
const enum gs_color_space *preferred_spaces)
{
UNUSED_PARAMETER(count);
UNUSED_PARAMETER(preferred_spaces);
struct shader_filter_data *filter = data;
obs_source_t *target = obs_filter_get_target(filter->context);
const enum gs_color_space potential_spaces[] = {
GS_CS_SRGB,
GS_CS_SRGB_16F,
GS_CS_709_EXTENDED,
};

struct shader_filter_data *filter = data;
const enum gs_color_space source_space = obs_source_get_color_space(
obs_filter_get_target(filter->context),
OBS_COUNTOF(potential_spaces), potential_spaces);

enum gs_color_space space = source_space;
for (size_t i = 0; i < count; ++i) {
space = preferred_spaces[i];
if (space == source_space)
break;
}

return space;
return obs_source_get_color_space(target, OBS_COUNTOF(potential_spaces),
potential_spaces);
}

struct obs_source_info shader_filter = {
Expand Down

0 comments on commit 926237d

Please sign in to comment.