2 * Copyright (C) <2005> Julien Moutte <julien@moutte.net>
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.
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.
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.
20 #ifndef __GST_XIMAGESINK_H__
21 #define __GST_XIMAGESINK_H__
23 #include <gst/video/gstvideosink.h>
26 #include <sys/types.h>
29 #endif /* HAVE_XSHM */
32 #include <X11/Xutil.h>
35 #include <X11/extensions/XShm.h>
36 #endif /* HAVE_XSHM */
41 /* Helper functions */
42 #include <gst/video/video.h>
45 #define GST_TYPE_XIMAGESINK \
46 (gst_ximagesink_get_type())
47 #define GST_XIMAGESINK(obj) \
48 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XIMAGESINK, GstXImageSink))
49 #define GST_XIMAGESINK_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XIMAGESINK, GstXImageSinkClass))
51 #define GST_IS_XIMAGESINK(obj) \
52 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XIMAGESINK))
53 #define GST_IS_XIMAGESINK_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XIMAGESINK))
56 typedef struct _GstXContext GstXContext;
57 typedef struct _GstXWindow GstXWindow;
59 typedef struct _GstXImageSink GstXImageSink;
60 typedef struct _GstXImageSinkClass GstXImageSinkClass;
62 #include "ximagepool.h"
66 * @disp: the X11 Display of this context
67 * @screen: the default Screen of Display @disp
68 * @screen_num: the Screen number of @screen
69 * @visual: the default Visual of Screen @screen
70 * @root: the root Window of Display @disp
71 * @white: the value of a white pixel on Screen @screen
72 * @black: the value of a black pixel on Screen @screen
73 * @depth: the color depth of Display @disp
74 * @bpp: the number of bits per pixel on Display @disp
75 * @endianness: the endianness of image bytes on Display @disp
76 * @width: the width in pixels of Display @disp
77 * @height: the height in pixels of Display @disp
78 * @widthmm: the width in millimeters of Display @disp
79 * @heightmm: the height in millimeters of Display @disp
80 * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
82 * @use_xshm: used to known wether of not XShm extension is usable or not even
83 * if the Extension is present
84 * @caps: the #GstCaps that Display @disp can accept
86 * Structure used to store various informations collected/calculated for a
106 gint widthmm, heightmm;
107 GValue *par; /* calculated pixel aspect ratio */
117 * @win: the Window ID of this X11 window
118 * @width: the width in pixels of Window @win
119 * @height: the height in pixels of Window @win
120 * @internal: used to remember if Window @win was created internally or passed
121 * through the #GstXOverlay interface
122 * @gc: the Graphical Context of Window @win
124 * Structure used to store informations about a Window.
136 * @display_name: the name of the Display we want to render to
137 * @xcontext: our instance's #GstXContext
138 * @xwindow: the #GstXWindow we are rendering to
139 * @ximage: internal #GstXImage used to store incoming buffers and render when
140 * not using the buffer_alloc optimization mechanism
141 * @cur_image: a reference to the last #GstXImage that was put to @xwindow. It
142 * is used when Expose events are received to redraw the latest video frame
143 * @event_thread: a thread listening for events on @xwindow and handling them
144 * @running: used to inform @event_thread if it should run/shutdown
145 * @fps_n: the framerate fraction numerator
146 * @fps_d: the framerate fraction denominator
147 * @x_lock: used to protect X calls as we are not using the XLib in threaded
149 * @flow_lock: used to protect data flow routines from external calls such as
150 * events from @event_thread or methods from the #GstXOverlay interface
151 * @par: used to override calculated pixel aspect ratio from @xcontext
152 * @pool_lock: used to protect the buffer pool
153 * @buffer_pool: a list of #GstXImageBuffer that could be reused at next buffer
155 * @synchronous: used to store if XSynchronous should be used or not (for
156 * debugging purpose only)
157 * @keep_aspect: used to remember if reverse negotiation scaling should respect
159 * @handle_events: used to know if we should handle select XEvents or not
161 * The #GstXImageSink data structure.
163 struct _GstXImageSink
165 /* Our element stuff */
166 GstVideoSink videosink;
170 GstXContext *xcontext;
172 GstBuffer *cur_image;
174 GThread *event_thread;
179 /* Framerate numerator and denominator */
186 /* object-set pixel aspect ratio */
189 /* the buffer pool */
192 gboolean synchronous;
193 gboolean keep_aspect;
194 gboolean handle_events;
195 gboolean handle_expose;
196 gboolean draw_border;
198 /* stream metadata */
202 struct _GstXImageSinkClass
204 GstVideoSinkClass parent_class;
207 GType gst_ximagesink_get_type (void);
210 #endif /* __GST_XIMAGESINK_H__ */