summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Scobich <sergey.scobich@gmail.com>2006-11-01 10:19:18 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-11-01 10:19:18 +0000
commit017a8c8527ff37a4068189e4323a68bc30d1fa92 (patch)
tree145d9d04f34fa14c7b47bfd4f49934f0d493f708
parent4bef7791d973deef3e6339ea6a8b421326d6b084 (diff)
downloadgst-plugins-bad-017a8c8527ff37a4068189e4323a68bc30d1fa92.tar.gz
gst-plugins-bad-017a8c8527ff37a4068189e4323a68bc30d1fa92.tar.bz2
gst-plugins-bad-017a8c8527ff37a4068189e4323a68bc30d1fa92.zip
sys/: Wait until the window is created before using it; guard unistd.h includes with HAVE_UNISTD_H. (#366523)
Original commit message from CVS: Patch by: Sergey Scobich <sergey dot scobich at gmail com> * sys/directdraw/gstdirectdrawsink.c: (gst_directdrawsink_window_thread), (gst_directdrawsink_create_default_window): * sys/directdraw/gstdirectdrawsink.h: * sys/directsound/gstdirectsoundsink.c: Wait until the window is created before using it; guard unistd.h includes with HAVE_UNISTD_H. (#366523) * win32/vs8/libgstdirectdraw.vcproj: * win32/vs8/libgstdirectsound.vcproj: Update project files.
-rw-r--r--ChangeLog16
-rw-r--r--sys/directdraw/gstdirectdrawsink.c20
-rw-r--r--sys/directdraw/gstdirectdrawsink.h1
-rw-r--r--sys/directsound/gstdirectsoundsink.c2
-rw-r--r--win32/vs8/libgstdirectdraw.vcproj8
-rw-r--r--win32/vs8/libgstdirectsound.vcproj8
6 files changed, 45 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 7ce15724..60682bb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2006-11-01 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Sergey Scobich <sergey dot scobich at gmail com>
+
+ * sys/directdraw/gstdirectdrawsink.c:
+ (gst_directdrawsink_window_thread),
+ (gst_directdrawsink_create_default_window):
+ * sys/directdraw/gstdirectdrawsink.h:
+ * sys/directsound/gstdirectsoundsink.c:
+ Wait until the window is created before using it; guard unistd.h
+ includes with HAVE_UNISTD_H. (#366523)
+
+ * win32/vs8/libgstdirectdraw.vcproj:
+ * win32/vs8/libgstdirectsound.vcproj:
+ Update project files.
+
2006-10-31 Wim Taymans <wim@fluendo.com>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_get_duration),
diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c
index fbccb80d..ec449c7d 100644
--- a/sys/directdraw/gstdirectdrawsink.c
+++ b/sys/directdraw/gstdirectdrawsink.c
@@ -28,7 +28,9 @@
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <string.h>
GST_DEBUG_CATEGORY_STATIC (directdrawsink_debug);
@@ -1366,6 +1368,8 @@ gst_directdrawsink_window_thread (GstDirectDrawSink * ddrawsink)
if (ddrawsink->video_window == NULL)
return FALSE;
+ ReleaseSemaphore (ddrawsink->window_created_signal, 1, NULL);
+
/*start message loop processing our default window messages */
while (1) {
MSG msg;
@@ -1381,15 +1385,27 @@ gst_directdrawsink_window_thread (GstDirectDrawSink * ddrawsink)
static gboolean
gst_directdrawsink_create_default_window (GstDirectDrawSink * ddrawsink)
{
+ ddrawsink->window_created_signal = CreateSemaphore (NULL, 0, 1, NULL);
+ if (ddrawsink->window_created_signal == NULL)
+ return FALSE;
+
ddrawsink->window_thread = g_thread_create (
(GThreadFunc) gst_directdrawsink_window_thread, ddrawsink, TRUE, NULL);
if (ddrawsink->window_thread == NULL)
- return FALSE;
+ goto failed;
- /*TODO:wait for the window to be created with timeout */
+ /* wait maximum 10 seconds for windows creating */
+ if (WaitForSingleObject (ddrawsink->window_created_signal,
+ 10000) != WAIT_OBJECT_0)
+ goto failed;
+ CloseHandle (ddrawsink->window_created_signal);
return TRUE;
+
+failed:
+ CloseHandle (ddrawsink->window_created_signal);
+ return FALSE;
}
static gboolean
diff --git a/sys/directdraw/gstdirectdrawsink.h b/sys/directdraw/gstdirectdrawsink.h
index f11c95ec..f9d4c865 100644
--- a/sys/directdraw/gstdirectdrawsink.h
+++ b/sys/directdraw/gstdirectdrawsink.h
@@ -104,6 +104,7 @@ struct _GstDirectDrawSink
/*handle of the video window */
HWND video_window;
+ HANDLE window_created_signal;
gboolean resize_window;
/*video properties */
diff --git a/sys/directsound/gstdirectsoundsink.c b/sys/directsound/gstdirectsoundsink.c
index 35149f12..8676238a 100644
--- a/sys/directsound/gstdirectsoundsink.c
+++ b/sys/directsound/gstdirectsoundsink.c
@@ -27,7 +27,9 @@
#include <fcntl.h>
#include <errno.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <string.h>
GST_DEBUG_CATEGORY_STATIC (directsoundsink_debug);
diff --git a/win32/vs8/libgstdirectdraw.vcproj b/win32/vs8/libgstdirectdraw.vcproj
index 06f5ee12..31af1ca9 100644
--- a/win32/vs8/libgstdirectdraw.vcproj
+++ b/win32/vs8/libgstdirectdraw.vcproj
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="windows-1251"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="libgstdirectdraw"
ProjectGUID="{1594A623-5529-4B86-BD4A-694CF0BDB5C4}"
Keyword="Win32Proj"
@@ -61,7 +61,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ddraw.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
+ AdditionalDependencies="ddraw.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib gdi32.lib"
OutputFile="$(OutDir)/libgstdirectdraw.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName);../../../gst-plugins-base/win32/vs8/$(ConfigurationName)"
@@ -141,7 +141,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ddraw.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
+ AdditionalDependencies="ddraw.lib libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib gdi32.lib"
OutputFile="$(OutDir)/libgstdirectdraw.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName);../../../gst-plugins-base/win32/vs8/$(ConfigurationName)"
diff --git a/win32/vs8/libgstdirectsound.vcproj b/win32/vs8/libgstdirectsound.vcproj
index 25033844..bb6b6c5a 100644
--- a/win32/vs8/libgstdirectsound.vcproj
+++ b/win32/vs8/libgstdirectsound.vcproj
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="windows-1251"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="libgstdirectsound"
ProjectGUID="{566A2EB9-984C-4027-86DD-EDC7B390C679}"
Keyword="Win32Proj"
@@ -61,7 +61,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="dsound.lib dxerr9.lib libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
+ AdditionalDependencies="dsound.lib dxerr9.lib libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib"
OutputFile="$(OutDir)/libgstdirectsound.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName);../../../gst-plugins-base/win32/vs8/$(ConfigurationName)"
@@ -141,7 +141,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="dsound.lib dxerr9.lib libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
+ AdditionalDependencies="dsound.lib dxerr9.lib libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib user32.lib"
OutputFile="$(OutDir)/libgstdirectsound.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName);../../../gst-plugins-base/win32/vs8/$(ConfigurationName)"