1 | /* GStreamer |
---|
2 | * Copyright (C) <2003> Julien Moutte <julien@moutte.net> |
---|
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_GLIMAGESINK_H__ |
---|
21 | #define __GST_GLIMAGESINK_H__ |
---|
22 | |
---|
23 | #include <gst/video/videosink.h> |
---|
24 | |
---|
25 | #include <X11/Xlib.h> |
---|
26 | #include <GL/glx.h> |
---|
27 | #include <GL/gl.h> |
---|
28 | #include <GL/glu.h> |
---|
29 | |
---|
30 | #include <string.h> |
---|
31 | #include <math.h> |
---|
32 | |
---|
33 | G_BEGIN_DECLS |
---|
34 | |
---|
35 | #define GST_TYPE_GLIMAGESINK \ |
---|
36 | (gst_glimagesink_get_type()) |
---|
37 | #define GST_GLIMAGESINK(obj) \ |
---|
38 | (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GLIMAGESINK, GstGLImageSink)) |
---|
39 | #define GST_GLIMAGESINK_CLASS(klass) \ |
---|
40 | (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GLIMAGESINK, GstGLImageSink)) |
---|
41 | #define GST_IS_GLIMAGESINK(obj) \ |
---|
42 | (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GLIMAGESINK)) |
---|
43 | #define GST_IS_GLIMAGESINK_CLASS(obj) \ |
---|
44 | (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GLIMAGESINK)) |
---|
45 | |
---|
46 | typedef struct _GstXContext GstXContext; |
---|
47 | typedef struct _GstGLWindow GstGLWindow; |
---|
48 | typedef struct _GstGLImage GstGLImage; |
---|
49 | |
---|
50 | typedef struct _GstGLImageSink GstGLImageSink; |
---|
51 | typedef struct _GstGLImageSinkClass GstGLImageSinkClass; |
---|
52 | |
---|
53 | /* Global X Context stuff */ |
---|
54 | struct _GstXContext { |
---|
55 | Display *disp; |
---|
56 | |
---|
57 | Screen *screen; |
---|
58 | gint screen_num; |
---|
59 | |
---|
60 | Visual *visual; |
---|
61 | XVisualInfo *visualinfo; |
---|
62 | |
---|
63 | Window root; |
---|
64 | GLXContext glx; |
---|
65 | |
---|
66 | gulong white, black; |
---|
67 | |
---|
68 | gint depth; |
---|
69 | gint bpp; |
---|
70 | gint endianness; |
---|
71 | |
---|
72 | gboolean use_xshm; |
---|
73 | |
---|
74 | GstCaps *caps; |
---|
75 | }; |
---|
76 | |
---|
77 | /* XWindow stuff */ |
---|
78 | struct _GstGLWindow { |
---|
79 | XSetWindowAttributes attr; |
---|
80 | Window win; |
---|
81 | gint width, height; |
---|
82 | gboolean internal; |
---|
83 | }; |
---|
84 | |
---|
85 | /* XImage stuff */ |
---|
86 | struct _GstGLImage { |
---|
87 | /* Reference to the ximagesink we belong to */ |
---|
88 | GstGLImageSink *glimagesink; |
---|
89 | |
---|
90 | GLuint texid; |
---|
91 | |
---|
92 | char *data; |
---|
93 | gint width, height, size; |
---|
94 | }; |
---|
95 | |
---|
96 | struct _GstGLImageSink { |
---|
97 | /* Our element stuff */ |
---|
98 | GstVideoSink videosink; |
---|
99 | |
---|
100 | char *display_name; |
---|
101 | |
---|
102 | GstXContext *xcontext; |
---|
103 | GstGLWindow *window; |
---|
104 | GstGLImage *glimage; |
---|
105 | GstGLImage *cur_image; |
---|
106 | |
---|
107 | gdouble framerate; |
---|
108 | GMutex *x_lock; |
---|
109 | |
---|
110 | gint pixel_width, pixel_height; /* Unused */ |
---|
111 | |
---|
112 | GstClockTime time; |
---|
113 | |
---|
114 | GMutex *pool_lock; |
---|
115 | GSList *image_pool; |
---|
116 | |
---|
117 | guint pointer_x, pointer_y; |
---|
118 | gboolean pointer_moved; |
---|
119 | gboolean pointer_button[5]; |
---|
120 | |
---|
121 | gboolean synchronous; |
---|
122 | gboolean signal_handoffs; |
---|
123 | }; |
---|
124 | |
---|
125 | struct _GstGLImageSinkClass { |
---|
126 | GstVideoSinkClass parent_class; |
---|
127 | |
---|
128 | /* signals */ |
---|
129 | void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad); |
---|
130 | void (*bufferalloc) (GstElement *element, GstBuffer *buf, GstPad *pad); |
---|
131 | }; |
---|
132 | |
---|
133 | GType gst_glimagesink_get_type(void); |
---|
134 | |
---|
135 | G_END_DECLS |
---|
136 | |
---|
137 | #endif /* __GST_GLIMAGESINK_H__ */ |
---|