summaryrefslogtreecommitdiff
path: root/ext/rtmp
diff options
context:
space:
mode:
authorJulien Isorce <julien.isorce@gmail.com>2011-10-06 17:43:19 +0200
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-11-28 10:34:45 +0000
commit26d6add9457f00ce8ec13844368466f0e3816e5d (patch)
tree9401bf8827b184fe12b65e7d0ed19f809c15ab07 /ext/rtmp
parent98b9d602c1b7c9a4c7bed083f6549c481570caa7 (diff)
downloadgstreamer-plugins-bad-26d6add9457f00ce8ec13844368466f0e3816e5d.tar.gz
rtmp: add WSAStartup and WSACleanup on Win32
https://bugzilla.gnome.org/show_bug.cgi?id=661098
Diffstat (limited to 'ext/rtmp')
-rw-r--r--ext/rtmp/gstrtmpsink.c24
-rw-r--r--ext/rtmp/gstrtmpsrc.c16
2 files changed, 40 insertions, 0 deletions
diff --git a/ext/rtmp/gstrtmpsink.c b/ext/rtmp/gstrtmpsink.c
index 90a1a79ec..db066847d 100644
--- a/ext/rtmp/gstrtmpsink.c
+++ b/ext/rtmp/gstrtmpsink.c
@@ -43,6 +43,10 @@
#include "gstrtmpsink.h"
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
GST_DEBUG_CATEGORY_STATIC (gst_rtmp_sink_debug);
#define GST_CAT_DEFAULT gst_rtmp_sink_debug
@@ -71,6 +75,7 @@ static void gst_rtmp_sink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtmp_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
+static void gst_rtmp_sink_finalize (GObject * object);
static gboolean gst_rtmp_sink_stop (GstBaseSink * sink);
static gboolean gst_rtmp_sink_start (GstBaseSink * sink);
static GstFlowReturn gst_rtmp_sink_render (GstBaseSink * sink, GstBuffer * buf);
@@ -116,6 +121,7 @@ gst_rtmp_sink_class_init (GstRTMPSinkClass * klass)
GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
gobject_class = (GObjectClass *) klass;
+ gobject_class->finalize = gst_rtmp_sink_finalize;
gobject_class->set_property = gst_rtmp_sink_set_property;
gobject_class->get_property = gst_rtmp_sink_get_property;
@@ -133,8 +139,26 @@ gst_rtmp_sink_class_init (GstRTMPSinkClass * klass)
static void
gst_rtmp_sink_init (GstRTMPSink * sink, GstRTMPSinkClass * klass)
{
+#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_rtmp_sink_finalize (GObject * object)
+{
+#ifdef G_OS_WIN32
+ WSACleanup ();
+#endif
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
+
static gboolean
gst_rtmp_sink_start (GstBaseSink * basesink)
{
diff --git a/ext/rtmp/gstrtmpsrc.c b/ext/rtmp/gstrtmpsrc.c
index e37ac06b7..578bd8f90 100644
--- a/ext/rtmp/gstrtmpsrc.c
+++ b/ext/rtmp/gstrtmpsrc.c
@@ -53,6 +53,10 @@
#include <gst/gst.h>
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
GST_DEBUG_CATEGORY_STATIC (rtmpsrc_debug);
#define GST_CAT_DEFAULT rtmpsrc_debug
@@ -153,6 +157,14 @@ gst_rtmp_src_class_init (GstRTMPSrcClass * klass)
static void
gst_rtmp_src_init (GstRTMPSrc * rtmpsrc, GstRTMPSrcClass * klass)
{
+#ifdef G_OS_WIN32
+ WSADATA wsa_data;
+
+ if (WSAStartup (MAKEWORD (2, 2), &wsa_data) != 0) {
+ GST_ERROR_OBJECT (rtmpsrc, "WSAStartup failed: 0x%08x", WSAGetLastError ());
+ }
+#endif
+
rtmpsrc->cur_offset = 0;
rtmpsrc->last_timestamp = 0;
@@ -167,6 +179,10 @@ gst_rtmp_src_finalize (GObject * object)
g_free (rtmpsrc->uri);
rtmpsrc->uri = NULL;
+#ifdef G_OS_WIN32
+ WSACleanup ();
+#endif
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}