mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
d3dvideosink: port to the new GLib thread API
This commit is contained in:
parent
82f46a5efe
commit
4a843dbbac
3 changed files with 13 additions and 17 deletions
|
@ -319,7 +319,7 @@ gst_d3dvideosink_init (GstD3DVideoSink * sink)
|
|||
{
|
||||
gst_d3dvideosink_clear (sink);
|
||||
|
||||
sink->d3d_device_lock = g_mutex_new ();
|
||||
g_mutex_init (&sink->d3d_device_lock);
|
||||
|
||||
sink->par = g_new0 (GValue, 1);
|
||||
g_value_init (sink->par, GST_TYPE_FRACTION);
|
||||
|
@ -341,8 +341,7 @@ gst_d3dvideosink_finalize (GObject * gobject)
|
|||
sink->par = NULL;
|
||||
}
|
||||
|
||||
g_mutex_free (sink->d3d_device_lock);
|
||||
sink->d3d_device_lock = NULL;
|
||||
g_mutex_clear (&sink->d3d_device_lock);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (gobject);
|
||||
}
|
||||
|
@ -526,8 +525,8 @@ gst_d3dvideosink_create_shared_hidden_window (GstD3DVideoSink * sink)
|
|||
if (shared.hidden_window_created_signal == NULL)
|
||||
goto failed;
|
||||
|
||||
shared.hidden_window_thread = g_thread_create ((GThreadFunc)
|
||||
gst_d3dvideosink_shared_hidden_window_thread, sink, TRUE, NULL);
|
||||
shared.hidden_window_thread = g_thread_try_new ("shared hidden window thread",
|
||||
(GThreadFunc) gst_d3dvideosink_shared_hidden_window_thread, sink, NULL);
|
||||
|
||||
/* wait maximum 60 seconds for window to be created */
|
||||
if (WaitForSingleObject (shared.hidden_window_created_signal,
|
||||
|
@ -1044,9 +1043,8 @@ gst_d3dvideosink_create_default_window (GstD3DVideoSink * sink)
|
|||
if (sink->window_created_signal == NULL)
|
||||
goto failed;
|
||||
|
||||
sink->window_thread =
|
||||
g_thread_create ((GThreadFunc) gst_d3dvideosink_window_thread, sink, TRUE,
|
||||
NULL);
|
||||
sink->window_thread = g_thread_try_new ("window thread",
|
||||
(GThreadFunc) gst_d3dvideosink_window_thread, sink, NULL);
|
||||
|
||||
/* wait maximum 10 seconds for window to be created */
|
||||
if (WaitForSingleObject (sink->window_created_signal, 10000) != WAIT_OBJECT_0)
|
||||
|
|
|
@ -63,17 +63,15 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstD3DVideoSink GstD3DVideoSink;
|
||||
typedef struct _GstD3DVideoSinkClass GstD3DVideoSinkClass;
|
||||
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_LOCK(sink) g_mutex_lock (GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_TRYLOCK(sink) g_mutex_trylock (GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_UNLOCK(sink) g_mutex_unlock (GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_LOCK(sink) g_mutex_lock (&GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_TRYLOCK(sink) g_mutex_trylock (&GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
#define GST_D3DVIDEOSINK_D3D_DEVICE_UNLOCK(sink) g_mutex_unlock (&GST_D3DVIDEOSINK (sink)->d3d_device_lock)
|
||||
|
||||
struct _GstD3DVideoSink
|
||||
{
|
||||
GstVideoSink sink;
|
||||
|
||||
/* source rectangle */
|
||||
//gint width;
|
||||
//gint height;
|
||||
|
||||
GstVideoFormat format;
|
||||
GstVideoInfo info;
|
||||
|
@ -100,7 +98,7 @@ struct _GstD3DVideoSink
|
|||
WNDPROC prevWndProc;
|
||||
gboolean is_hooked;
|
||||
|
||||
GMutex *d3d_device_lock;
|
||||
GMutex d3d_device_lock;
|
||||
LPDIRECT3DSURFACE9 d3d_offscreen_surface;
|
||||
LPDIRECT3DDEVICE9 d3ddev;
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
|
|
|
@ -46,8 +46,8 @@ init_supported_apis (void)
|
|||
static DirectXAPI *directx_determine_best_available_api (void);
|
||||
|
||||
/* Mutex macros */
|
||||
#define DIRECTX_LOCK g_static_rec_mutex_lock (&dx_lock);
|
||||
#define DIRECTX_UNLOCK g_static_rec_mutex_unlock (&dx_lock);
|
||||
#define DIRECTX_LOCK g_rec_mutex_lock (&dx_lock);
|
||||
#define DIRECTX_UNLOCK g_rec_mutex_unlock (&dx_lock);
|
||||
|
||||
typedef struct _DirectXInfo DirectXInfo;
|
||||
struct _DirectXInfo
|
||||
|
@ -63,7 +63,7 @@ struct _DirectXInfo
|
|||
|
||||
/* Private vars */
|
||||
static DirectXInfo dx;
|
||||
static GStaticRecMutex dx_lock = G_STATIC_REC_MUTEX_INIT;
|
||||
static GRecMutex dx_lock;
|
||||
|
||||
gboolean
|
||||
directx_initialize (DirectXInitParams * init_params)
|
||||
|
|
Loading…
Reference in a new issue