glupload: rearchitecture for non GLMemory inputs/outputs
[platform/upstream/gstreamer.git] / ext / gl / gstglimagesink.h
1 /*
2  * GStreamer
3  * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
4  * Copyright (C) 2005,2006,2007 David A. Schleef <ds@schleef.org>
5  * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef _GLIMAGESINK_H_
24 #define _GLIMAGESINK_H_
25
26 #include <gst/gst.h>
27 #include <gst/video/gstvideosink.h>
28 #include <gst/video/video.h>
29
30 #include <gst/gl/gl.h>
31
32 G_BEGIN_DECLS
33
34 GST_DEBUG_CATEGORY_EXTERN (gst_debug_glimage_sink);
35
36 #define GST_TYPE_GLIMAGE_SINK \
37     (gst_glimage_sink_get_type())
38 #define GST_GLIMAGE_SINK(obj) \
39     (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GLIMAGE_SINK,GstGLImageSink))
40 #define GST_GLIMAGE_SINK_CLASS(klass) \
41     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GLIMAGE_SINK,GstGLImageSinkClass))
42 #define GST_IS_GLIMAGE_SINK(obj) \
43     (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GLIMAGE_SINK))
44 #define GST_IS_GLIMAGE_SINK_CLASS(klass) \
45     (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GLIMAGE_SINK))
46
47 typedef struct _GstGLImageSink GstGLImageSink;
48 typedef struct _GstGLImageSinkClass GstGLImageSinkClass;
49
50 struct _GstGLImageSink
51 {
52     GstVideoSink video_sink;
53
54     //properties
55     gchar *display_name;
56
57     guintptr window_id;
58     guintptr new_window_id;
59     gulong mouse_sig_id;
60     gulong key_sig_id;
61
62     //caps
63     GstVideoInfo info;
64     GstCaps *gl_caps;
65
66     GstGLDisplay *display;
67     GstGLContext *context;
68     GstGLContext *other_context;
69     gboolean handle_events;
70
71     GstGLUpload *upload;
72     guint      next_tex;
73     GstBuffer *next_buffer;
74
75     volatile gint to_quit;
76     gboolean keep_aspect_ratio;
77     gint par_n, par_d;
78
79     GstBufferPool *pool;
80
81     /* avoid replacing the stored_buffer while drawing */
82     GMutex drawing_lock;
83     GstBuffer *stored_buffer;
84     GLuint redisplay_texture;
85
86     gboolean caps_change;
87     guint window_width;
88     guint window_height;
89
90 #if GST_GL_HAVE_GLES2
91   GstGLShader *redisplay_shader;
92   GLint redisplay_attr_position_loc;
93   GLint redisplay_attr_texture_loc;
94 #endif
95
96 };
97
98 struct _GstGLImageSinkClass
99 {
100     GstVideoSinkClass video_sink_class;
101 };
102
103 GType gst_glimage_sink_get_type(void);
104
105 G_END_DECLS
106
107 #endif
108