2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2003 Colin Walters <cwalters@gnome.org>
4 * 2000,2005,2007 Wim Taymans <wim.taymans@gmail.com>
5 * 2007 Thiago Sousa Santos <thiagoss@lcc.ufcg.edu.br>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_QUEUE2_H__
25 #define __GST_QUEUE2_H__
31 #define GST_TYPE_QUEUE2 \
32 (gst_queue2_get_type())
33 #define GST_QUEUE2(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QUEUE2,GstQueue2))
35 #define GST_QUEUE2_CLASS(klass) \
36 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QUEUE2,GstQueue2Class))
37 #define GST_IS_QUEUE2(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QUEUE2))
39 #define GST_IS_QUEUE2_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QUEUE2))
41 #define GST_QUEUE2_CAST(obj) \
44 typedef struct _GstQueue2 GstQueue2;
45 typedef struct _GstQueue2Size GstQueue2Size;
46 typedef struct _GstQueue2Class GstQueue2Class;
48 /* used to keep track of sizes (current and max) */
65 /* segments to keep track of timestamps */
66 GstSegment sink_segment;
67 GstSegment src_segment;
69 /* flowreturn when srcpad is paused */
70 GstFlowReturn srcresult;
74 /* the queue of data we're keeping our hands on */
77 GstQueue2Size cur_level; /* currently in the queue */
78 GstQueue2Size max_level; /* max. amount of data allowed in the queue */
79 gboolean use_buffering;
80 gboolean use_rate_estimate;
81 GstClockTime buffering_interval;
82 gint low_percent; /* low/high watermarks for buffering */
85 /* current buffering state */
86 gboolean is_buffering;
87 guint buffering_iteration;
89 /* for measuring input/output rates */
91 gboolean in_timer_started;
92 gdouble last_in_elapsed;
97 gboolean out_timer_started;
98 gdouble last_out_elapsed;
100 gdouble byte_out_rate;
102 GMutex *qlock; /* lock for queue (vs object lock) */
103 gboolean waiting_add;
104 GCond *item_add; /* signals buffers now available for reading */
105 gboolean waiting_del;
106 GCond *item_del; /* signals space now available for writing */
108 /* temp location stuff */
109 gchar *temp_template;
110 gboolean temp_location_set;
111 gchar *temp_location;
115 guint64 max_reading_pos;
116 /* we need this to send the first new segment event of the stream
117 * because we can't save it on the file */
118 gboolean segment_event_received;
119 GstEvent *starting_segment;
123 struct _GstQueue2Class
125 GstElementClass parent_class;
128 GType gst_queue2_get_type (void);
132 #endif /* __GST_QUEUE2_H__ */