GstRTSPSessionPool

GstRTSPSessionPool

Synopsis

                    GstRTSPSessionPool;
                    GstRTSPSessionPoolClass;
gboolean            (*GstRTSPSessionPoolFunc)           (GstRTSPSessionPool *pool,
                                                         gpointer user_data);
enum                GstRTSPFilterResult;
GstRTSPFilterResult  (*GstRTSPSessionFilterFunc)        (GstRTSPSessionPool *pool,
                                                         GstRTSPSession *session,
                                                         gpointer user_data);
GstRTSPSessionPool * gst_rtsp_session_pool_new          (void);
void                gst_rtsp_session_pool_set_max_sessions
                                                        (GstRTSPSessionPool *pool,
                                                         guint max);
guint               gst_rtsp_session_pool_get_max_sessions
                                                        (GstRTSPSessionPool *pool);
guint               gst_rtsp_session_pool_get_n_sessions
                                                        (GstRTSPSessionPool *pool);
GstRTSPSession *    gst_rtsp_session_pool_create        (GstRTSPSessionPool *pool);
GstRTSPSession *    gst_rtsp_session_pool_find          (GstRTSPSessionPool *pool,
                                                         const gchar *sessionid);
gboolean            gst_rtsp_session_pool_remove        (GstRTSPSessionPool *pool,
                                                         GstRTSPSession *sess);
GList *             gst_rtsp_session_pool_filter        (GstRTSPSessionPool *pool,
                                                         GstRTSPSessionFilterFunc func,
                                                         gpointer user_data);
guint               gst_rtsp_session_pool_cleanup       (GstRTSPSessionPool *pool);
GSource *           gst_rtsp_session_pool_create_watch  (GstRTSPSessionPool *pool);

Object Hierarchy

  GObject
   +----GstRTSPSessionPool

Properties

  "max-sessions"             guint                 : Read / Write

Description

Details

GstRTSPSessionPool

typedef struct _GstRTSPSessionPool GstRTSPSessionPool;

An object that keeps track of the active sessions. This object is usually attached to a GstRTSPServer object to manage the sessions in that server.


GstRTSPSessionPoolClass

typedef struct {
  GObjectClass  parent_class;

  gchar * (*create_session_id)   (GstRTSPSessionPool *pool);
} GstRTSPSessionPoolClass;

GObjectClass parent_class;

create_session_id ()

create a new random session id. Subclasses can create custom session ids and should not check if the session exists.

GstRTSPSessionPoolFunc ()

gboolean            (*GstRTSPSessionPoolFunc)           (GstRTSPSessionPool *pool,
                                                         gpointer user_data);

The function that will be called from the GSource watch on the session pool.

The function will be called when the pool must be cleaned up because one or more sessions timed out.

pool :

a GstRTSPSessionPool object

user_data :

user data that has been given when registering the handler

Returns :

FALSE if the source should be removed.

enum GstRTSPFilterResult

typedef enum
{
  GST_RTSP_FILTER_REMOVE,
  GST_RTSP_FILTER_KEEP,
  GST_RTSP_FILTER_REF,
} GstRTSPFilterResult;

Possible return values for gst_rtsp_session_pool_filter().

GST_RTSP_FILTER_REMOVE

Remove session

GST_RTSP_FILTER_KEEP

Keep session in the pool

GST_RTSP_FILTER_REF

Ref session in the result list

GstRTSPSessionFilterFunc ()

GstRTSPFilterResult  (*GstRTSPSessionFilterFunc)        (GstRTSPSessionPool *pool,
                                                         GstRTSPSession *session,
                                                         gpointer user_data);

This function will be called by the gst_rtsp_session_pool_filter(). An implementation should return a value of GstRTSPFilterResult.

When this function returns GST_RTSP_FILTER_REMOVE, session will be removed from pool.

A return value of GST_RTSP_FILTER_KEEP will leave session untouched in pool.

A value of GST_RTSP_FILTER_REF will add session to the result GList of gst_rtsp_session_pool_filter().

pool :

a GstRTSPSessionPool object

session :

a GstRTSPSession in pool

