gsttask.h   gsttask.h 
skipping to change at line 27 skipping to change at line 27
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the * License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifndef __GST_TASK_H__ #ifndef __GST_TASK_H__
#define __GST_TASK_H__ #define __GST_TASK_H__
#include <gst/gstobject.h> #include <gst/gstobject.h>
#include <gst/gsttaskpool.h>
G_BEGIN_DECLS G_BEGIN_DECLS
/** /**
* GstTaskFunction: * GstTaskFunction:
* @data: user data passed to the function * @data: user data passed to the function
* *
* A function that will repeatedly be called in the thread created by * A function that will repeatedly be called in the thread created by
* a #GstTask. * a #GstTask.
*/ */
typedef void (*GstTaskFunction) (void *data); typedef void (*GstTaskFunction) (void *data);
/* --- standard type macros --- */ /* --- standard type macros --- */
#define GST_TYPE_TASK (gst_task_get_type ()) #define GST_TYPE_TASK (gst_task_get_type ())
#define GST_TASK(task) (G_TYPE_CHECK_INSTANCE_CAST ((task), #define GST_TASK(task) (G_TYPE_CHECK_INSTANCE_CAST ((task)
GST_TYPE_TASK, GstTask)) , GST_TYPE_TASK, GstTask))
#define GST_IS_TASK(task) (G_TYPE_CHECK_INSTANCE_TYPE ((task), #define GST_IS_TASK(task) (G_TYPE_CHECK_INSTANCE_TYPE ((task)
GST_TYPE_TASK)) , GST_TYPE_TASK))
#define GST_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((t #define GST_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass),
class), GST_TYPE_TASK, GstTaskClass)) GST_TYPE_TASK, GstTaskClass))
#define GST_IS_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((t #define GST_IS_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass),
class), GST_TYPE_TASK)) GST_TYPE_TASK))
#define GST_TASK_GET_CLASS(task) (G_TYPE_INSTANCE_GET_CLASS ((task), #define GST_TASK_GET_CLASS(task) (G_TYPE_INSTANCE_GET_CLASS ((task),
GST_TYPE_TASK, GstTaskClass)) GST_TYPE_TASK, GstTaskClass))
#define GST_TASK_CAST(task) ((GstTask*)(task)) #define GST_TASK_CAST(task) ((GstTask*)(task))
typedef struct _GstTask GstTask; typedef struct _GstTask GstTask;
typedef struct _GstTaskClass GstTaskClass; typedef struct _GstTaskClass GstTaskClass;
typedef struct _GstTaskPrivate GstTaskPrivate;
/** /**
* GstTaskState: * GstTaskState:
* @GST_TASK_STARTED: the task is started and running * @GST_TASK_STARTED: the task is started and running
* @GST_TASK_STOPPED: the task is stopped * @GST_TASK_STOPPED: the task is stopped
* @GST_TASK_PAUSED: the task is paused * @GST_TASK_PAUSED: the task is paused
* *
* The different states a task can be in * The different states a task can be in
*/ */
typedef enum { typedef enum {
skipping to change at line 71 skipping to change at line 73
GST_TASK_STOPPED, GST_TASK_STOPPED,
GST_TASK_PAUSED GST_TASK_PAUSED
} GstTaskState; } GstTaskState;
/** /**
* GST_TASK_STATE: * GST_TASK_STATE:
* @task: Task to get the state of * @task: Task to get the state of
* *
* Get access to the state of the task. * Get access to the state of the task.
*/ */
#define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state) #define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state)
/** /**
* GST_TASK_GET_COND: * GST_TASK_GET_COND:
* @task: Task to get the cond of * @task: Task to get the cond of
* *
* Get access to the cond of the task. * Get access to the cond of the task.
*/ */
#define GST_TASK_GET_COND(task) (GST_TASK_CAST(task)->cond) #define GST_TASK_GET_COND(task) (GST_TASK_CAST(task)->cond)
/** /**
* GST_TASK_WAIT: * GST_TASK_WAIT:
* @task: Task to wait for * @task: Task to wait for
* *
* Wait for the task cond to be signalled * Wait for the task cond to be signalled
*/ */
#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task) , GST_OBJECT_GET_LOCK (task)) #define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task ), GST_OBJECT_GET_LOCK (task))
/** /**
* GST_TASK_SIGNAL: * GST_TASK_SIGNAL:
* @task: Task to signal * @task: Task to signal
* *
* Signal the task cond * Signal the task cond
*/ */
#define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (tas k)) #define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (ta sk))
/** /**
* GST_TASK_BROADCAST: * GST_TASK_BROADCAST:
* @task: Task to broadcast * @task: Task to broadcast
* *
* Send a broadcast signal to all waiting task conds * Send a broadcast signal to all waiting task conds
*/ */
#define GST_TASK_BROADCAST(task) g_cond_breadcast(GST_TASK_GET_COND ( task)) #define GST_TASK_BROADCAST(task) g_cond_breadcast(GST_TASK_GET_COND (task))
/** /**
* GST_TASK_GET_LOCK: * GST_TASK_GET_LOCK:
* @task: Task to get the lock of * @task: Task to get the lock of
* *
* Get access to the task lock. * Get access to the task lock.
*/ */
#define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock) #define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock)
/**
* GstTaskThreadCallbacks:
* @enter_thread: a thread is entered, this callback is called when the new
* thread enters its function.
* @leave_thread: a thread is exiting, this is called when the thread is ab
out
* to leave its function
*
* Custom GstTask thread callback functions that can be installed.
*
* Since: 0.10.24
*/
typedef struct {
/* manage the lifetime of the thread */
void (*enter_thread) (GstTask *task, GThread *thread, gpointer u
ser_data);
void (*leave_thread) (GstTask *task, GThread *thread, gpointer u
ser_data);
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
} GstTaskThreadCallbacks;
/** /**
* GstTask: * GstTask:
* @state: the state of the task * @state: the state of the task
* @cond: used to pause/resume the task * @cond: used to pause/resume the task
* @lock: The lock taken when iterating the task function * @lock: The lock taken when iterating the task function
* @func: the function executed by this task * @func: the function executed by this task
* @data: data passed to the task function * @data: data passed to the task function
* @running: a flag indicating that the task is running * @running: a flag indicating that the task is running
* *
* The #GstTask object. * The #GstTask object.
*/ */
struct _GstTask { struct _GstTask {
GstObject object; GstObject object;
/*< public >*/ /* with LOCK */ /*< public >*/ /* with LOCK */
GstTaskState state; GstTaskState state;
GCond *cond; GCond *cond;
GStaticRecMutex *lock; GStaticRecMutex *lock;
GstTaskFunction func; GstTaskFunction func;
gpointer data; gpointer data;
gboolean running; gboolean running;
/*< private >*/ /*< private >*/
union { union {
struct { struct {
/* thread this task is currently running in */ /* thread this task is currently running in */
GThread *thread; GThread *thread;
} ABI; } ABI;
/* adding + 0 to mark ABI change to be undone later */ gpointer _gst_reserved[GST_PADDING - 1];
gpointer _gst_reserved[GST_PADDING + 0];
} abidata; } abidata;
GstTaskPrivate *priv;
}; };
struct _GstTaskClass { struct _GstTaskClass {
GstObjectClass parent_class; GstObjectClass parent_class;
/*< private >*/ /*< private >*/
GThreadPool *pool; GstTaskPool *pool;
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
void gst_task_cleanup_all (void); void gst_task_cleanup_all (void);
GType gst_task_get_type (void); GType gst_task_get_type (void);
GstTask* gst_task_create (GstTaskFunction func, gpointer data GstTask* gst_task_create (GstTaskFunction func, gpointer dat
); a);
void gst_task_set_lock (GstTask *task, GStaticRecMutex *mut void gst_task_set_lock (GstTask *task, GStaticRecMutex *mu
ex); tex);
void gst_task_set_priority (GstTask *task, GThreadPriority pri
GstTaskState gst_task_get_state (GstTask *task); ority);
gboolean gst_task_start (GstTask *task); GstTaskPool * gst_task_get_pool (GstTask *task);
gboolean gst_task_stop (GstTask *task); void gst_task_set_pool (GstTask *task, GstTaskPool *pool);
gboolean gst_task_pause (GstTask *task);
void gst_task_set_thread_callbacks (GstTask *task,
GstTaskThreadCallbacks *cal
lbacks,
gpointer user_data,
GDestroyNotify notify);
GstTaskState gst_task_get_state (GstTask *task);
gboolean gst_task_set_state (GstTask *task, GstTaskState state)
;
gboolean gst_task_start (GstTask *task);
gboolean gst_task_stop (GstTask *task);
gboolean gst_task_pause (GstTask *task);
gboolean gst_task_join (GstTask *task); gboolean gst_task_join (GstTask *task);
G_END_DECLS G_END_DECLS
#endif /* __GST_TASK_H__ */ #endif /* __GST_TASK_H__ */
 End of changes. 18 change blocks. 
36 lines changed or deleted 73 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/