2004-12-08 18:05:14 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2005-01-06 18:17:12 +00:00
|
|
|
* <2005> Wim Taymans <wim@fluendo.com>
|
|
|
|
*
|
|
|
|
* gsttask.h: Streaming tasks
|
2004-12-08 18:05:14 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_TASK_H__
|
|
|
|
#define __GST_TASK_H__
|
|
|
|
|
|
|
|
#include <gst/gstobject.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2005-01-06 18:17:12 +00:00
|
|
|
typedef void (*GstTaskFunction) (void *data);
|
2004-12-08 18:05:14 +00:00
|
|
|
|
|
|
|
/* --- standard type macros --- */
|
|
|
|
#define GST_TYPE_TASK (gst_task_get_type ())
|
|
|
|
#define GST_TASK(task) (G_TYPE_CHECK_INSTANCE_CAST ((task), GST_TYPE_TASK, GstTask))
|
|
|
|
#define GST_IS_TASK(task) (G_TYPE_CHECK_INSTANCE_TYPE ((task), GST_TYPE_TASK))
|
|
|
|
#define GST_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), GST_TYPE_TASK, GstTaskClass))
|
|
|
|
#define GST_IS_TASK_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), GST_TYPE_TASK))
|
|
|
|
#define GST_TASK_GET_CLASS(task) (G_TYPE_INSTANCE_GET_CLASS ((task), GST_TYPE_TASK, GstTaskClass))
|
2005-01-06 18:17:12 +00:00
|
|
|
#define GST_TASK_CAST(task) ((GstTask*)(task))
|
2004-12-08 18:05:14 +00:00
|
|
|
|
|
|
|
typedef struct _GstTask GstTask;
|
|
|
|
typedef struct _GstTaskClass GstTaskClass;
|
|
|
|
|
2005-01-06 18:17:12 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_TASK_STARTED,
|
|
|
|
GST_TASK_STOPPED,
|
|
|
|
GST_TASK_PAUSED,
|
|
|
|
} GstTaskState;
|
|
|
|
|
|
|
|
#define GST_TASK_STATE(task) (GST_TASK_CAST(task)->state)
|
|
|
|
|
|
|
|
#define GST_TASK_GET_COND(task) (GST_TASK_CAST(task)->cond)
|
|
|
|
#define GST_TASK_WAIT(task) g_cond_wait(GST_TASK_GET_COND (task), GST_GET_LOCK (task))
|
|
|
|
#define GST_TASK_SIGNAL(task) g_cond_signal(GST_TASK_GET_COND (task))
|
|
|
|
#define GST_TASK_BROADCAST(task) g_cond_breadcast(GST_TASK_GET_COND (task))
|
|
|
|
|
2004-12-08 18:05:14 +00:00
|
|
|
struct _GstTask {
|
|
|
|
GstObject object;
|
|
|
|
|
2005-01-26 10:56:09 +00:00
|
|
|
/*< public >*/ /* with TASK_LOCK */
|
2005-01-06 18:17:12 +00:00
|
|
|
GstTaskState state;
|
|
|
|
GCond *cond;
|
|
|
|
|
|
|
|
GstTaskFunction func;
|
|
|
|
gpointer data;
|
|
|
|
|
|
|
|
/*< private >*/
|
2004-12-08 18:05:14 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstTaskClass {
|
|
|
|
GstObjectClass parent_class;
|
|
|
|
|
2005-01-06 18:17:12 +00:00
|
|
|
/*< protected >*/
|
2004-12-08 18:05:14 +00:00
|
|
|
gboolean (*start) (GstTask *task);
|
|
|
|
gboolean (*stop) (GstTask *task);
|
gst/: Work on flushing.
Original commit message from CVS:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_get), (gst_filesrc_activate):
* gst/gstclock.c: (gst_clock_init), (gst_clock_dispose):
* gst/gstclock.h:
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_new_discontinuous), (gst_event_discont_get_value),
(gst_event_new_flush):
* gst/gstevent.h:
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_set_blocked_async),
(gst_pad_set_acceptcaps_function),
(gst_pad_set_fixatecaps_function), (gst_pad_unlink),
(gst_pad_link_prepare_filtered), (gst_pad_link_filtered),
(gst_pad_relink_filtered), (gst_real_pad_get_caps_unlocked),
(gst_pad_peer_get_caps), (gst_pad_fixate_caps),
(gst_pad_accept_caps), (gst_pad_peer_accept_caps),
(gst_pad_set_caps), (gst_pad_configure_sink),
(gst_pad_configure_src), (gst_pad_realize), (gst_pad_alloc_buffer),
(gst_pad_push), (gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gsttask.c: (gst_task_pause):
* gst/gsttask.h:
* gst/schedulers/threadscheduler.c:
(gst_thread_scheduler_task_class_init),
(gst_thread_scheduler_task_init),
(gst_thread_scheduler_task_start),
(gst_thread_scheduler_task_stop),
(gst_thread_scheduler_task_pause), (gst_thread_scheduler_func):
Work on flushing.
Allow tasks to be paused.
Remove some old code in GstClock
2005-01-04 12:06:57 +00:00
|
|
|
gboolean (*pause) (GstTask *task);
|
2004-12-08 18:05:14 +00:00
|
|
|
|
2005-01-06 18:17:12 +00:00
|
|
|
/*< private >*/
|
2004-12-08 18:05:14 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_task_get_type (void);
|
|
|
|
|
2005-01-06 18:17:12 +00:00
|
|
|
GstTask* gst_task_create (GstTaskFunction func, gpointer data);
|
|
|
|
|
|
|
|
GstTaskState gst_task_get_state (GstTask *task);
|
|
|
|
|
2004-12-08 18:05:14 +00:00
|
|
|
gboolean gst_task_start (GstTask *task);
|
|
|
|
gboolean gst_task_stop (GstTask *task);
|
gst/: Work on flushing.
Original commit message from CVS:
* gst/elements/gstfilesrc.c: (gst_filesrc_getrange),
(gst_filesrc_get), (gst_filesrc_activate):
* gst/gstclock.c: (gst_clock_init), (gst_clock_dispose):
* gst/gstclock.h:
* gst/gstevent.c: (gst_event_new_discontinuous_valist),
(gst_event_new_discontinuous), (gst_event_discont_get_value),
(gst_event_new_flush):
* gst/gstevent.h:
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_set_blocked_async),
(gst_pad_set_acceptcaps_function),
(gst_pad_set_fixatecaps_function), (gst_pad_unlink),
(gst_pad_link_prepare_filtered), (gst_pad_link_filtered),
(gst_pad_relink_filtered), (gst_real_pad_get_caps_unlocked),
(gst_pad_peer_get_caps), (gst_pad_fixate_caps),
(gst_pad_accept_caps), (gst_pad_peer_accept_caps),
(gst_pad_set_caps), (gst_pad_configure_sink),
(gst_pad_configure_src), (gst_pad_realize), (gst_pad_alloc_buffer),
(gst_pad_push), (gst_pad_push_event), (gst_pad_send_event):
* gst/gstpad.h:
* gst/gsttask.c: (gst_task_pause):
* gst/gsttask.h:
* gst/schedulers/threadscheduler.c:
(gst_thread_scheduler_task_class_init),
(gst_thread_scheduler_task_init),
(gst_thread_scheduler_task_start),
(gst_thread_scheduler_task_stop),
(gst_thread_scheduler_task_pause), (gst_thread_scheduler_func):
Work on flushing.
Allow tasks to be paused.
Remove some old code in GstClock
2005-01-04 12:06:57 +00:00
|
|
|
gboolean gst_task_pause (GstTask *task);
|
2004-12-08 18:05:14 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_TASK_H__ */
|
|
|
|
|