1 /*
2  * GStreamer
3  * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
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., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef __GST_GL_MIXER_H__
22 #define __GST_GL_MIXER_H__
23 
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26 #include <gst/gl/gl.h>
27 #include <gst/gl/gstglfuncs.h>
28 #include "gstglbasemixer.h"
29 
30 G_BEGIN_DECLS
31 
32 typedef struct _GstGLMixer GstGLMixer;
33 typedef struct _GstGLMixerClass GstGLMixerClass;
34 typedef struct _GstGLMixerPrivate GstGLMixerPrivate;
35 
36 #define GST_TYPE_GL_MIXER_PAD (gst_gl_mixer_pad_get_type())
37 #define GST_GL_MIXER_PAD(obj) \
38         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER_PAD, GstGLMixerPad))
39 #define GST_GL_MIXER_PAD_CLASS(klass) \
40         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER_PAD, GstGLMixerPadClass))
41 #define GST_IS_GL_MIXER_PAD(obj) \
42         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER_PAD))
43 #define GST_IS_GL_MIXER_PAD_CLASS(klass) \
44         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER_PAD))
45 #define GST_GL_MIXER_PAD_GET_CLASS(obj) \
46         (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER_PAD,GstGLMixerPadClass))
47 
48 typedef struct _GstGLMixerPad GstGLMixerPad;
49 typedef struct _GstGLMixerPadClass GstGLMixerPadClass;
50 
51 /* all information needed for one video stream */
52 struct _GstGLMixerPad
53 {
54   GstGLBaseMixerPad parent;
55 
56   guint current_texture;
57 };
58 
59 struct _GstGLMixerPadClass
60 {
61   GstGLBaseMixerPadClass parent_class;
62 };
63 
64 GType gst_gl_mixer_pad_get_type (void);
65 
66 #define GST_TYPE_GL_MIXER (gst_gl_mixer_get_type())
67 #define GST_GL_MIXER(obj) \
68         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER, GstGLMixer))
69 #define GST_GL_MIXER_CLASS(klass) \
70         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER, GstGLMixerClass))
71 #define GST_IS_GL_MIXER(obj) \
72         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER))
73 #define GST_IS_GL_MIXER_CLASS(klass) \
74         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER))
75 #define GST_GL_MIXER_GET_CLASS(obj) \
76         (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER,GstGLMixerClass))
77 
78 typedef gboolean (*GstGLMixerSetCaps) (GstGLMixer* mixer,
79   GstCaps* outcaps);
80 typedef void (*GstGLMixerReset) (GstGLMixer *mixer);
81 typedef gboolean (*GstGLMixerProcessFunc) (GstGLMixer *mix, GstBuffer *outbuf);
82 typedef gboolean (*GstGLMixerProcessTextures) (GstGLMixer *mix, GstGLMemory *out_tex);
83 
84 struct _GstGLMixer
85 {
86   GstGLBaseMixer vaggregator;
87 
88   GstGLFramebuffer *fbo;
89 
90   GstCaps *out_caps;
91 
92   GstGLMixerPrivate *priv;
93 };
94 
95 struct _GstGLMixerClass
96 {
97   GstGLBaseMixerClass parent_class;
98 
99   GstGLMixerSetCaps set_caps;
100   GstGLMixerReset reset;
101   GstGLMixerProcessFunc process_buffers;
102   GstGLMixerProcessTextures process_textures;
103 };
104 
105 GType gst_gl_mixer_get_type(void);
106 
107 gboolean gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf);
108 
109 G_END_DECLS
110 #endif /* __GST_GL_MIXER_H__ */
111