Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / gst / videomixer / videomixer2.h
1 /* Generic video mixer plugin
2  * Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
3  * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
4  *
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.
9  *
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.
14  *
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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20  
21 #ifndef __GST_VIDEO_MIXER2_H__
22 #define __GST_VIDEO_MIXER2_H__
23
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26
27 #include "blend.h"
28 #include <gst/base/gstcollectpads2.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_VIDEO_MIXER2 (gst_videomixer2_get_type())
33 #define GST_VIDEO_MIXER2(obj) \
34         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_MIXER2, GstVideoMixer2))
35 #define GST_VIDEO_MIXER2_CLASS(klass) \
36         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_MIXER2, GstVideoMixer2Class))
37 #define GST_IS_VIDEO_MIXER2(obj) \
38         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_MIXER2))
39 #define GST_IS_VIDEO_MIXER2_CLASS(klass) \
40         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_MIXER2))
41
42 typedef struct _GstVideoMixer2 GstVideoMixer2;
43 typedef struct _GstVideoMixer2Class GstVideoMixer2Class;
44
45 /**
46  * GstVideoMixer2Background:
47  * @VIDEO_MIXER2_BACKGROUND_CHECKER: checker pattern background
48  * @VIDEO_MIXER2_BACKGROUND_BLACK: solid color black background
49  * @VIDEO_MIXER2_BACKGROUND_WHITE: solid color white background
50  * @VIDEO_MIXER2_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.
51  *
52  * The different backgrounds videomixer can blend over.
53  */
54 typedef enum
55 {
56   VIDEO_MIXER2_BACKGROUND_CHECKER,
57   VIDEO_MIXER2_BACKGROUND_BLACK,
58   VIDEO_MIXER2_BACKGROUND_WHITE,
59   VIDEO_MIXER2_BACKGROUND_TRANSPARENT,
60 }
61 GstVideoMixer2Background;
62
63 /**
64  * GstVideoMixer2:
65  *
66  * The opaque #GstVideoMixer2 structure.
67  */
68 struct _GstVideoMixer2
69 {
70   GstElement element;
71
72   /* < private > */
73
74   /* pad */
75   GstPad *srcpad;
76
77   /* Lock to prevent the state to change while blending */
78   GMutex *lock;
79   /* Sink pads using Collect Pads 2*/
80   GstCollectPads2 *collect;
81
82   /* sinkpads, a GSList of GstVideoMixer2Pads */
83   GSList *sinkpads;
84   gint numpads;
85   /* Next available sinkpad index */
86   gint next_sinkpad;
87
88   /* Output caps */
89   GstVideoFormat format;
90   gint width, height;
91   gint fps_n;
92   gint fps_d;
93   gint par_n;
94   gint par_d;
95
96   gboolean newseg_pending;
97   gboolean flush_stop_pending;
98
99   GstVideoMixer2Background background;
100
101   /* Current downstream segment */
102   GstSegment segment;
103   GstClockTime ts_offset;
104   guint64 nframes;
105
106   /* QoS stuff */
107   gdouble proportion;
108   GstClockTime earliest_time;
109   guint64 qos_processed, qos_dropped;
110
111   BlendFunction blend, overlay;
112   FillCheckerFunction fill_checker;
113   FillColorFunction fill_color;
114 };
115
116 struct _GstVideoMixer2Class
117 {
118   GstElementClass parent_class;
119 };
120
121 GType gst_videomixer2_get_type (void);
122 gboolean gst_videomixer2_register (GstPlugin * plugin);
123
124 G_END_DECLS
125 #endif /* __GST_VIDEO_MIXER2_H__ */