2000-12-29 05:38:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstqueue.h:
|
2000-01-30 09:03:00 +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_QUEUE_H__
|
|
|
|
#define __GST_QUEUE_H__
|
|
|
|
|
|
|
|
|
2001-01-19 00:02:53 +00:00
|
|
|
#include <gst/gstelement.h>
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
G_BEGIN_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
#define GST_TYPE_QUEUE \
|
|
|
|
(gst_queue_get_type())
|
|
|
|
#define GST_QUEUE(obj) \
|
2001-06-25 01:20:11 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QUEUE,GstQueue))
|
2000-01-30 09:03:00 +00:00
|
|
|
#define GST_QUEUE_CLASS(klass) \
|
2001-06-25 01:20:11 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QUEUE,GstQueueClass))
|
2000-01-30 09:03:00 +00:00
|
|
|
#define GST_IS_QUEUE(obj) \
|
2001-06-25 01:20:11 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QUEUE))
|
2000-01-30 09:03:00 +00:00
|
|
|
#define GST_IS_QUEUE_CLASS(obj) \
|
2001-06-25 01:20:11 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QUEUE))
|
2004-03-15 14:43:35 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
GST_QUEUE_NO_LEAK = 0,
|
|
|
|
GST_QUEUE_LEAK_UPSTREAM = 1,
|
|
|
|
GST_QUEUE_LEAK_DOWNSTREAM = 2
|
2001-05-25 21:00:07 +00:00
|
|
|
};
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
typedef struct _GstQueue GstQueue;
|
2004-04-07 15:31:25 +00:00
|
|
|
typedef struct _GstQueueSize GstQueueSize;
|
2000-01-30 09:03:00 +00:00
|
|
|
typedef struct _GstQueueClass GstQueueClass;
|
|
|
|
|
2004-04-07 15:31:25 +00:00
|
|
|
struct _GstQueueSize {
|
|
|
|
guint buffers; /* no. of buffers */
|
|
|
|
guint bytes; /* no. of bytes */
|
|
|
|
guint64 time; /* amount of time */
|
|
|
|
};
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
struct _GstQueue {
|
2000-12-29 02:28:04 +00:00
|
|
|
GstElement element;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
2003-12-13 17:12:46 +00:00
|
|
|
/* the queue of data we're keeping our grubby hands on */
|
2002-07-08 19:22:02 +00:00
|
|
|
GQueue *queue;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-04-07 15:31:25 +00:00
|
|
|
GstQueueSize
|
|
|
|
cur_level, /* currently in the queue */
|
2004-03-15 14:43:35 +00:00
|
|
|
max_size, /* max. amount of data allowed in the queue */
|
|
|
|
min_threshold; /* min. amount of data required to wake reader */
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-12-13 17:12:46 +00:00
|
|
|
/* whether we leak data, and at which end */
|
|
|
|
gint leaky;
|
|
|
|
|
|
|
|
/* number of nanoseconds until a blocked queue 'times out'
|
|
|
|
* to receive data and returns a filler event. -1 = disable */
|
|
|
|
guint64 block_timeout;
|
|
|
|
|
|
|
|
/* it the queue should fail on possible deadlocks */
|
|
|
|
gboolean may_deadlock;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-05-26 21:54:27 +00:00
|
|
|
gboolean interrupt;
|
2002-06-09 12:13:56 +00:00
|
|
|
gboolean flush;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
GMutex *qlock; /* lock for queue (vs object lock) */
|
|
|
|
GCond *item_add; /* signals buffers now available for reading */
|
|
|
|
GCond *item_del; /* signals space now available for writing */
|
|
|
|
GCond *event_done; /* upstream event signaller */
|
2001-01-07 14:49:23 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
GTimeVal *timeval; /* the timeout for the queue locking */
|
|
|
|
GQueue *events; /* upstream events get decoupled here */
|
2003-10-07 21:58:42 +00:00
|
|
|
|
2004-01-11 22:11:35 +00:00
|
|
|
GstCaps *negotiated_caps;
|
|
|
|
|
2004-07-28 15:28:18 +00:00
|
|
|
GMutex *event_lock; /* lock when handling the events queue */
|
|
|
|
|
|
|
|
gpointer _gst_reserved[GST_PADDING - 1];
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
struct _GstQueueClass {
|
2000-12-29 02:28:04 +00:00
|
|
|
GstElementClass parent_class;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-12-13 17:12:46 +00:00
|
|
|
/* signals - 'running' is called from both sides
|
|
|
|
* which might make it sort of non-useful... */
|
2004-03-15 14:43:35 +00:00
|
|
|
void (*underrun) (GstQueue *queue);
|
|
|
|
void (*running) (GstQueue *queue);
|
|
|
|
void (*overrun) (GstQueue *queue);
|
2003-10-07 21:58:42 +00:00
|
|
|
|
2003-12-09 02:39:31 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
GType gst_queue_get_type (void);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
G_END_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
#endif /* __GST_QUEUE_H__ */
|