1 /* Generic video compositor plugin
2 * Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
3 * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef __GST_COMPOSITOR_H__
22 #define __GST_COMPOSITOR_H__
25 #include <gst/video/video.h>
26 #include <gst/video/gstvideoaggregator.h>
32 #define GST_TYPE_COMPOSITOR (gst_compositor_get_type())
33 #define GST_COMPOSITOR(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COMPOSITOR, GstCompositor))
35 #define GST_COMPOSITOR_CLASS(klass) \
36 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COMPOSITOR, GstCompositorClass))
37 #define GST_IS_COMPOSITOR(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COMPOSITOR))
39 #define GST_IS_COMPOSITOR_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COMPOSITOR))
42 #define GST_TYPE_COMPOSITOR_PAD (gst_compositor_pad_get_type())
43 #define GST_COMPOSITOR_PAD(obj) \
44 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COMPOSITOR_PAD, GstCompositorPad))
45 #define GST_COMPOSITOR_PAD_CLASS(klass) \
46 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COMPOSITOR_PAD, GstCompositorPadClass))
47 #define GST_IS_COMPOSITOR_PAD(obj) \
48 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COMPOSITOR_PAD))
49 #define GST_IS_COMPOSITOR_PAD_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COMPOSITOR_PAD))
52 typedef struct _GstCompositor GstCompositor;
53 typedef struct _GstCompositorClass GstCompositorClass;
55 typedef struct _GstCompositorPad GstCompositorPad;
56 typedef struct _GstCompositorPadClass GstCompositorPadClass;
59 * GstCompositorBackground:
60 * @COMPOSITOR_BACKGROUND_CHECKER: checker pattern background
61 * @COMPOSITOR_BACKGROUND_BLACK: solid color black background
62 * @COMPOSITOR_BACKGROUND_WHITE: solid color white background
63 * @COMPOSITOR_BACKGROUND_TRANSPARENT: background is left transparent and layers are composited using "A OVER B" composition rules. This is only applicable to AYUV and ARGB (and variants) as it preserves the alpha channel and allows for further mixing.
65 * The different backgrounds compositor can blend over.
69 COMPOSITOR_BACKGROUND_CHECKER,
70 COMPOSITOR_BACKGROUND_BLACK,
71 COMPOSITOR_BACKGROUND_WHITE,
72 COMPOSITOR_BACKGROUND_TRANSPARENT,
73 } GstCompositorBackground;
76 * GstCompositorOperator:
77 * @COMPOSITOR_OPERATOR_SOURCE: Copy the source over the destination,
78 * without the destination pixels.
79 * @COMPOSITOR_OPERATOR_OVER: Blend the source over the destination.
80 * @COMPOSITOR_OPERATOR_ADD: Similar to over but add the source and
81 * destination alpha. Requires output with alpha
84 * The different blending operators that can be used by compositor.
86 * See https://www.cairographics.org/operators/ for some explanation and
92 COMPOSITOR_OPERATOR_SOURCE,
93 COMPOSITOR_OPERATOR_OVER,
94 COMPOSITOR_OPERATOR_ADD,
95 } GstCompositorOperator;
100 * The opaque #GstCompositor structure.
102 struct _GstCompositor
104 GstVideoAggregator videoaggregator;
105 GstCompositorBackground background;
107 /* The 'blend' compositing function does not preserve the alpha value of the
108 * background, while 'overlay' does; i.e., COMPOSITOR_OPERATOR_ADD is the
109 * same as COMPOSITOR_OPERATOR_OVER when using the 'blend' BlendFunction. */
110 BlendFunction blend, overlay;
111 FillCheckerFunction fill_checker;
112 FillColorFunction fill_color;
115 struct _GstCompositorClass
117 GstVideoAggregatorClass parent_class;
123 * The opaque #GstCompositorPad structure.
125 struct _GstCompositorPad
127 GstVideoAggregatorConvertPad parent;
134 GstCompositorOperator op;
137 struct _GstCompositorPadClass
139 GstVideoAggregatorConvertPadClass parent_class;
142 GType gst_compositor_get_type (void);
143 GType gst_compositor_pad_get_type (void);
146 #endif /* __GST_COMPOSITOR_H__ */