fffd6f5f9256d1af6df347ea99524cbe23e10ede
[platform/upstream/gstreamer.git] / gst / gstthread.h
1 /* Gnome-Streamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __GST_THREAD_H__
22 #define __GST_THREAD_H__
23
24
25 #include <gst/gstbin.h>
26 #include <pthread.h>
27
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 GstElementDetails gst_thread_details;
34
35
36 typedef enum {
37   GST_THREAD_CREATE             = (1 << 16),
38   GST_THREAD_STATE_SPINNING     = (1 << 17),
39   GST_THREAD_STATE_REAPING      = (1 << 18),
40 } GstThreadState;
41
42
43 #define GST_TYPE_THREAD \
44   (gst_thread_get_type())
45 #define GST_THREAD(obj) \
46   (GTK_CHECK_CAST((obj),GST_TYPE_THREAD,GstThread))
47 #define GST_THREAD_CLASS(klass) \
48   (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_THREAD,GstThreadClass))
49 #define GST_IS_THREAD(obj) \
50   (GTK_CHECK_TYPE((obj),GST_TYPE_THREAD))
51 #define GST_IS_THREAD_CLASS(obj) \
52   (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_THREAD)))
53
54 typedef struct _GstThread GstThread;
55 typedef struct _GstThreadClass GstThreadClass;
56
57 struct _GstThread {
58   GstBin bin;
59
60   GList *entries;               /* used to determine iterate behavior */
61   gint numentries;              /* number of above entry points */
62
63   pthread_t thread_id;          /* id of the thread, if any */
64   GMutex *lock;                 /* thread lock/condititon pair... */
65   GCond *cond;                  /* used to control the thread */
66 };
67
68 struct _GstThreadClass {
69   GstBinClass parent_class;
70 };
71
72 GtkType gst_thread_get_type(void);
73 GstElement *gst_thread_new(guchar *name);
74
75 void *gst_thread_main_loop(void *arg);
76 void gst_thread_iterate(GstThread *thread);
77
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81
82
83 #endif /* __GST_THREAD_H__ */     
84