1 /* GStreamer 2 * Copyright (C) 2018 Matthew Waters <matthew@centricular.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 21 #ifndef __GST_GL_ALPHA_H__ 22 #define __GST_GL_ALPHA_H__ 23 24 #include <gst/gst.h> 25 #include <gst/video/video.h> 26 #include <gst/gl/gl.h> 27 28 G_BEGIN_DECLS 29 30 #define GST_TYPE_GL_ALPHA \ 31 (gst_gl_alpha_get_type()) 32 #define GST_GL_ALPHA(obj) \ 33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_ALPHA,GstGLAlpha)) 34 #define GST_GL_ALPHA_CLASS(klass) \ 35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_ALPHA,GstGLAlphaClass)) 36 #define GST_IS_GL_ALPHA(obj) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_ALPHA)) 38 #define GST_IS_GL_ALPHA_CLASS(klass) \ 39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_ALPHA)) 40 41 typedef struct _GstGLAlpha GstGLAlpha; 42 typedef struct _GstGLAlphaClass GstGLAlphaClass; 43 44 /** 45 * GstGLAlphaMethod: 46 * @ALPHA_METHOD_SET: Set/adjust alpha channel 47 * @ALPHA_METHOD_GREEN: Chroma Key green 48 * @ALPHA_METHOD_BLUE: Chroma Key blue 49 * @ALPHA_METHOD_CUSTOM: Chroma Key on target_r/g/b 50 */ 51 typedef enum 52 { 53 ALPHA_METHOD_SET, 54 ALPHA_METHOD_GREEN, 55 ALPHA_METHOD_BLUE, 56 ALPHA_METHOD_CUSTOM, 57 } 58 GstGLAlphaMethod; 59 60 /** 61 * GstGLAlpha: 62 * 63 * Opaque data structure. 64 */ 65 struct _GstGLAlpha { 66 GstGLFilter videofilter; 67 68 /* < private > */ 69 GstGLShader *alpha_shader; 70 GstGLShader *chroma_key_shader; 71 72 /* properties */ 73 gdouble alpha; 74 75 guint target_r; 76 guint target_g; 77 guint target_b; 78 79 GstGLAlphaMethod method; 80 81 gfloat angle; 82 gfloat noise_level; 83 guint black_sensitivity; 84 guint white_sensitivity; 85 86 /* precalculated values for chroma keying */ 87 gfloat cb, cr; 88 gfloat kg; 89 gfloat accept_angle_tg; 90 gfloat accept_angle_ctg; 91 gfloat one_over_kc; 92 gfloat kfgy_scale; 93 gfloat noise_level2; 94 }; 95 96 struct _GstGLAlphaClass { 97 GstGLFilterClass parent_class; 98 }; 99 100 GType gst_gl_alpha_get_type(void); 101 102 G_END_DECLS 103 104 #endif /* __GST_GL_ALPHA_H__ */ 105