[MOVED FROM GOOD] sys/directdraw/gstdirectdrawsink.*: Fix more warnings when compiling with MingW (#439914).

Original commit message from CVS:
Patch by: Vincent Torri  <vtorri at univ-evry fr>
* sys/directdraw/gstdirectdrawsink.c:
(gst_directdraw_sink_buffer_alloc),
(gst_directdraw_sink_show_frame),
(gst_directdraw_sink_check_primary_surface),
(gst_directdraw_sink_check_offscreen_surface),
(EnumModesCallback2), (gst_directdraw_sink_get_ddrawcaps),
(gst_directdraw_sink_surface_create):
* sys/directdraw/gstdirectdrawsink.h:
Fix more warnings when compiling with MingW (#439914).
This commit is contained in:
Vincent Torri 2007-05-24 08:35:23 +00:00 committed by Jan Schmidt
parent b7476655fb
commit 4c32422297
2 changed files with 34 additions and 15 deletions

View file

@ -585,6 +585,7 @@ gst_directdraw_sink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
guint depth; guint depth;
HRESULT hres; HRESULT hres;
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
DDSURFACEDESC2 *sd;
GstStructure *structure = NULL; GstStructure *structure = NULL;
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
@ -593,8 +594,11 @@ gst_directdraw_sink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
"Can't get depth from buffer_alloc caps"); "Can't get depth from buffer_alloc caps");
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
surface_desc.dwSize = sizeof (DDSURFACEDESC); surface_desc.dwSize = sizeof (surface_desc);
hres = IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object, &surface_desc); sd = &surface_desc;
hres =
IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object,
(DDSURFACEDESC *) sd);
if (hres != DD_OK) { if (hres != DD_OK) {
GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink, GST_CAT_DEBUG_OBJECT (directdrawsink_debug, ddrawsink,
"Can't get current display mode (error=%ld)", (glong) hres); "Can't get current display mode (error=%ld)", (glong) hres);
@ -744,14 +748,16 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
LPBYTE data = NULL; LPBYTE data = NULL;
guint src_pitch, line; guint src_pitch, line;
DDSURFACEDESC2 surf_desc; DDSURFACEDESC2 surf_desc;
DDSURFACEDESC2 *sd;
ZeroMemory (&surf_desc, sizeof (surf_desc)); ZeroMemory (&surf_desc, sizeof (surf_desc));
surf_desc.dwSize = sizeof (surf_desc); surf_desc.dwSize = sizeof (surf_desc);
sd = &surf_desc;
/* Lock the surface */ /* Lock the surface */
hRes = hRes =
IDirectDrawSurface7_Lock (ddrawsink->offscreen_surface, NULL, IDirectDrawSurface7_Lock (ddrawsink->offscreen_surface, NULL,
&surf_desc, DDLOCK_WAIT, NULL); (DDSURFACEDESC *) sd, DDLOCK_WAIT, NULL);
if (hRes != DD_OK) { if (hRes != DD_OK) {
GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink, GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
"gst_directdraw_sink_show_frame failed locking surface %s", "gst_directdraw_sink_show_frame failed locking surface %s",
@ -1284,6 +1290,7 @@ gst_directdraw_sink_check_primary_surface (GstDirectDrawSink * ddrawsink)
{ {
HRESULT hres; HRESULT hres;
DDSURFACEDESC2 dd_surface_desc; DDSURFACEDESC2 dd_surface_desc;
DDSURFACEDESC2 *sd;
/* if our primary surface already exist, check if it's not lost */ /* if our primary surface already exist, check if it's not lost */
if (ddrawsink->primary_surface) { if (ddrawsink->primary_surface) {
@ -1320,7 +1327,9 @@ gst_directdraw_sink_check_primary_surface (GstDirectDrawSink * ddrawsink)
dd_surface_desc.dwSize = sizeof (dd_surface_desc); dd_surface_desc.dwSize = sizeof (dd_surface_desc);
dd_surface_desc.dwFlags = DDSD_CAPS; dd_surface_desc.dwFlags = DDSD_CAPS;
dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hres = IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, &dd_surface_desc, sd = &dd_surface_desc;
hres =
IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, (DDSURFACEDESC *) sd,
&ddrawsink->primary_surface, NULL); &ddrawsink->primary_surface, NULL);
if (hres != DD_OK) { if (hres != DD_OK) {
GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE, GST_ELEMENT_ERROR (ddrawsink, RESOURCE, WRITE,
@ -1342,6 +1351,7 @@ static gboolean
gst_directdraw_sink_check_offscreen_surface (GstDirectDrawSink * ddrawsink) gst_directdraw_sink_check_offscreen_surface (GstDirectDrawSink * ddrawsink)
{ {
DDSURFACEDESC2 dd_surface_desc; DDSURFACEDESC2 dd_surface_desc;
DDSURFACEDESC2 *sd;
HRESULT hres; HRESULT hres;
/* if our offscreen surface already exist, check if it's not lost */ /* if our offscreen surface already exist, check if it's not lost */
@ -1380,7 +1390,9 @@ gst_directdraw_sink_check_offscreen_surface (GstDirectDrawSink * ddrawsink)
sizeof (DDPIXELFORMAT)); sizeof (DDPIXELFORMAT));
dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; dd_surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
hres = IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, &dd_surface_desc, sd = &dd_surface_desc;
hres =
IDirectDraw7_CreateSurface (ddrawsink->ddraw_object, (DDSURFACEDESC *) sd,
&ddrawsink->offscreen_surface, NULL); &ddrawsink->offscreen_surface, NULL);
if (hres != DD_OK) { if (hres != DD_OK) {
GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink, GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink,
@ -1412,25 +1424,26 @@ gst_directdraw_sink_get_depth (LPDDPIXELFORMAT lpddpfPixelFormat)
} }
HRESULT WINAPI HRESULT WINAPI
EnumModesCallback2 (LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext) EnumModesCallback2 (LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
{ {
GstDirectDrawSink *ddrawsink = (GstDirectDrawSink *) lpContext; GstDirectDrawSink *ddrawsink = (GstDirectDrawSink *) lpContext;
GstCaps *format_caps = NULL; GstCaps *format_caps = NULL;
LPDDSURFACEDESC2 sd;
if (!ddrawsink || !lpDDSurfaceDesc) if (!ddrawsink || !lpDDSurfaceDesc)
return DDENUMRET_CANCEL; return DDENUMRET_CANCEL;
if ((lpDDSurfaceDesc->dwFlags & DDSD_PIXELFORMAT) != DDSD_PIXELFORMAT) { sd = (LPDDSURFACEDESC2) lpDDSurfaceDesc;
if ((sd->dwFlags & DDSD_PIXELFORMAT) != DDSD_PIXELFORMAT) {
GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
"Display mode found with DDSD_PIXELFORMAT not set"); "Display mode found with DDSD_PIXELFORMAT not set");
return DDENUMRET_OK; return DDENUMRET_OK;
} }
if ((lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_RGB) != DDPF_RGB) if ((sd->ddpfPixelFormat.dwFlags & DDPF_RGB) != DDPF_RGB)
return DDENUMRET_OK; return DDENUMRET_OK;
format_caps = format_caps = gst_directdraw_sink_create_caps_from_surfacedesc (sd);
gst_directdraw_sink_create_caps_from_surfacedesc (lpDDSurfaceDesc);
if (format_caps) { if (format_caps) {
gst_caps_append (ddrawsink->caps, format_caps); gst_caps_append (ddrawsink->caps, format_caps);
@ -1503,6 +1516,7 @@ gst_directdraw_sink_get_ddrawcaps (GstDirectDrawSink * ddrawsink)
/* we don't test for DDCAPS_BLTSTRETCH on the hardware as the directdraw emulation layer can do it */ /* we don't test for DDCAPS_BLTSTRETCH on the hardware as the directdraw emulation layer can do it */
if (!(ddcaps_hardware.dwCaps & DDCAPS_BLTFOURCC)) { if (!(ddcaps_hardware.dwCaps & DDCAPS_BLTFOURCC)) {
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
DDSURFACEDESC2 *sd;
GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink,
"hardware doesn't support blit from one colorspace to another one. " "hardware doesn't support blit from one colorspace to another one. "
@ -1511,8 +1525,11 @@ gst_directdraw_sink_get_ddrawcaps (GstDirectDrawSink * ddrawsink)
/* save blit caps */ /* save blit caps */
ddrawsink->can_blit_between_colorspace = FALSE; ddrawsink->can_blit_between_colorspace = FALSE;
surface_desc.dwSize = sizeof (DDSURFACEDESC); surface_desc.dwSize = sizeof (surface_desc);
hRes = IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object, &surface_desc); sd = &surface_desc;
hRes =
IDirectDraw7_GetDisplayMode (ddrawsink->ddraw_object,
(DDSURFACEDESC *) sd);
if (hRes != DD_OK) { if (hRes != DD_OK) {
GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION, GST_ELEMENT_ERROR (ddrawsink, CORE, NEGOTIATION,
("Error getting the current display mode error=%s", ("Error getting the current display mode error=%s",
@ -1572,7 +1589,10 @@ gst_directdraw_sink_surface_create (GstDirectDrawSink * ddrawsink,
GstDDrawSurface *surface = NULL; GstDDrawSurface *surface = NULL;
GstStructure *structure = NULL; GstStructure *structure = NULL;
gint pitch; gint pitch;
#if 0
HRESULT hRes; HRESULT hRes;
#endif
DDSURFACEDESC2 surf_desc, surf_lock_desc; DDSURFACEDESC2 surf_desc, surf_lock_desc;
g_return_val_if_fail (GST_IS_DIRECTDRAW_SINK (ddrawsink), NULL); g_return_val_if_fail (GST_IS_DIRECTDRAW_SINK (ddrawsink), NULL);
@ -1655,9 +1675,8 @@ lock:
"allocating a surface of %d bytes (stride=%ld)\n", size, "allocating a surface of %d bytes (stride=%ld)\n", size,
surf_lock_desc.lPitch); surf_lock_desc.lPitch);
#else
surface_pitch_bad: surface_pitch_bad:
#else
GST_BUFFER (surface)->malloc_data = g_malloc (size); GST_BUFFER (surface)->malloc_data = g_malloc (size);
GST_BUFFER_DATA (surface) = GST_BUFFER (surface)->malloc_data; GST_BUFFER_DATA (surface) = GST_BUFFER (surface)->malloc_data;
GST_BUFFER_SIZE (surface) = size; GST_BUFFER_SIZE (surface) = size;

View file

@ -136,7 +136,7 @@ struct _GstDirectDrawSinkClass
GstVideoSinkClass parent_class; GstVideoSinkClass parent_class;
}; };
GType gst_direct_drawsink_get_type (void); GType gst_directdraw_sink_get_type (void);
G_END_DECLS G_END_DECLS
#endif /* __GST_DIRECTDRAWSINK_H__ */ #endif /* __GST_DIRECTDRAWSINK_H__ */