2 * Copyright (C) 2010 David Hoyt <dhoyt@hoytsoft.org>
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 __D3DVIDEOSINK_H__
21 #define __D3DVIDEOSINK_H__
24 #include <gst/video/video.h>
25 #include <gst/video/gstvideosink.h>
26 #include <gst/interfaces/xoverlay.h>
27 #include <gst/interfaces/navigation.h>
33 #include "directx/directx.h"
36 #pragma warning( disable : 4090 4024)
40 #define GST_TYPE_D3DVIDEOSINK (gst_d3dvideosink_get_type())
41 #define GST_D3DVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3DVIDEOSINK,GstD3DVideoSink))
42 #define GST_D3DVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3DVIDEOSINK,GstD3DVideoSinkClass))
43 #define GST_D3DVIDEOSINK_GET_CLASS(obj) (GST_D3DVIDEOSINK_CLASS(G_OBJECT_GET_CLASS(obj)))
44 #define GST_IS_D3DVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3DVIDEOSINK))
45 #define GST_IS_D3DVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3DVIDEOSINK))
47 typedef struct _GstD3DVideoSink GstD3DVideoSink;
48 typedef struct _GstD3DVideoSinkClass GstD3DVideoSinkClass;
50 #define GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK(sink) g_mutex_lock (GST_D3DVIDEOSINK (sink)->d3d_swap_chain_lock);
51 #define GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK(sink) g_mutex_unlock (GST_D3DVIDEOSINK (sink)->d3d_swap_chain_lock);
53 struct _GstD3DVideoSink
57 /* source rectangle */
61 GstVideoFormat format;
63 gboolean enable_navigation_events;
65 gboolean keep_aspect_ratio;
68 /* If the window is closed, we set this and error out */
69 gboolean window_closed;
71 /* The video window set through GstXOverlay */
74 /* If we created the window, it needs to be closed in ::stop() */
75 gboolean is_new_window;
77 /* If we create our own window, we run it from another thread */
78 GThread *window_thread;
79 HANDLE window_created_signal;
81 /* If we use an app-supplied window, we need to hook its WNDPROC */
85 GMutex *d3d_swap_chain_lock;
86 LPDIRECT3DSWAPCHAIN9 d3d_swap_chain;
87 LPDIRECT3DSURFACE9 d3d_offscreen_surface;
91 D3DTEXTUREFILTERTYPE d3dfiltertype;
94 struct _GstD3DVideoSinkClass
96 GstVideoSinkClass parent_class;
98 gboolean is_directx_supported;
100 DirectXAPI *directx_api;
103 GType gst_d3dvideosink_get_type (void);
106 #endif /* __D3DVIDEOSINK_H__ */