Merge branch 'master' into 0.11
[platform/upstream/gstreamer.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   GStaticMutex lock;
74
75   GstVideoInfo in_info, out_info;
76   gboolean in_sdtv, out_sdtv;
77
78   /* properties */
79   gdouble alpha;
80
81   guint target_r;
82   guint target_g;
83   guint target_b;
84
85   GstAlphaMethod method;
86
87   gfloat angle;
88   gfloat noise_level;
89   guint black_sensitivity;
90   guint white_sensitivity;
91
92   gboolean prefer_passthrough;
93
94   /* processing function */
95   void (*process) (const GstVideoFrame *in_frame, GstVideoFrame *out_frame, GstAlpha *alpha);
96
97   /* precalculated values for chroma keying */
98   gint8 cb, cr;
99   gint8 kg;
100   guint8 accept_angle_tg;
101   guint8 accept_angle_ctg;
102   guint8 one_over_kc;
103   guint8 kfgy_scale;
104   guint noise_level2;
105 };
106
107 struct _GstAlphaClass
108 {
109   GstVideoFilterClass parent_class;
110 };
111
112 GType gst_alpha_get_type (void);
113
114 G_END_DECLS
115
116 #endif /* __GST_ALPHA_H__ */