/**
* gst_rtsp_thread_new:
+ * @type: the thread type
*
* Create a new thread object that can run a mainloop.
*
* Returns: a #GstRTSPThread.
*/
GstRTSPThread *
-gst_rtsp_thread_new (void)
+gst_rtsp_thread_new (GstRTSPThreadType type)
{
GstRTSPThreadImpl *impl;
impl = g_slice_new0 (GstRTSPThreadImpl);
gst_rtsp_thread_init (impl);
+ impl->thread.type = type;
impl->thread.context = g_main_context_new ();
impl->thread.loop = g_main_loop_new (impl->thread.context, TRUE);
}
static GstRTSPThread *
-make_thread (GstRTSPThreadPool * pool, GstRTSPClientState * state)
+make_thread (GstRTSPThreadPool * pool, GstRTSPThreadType type,
+ GstRTSPClientState * state)
{
GstRTSPThreadPoolClass *klass;
GstRTSPThread *thread;
klass = GST_RTSP_THREAD_POOL_GET_CLASS (pool);
- thread = gst_rtsp_thread_new ();
+ thread = gst_rtsp_thread_new (type);
gst_mini_object_set_qdata (GST_MINI_OBJECT (thread), thread_pool,
g_object_ref (pool), g_object_unref);
} else {
/* make more threads */
GST_DEBUG_OBJECT (pool, "make new client thread");
- thread = make_thread (pool, state);
+ thread = make_thread (pool, type, state);
if (!g_thread_pool_push (klass->pool, thread, &error))
goto thread_error;
break;
case GST_RTSP_THREAD_TYPE_MEDIA:
GST_DEBUG_OBJECT (pool, "make new media thread");
- thread = make_thread (pool, state);
+ thread = make_thread (pool, type, state);
if (!g_thread_pool_push (klass->pool, thread, &error))
goto thread_error;
#define GST_RTSP_THREAD(obj) (GST_RTSP_THREAD_CAST(obj))
/**
+ * GstRTSPThreadType:
+ * @GST_RTSP_THREAD_TYPE_CLIENT: a thread to handle the client communication
+ * @GST_RTSP_THREAD_TYPE_MEDIA: a thread to handle media
+ *
+ * Different thread types
+ */
+typedef enum
+{
+ GST_RTSP_THREAD_TYPE_CLIENT,
+ GST_RTSP_THREAD_TYPE_MEDIA
+} GstRTSPThreadType;
+
+/**
* GstRTSPThread:
*
* Structure holding info about a mainloop running in a thread
struct _GstRTSPThread {
GstMiniObject mini_object;
+ GstRTSPThreadType type;
GMainContext *context;
GMainLoop *loop;
};
-GstRTSPThread * gst_rtsp_thread_new (void);
+GstRTSPThread * gst_rtsp_thread_new (GstRTSPThreadType type);
void gst_rtsp_thread_reuse (GstRTSPThread * thread);
void gst_rtsp_thread_stop (GstRTSPThread * thread);
}
/**
- * GstRTSPThreadType:
- * @GST_RTSP_THREAD_TYPE_CLIENT: a thread to handle the client communication
- * @GST_RTSP_THREAD_TYPE_MEDIA: a thread to handle media
- *
- * Different thread types
- */
-typedef enum
-{
- GST_RTSP_THREAD_TYPE_CLIENT,
- GST_RTSP_THREAD_TYPE_MEDIA
-} GstRTSPThreadType;
-
-/**
* GstRTSPThreadPool:
*
* The thread pool structure.