user_data :

user data that has been given to gst_rtsp_session_pool_filter()

Returns :

a GstRTSPFilterResult.

gst_rtsp_session_pool_new ()

GstRTSPSessionPool * gst_rtsp_session_pool_new          (void);

Create a new GstRTSPSessionPool instance.

Returns :

A new GstRTSPSessionPool. g_object_unref() after usage.

gst_rtsp_session_pool_set_max_sessions ()

void                gst_rtsp_session_pool_set_max_sessions
                                                        (GstRTSPSessionPool *pool,
                                                         guint max);

Configure the maximum allowed number of sessions in pool to max. A value of 0 means an unlimited amount of sessions.

pool :

a GstRTSPSessionPool

max :

the maximum number of sessions

gst_rtsp_session_pool_get_max_sessions ()

guint               gst_rtsp_session_pool_get_max_sessions
                                                        (GstRTSPSessionPool *pool);

Get the maximum allowed number of sessions in pool. 0 means an unlimited amount of sessions.

pool :

a GstRTSPSessionPool

Returns :

the maximum allowed number of sessions.

gst_rtsp_session_pool_get_n_sessions ()

guint               gst_rtsp_session_pool_get_n_sessions
                                                        (GstRTSPSessionPool *pool);

Get the amount of active sessions in pool.

pool :

a GstRTSPSessionPool

Returns :

the amount of active sessions in pool.

gst_rtsp_session_pool_create ()

GstRTSPSession *    gst_rtsp_session_pool_create        (GstRTSPSessionPool *pool);

Create a new GstRTSPSession object in pool.

pool :

a GstRTSPSessionPool

Returns :

a new GstRTSPSession.

gst_rtsp_session_pool_find ()

GstRTSPSession *    gst_rtsp_session_pool_find          (GstRTSPSessionPool *pool,
                                                         const gchar *sessionid);

Find the session with sessionid in pool. The access time of the session will be updated with gst_rtsp_session_touch().

pool :

the pool to search

sessionid :

the session id

Returns :

the GstRTSPSession with sessionid or NULL when the session did not exist. g_object_unref() after usage.

gst_rtsp_session_pool_remove ()

gboolean            gst_rtsp_session_pool_remove        (GstRTSPSessionPool *pool,
                                                         GstRTSPSession *sess);

Remove sess from pool, releasing the ref that the pool has on sess.

pool :

a GstRTSPSessionPool

sess :

a GstRTSPSession

Returns :

TRUE if the session was found and removed.

gst_rtsp_session_pool_filter ()

GList *             gst_rtsp_session_pool_filter        (GstRTSPSessionPool *pool,
                                                         GstRTSPSessionFilterFunc func,
                                                         gpointer user_data);

Call func for each session in pool. The result value of func determines what happens to the session. func will be called with the session pool locked so no further actions on pool can be performed from func.

If func returns GST_RTSP_FILTER_REMOVE, the session will be removed from pool.

If func returns GST_RTSP_FILTER_KEEP, the session will remain in pool.

If func returns GST_RTSP_FILTER_REF, the session will remain in pool but will also be added with an additional ref to the result GList of this function..

pool :

a GstRTSPSessionPool

func :

a callback

user_data :

user data passed to func

Returns :

a GList with all sessions for which func returned GST_RTSP_FILTER_REF. After usage, each element in the GList should be unreffed before the list is freed.

gst_rtsp_session_pool_cleanup ()

guint               gst_rtsp_session_pool_cleanup       (GstRTSPSessionPool *pool);

Inspect all the sessions in pool and remove the sessions that are inactive for more than their timeout.

pool :

a GstRTSPSessionPool

Returns :

the amount of sessions that got removed.

gst_rtsp_session_pool_create_watch ()

GSource *           gst_rtsp_session_pool_create_watch  (GstRTSPSessionPool *pool);

A GSource that will be dispatched when the session should be cleaned up.

pool :

a GstRTSPSessionPool

Property Details

The "max-sessions" property

  "max-sessions"             guint                 : Read / Write

the maximum amount of sessions (0 = unlimited).

Default value: 0