winscreencap: Fix compiling with mingw

https://bugzilla.gnome.org/show_bug.cgi?id=672505
This commit is contained in:
Raimo Järvi 2012-03-21 00:17:47 +02:00 committed by Tim-Philipp Müller
parent a7c55d3106
commit 477aaba617
2 changed files with 26 additions and 24 deletions

View file

@ -296,14 +296,15 @@ gst_dx9screencapsrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
src->src_rect.bottom = src->src_rect.top + src->capture_h; src->src_rect.bottom = src->src_rect.top + src->capture_h;
} }
if (framerate = gst_structure_get_value (structure, "framerate")) { framerate = gst_structure_get_value (structure, "framerate");
if (framerate) {
src->rate_numerator = gst_value_get_fraction_numerator (framerate); src->rate_numerator = gst_value_get_fraction_numerator (framerate);
src->rate_denominator = gst_value_get_fraction_denominator (framerate); src->rate_denominator = gst_value_get_fraction_denominator (framerate);
} }
GST_DEBUG_OBJECT (src, "size %dx%d, %d/%d fps", GST_DEBUG_OBJECT (src, "size %dx%d, %d/%d fps",
src->src_rect.right - src->src_rect.left, (gint) (src->src_rect.right - src->src_rect.left),
src->src_rect.bottom - src->src_rect.top, (gint) (src->src_rect.bottom - src->src_rect.top),
src->rate_numerator, src->rate_denominator); src->rate_numerator, src->rate_denominator);
return TRUE; return TRUE;
@ -390,26 +391,26 @@ gst_dx9screencapsrc_create_caps_from_format (D3DFORMAT fmt,
depth = 15; depth = 15;
endianness = G_BYTE_ORDER; endianness = G_BYTE_ORDER;
alpha = GST_VIDEO_ALPHA_MASK_15_INT; alpha = GST_VIDEO_ALPHA_MASK_15_INT;
red = GST_VIDEO_RED_MASK_15_INT; red = GST_VIDEO_COMP1_MASK_15_INT;
green = GST_VIDEO_GREEN_MASK_15_INT; green = GST_VIDEO_COMP2_MASK_15_INT;
blue = GST_VIDEO_BLUE_MASK_15_INT; blue = GST_VIDEO_COMP3_MASK_15_INT;
break; break;
case D3DFMT_X1R5G5B5: case D3DFMT_X1R5G5B5:
bpp = 16; bpp = 16;
depth = 15; depth = 15;
endianness = G_BYTE_ORDER; endianness = G_BYTE_ORDER;
alpha = 0; alpha = 0;
red = GST_VIDEO_RED_MASK_15_INT; red = GST_VIDEO_COMP1_MASK_15_INT;
green = GST_VIDEO_GREEN_MASK_15_INT; green = GST_VIDEO_COMP2_MASK_15_INT;
blue = GST_VIDEO_BLUE_MASK_15_INT; blue = GST_VIDEO_COMP3_MASK_15_INT;
break; break;
case D3DFMT_R5G6B5: case D3DFMT_R5G6B5:
bpp = depth = 16; bpp = depth = 16;
endianness = G_BYTE_ORDER; endianness = G_BYTE_ORDER;
alpha = 0; alpha = 0;
red = GST_VIDEO_RED_MASK_16_INT; red = GST_VIDEO_COMP1_MASK_15_INT;
green = GST_VIDEO_GREEN_MASK_16_INT; green = GST_VIDEO_COMP2_MASK_15_INT;
blue = GST_VIDEO_BLUE_MASK_16_INT; blue = GST_VIDEO_COMP3_MASK_15_INT;
break; break;
default: default:
return NULL; return NULL;
@ -478,7 +479,6 @@ static void
gst_dx9screencapsrc_get_times (GstBaseSrc * basesrc, gst_dx9screencapsrc_get_times (GstBaseSrc * basesrc,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end) GstBuffer * buffer, GstClockTime * start, GstClockTime * end)
{ {
GstDX9ScreenCapSrc *src = GST_DX9SCREENCAPSRC (basesrc);
GstClockTime timestamp; GstClockTime timestamp;
timestamp = GST_BUFFER_TIMESTAMP (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer);
@ -501,7 +501,8 @@ gst_dx9screencapsrc_create (GstPushSrc * push_src, GstBuffer ** buf)
gint new_buf_size, i; gint new_buf_size, i;
gint width, height, stride; gint width, height, stride;
GstClock *clock; GstClock *clock;
GstClockTime time, buf_time; GstClockTime time = GST_CLOCK_TIME_NONE;
GstClockTime buf_time;
D3DLOCKED_RECT locked_rect; D3DLOCKED_RECT locked_rect;
LPBYTE p_dst, p_src; LPBYTE p_dst, p_src;
HRESULT hres; HRESULT hres;
@ -536,7 +537,7 @@ gst_dx9screencapsrc_create (GstPushSrc * push_src, GstBuffer ** buf)
} }
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src,
"creating buffer of %lu bytes with %dx%d image for frame %d", "creating buffer of %d bytes with %dx%d image for frame %d",
new_buf_size, width, height, (gint) src->frames); new_buf_size, width, height, (gint) src->frames);
res = gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (src), res = gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (src),

