2006-01-05 23:17:44 +00:00
|
|
|
/* GStreamer
|
2007-09-22 08:12:57 +00:00
|
|
|
* Copyright (C) 2005 Sebastien Moutte <sebastien@moutte.net>
|
2007-02-27 12:02:03 +00:00
|
|
|
* Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
|
2006-01-05 23:17:44 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2007-02-27 12:02:03 +00:00
|
|
|
*
|
|
|
|
* The development of this code was made possible due to the involvement
|
|
|
|
* of Pioneers of the Inevitable, the creators of the Songbird Music player
|
|
|
|
*
|
2006-01-05 23:17:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_DIRECTDRAWSINK_H__
|
|
|
|
#define __GST_DIRECTDRAWSINK_H__
|
|
|
|
|
|
|
|
#define DIRECTDRAW_VERSION 0x0700
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/gstvideosink.h>
|
2007-02-11 15:26:49 +00:00
|
|
|
#include <gst/interfaces/xoverlay.h>
|
2009-07-30 22:05:41 +00:00
|
|
|
#include <gst/interfaces/navigation.h>
|
2006-01-05 23:17:44 +00:00
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
#include <windows.h>
|
2006-01-05 23:17:44 +00:00
|
|
|
#include <ddraw.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
2007-09-22 08:12:57 +00:00
|
|
|
|
2007-02-18 18:00:51 +00:00
|
|
|
#define GST_TYPE_DIRECTDRAW_SINK (gst_directdraw_sink_get_type())
|
2006-06-01 22:00:26 +00:00
|
|
|
#define GST_DIRECTDRAW_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSink))
|
|
|
|
#define GST_DIRECTDRAW_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECTDRAW_SINK,GstDirectDrawSinkClass))
|
|
|
|
#define GST_IS_DIRECTDRAW_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECTDRAW_SINK))
|
|
|
|
#define GST_IS_DIRECTDRAW_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECTDRAW_SINK))
|
2006-01-05 23:17:44 +00:00
|
|
|
typedef struct _GstDirectDrawSink GstDirectDrawSink;
|
|
|
|
typedef struct _GstDirectDrawSinkClass GstDirectDrawSinkClass;
|
|
|
|
|
|
|
|
#define GST_TYPE_DDRAWSURFACE (gst_ddrawsurface_get_type())
|
|
|
|
#define GST_IS_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DDRAWSURFACE))
|
|
|
|
#define GST_DDRAWSURFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DDRAWSURFACE, GstDDrawSurface))
|
|
|
|
|
|
|
|
typedef struct _GstDDrawSurface GstDDrawSurface;
|
|
|
|
|
|
|
|
struct _GstDDrawSurface
|
|
|
|
{
|
|
|
|
/* Extension of GstBuffer to store directdraw surfaces */
|
|
|
|
GstBuffer buffer;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* directdraw surface */
|
2006-01-05 23:17:44 +00:00
|
|
|
LPDIRECTDRAWSURFACE surface;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* surface dimensions */
|
2006-01-05 23:17:44 +00:00
|
|
|
gint width;
|
|
|
|
gint height;
|
2006-03-03 23:45:23 +00:00
|
|
|
|
|
|
|
/*TRUE when surface is locked*/
|
2006-01-05 23:17:44 +00:00
|
|
|
gboolean locked;
|
2007-02-11 15:26:49 +00:00
|
|
|
|
2006-03-03 23:45:23 +00:00
|
|
|
/*TRUE when surface is using a system memory buffer
|
|
|
|
(i'm using system memory when directdraw optimized pitch is not the same as the GStreamer one)*/
|
|
|
|
gboolean system_memory;
|
2006-01-05 23:17:44 +00:00
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* pixel format of the encapsulated surface */
|
2006-01-05 23:17:44 +00:00
|
|
|
DDPIXELFORMAT dd_pixel_format;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* pointer to parent */
|
2006-01-05 23:17:44 +00:00
|
|
|
GstDirectDrawSink *ddrawsink;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstDirectDrawSink
|
|
|
|
{
|
|
|
|
GstVideoSink videosink;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* directdraw offscreen surfaces pool */
|
2006-01-05 23:17:44 +00:00
|
|
|
GSList *buffer_pool;
|
2007-02-11 15:26:49 +00:00
|
|
|
GMutex *pool_lock;
|
2006-01-05 23:17:44 +00:00
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* directdraw objects */
|
2006-01-05 23:17:44 +00:00
|
|
|
LPDIRECTDRAW ddraw_object;
|
|
|
|
LPDIRECTDRAWSURFACE primary_surface;
|
|
|
|
LPDIRECTDRAWSURFACE offscreen_surface;
|
2006-07-24 21:43:06 +00:00
|
|
|
LPDIRECTDRAWCLIPPER clipper;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* last buffer displayed (used for XOverlay interface expose method) */
|
|
|
|
GstBuffer * last_buffer;
|
2006-01-05 23:17:44 +00:00
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* directdraw caps */
|
2006-01-05 23:17:44 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* video window management */
|
2006-01-05 23:17:44 +00:00
|
|
|
HWND video_window;
|
2007-02-11 15:26:49 +00:00
|
|
|
gboolean our_video_window;
|
2006-11-01 10:19:18 +00:00
|
|
|
HANDLE window_created_signal;
|
2013-04-05 17:59:41 +00:00
|
|
|
WNDPROC previous_wndproc;
|
|
|
|
LONG_PTR previous_user_data;
|
2007-02-11 15:26:49 +00:00
|
|
|
|
|
|
|
/* video properties */
|
2006-01-05 23:17:44 +00:00
|
|
|
gint video_width, video_height;
|
|
|
|
gint out_width, out_height;
|
|
|
|
gint fps_n;
|
|
|
|
gint fps_d;
|
|
|
|
|
2007-02-18 18:00:51 +00:00
|
|
|
/* properties */
|
2006-07-24 21:43:06 +00:00
|
|
|
gboolean keep_aspect_ratio;
|
|
|
|
|
2006-01-05 23:17:44 +00:00
|
|
|
/*pixel format */
|
|
|
|
DDPIXELFORMAT dd_pixel_format;
|
|
|
|
|
2007-02-11 15:26:49 +00:00
|
|
|
/* thread processing our default window messages */
|
2006-01-05 23:17:44 +00:00
|
|
|
GThread *window_thread;
|
|
|
|
|
2007-09-22 08:12:57 +00:00
|
|
|
/* TRUE when directdraw object is set up */
|
2006-01-05 23:17:44 +00:00
|
|
|
gboolean setup;
|
2007-03-11 22:23:04 +00:00
|
|
|
|
2007-09-22 08:12:57 +00:00
|
|
|
/* TRUE if the hardware supports blitting from one colorspace to another */
|
2007-03-11 22:23:04 +00:00
|
|
|
gboolean can_blit_between_colorspace;
|
|
|
|
|
2007-09-22 08:12:57 +00:00
|
|
|
/* This flag is used to force re-creation of our offscreen surface.
|
|
|
|
* It's needed when hardware doesn't support fourcc blit and the bit depth
|
2007-03-11 22:23:04 +00:00
|
|
|
* of the current display mode changes.
|
|
|
|
*/
|
|
|
|
gboolean must_recreate_offscreen;
|
2006-01-05 23:17:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstDirectDrawSinkClass
|
|
|
|
{
|
|
|
|
GstVideoSinkClass parent_class;
|
|
|
|
};
|
|
|
|
|
2007-05-24 08:35:23 +00:00
|
|
|
GType gst_directdraw_sink_get_type (void);
|
2006-01-05 23:17:44 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
2007-09-22 08:12:57 +00:00
|
|
|
|
2006-01-05 23:17:44 +00:00
|
|
|
#endif /* __GST_DIRECTDRAWSINK_H__ */
|