Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / gst / alpha / gstalpha.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) <2007> Wim Taymans <wim.taymans@collabora.co.uk>
4  * Copyright (C) <2007> Edward Hervey <edward.hervey@collabora.co.uk>
5  * Copyright (C) <2007> Jan Schmidt <thaytan@noraisin.net>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __GST_ALPHA_H__
24 #define __GST_ALPHA_H__
25
26 #include <gst/gst.h>
27 #include <gst/video/video.h>
28 #include <gst/video/gstvideofilter.h>
29 #include <gst/controller/gstcontroller.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_ALPHA \
34   (gst_alpha_get_type())
35 #define GST_ALPHA(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALPHA,GstAlpha))
37 #define GST_ALPHA_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALPHA,GstAlphaClass))
39 #define GST_IS_ALPHA(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALPHA))
41 #define GST_IS_ALPHA_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALPHA))
43
44 typedef struct _GstAlpha GstAlpha;
45 typedef struct _GstAlphaClass GstAlphaClass;
46
47 /** 
48  * GstAlphaMethod:
49  * @ALPHA_METHOD_SET: Set/adjust alpha channel
50  * @ALPHA_METHOD_GREEN: Chroma Key green
51  * @ALPHA_METHOD_BLUE: Chroma Key blue
52  * @ALPHA_METHOD_CUSTOM: Chroma Key on target_r/g/b
53  */
54 typedef enum
55 {
56   ALPHA_METHOD_SET,
57   ALPHA_METHOD_GREEN,
58   ALPHA_METHOD_BLUE,
59   ALPHA_METHOD_CUSTOM,
60 }
61 GstAlphaMethod;
62
63 GST_DEBUG_CATEGORY_STATIC (gst_alpha_debug);
64 #define GST_CAT_DEFAULT gst_alpha_debug
65
66 struct _GstAlpha
67 {
68   GstVideoFilter parent;
69
70   /* <private> */
71
72   /* caps */
73 #if !GLIB_CHECK_VERSION (2, 31, 0)
74   GStaticMutex lock;
75 #else
76   GMutex lock;
77 #endif
78
79   GstVideoFormat in_format, out_format;
80   gint width, height;
81   gboolean in_sdtv, out_sdtv;
82
83   /* properties */
84   gdouble alpha;
85
86   guint target_r;
87   guint target_g;
88   guint target_b;
89
90   GstAlphaMethod method;
91
92   gfloat angle;
93   gfloat noise_level;
94   guint black_sensitivity;
95   guint white_sensitivity;
96
97   gboolean prefer_passthrough;
98
99   /* processing function */
100   void (*process) (const guint8 *src, guint8 *dest, gint width, gint height, GstAlpha *alpha);
101
102   /* precalculated values for chroma keying */
103   gint8 cb, cr;
104   gint8 kg;
105   guint8 accept_angle_tg;
106   guint8 accept_angle_ctg;
107   guint8 one_over_kc;
108   guint8 kfgy_scale;
109   guint noise_level2;
110 };
111
112 struct _GstAlphaClass
113 {
114   GstVideoFilterClass parent_class;
115 };
116
117 GType gst_alpha_get_type (void);
118
119 G_END_DECLS
120
121 #endif /* __GST_ALPHA_H__ */