mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
add280cd10
Original commit message from CVS: * gst/base/gstadapter.c: (gst_adapter_peek), (gst_adapter_flush): * gst/base/gstbasesink.c: (gst_basesink_preroll_queue_push), (gst_basesink_finish_preroll), (gst_basesink_chain), (gst_basesink_loop), (gst_basesink_activate), (gst_basesink_change_state): * gst/base/gstbasesrc.c: (gst_basesrc_do_seek), (gst_basesrc_get_range), (gst_basesrc_loop), (gst_basesrc_activate): * gst/elements/gsttee.c: (gst_tee_sink_activate): * gst/gstpad.c: (gst_pad_dispose), (gst_real_pad_class_init), (gst_real_pad_init), (gst_real_pad_set_property), (gst_real_pad_get_property), (gst_pad_set_active), (gst_pad_is_active), (gst_pad_get_query_types), (gst_pad_unlink), (gst_pad_link_prepare), (gst_pad_link), (gst_pad_get_real_parent), (gst_real_pad_get_caps_unlocked), (gst_pad_peer_get_caps), (gst_pad_accept_caps), (gst_pad_get_peer), (gst_pad_realize), (gst_pad_event_default_dispatch), (gst_pad_event_default), (gst_pad_dispatcher), (gst_pad_query), (gst_real_pad_dispose), (gst_pad_save_thyself), (handle_pad_block), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_send_event), (gst_pad_start_task), (gst_pad_pause_task), (gst_pad_stop_task): * gst/gstpad.h: * gst/gstqueue.c: (gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop), (gst_queue_src_activate): * gst/gsttask.c: (gst_task_init), (gst_task_set_lock), (gst_task_get_state): * gst/gsttask.h: * gst/schedulers/threadscheduler.c: (gst_thread_scheduler_task_start), (gst_thread_scheduler_func): Implement gst_pad_pause/start/stop_task(), take STREAM lock in task function. Remove ACTIVE pad flag, use FLUSHING everywhere Added _pad_chain(), _pad_get_range() to call chain/getrange functions. Add locks around IS_FLUSHING when reading. Take STREAM lock in chain(), get_range() functions so plugins don't need to take it anymore.
104 lines
3.3 KiB
C
104 lines
3.3 KiB
C
/* GStreamer
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
* <2005> Wim Taymans <wim@fluendo.com>
|
|
*
|
|
* gsttask.h: Streaming tasks
|
|
*
|
|
* 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
|
|
|
|
typedef void (*GstTaskFunction) (void *data);
|
|
|
|
/* --- 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))
|
|
#define GST_TASK_CAST(task) ((GstTask*)(task))
|
|
|
|
typedef struct _GstTask GstTask;
|
|
typedef struct _GstTaskClass GstTaskClass;
|
|
|
|
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))
|
|
|
|
#define GST_TASK_GET_LOCK(task) (GST_TASK_CAST(task)->lock)
|
|
#define GST_TASK_LOCK(task) g_static_rec_mutex_lock(GST_TASK_GET_LOCK(task))
|
|
#define GST_TASK_UNLOCK(task) g_static_rec_mutex_unlock(GST_TASK_GET_LOCK(task))
|
|
|
|
struct _GstTask {
|
|
GstObject object;
|
|
|
|
|
|
/*< public >*/ /* with LOCK */
|
|
GstTaskState state;
|
|
GCond *cond;
|
|
|
|
GStaticRecMutex *lock;
|
|
|
|
GstTaskFunction func;
|
|
gpointer data;
|
|
|
|
/*< private >*/
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
};
|
|
|
|
struct _GstTaskClass {
|
|
GstObjectClass parent_class;
|
|
|
|
/*< protected >*/
|
|
gboolean (*start) (GstTask *task);
|
|
gboolean (*stop) (GstTask *task);
|
|
gboolean (*pause) (GstTask *task);
|
|
|
|
/*< private >*/
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
};
|
|
|
|
GType gst_task_get_type (void);
|
|
|
|
GstTask* gst_task_create (GstTaskFunction func, gpointer data);
|
|
void gst_task_set_lock (GstTask *task, GStaticRecMutex *mutex);
|
|
|
|
GstTaskState gst_task_get_state (GstTask *task);
|
|
|
|
gboolean gst_task_start (GstTask *task);
|
|
gboolean gst_task_stop (GstTask *task);
|
|
gboolean gst_task_pause (GstTask *task);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GST_TASK_H__ */
|
|
|