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;
|
|
|
|
|
2005-07-19 17:46:37 +00:00
|
|
|
/* flowreturn when srcpad is paused */
|
|
|
|
GstFlowReturn srcresult;
|
|
|
|
|
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;
|
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 */
|
2003-10-07 21:58:42 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
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__ */
|