Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / gst / videomixer / videomixer.h
1 /* Generic video mixer plugin
2  * Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19  
20 #ifndef __GST_VIDEO_MIXER_H__
21 #define __GST_VIDEO_MIXER_H__
22
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include "videomixerpad.h"
26 #include "blend.h"
27
28 G_BEGIN_DECLS
29
30 #define GST_TYPE_VIDEO_MIXER (gst_videomixer_get_type())
31 #define GST_VIDEO_MIXER(obj) \
32         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_MIXER, GstVideoMixer))
33 #define GST_VIDEO_MIXER_CLASS(klass) \
34         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_MIXER, GstVideoMixerClass))
35 #define GST_IS_VIDEO_MIXER(obj) \
36         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_MIXER))
37 #define GST_IS_VIDEO_MIXER_CLASS(klass) \
38         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_MIXER))
39
40 typedef struct _GstVideoMixer GstVideoMixer;
41 typedef struct _GstVideoMixerClass GstVideoMixerClass;
42
43 /**
44  * GstVideoMixerBackground:
45  * @VIDEO_MIXER_BACKGROUND_CHECKER: checker pattern background
46  * @VIDEO_MIXER_BACKGROUND_BLACK: solid color black background
47  * @VIDEO_MIXER_BACKGROUND_WHITE: solid color white background
48  * @VIDEO_MIXER_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.
49  *
50  * The different backgrounds videomixer can blend over.
51  */
52 typedef enum
53 {
54   VIDEO_MIXER_BACKGROUND_CHECKER,
55   VIDEO_MIXER_BACKGROUND_BLACK,
56   VIDEO_MIXER_BACKGROUND_WHITE,
57   VIDEO_MIXER_BACKGROUND_TRANSPARENT,
58 }
59 GstVideoMixerBackground;
60
61 /**
62  * GstVideoMixer:
63  *
64  * The opaque #GstVideoMixer structure.
65  */
66 struct _GstVideoMixer
67 {
68   GstElement element;
69
70   /* pad */
71   GstPad *srcpad;
72
73   /* Lock to prevent the state to change while blending */
74   GMutex *state_lock;
75   /* Sink pads using Collect Pads from core's base library */
76   GstCollectPads *collect;
77   /* sinkpads, a GSList of GstVideoMixerPads */
78   GSList *sinkpads;
79
80   gint numpads;
81
82   GstClockTime last_ts;
83   GstClockTime last_duration;
84
85   /* the master pad */
86   GstVideoMixerPad *master;
87
88   GstVideoFormat fmt;
89
90   gint in_width, in_height;
91   gint out_width, out_height;
92   gboolean setcaps;
93   gboolean sendseg;
94
95   GstVideoMixerBackground background;
96
97   gint fps_n;
98   gint fps_d;
99
100   gint par_n;
101   gint par_d;
102
103   /* Next available sinkpad index */
104   gint next_sinkpad;
105
106   /* sink event handling */
107   GstPadEventFunction collect_event;
108   guint64       segment_position;
109
110   /* Current downstream segment */
111   GstSegment    segment;
112
113   /* QoS stuff */
114   gdouble proportion;
115   GstClockTime earliest_time;
116
117   BlendFunction blend, overlay;
118   FillCheckerFunction fill_checker;
119   FillColorFunction fill_color;
120
121   gboolean flush_stop_pending;
122 };
123
124 struct _GstVideoMixerClass
125 {
126   GstElementClass parent_class;
127 };
128
129 GType gst_video_mixer_get_type (void);
130
131 G_END_DECLS
132 #endif /* __GST_VIDEO_MIXER_H__ */