1 /* GStreamer |
|
2 * Copyright (C) <2009> Wim Taymans <wim.taymans@gmail.com> |
|
3 * |
|
4 * gsttaskpool.h: Pool for creating streaming threads |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Library General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Library General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Library General Public |
|
17 * License along with this library; if not, write to the |
|
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
19 * Boston, MA 02111-1307, USA. |
|
20 */ |
|
21 |
|
22 #ifndef __GST_TASK_POOL_H__ |
|
23 #define __GST_TASK_POOL_H__ |
|
24 |
|
25 #include <gst/gstobject.h> |
|
26 |
|
27 G_BEGIN_DECLS |
|
28 |
|
29 /* --- standard type macros --- */ |
|
30 #define GST_TYPE_TASK_POOL (gst_task_pool_get_type ()) |
|
31 #define GST_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_CAST ((pool), GST_TYPE_TASK_POOL, GstTaskPool)) |
|
32 #define GST_IS_TASK_POOL(pool) (G_TYPE_CHECK_INSTANCE_TYPE ((pool), GST_TYPE_TASK_POOL)) |
|
33 #define GST_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), GST_TYPE_TASK_POOL, GstTaskPoolClass)) |
|
34 #define GST_IS_TASK_POOL_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), GST_TYPE_TASK_POOL)) |
|
35 #define GST_TASK_POOL_GET_CLASS(pool) (G_TYPE_INSTANCE_GET_CLASS ((pool), GST_TYPE_TASK_POOL, GstTaskPoolClass)) |
|
36 #define GST_TASK_POOL_CAST(pool) ((GstTaskPool*)(pool)) |
|
37 |
|
38 typedef struct _GstTaskPool GstTaskPool; |
|
39 typedef struct _GstTaskPoolClass GstTaskPoolClass; |
|
40 |
|
41 typedef void (*GstTaskPoolFunction) (void *data); |
|
42 |
|
43 /** |
|
44 * GstTaskPool: |
|
45 * |
|
46 * The #GstTaskPool object. |
|
47 */ |
|
48 struct _GstTaskPool { |
|
49 GstObject object; |
|
50 |
|
51 /*< private >*/ |
|
52 GThreadPool *pool; |
|
53 |
|
54 gpointer _gst_reserved[GST_PADDING]; |
|
55 }; |
|
56 |
|
57 /** |
|
58 * GstTaskPoolClass: |
|
59 * @parent_class: the parent class structure |
|
60 * @prepare: prepare the threadpool |
|
61 * @cleanup: make sure all threads are stopped |
|
62 * @push: start a new thread |
|
63 * @join: join a thread |
|
64 * |
|
65 * The #GstTaskPoolClass object. |
|
66 */ |
|
67 struct _GstTaskPoolClass { |
|
68 GstObjectClass parent_class; |
|
69 |
|
70 /*< public >*/ |
|
71 void (*prepare) (GstTaskPool *pool, GError **error); |
|
72 void (*cleanup) (GstTaskPool *pool); |
|
73 |
|
74 gpointer (*push) (GstTaskPool *pool, GstTaskPoolFunction func, |
|
75 gpointer user_data, GError **error); |
|
76 void (*join) (GstTaskPool *pool, gpointer id); |
|
77 |
|
78 /*< private >*/ |
|
79 gpointer _gst_reserved[GST_PADDING]; |
|
80 }; |
|
81 #ifdef __SYMBIAN32__ |
|
82 IMPORT_C |
|
83 #endif |
|
84 |
|
85 |
|
86 GType gst_task_pool_get_type (void); |
|
87 #ifdef __SYMBIAN32__ |
|
88 IMPORT_C |
|
89 #endif |
|
90 |
|
91 |
|
92 GstTaskPool * gst_task_pool_new (void); |
|
93 #ifdef __SYMBIAN32__ |
|
94 IMPORT_C |
|
95 #endif |
|
96 |
|
97 void gst_task_pool_prepare (GstTaskPool *pool, GError **error); |
|
98 #ifdef __SYMBIAN32__ |
|
99 IMPORT_C |
|
100 #endif |
|
101 |
|
102 |
|
103 gpointer gst_task_pool_push (GstTaskPool *pool, GstTaskPoolFunction func, |
|
104 gpointer user_data, GError **error); |
|
105 #ifdef __SYMBIAN32__ |
|
106 IMPORT_C |
|
107 #endif |
|
108 |
|
109 void gst_task_pool_join (GstTaskPool *pool, gpointer id); |
|
110 #ifdef __SYMBIAN32__ |
|
111 IMPORT_C |
|
112 #endif |
|
113 |
|
114 |
|
115 void gst_task_pool_cleanup (GstTaskPool *pool); |
|
116 |
|
117 G_END_DECLS |
|
118 |
|
119 #endif /* __GST_TASK_POOL_H__ */ |
|