diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-05-07 23:57:08 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-05-07 23:59:58 +0100 |
commit | 9503daa56ab5a33bad27bcb0e5f3bc492e3963cb (patch) | |
tree | 9c04adecddb0be78ee2e7a0c580fbbaeb018556a /gst/librfb | |
parent | 2f20ec731202b72a03c5013239ab122fa2f22337 (diff) | |
download | gstreamer-plugins-bad-9503daa56ab5a33bad27bcb0e5f3bc492e3963cb.tar.gz |
rfbsrc: call WSAStartup/Cleanup on win32
If we link against libwinsock2, we should probably call
Startup/Cleanup as well.
https://bugzilla.gnome.org/show_bug.cgi?id=675415
Diffstat (limited to 'gst/librfb')
-rw-r--r-- | gst/librfb/gstrfbsrc.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gst/librfb/gstrfbsrc.c b/gst/librfb/gstrfbsrc.c index e19de5592..235acd5a8 100644 --- a/gst/librfb/gstrfbsrc.c +++ b/gst/librfb/gstrfbsrc.c @@ -34,6 +34,10 @@ #include <X11/Xlib.h> #endif +#ifdef G_OS_WIN32 +#include <winsock2.h> +#endif + enum { ARG_0, @@ -70,7 +74,7 @@ GST_STATIC_PAD_TEMPLATE ("src", "height = (int) [ 16, 4096 ], " "framerate = (fraction) 0/1") ); -static void gst_rfb_src_dispose (GObject * object); +static void gst_rfb_src_finalize (GObject * object); static void gst_rfb_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_rfb_src_get_property (GObject * object, guint prop_id, @@ -114,7 +118,7 @@ gst_rfb_src_class_init (GstRfbSrcClass * klass) gstbasesrc_class = (GstBaseSrcClass *) klass; gstpushsrc_class = (GstPushSrcClass *) klass; - gobject_class->dispose = gst_rfb_src_dispose; + gobject_class->finalize = gst_rfb_src_finalize; gobject_class->set_property = gst_rfb_src_set_property; gobject_class->get_property = gst_rfb_src_get_property; @@ -188,10 +192,19 @@ gst_rfb_src_init (GstRfbSrc * src, GstRfbSrcClass * klass) src->decoder = rfb_decoder_new (); +#ifdef G_OS_WIN32 + { + WSADATA wsa_data; + + if (WSAStartup (MAKEWORD (2, 2), &wsa_data) != 0) { + GST_ERROR_OBJECT (sink, "WSAStartup failed: 0x%08x", WSAGetLastError ()); + } + } +#endif } static void -gst_rfb_src_dispose (GObject * object) +gst_rfb_src_finalize (GObject * object) { GstRfbSrc *src = GST_RFB_SRC (object); @@ -201,8 +214,11 @@ gst_rfb_src_dispose (GObject * object) g_free (src->decoder); src->decoder = NULL; } +#ifdef G_OS_WIN32 + WSACleanup (); +#endif - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void |