mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
rtmp: add WSAStartup and WSACleanup on Win32
https://bugzilla.gnome.org/show_bug.cgi?id=661098
This commit is contained in:
parent
98b9d602c1
commit
26d6add945
2 changed files with 40 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue