summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/directdraw/gstdirectdrawplugin.c2
-rw-r--r--sys/directdraw/gstdirectdrawsink.c32
-rw-r--r--sys/directdraw/gstdirectdrawsink.h5
-rw-r--r--sys/directsound/gstdirectsoundplugin.c2
-rw-r--r--sys/directsound/gstdirectsoundsink.c5
5 files changed, 33 insertions, 13 deletions
diff --git a/sys/directdraw/gstdirectdrawplugin.c b/sys/directdraw/gstdirectdrawplugin.c
index 69d79507..de5452f3 100644
--- a/sys/directdraw/gstdirectdrawplugin.c
+++ b/sys/directdraw/gstdirectdrawplugin.c
@@ -28,7 +28,7 @@
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "directdrawsink", GST_RANK_NONE,
+ if (!gst_element_register (plugin, "directdrawsink", GST_RANK_PRIMARY,
GST_TYPE_DIRECTDRAW_SINK))
return FALSE;
diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c
index 55a0d54a..2f837496 100644
--- a/sys/directdraw/gstdirectdrawsink.c
+++ b/sys/directdraw/gstdirectdrawsink.c
@@ -296,6 +296,8 @@ gst_ddrawsurface_init (GstDDrawSurface * surface, gpointer g_class)
surface->width = 0;
surface->height = 0;
surface->ddrawsink = NULL;
+ surface->locked = FALSE;
+ surface->system_memory = FALSE;
memset (&surface->dd_pixel_format, 0, sizeof (DDPIXELFORMAT));
}
@@ -1184,9 +1186,10 @@ gst_directdrawsink_setup_ddraw (GstDirectDrawSink * ddrawsink)
bRet = FALSE;
/*for fullscreen mode, setup display mode */
- if (ddrawsink->bFullScreen) {
+/* if (ddrawsink->bFullScreen) {
hRes = IDirectDraw_SetDisplayMode (ddrawsink->ddraw_object, 640, 480, 32);
}
+ */
if (!ddrawsink->extern_surface) {
/*create our primary surface */
@@ -1309,8 +1312,6 @@ gst_directdrawsink_window_thread (GstDirectDrawSink * ddrawsink)
if (ddrawsink->video_window == NULL)
return FALSE;
- ShowWindow (ddrawsink->video_window, SW_SHOW);
-
/*start message loop processing our default window messages */
while (1) {
MSG msg;
@@ -1422,7 +1423,7 @@ gst_directdrawsink_get_depth (LPDDPIXELFORMAT lpddpfPixelFormat)
}
HRESULT WINAPI
-EnumModesCallback2 (LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext)
+EnumModesCallback2 (LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
{
GstDirectDrawSink *ddrawsink = (GstDirectDrawSink *) lpContext;
GstCaps *format_caps = NULL;
@@ -1537,6 +1538,7 @@ gst_directdrawsink_surface_create (GstDirectDrawSink * ddrawsink,
{
GstDDrawSurface *surface = NULL;
GstStructure *structure = NULL;
+ gint pitch;
HRESULT hRes;
DDSURFACEDESC surf_desc, surf_lock_desc;
@@ -1559,6 +1561,8 @@ gst_directdrawsink_surface_create (GstDirectDrawSink * ddrawsink,
GST_WARNING ("failed getting geometry from caps %" GST_PTR_FORMAT, caps);
}
+ pitch = GST_ROUND_UP_8 (size / surface->height);
+
if (!gst_ddrawvideosink_get_format_from_caps (caps,
&surface->dd_pixel_format)) {
GST_WARNING ("failed getting pixel format from caps %" GST_PTR_FORMAT,
@@ -1568,9 +1572,6 @@ gst_directdrawsink_surface_create (GstDirectDrawSink * ddrawsink,
if (ddrawsink->ddraw_object) {
/* Creating an internal surface which will be used as GstBuffer, we used
the detected pixel format and video dimensions */
- gint pitch = GST_ROUND_UP_8 (size / surface->height);
-
- surf_desc.lPitch = pitch;
surf_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
surf_desc.dwFlags =
@@ -1600,7 +1601,9 @@ gst_directdrawsink_surface_create (GstDirectDrawSink * ddrawsink,
GST_DEBUG
("DDraw stride/pitch %d isn't as expected value %d, let's continue allocating buffer.",
surf_lock_desc.lPitch, pitch);
- IDirectDrawSurface_Release (surface->surface);
+
+ /*Unlock the surface as we will change it to use system memory with a GStreamer compatible pitch */
+ hRes = IDirectDrawSurface_Unlock (surface->surface, NULL);
goto surface_pitch_bad;
}
@@ -1614,6 +1617,19 @@ gst_directdrawsink_surface_create (GstDirectDrawSink * ddrawsink,
GST_BUFFER (surface)->malloc_data = g_malloc (size);
GST_BUFFER_DATA (surface) = GST_BUFFER (surface)->malloc_data;
GST_BUFFER_SIZE (surface) = size;
+
+/* surf_desc.dwSize = sizeof(DDSURFACEDESC);
+ surf_desc.dwFlags = DDSD_PITCH | DDSD_LPSURFACE | DDSD_HEIGHT | DDSD_WIDTH ||DDSD_PIXELFORMAT;
+ surf_desc.lpSurface = GST_BUFFER (surface)->malloc_data;
+ surf_desc.lPitch = pitch;
+ //surf_desc.dwHeight = surface->height;
+ surf_desc.dwWidth = surface->width;
+ hRes = IDirectDrawSurface7_SetSurfaceDesc(surface->surface, &surf_desc, 0);
+ printf("%\n", DDErrorString(hRes));
+
+ hRes = IDirectDrawSurface7_Lock (surface->surface, NULL, &surf_lock_desc,
+ DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL);
+*/
surface->surface = NULL;
printf ("allocating a buffer of %d bytes\n", size);
}
diff --git a/sys/directdraw/gstdirectdrawsink.h b/sys/directdraw/gstdirectdrawsink.h
index 7476eaac..c144f646 100644
--- a/sys/directdraw/gstdirectdrawsink.h
+++ b/sys/directdraw/gstdirectdrawsink.h
@@ -56,7 +56,12 @@ struct _GstDDrawSurface
gint width;
gint height;
+
+ /*TRUE when surface is locked*/
gboolean locked;
+ /*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;
DDPIXELFORMAT dd_pixel_format;
diff --git a/sys/directsound/gstdirectsoundplugin.c b/sys/directsound/gstdirectsoundplugin.c
index c789b2bf..aaa496f3 100644
--- a/sys/directsound/gstdirectsoundplugin.c
+++ b/sys/directsound/gstdirectsoundplugin.c
@@ -29,7 +29,7 @@
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "directsoundsink", GST_RANK_NONE,
+ if (!gst_element_register (plugin, "directsoundsink", GST_RANK_PRIMARY,
GST_TYPE_DIRECTSOUND_SINK))
return FALSE;
diff --git a/sys/directsound/gstdirectsoundsink.c b/sys/directsound/gstdirectsoundsink.c
index 3d7ab997..13e077a1 100644
--- a/sys/directsound/gstdirectsoundsink.c
+++ b/sys/directsound/gstdirectsoundsink.c
@@ -121,7 +121,7 @@ gst_directsoundsink_class_init (GstDirectSoundSinkClass * klass)
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
gstaudiosink_class = (GstAudioSinkClass *) klass;
- parent_class = g_type_class_ref (GST_TYPE_DIRECTSOUND_SINK);
+ parent_class = g_type_class_ref (GST_TYPE_BASE_AUDIO_SINK);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_directsoundsink_dispose);
gobject_class->get_property =
@@ -212,8 +212,7 @@ gst_directsoundsink_open (GstAudioSink * asink)
return FALSE;
}
- if (FAILED (hRes =
- IDirectSound_SetCooperativeLevel (dsoundsink->pDS,
+ if (FAILED (hRes = IDirectSound_SetCooperativeLevel (dsoundsink->pDS,
GetDesktopWindow (), DSSCL_PRIORITY))) {
GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ,
("gst_directsoundsink_open: IDirectSound_SetCooperativeLevel: %s",