2008-10-09 12:29:12 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2011-01-12 09:57:08 +00:00
|
|
|
#ifndef __GST_RTSP_SERVER_H__
|
|
|
|
#define __GST_RTSP_SERVER_H__
|
|
|
|
|
2008-10-09 12:29:12 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2011-01-12 09:57:08 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _GstRTSPServer GstRTSPServer;
|
|
|
|
typedef struct _GstRTSPServerClass GstRTSPServerClass;
|
|
|
|
|
2008-10-09 12:29:12 +00:00
|
|
|
#include "rtsp-session-pool.h"
|
2009-01-22 14:33:29 +00:00
|
|
|
#include "rtsp-media-mapping.h"
|
2010-12-11 17:01:53 +00:00
|
|
|
#include "rtsp-media-factory-uri.h"
|
2009-01-20 12:19:36 +00:00
|
|
|
#include "rtsp-client.h"
|
2011-01-11 23:17:54 +00:00
|
|
|
#include "rtsp-auth.h"
|
2008-10-09 12:29:12 +00:00
|
|
|
|
|
|
|
#define GST_TYPE_RTSP_SERVER (gst_rtsp_server_get_type ())
|
|
|
|
#define GST_IS_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_SERVER))
|
|
|
|
#define GST_IS_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_SERVER))
|
|
|
|
#define GST_RTSP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
|
|
|
|
#define GST_RTSP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_SERVER, GstRTSPServer))
|
|
|
|
#define GST_RTSP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_SERVER, GstRTSPServerClass))
|
|
|
|
#define GST_RTSP_SERVER_CAST(obj) ((GstRTSPServer*)(obj))
|
|
|
|
#define GST_RTSP_SERVER_CLASS_CAST(klass) ((GstRTSPServerClass*)(klass))
|
|
|
|
|
2011-01-12 17:57:41 +00:00
|
|
|
#define GST_RTSP_SERVER_GET_LOCK(server) (GST_RTSP_SERVER_CAST(server)->lock)
|
|
|
|
#define GST_RTSP_SERVER_LOCK(server) (g_mutex_lock(GST_RTSP_SERVER_GET_LOCK(server)))
|
|
|
|
#define GST_RTSP_SERVER_UNLOCK(server) (g_mutex_unlock(GST_RTSP_SERVER_GET_LOCK(server)))
|
|
|
|
|
2011-01-12 09:57:08 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPServer:
|
|
|
|
*
|
|
|
|
* This object listens on a port, creates and manages the clients connected to
|
|
|
|
* it.
|
|
|
|
*/
|
2008-10-09 12:29:12 +00:00
|
|
|
struct _GstRTSPServer {
|
2011-01-12 09:57:08 +00:00
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
GMutex *lock;
|
2008-10-09 12:29:12 +00:00
|
|
|
|
|
|
|
/* server information */
|
2011-01-12 09:57:08 +00:00
|
|
|
gchar *address;
|
|
|
|
gchar *service;
|
|
|
|
gint backlog;
|
2010-03-09 12:49:00 +00:00
|
|
|
|
2008-10-09 12:29:12 +00:00
|
|
|
/* sessions on this server */
|
2009-01-29 12:31:27 +00:00
|
|
|
GstRTSPSessionPool *session_pool;
|
2009-01-20 18:47:07 +00:00
|
|
|
|
2009-01-22 14:33:29 +00:00
|
|
|
/* media mapper for this server */
|
2009-01-29 12:31:27 +00:00
|
|
|
GstRTSPMediaMapping *media_mapping;
|
2011-01-11 23:17:54 +00:00
|
|
|
|
|
|
|
/* authentication manager */
|
|
|
|
GstRTSPAuth *auth;
|
2011-01-12 09:57:08 +00:00
|
|
|
|
|
|
|
/* the clients that are connected */
|
|
|
|
GList *clients;
|
2008-10-09 12:29:12 +00:00
|
|
|
};
|
|
|
|
|
2009-01-20 12:19:36 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPServerClass:
|
|
|
|
*
|
2011-01-12 09:57:08 +00:00
|
|
|
* @create_client: Create, configure a new GstRTSPClient
|
|
|
|
* object that handles the new connection on @channel.
|
|
|
|
* @accept_client: accept a new GstRTSPClient
|
2009-01-20 12:19:36 +00:00
|
|
|
*
|
|
|
|
* The RTSP server class structure
|
|
|
|
*/
|
2008-10-09 12:29:12 +00:00
|
|
|
struct _GstRTSPServerClass {
|
|
|
|
GObjectClass parent_class;
|
2009-01-20 12:19:36 +00:00
|
|
|
|
2011-01-12 09:57:08 +00:00
|
|
|
GstRTSPClient * (*create_client) (GstRTSPServer *server);
|
|
|
|
gboolean (*accept_client) (GstRTSPServer *server, GstRTSPClient *client, GIOChannel *channel);
|
2008-10-09 12:29:12 +00:00
|
|
|
};
|
|
|
|
|
2009-01-20 18:47:07 +00:00
|
|
|
GType gst_rtsp_server_get_type (void);
|
|
|
|
|
|
|
|
GstRTSPServer * gst_rtsp_server_new (void);
|
2008-10-09 12:29:12 +00:00
|
|
|
|
2010-03-09 12:49:00 +00:00
|
|
|
void gst_rtsp_server_set_address (GstRTSPServer *server, const gchar *address);
|
|
|
|
gchar * gst_rtsp_server_get_address (GstRTSPServer *server);
|
|
|
|
|
|
|
|
void gst_rtsp_server_set_service (GstRTSPServer *server, const gchar *service);
|
|
|
|
gchar * gst_rtsp_server_get_service (GstRTSPServer *server);
|
2008-10-09 12:29:12 +00:00
|
|
|
|
2009-01-20 18:47:07 +00:00
|
|
|
void gst_rtsp_server_set_backlog (GstRTSPServer *server, gint backlog);
|
|
|
|
gint gst_rtsp_server_get_backlog (GstRTSPServer *server);
|
2009-01-19 18:36:23 +00:00
|
|
|
|
2009-01-20 18:47:07 +00:00
|
|
|
void gst_rtsp_server_set_session_pool (GstRTSPServer *server, GstRTSPSessionPool *pool);
|
|
|
|
GstRTSPSessionPool * gst_rtsp_server_get_session_pool (GstRTSPServer *server);
|
2009-01-19 18:36:23 +00:00
|
|
|
|
2009-01-22 14:33:29 +00:00
|
|
|
void gst_rtsp_server_set_media_mapping (GstRTSPServer *server, GstRTSPMediaMapping *mapping);
|
|
|
|
GstRTSPMediaMapping * gst_rtsp_server_get_media_mapping (GstRTSPServer *server);
|
2009-01-19 18:36:23 +00:00
|
|
|
|
2011-01-11 23:17:54 +00:00
|
|
|
void gst_rtsp_server_set_auth (GstRTSPServer *server, GstRTSPAuth *auth);
|
|
|
|
GstRTSPAuth * gst_rtsp_server_get_auth (GstRTSPServer *server);
|
|
|
|
|
2009-01-20 18:47:07 +00:00
|
|
|
gboolean gst_rtsp_server_io_func (GIOChannel *channel, GIOCondition condition,
|
2009-01-30 13:53:28 +00:00
|
|
|
GstRTSPServer *server);
|
2009-01-19 18:36:23 +00:00
|
|
|
|
2009-01-20 18:47:07 +00:00
|
|
|
GIOChannel * gst_rtsp_server_get_io_channel (GstRTSPServer *server);
|
|
|
|
GSource * gst_rtsp_server_create_watch (GstRTSPServer *server);
|
2010-03-09 12:49:00 +00:00
|
|
|
guint gst_rtsp_server_attach (GstRTSPServer *server,
|
2009-01-30 13:53:28 +00:00
|
|
|
GMainContext *context);
|
2008-10-09 12:29:12 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_RTSP_SERVER_H__ */
|