1 /*
2  * GStreamer
3  * Copyright (C) 2015 Lubosz Sarnecki <lubosz.sarnecki@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., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef __GST_GL_OVERLAY_COMPOSITOR_H__
22 #define __GST_GL_OVERLAY_COMPOSITOR_H__
23 
24 #include <gst/video/video.h>
25 #include <gst/gl/gstgl_fwd.h>
26 
27 #define GST_TYPE_GL_OVERLAY_COMPOSITOR (gst_gl_overlay_compositor_get_type())
28 #define GST_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositor))
29 #define GST_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositorClass))
30 #define GST_IS_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR))
31 #define GST_IS_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR))
32 #define GST_GL_OVERLAY_COMPOSITOR_CAST(obj) ((GstGLOverlayCompositor*)(obj))
33 
34 G_BEGIN_DECLS
35 
36 GST_GL_API
37 GType gst_gl_overlay_compositor_get_type (void);
38 
39 /**
40  * GstGLOverlayCompositor:
41  *
42  * Opaque #GstGLOverlayCompositor object
43  */
44 struct _GstGLOverlayCompositor
45 {
46   /* <private> */
47   GstObject parent;
48 
49   GstGLContext *context;
50 
51   guint last_window_width;
52   guint last_window_height;
53 
54   GList * overlays;
55 
56   GstGLShader *shader;
57   gint  position_attrib;
58   gint  texcoord_attrib;
59 
60   gpointer _padding[GST_PADDING];
61 };
62 
63 /**
64  * GstGLOverlayCompositorClass:
65  *
66  */
67 struct _GstGLOverlayCompositorClass
68 {
69   GstObjectClass object_class;
70 
71   /* <private> */
72   gpointer _padding[GST_PADDING];
73 };
74 
75 GST_GL_API
76 GstGLOverlayCompositor *gst_gl_overlay_compositor_new (GstGLContext * context);
77 
78 GST_GL_API
79 void gst_gl_overlay_compositor_free_overlays (GstGLOverlayCompositor * compositor);
80 
81 GST_GL_API
82 void gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor,
83         GstBuffer * buf);
84 
85 GST_GL_API
86 void gst_gl_overlay_compositor_draw_overlays (GstGLOverlayCompositor * compositor);
87 
88 GST_GL_API
89 GstCaps * gst_gl_overlay_compositor_add_caps(GstCaps * caps);
90 
91 G_END_DECLS
92 #endif /* __GST_GL_OVERLAY_COMPOSITOR_H__ */
93