View file

@ -315,7 +315,8 @@ gst_gdiscreencapsrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
src->src_rect.bottom = src->src_rect.top + src->capture_h; src->src_rect.bottom = src->src_rect.top + src->capture_h;
} }
if (framerate = gst_structure_get_value (structure, "framerate")) { framerate = gst_structure_get_value (structure, "framerate");
if (framerate) {
src->rate_numerator = gst_value_get_fraction_numerator (framerate); src->rate_numerator = gst_value_get_fraction_numerator (framerate);
src->rate_denominator = gst_value_get_fraction_denominator (framerate); src->rate_denominator = gst_value_get_fraction_denominator (framerate);
} }
@ -349,8 +350,8 @@ gst_gdiscreencapsrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
ReleaseDC (capture, device); ReleaseDC (capture, device);
GST_DEBUG_OBJECT (src, "size %dx%d, %d/%d fps", GST_DEBUG_OBJECT (src, "size %dx%d, %d/%d fps",
src->info.bmiHeader.biWidth, (gint) src->info.bmiHeader.biWidth,
-src->info.bmiHeader.biHeight, (gint) (-src->info.bmiHeader.biHeight),
src->rate_numerator, src->rate_denominator); src->rate_numerator, src->rate_denominator);
return TRUE; return TRUE;
@ -378,7 +379,8 @@ gst_gdiscreencapsrc_get_caps (GstBaseSrc * bsrc)
} }
GST_DEBUG ("width = %d, height=%d", GST_DEBUG ("width = %d, height=%d",
rect_dst.right - rect_dst.left, rect_dst.bottom - rect_dst.top); (gint) (rect_dst.right - rect_dst.left),
(gint) (rect_dst.bottom - rect_dst.top));
return gst_caps_new_simple ("video/x-raw-rgb", return gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, 24, "bpp", G_TYPE_INT, 24,
@ -416,7 +418,6 @@ static void
gst_gdiscreencapsrc_get_times (GstBaseSrc * basesrc, GstBuffer * buffer, gst_gdiscreencapsrc_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
GstClockTime * start, GstClockTime * end) GstClockTime * start, GstClockTime * end)
{ {
GstGDIScreenCapSrc *src = GST_GDISCREENCAPSRC (basesrc);
GstClockTime timestamp; GstClockTime timestamp;
timestamp = GST_BUFFER_TIMESTAMP (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer);
@ -438,7 +439,7 @@ gst_gdiscreencapsrc_create (GstPushSrc * push_src, GstBuffer ** buf)
GstFlowReturn res; GstFlowReturn res;
gint new_buf_size; gint new_buf_size;
GstClock *clock; GstClock *clock;
GstClockTime time; GstClockTime time = GST_CLOCK_TIME_NONE;
GstClockTime base_time; GstClockTime base_time;
if (G_UNLIKELY (!src->info.bmiHeader.biWidth || if (G_UNLIKELY (!src->info.bmiHeader.biWidth ||
@ -455,9 +456,9 @@ gst_gdiscreencapsrc_create (GstPushSrc * push_src, GstBuffer ** buf)
(-src->info.bmiHeader.biHeight); (-src->info.bmiHeader.biHeight);
GST_LOG_OBJECT (src, GST_LOG_OBJECT (src,
"creating buffer of %lu bytes with %dx%d image for frame %d", "creating buffer of %d bytes with %dx%d image for frame %d",
new_buf_size, src->info.bmiHeader.biWidth, new_buf_size, (gint) src->info.bmiHeader.biWidth,
-src->info.bmiHeader.biHeight, (gint) src->frames); (gint) (-src->info.bmiHeader.biHeight), (gint) src->frames);
res = res =
gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (src), gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (src),