• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, 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 
30 G_BEGIN_DECLS
31 
32 #define GST_TYPE_ALPHA (gst_alpha_get_type ())
33 
34 G_DECLARE_FINAL_TYPE (GstAlpha, gst_alpha, GST, ALPHA, GstVideoFilter)
35 
36 /**
37  * GstAlphaMethod:
38  * @ALPHA_METHOD_SET: Set/adjust alpha channel
39  * @ALPHA_METHOD_GREEN: Chroma Key green
40  * @ALPHA_METHOD_BLUE: Chroma Key blue
41  * @ALPHA_METHOD_CUSTOM: Chroma Key on target_r/g/b
42  */
43 typedef enum
44 {
45   ALPHA_METHOD_SET,
46   ALPHA_METHOD_GREEN,
47   ALPHA_METHOD_BLUE,
48   ALPHA_METHOD_CUSTOM,
49 }
50 GstAlphaMethod;
51 
52 GST_DEBUG_CATEGORY_STATIC (gst_alpha_debug);
53 #define GST_CAT_DEFAULT gst_alpha_debug
54 
55 struct _GstAlpha
56 {
57   GstVideoFilter parent;
58 
59   /* <private> */
60 
61   /* caps */
62   GMutex lock;
63 
64   gboolean in_sdtv, out_sdtv;
65 
66   /* properties */
67   gdouble alpha;
68 
69   guint target_r;
70   guint target_g;
71   guint target_b;
72 
73   GstAlphaMethod method;
74 
75   gfloat angle;
76   gfloat noise_level;
77   guint black_sensitivity;
78   guint white_sensitivity;
79 
80   gboolean prefer_passthrough;
81 
82   /* processing function */
83   void (*process) (const GstVideoFrame *in_frame, GstVideoFrame *out_frame, GstAlpha *alpha);
84 
85   /* precalculated values for chroma keying */
86   gint8 cb, cr;
87   gint8 kg;
88   guint8 accept_angle_tg;
89   guint8 accept_angle_ctg;
90   guint8 one_over_kc;
91   guint8 kfgy_scale;
92   guint noise_level2;
93 };
94 
95 GST_ELEMENT_REGISTER_DECLARE (alpha);
96 
97 G_END_DECLS
98 
99 #endif /* __GST_ALPHA_H__ */
100