2 * Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net>
3 * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
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.
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.
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., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * The development of this code was made possible due to the involvement
21 * of Pioneers of the Inevitable, the creators of the Songbird Music player
25 #ifndef __GST_DIRECTDRAWSINK_H__
26 #define __GST_DIRECTDRAWSINK_H__
28 #define DIRECTDRAW_VERSION 0x0700
31 #include <gst/video/gstvideosink.h>
32 #include <gst/interfaces/xoverlay.h>
33 #include <gst/interfaces/navigation.h>
40 #define GST_TYPE_DIRECTDRAW_SINK (gst_directdraw_sink_get_type())
41 #define GST_DIRECTDRAW_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSink))
42 #define GST_DIRECTDRAW_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSinkClass))
43 #define GST_IS_DIRECTDRAW_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECTDRAW_SINK))
44 #define GST_IS_DIRECTDRAW_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECTDRAW_SINK))
45 typedef struct _GstDirectDrawSink GstDirectDrawSink;
46 typedef struct _GstDirectDrawSinkClass GstDirectDrawSinkClass;
48 #define GST_TYPE_DDRAWSURFACE (gst_ddrawsurface_get_type())
49 #define GST_IS_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DDRAWSURFACE))
50 #define GST_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DDRAWSURFACE, GstDDrawSurface))
52 typedef struct _GstDDrawSurface GstDDrawSurface;
54 struct _GstDDrawSurface
56 /* Extension of GstBuffer to store directdraw surfaces */
59 /* directdraw surface */
60 LPDIRECTDRAWSURFACE surface;
62 /* surface dimensions */
66 /*TRUE when surface is locked*/
69 /*TRUE when surface is using a system memory buffer
70 (i'm using system memory when directdraw optimized pitch is not the same as the GStreamer one)*/
71 gboolean system_memory;
73 /* pixel format of the encapsulated surface */
74 DDPIXELFORMAT dd_pixel_format;
76 /* pointer to parent */
77 GstDirectDrawSink *ddrawsink;
80 struct _GstDirectDrawSink
82 GstVideoSink videosink;
84 /* directdraw offscreen surfaces pool */
88 /* directdraw objects */
89 LPDIRECTDRAW ddraw_object;
90 LPDIRECTDRAWSURFACE primary_surface;
91 LPDIRECTDRAWSURFACE offscreen_surface;
92 LPDIRECTDRAWCLIPPER clipper;
94 /* last buffer displayed (used for XOverlay interface expose method) */
95 GstBuffer * last_buffer;
100 /* video window management */
102 gboolean our_video_window;
103 HANDLE window_created_signal;
105 /* video properties */
106 gint video_width, video_height;
107 gint out_width, out_height;
112 gboolean keep_aspect_ratio;
115 DDPIXELFORMAT dd_pixel_format;
117 /* thread processing our default window messages */
118 GThread *window_thread;
120 /* TRUE when directdraw object is set up */
123 /* TRUE if the hardware supports blitting from one colorspace to another */
124 gboolean can_blit_between_colorspace;
126 /* This flag is used to force re-creation of our offscreen surface.
127 * It's needed when hardware doesn't support fourcc blit and the bit depth
128 * of the current display mode changes.
130 gboolean must_recreate_offscreen;
133 struct _GstDirectDrawSinkClass
135 GstVideoSinkClass parent_class;
138 GType gst_directdraw_sink_get_type (void);
142 #endif /* __GST_DIRECTDRAWSINK_H__ */