179 * @buffer_time: the total buffer size in microseconds |
179 * @buffer_time: the total buffer size in microseconds |
180 * @segsize: the size of one segment in bytes |
180 * @segsize: the size of one segment in bytes |
181 * @segtotal: the total number of segments |
181 * @segtotal: the total number of segments |
182 * @bytes_per_sample: number of bytes in one sample |
182 * @bytes_per_sample: number of bytes in one sample |
183 * @silence_sample: bytes representing one sample of silence |
183 * @silence_sample: bytes representing one sample of silence |
|
184 * @seglatency: number of segments queued in the lower level device, |
|
185 * defaults to segtotal |
184 * |
186 * |
185 * The structure containing the format specification of the ringbuffer. |
187 * The structure containing the format specification of the ringbuffer. |
186 */ |
188 */ |
187 struct _GstRingBufferSpec |
189 struct _GstRingBufferSpec |
188 { |
190 { |
198 gint width; |
200 gint width; |
199 gint depth; |
201 gint depth; |
200 gint rate; |
202 gint rate; |
201 gint channels; |
203 gint channels; |
202 |
204 |
203 guint64 latency_time; /* the required/actual latency time */ |
205 guint64 latency_time; /* the required/actual latency time, this is the |
204 guint64 buffer_time; /* the required/actual time of the buffer */ |
206 * actual the size of one segment and the |
205 gint segsize; /* size of one buffer segment in bytes */ |
207 * minimum possible latency we can achieve. */ |
206 gint segtotal; /* total number of segments */ |
208 guint64 buffer_time; /* the required/actual time of the buffer, this is |
207 |
209 * the total size of the buffer and maximum |
|
210 * latency we can compensate for. */ |
|
211 gint segsize; /* size of one buffer segment in bytes, this value |
|
212 * should be chosen to match latency_time as |
|
213 * well as possible. */ |
|
214 gint segtotal; /* total number of segments, this value is the |
|
215 * number of segments of @segsize and should be |
|
216 * chosen so that it matches buffer_time as |
|
217 * close as possible. */ |
208 /* out */ |
218 /* out */ |
209 gint bytes_per_sample; /* number of bytes of one sample */ |
219 gint bytes_per_sample; /* number of bytes of one sample */ |
210 guint8 silence_sample[32]; /* bytes representing silence */ |
220 guint8 silence_sample[32]; /* bytes representing silence */ |
211 |
221 |
|
222 /* ABI added 0.10.20 */ |
|
223 gint seglatency; /* number of segments queued in the lower |
|
224 * level device, defaults to segtotal. */ |
|
225 |
212 /*< private >*/ |
226 /*< private >*/ |
213 gpointer _gst_reserved[GST_PADDING]; |
227 /* gpointer _gst_reserved[GST_PADDING]; */ |
|
228 guint8 _gst_reserved[(sizeof (gpointer) * GST_PADDING) - sizeof (gint)]; |
214 }; |
229 }; |
215 |
230 |
216 #define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond) |
231 #define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond) |
217 #define GST_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) |
232 #define GST_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) |
218 #define GST_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_GET_COND (buf))) |
233 #define GST_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_GET_COND (buf))) |
262 union { |
277 union { |
263 struct { |
278 struct { |
264 gboolean flushing; |
279 gboolean flushing; |
265 /* ATOMIC */ |
280 /* ATOMIC */ |
266 gint may_start; |
281 gint may_start; |
|
282 gboolean active; |
267 } ABI; |
283 } ABI; |
268 /* adding + 0 to mark ABI change to be undone later */ |
284 /* adding + 0 to mark ABI change to be undone later */ |
269 gpointer _gst_reserved[GST_PADDING + 0]; |
285 gpointer _gst_reserved[GST_PADDING + 0]; |
270 } abidata; |
286 } abidata; |
271 }; |
287 }; |
272 |
288 |
273 /** |
289 /** |
274 * GstRingBufferClass: |
290 * GstRingBufferClass: |
|
291 * @parent_class: parent class |
275 * @open_device: open the device, don't set any params or allocate anything |
292 * @open_device: open the device, don't set any params or allocate anything |
276 * @acquire: allocate the resources for the ringbuffer using the given spec |
293 * @acquire: allocate the resources for the ringbuffer using the given spec |
277 * @release: free resources of the ringbuffer |
294 * @release: free resources of the ringbuffer |
278 * @close_device: close the device |
295 * @close_device: close the device |
279 * @start: start processing of samples |
296 * @start: start processing of samples |
280 * @pause: pause processing of samples |
297 * @pause: pause processing of samples |
281 * @resume: resume processing of samples after pause |
298 * @resume: resume processing of samples after pause |
282 * @stop: stop processing of samples |
299 * @stop: stop processing of samples |
283 * @delay: get number of samples queued in device |
300 * @delay: get number of samples queued in device |
|
301 * @activate: activate the thread that starts pulling and monitoring the |
|
302 * consumed segments in the device. Since 0.10.22 |
|
303 * @commit: write samples into the ringbuffer |
|
304 * @clear_all: clear the entire ringbuffer Since 0.10.24 |
284 * |
305 * |
285 * The vmethods that subclasses can override to implement the ringbuffer. |
306 * The vmethods that subclasses can override to implement the ringbuffer. |
286 */ |
307 */ |
287 struct _GstRingBufferClass { |
308 struct _GstRingBufferClass { |
288 GstObjectClass parent_class; |
309 GstObjectClass parent_class; |
298 gboolean (*resume) (GstRingBuffer *buf); |
319 gboolean (*resume) (GstRingBuffer *buf); |
299 gboolean (*stop) (GstRingBuffer *buf); |
320 gboolean (*stop) (GstRingBuffer *buf); |
300 |
321 |
301 guint (*delay) (GstRingBuffer *buf); |
322 guint (*delay) (GstRingBuffer *buf); |
302 |
323 |
|
324 /* ABI added */ |
|
325 gboolean (*activate) (GstRingBuffer *buf, gboolean active); |
|
326 |
|
327 guint (*commit) (GstRingBuffer * buf, guint64 *sample, |
|
328 guchar * data, gint in_samples, |
|
329 gint out_samples, gint * accum); |
|
330 |
|
331 void (*clear_all) (GstRingBuffer * buf); |
|
332 |
303 /*< private >*/ |
333 /*< private >*/ |
304 gpointer _gst_reserved[GST_PADDING]; |
334 gpointer _gst_reserved[GST_PADDING - 3]; |
305 }; |
335 }; |
306 #ifdef __SYMBIAN32__ |
336 #ifdef __SYMBIAN32__ |
307 IMPORT_C |
337 IMPORT_C |
308 #endif |
338 #endif |
309 |
339 |