rtsp: Port to GIO

This commit is contained in:
Sebastian Dröge 2012-01-17 16:38:45 +01:00
parent cfa7083e94
commit aed2666b53
6 changed files with 343 additions and 529 deletions

View file

@ -32,8 +32,8 @@ noinst_HEADERS = gstrtsp.h
#gstrtspextwms.c #gstrtspextwms.c
#rtspextreal.c #rtspextreal.c
libgstrtsp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstrtsp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS)
libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS) $(HSTRERROR_LIBS) libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(GIO_LIBS)
libgstrtsp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) libgstrtsp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
BUILT_SOURCES = $(built_headers) $(built_sources) BUILT_SOURCES = $(built_headers) $(built_sources)
@ -76,6 +76,7 @@ GstRtsp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_MAJORMINO
--libtool="$(top_builddir)/libtool" \ --libtool="$(top_builddir)/libtool" \
--pkg gstreamer-@GST_MAJORMINOR@ \ --pkg gstreamer-@GST_MAJORMINOR@ \
--pkg gstreamer-sdp-@GST_MAJORMINOR@ \ --pkg gstreamer-sdp-@GST_MAJORMINOR@ \
--pkg gio-2.0 \
--pkg-export gstreamer-rtsp-@GST_MAJORMINOR@ \ --pkg-export gstreamer-rtsp-@GST_MAJORMINOR@ \
--add-init-section="gst_init(NULL,NULL);" \ --add-init-section="gst_init(NULL,NULL);" \
--output $@ \ --output $@ \

File diff suppressed because it is too large Load diff

View file

@ -49,6 +49,7 @@
#include <gst/rtsp/gstrtspdefs.h> #include <gst/rtsp/gstrtspdefs.h>
#include <gst/rtsp/gstrtspurl.h> #include <gst/rtsp/gstrtspurl.h>
#include <gst/rtsp/gstrtspmessage.h> #include <gst/rtsp/gstrtspmessage.h>
#include <gio/gio.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -61,12 +62,12 @@ typedef struct _GstRTSPConnection GstRTSPConnection;
/* opening/closing a connection */ /* opening/closing a connection */
GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn); GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn);
GstRTSPResult gst_rtsp_connection_create_from_fd (gint fd, GstRTSPResult gst_rtsp_connection_create_from_socket (GSocket * socket,
const gchar * ip, const gchar * ip,
guint16 port, guint16 port,
const gchar * initial_buffer, const gchar * initial_buffer,
GstRTSPConnection ** conn); GstRTSPConnection ** conn);
GstRTSPResult gst_rtsp_connection_accept (gint sock, GstRTSPConnection **conn); GstRTSPResult gst_rtsp_connection_accept (GSocket *socket, GstRTSPConnection **conn, GCancellable *cancellable);
GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout); GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn); GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn); GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
@ -117,8 +118,8 @@ GstRTSPUrl * gst_rtsp_connection_get_url (const GstRTSPConnection *
const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn); const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn);
void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip); void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip);
gint gst_rtsp_connection_get_readfd (const GstRTSPConnection *conn); GSocket * gst_rtsp_connection_get_read_socket (const GstRTSPConnection *conn);
gint gst_rtsp_connection_get_writefd (const GstRTSPConnection *conn); GSocket * gst_rtsp_connection_get_write_socket (const GstRTSPConnection *conn);
void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn, void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn,
gboolean enable); gboolean enable);

View file

@ -54,12 +54,6 @@
#include "gstrtspdefs.h" #include "gstrtspdefs.h"
#ifdef G_OS_WIN32
#include <winsock2.h>
#else
#include <netdb.h>
#endif
struct rtsp_header struct rtsp_header
{ {
const gchar *name; const gchar *name;
@ -261,25 +255,10 @@ gst_rtsp_strresult (GstRTSPResult result)
switch (result) { switch (result) {
case GST_RTSP_OK: case GST_RTSP_OK:
return g_strdup ("OK"); return g_strdup ("OK");
#ifdef G_OS_WIN32
case GST_RTSP_ESYS: case GST_RTSP_ESYS:
return g_strdup ("System error");
case GST_RTSP_ENET: case GST_RTSP_ENET:
{ return g_strdup ("Network error");
gchar *res, *msg;
msg = g_win32_error_message (WSAGetLastError ());
if (result == GST_RTSP_ESYS)
res = g_strdup_printf ("System error: %s", msg);
else
res = g_strdup_printf ("Network error: %s", msg);
g_free (msg);
return res;
}
#else
case GST_RTSP_ESYS:
return g_strdup_printf ("System error: %s", g_strerror (errno));
case GST_RTSP_ENET:
return g_strdup_printf ("Network error: %s", hstrerror (h_errno));
#endif
case GST_RTSP_ERROR: case GST_RTSP_ERROR:
return g_strdup ("Generic error"); return g_strdup ("Generic error");
case GST_RTSP_EINVAL: case GST_RTSP_EINVAL:

View file

@ -10,7 +10,7 @@ typelibdir=@abs_top_builddir@/gst-libs/gst/rtsp
Name: GStreamer RTSP Library, Uninstalled Name: GStreamer RTSP Library, Uninstalled
Description: RTSP base classes and helper functions, uninstalled Description: RTSP base classes and helper functions, uninstalled
Version: @VERSION@ Version: @VERSION@
Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@ Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@ gio-2.0
Libs: @abs_top_builddir@/gst-libs/gst/rtsp/libgstrtsp-@GST_MAJORMINOR@.la Libs: @abs_top_builddir@/gst-libs/gst/rtsp/libgstrtsp-@GST_MAJORMINOR@.la
Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs

View file

@ -9,7 +9,7 @@ typelibdir=${libdir}/girepository-1.0
Name: GStreamer RTSP Library Name: GStreamer RTSP Library
Description: RTSP base classes and helper functions Description: RTSP base classes and helper functions
Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@ Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@ gio-2.0
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lgstrtsp-@GST_MAJORMINOR@ Libs: -L${libdir} -lgstrtsp-@GST_MAJORMINOR@
Cflags: -I${includedir} Cflags: -I${includedir}