- const char* shader_stack[] = { 0, 0, 0, 0, 0 };
-
- switch(get_output()->get_color_model())
- {
- case BC_YUV888:
- case BC_YUVA8888:
- shader_stack[0] = yuv_shader;
- shader_stack[1] = hsv_shader;
- if(config.show_mask)
- shader_stack[2] = show_yuvmask_shader;
- else
- shader_stack[2] = nomask_shader;
- shader_stack[3] = shader;
- break;
-
- default:
- shader_stack[0] = rgb_shader;
- shader_stack[1] = hsv_shader;
- if(config.show_mask)
- shader_stack[2] = show_rgbmask_shader;
- else
- shader_stack[2] = nomask_shader;
- shader_stack[3] = shader;
- break;
- }
-
-
- unsigned int frag = VFrame::make_shader(0,
- shader_stack[0],
- shader_stack[1],
- shader_stack[2],
- shader_stack[3],
- 0);
-
- if(frag)
- {
- glUseProgram(frag);
- glUniform1i(glGetUniformLocation(frag, "tex"), 0);
- glUniform1f(glGetUniformLocation(frag, "red"), red);
- glUniform1f(glGetUniformLocation(frag, "green"), green);
- glUniform1f(glGetUniformLocation(frag, "blue"), blue);
- glUniform1f(glGetUniformLocation(frag, "in_slope"), in_slope);
- glUniform1f(glGetUniformLocation(frag, "out_slope"), out_slope);
- glUniform1f(glGetUniformLocation(frag, "tolerance"), tolerance);
- glUniform1f(glGetUniformLocation(frag, "tolerance_in"), tolerance_in);
- glUniform1f(glGetUniformLocation(frag, "tolerance_out"), tolerance_out);
- glUniform1f(glGetUniformLocation(frag, "sat"), sat);
- glUniform1f(glGetUniformLocation(frag, "min_s"), min_s);
- glUniform1f(glGetUniformLocation(frag, "min_s_in"), min_s_in);
- glUniform1f(glGetUniformLocation(frag, "min_s_out"), min_s_out);
- glUniform1f(glGetUniformLocation(frag, "min_v"), min_v);
- glUniform1f(glGetUniformLocation(frag, "min_v_in"), min_v_in);
- glUniform1f(glGetUniformLocation(frag, "min_v_out"), min_v_out);
- glUniform1f(glGetUniformLocation(frag, "max_v"), max_v);
- glUniform1f(glGetUniformLocation(frag, "max_v_in"), max_v_in);
- glUniform1f(glGetUniformLocation(frag, "max_v_out"), max_v_out);
- glUniform1f(glGetUniformLocation(frag, "spill_threshold"), spill_threshold);
- glUniform1f(glGetUniformLocation(frag, "spill_amount"), spill_amount);
- glUniform1f(glGetUniformLocation(frag, "alpha_offset"), alpha_offset);
- glUniform1f(glGetUniformLocation(frag, "hue_key"), hue_key);
- glUniform1f(glGetUniformLocation(frag, "saturation_key"), saturation_key);
- glUniform1f(glGetUniformLocation(frag, "value_key"), value_key);
+ const char *shader_stack[16];
+ memset(shader_stack,0, sizeof(shader_stack));
+ int current_shader = 0;
+
+ shader_stack[current_shader++] = \
+ !BC_CModels::is_yuv(get_output()->get_color_model()) ?
+ rgb_shader : yuv_shader;
+ shader_stack[current_shader++] = hsv_shader;
+ shader_stack[current_shader++] = !config.show_mask ? nomask_shader :
+ !BC_CModels::is_yuv(get_output()->get_color_model()) ?
+ show_rgbmask_shader : show_yuvmask_shader ;
+ extern unsigned char _binary_chromakey_sl_start[];
+ static const char *shader_frag = (char*)_binary_chromakey_sl_start;
+ shader_stack[current_shader++] = shader_frag;
+
+ shader_stack[current_shader] = 0;
+ unsigned int shader = VFrame::make_shader(shader_stack);
+ if( shader > 0 ) {
+ glUseProgram(shader);
+ glUniform1i(glGetUniformLocation(shader, "tex"), 0);
+ glUniform1f(glGetUniformLocation(shader, "red"), red);
+ glUniform1f(glGetUniformLocation(shader, "green"), green);
+ glUniform1f(glGetUniformLocation(shader, "blue"), blue);
+ glUniform1f(glGetUniformLocation(shader, "in_slope"), in_slope);
+ glUniform1f(glGetUniformLocation(shader, "out_slope"), out_slope);
+ glUniform1f(glGetUniformLocation(shader, "tolerance"), tolerance);
+ glUniform1f(glGetUniformLocation(shader, "tolerance_in"), tolerance_in);
+ glUniform1f(glGetUniformLocation(shader, "tolerance_out"), tolerance_out);
+ glUniform1f(glGetUniformLocation(shader, "sat"), sat);
+ glUniform1f(glGetUniformLocation(shader, "min_s"), min_s);
+ glUniform1f(glGetUniformLocation(shader, "min_s_in"), min_s_in);
+ glUniform1f(glGetUniformLocation(shader, "min_s_out"), min_s_out);
+ glUniform1f(glGetUniformLocation(shader, "min_v"), min_v);
+ glUniform1f(glGetUniformLocation(shader, "min_v_in"), min_v_in);
+ glUniform1f(glGetUniformLocation(shader, "min_v_out"), min_v_out);
+ glUniform1f(glGetUniformLocation(shader, "max_v"), max_v);
+ glUniform1f(glGetUniformLocation(shader, "max_v_in"), max_v_in);
+ glUniform1f(glGetUniformLocation(shader, "max_v_out"), max_v_out);
+ glUniform1f(glGetUniformLocation(shader, "spill_threshold"), spill_threshold);
+ glUniform1f(glGetUniformLocation(shader, "spill_amount"), spill_amount);
+ glUniform1f(glGetUniformLocation(shader, "alpha_offset"), alpha_offset);
+ glUniform1f(glGetUniformLocation(shader, "hue_key"), hue_key);
+ glUniform1f(glGetUniformLocation(shader, "saturation_key"), saturation_key);
+ glUniform1f(glGetUniformLocation(shader, "value_key"), value_key);
+ if( BC_CModels::is_yuv(get_output()->get_color_model()) )
+ BC_GL_COLORS(shader);