]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/memblockq.h
handle failure to parse proplist in cli-command gracefully
[pulseaudio] / src / pulsecore / memblockq.h
index 8610a1aac8382be46bd4a4d0636c22f663e16a83..e315b8318d007ac828fc8df7f162922329e26b6c 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef foomemblockqhfoo
 #define foomemblockqhfoo
 
 #ifndef foomemblockqhfoo
 #define foomemblockqhfoo
 
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
 /***
   This file is part of PulseAudio.
 
@@ -10,7 +8,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2 of the
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -64,7 +62,7 @@ typedef struct pa_memblockq pa_memblockq;
 
    - maxrewind: how many bytes of history to keep in the queue
 
 
    - maxrewind: how many bytes of history to keep in the queue
 
-   - silence:   return this memblock when reading unitialized data
+   - silence:   return this memchunk when reading unitialized data
 */
 pa_memblockq* pa_memblockq_new(
         int64_t idx,
 */
 pa_memblockq* pa_memblockq_new(
         int64_t idx,
@@ -74,7 +72,7 @@ pa_memblockq* pa_memblockq_new(
         size_t prebuf,
         size_t minreq,
         size_t maxrewind,
         size_t prebuf,
         size_t minreq,
         size_t maxrewind,
-        pa_memblock *silence);
+        pa_memchunk *silence);
 
 void pa_memblockq_free(pa_memblockq*bq);
 
 
 void pa_memblockq_free(pa_memblockq*bq);
 
@@ -86,6 +84,9 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *chunk);
  * you know what you do. */
 int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk);
 
  * you know what you do. */
 int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk);
 
+/* Manipulate the write pointer */
+void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek);
+
 /* Return a copy of the next memory chunk in the queue. It is not
  * removed from the queue. There are two reasons this function might
  * fail: 1. prebuffering is active, 2. queue is empty and no silence
 /* Return a copy of the next memory chunk in the queue. It is not
  * removed from the queue. There are two reasons this function might
  * fail: 1. prebuffering is active, 2. queue is empty and no silence
@@ -97,6 +98,9 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk);
 /* Drop the specified bytes from the queue. */
 void pa_memblockq_drop(pa_memblockq *bq, size_t length);
 
 /* Drop the specified bytes from the queue. */
 void pa_memblockq_drop(pa_memblockq *bq, size_t length);
 
+/* Rewind the read index. If the history is shorter than the specified length we'll point to silence afterwards. */
+void pa_memblockq_rewind(pa_memblockq *bq, size_t length);
+
 /* Test if the pa_memblockq is currently readable, that is, more data than base */
 pa_bool_t pa_memblockq_is_readable(pa_memblockq *bq);
 
 /* Test if the pa_memblockq is currently readable, that is, more data than base */
 pa_bool_t pa_memblockq_is_readable(pa_memblockq *bq);
 
@@ -113,26 +117,11 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq);
 /* Directly moves the data from the source memblockq into bq */
 int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source);
 
 /* Directly moves the data from the source memblockq into bq */
 int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source);
 
-/* Returns the minimal request value */
-size_t pa_memblockq_get_minreq(pa_memblockq *bq);
-
-/* Manipulate the write pointer */
-void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek);
-
 /* Set the queue to silence, set write index to read index */
 /* Set the queue to silence, set write index to read index */
-void pa_memblockq_flush(pa_memblockq *bq);
-
-/* Get Target length */
-size_t pa_memblockq_get_tlength(pa_memblockq *bq);
+void pa_memblockq_flush_write(pa_memblockq *bq);
 
 
-/* Return the current read index */
-int64_t pa_memblockq_get_read_index(pa_memblockq *bq);
-
-/* Return the current write index */
-int64_t pa_memblockq_get_write_index(pa_memblockq *bq);
-
-/* Rewind the read index. If the history is shorter than the specified length we'll point to silence afterwards. */
-void pa_memblockq_rewind(pa_memblockq *bq, size_t length);
+/* Set the queue to silence, set write read index to write index*/
+void pa_memblockq_flush_read(pa_memblockq *bq);
 
 /* Ignore prebuf for now */
 void pa_memblockq_prebuf_disable(pa_memblockq *bq);
 
 /* Ignore prebuf for now */
 void pa_memblockq_prebuf_disable(pa_memblockq *bq);
@@ -143,16 +132,35 @@ void pa_memblockq_prebuf_force(pa_memblockq *bq);
 /* Return the maximum length of the queue in bytes */
 size_t pa_memblockq_get_maxlength(pa_memblockq *bq);
 
 /* Return the maximum length of the queue in bytes */
 size_t pa_memblockq_get_maxlength(pa_memblockq *bq);
 
+/* Get Target length */
+size_t pa_memblockq_get_tlength(pa_memblockq *bq);
+
 /* Return the prebuffer length in bytes */
 size_t pa_memblockq_get_prebuf(pa_memblockq *bq);
 
 /* Return the prebuffer length in bytes */
 size_t pa_memblockq_get_prebuf(pa_memblockq *bq);
 
+/* Returns the minimal request value */
+size_t pa_memblockq_get_minreq(pa_memblockq *bq);
+
+/* Return the base unit in bytes */
+size_t pa_memblockq_get_base(pa_memblockq *bq);
+
+/* Return the current read index */
+int64_t pa_memblockq_get_read_index(pa_memblockq *bq);
+
+/* Return the current write index */
+int64_t pa_memblockq_get_write_index(pa_memblockq *bq);
+
 /* Change metrics. Always call in order. */
 void pa_memblockq_set_maxlength(pa_memblockq *memblockq, size_t maxlength); /* might modify tlength, prebuf, minreq too */
 void pa_memblockq_set_tlength(pa_memblockq *memblockq, size_t tlength); /* might modify minreq, too */
 void pa_memblockq_set_prebuf(pa_memblockq *memblockq, size_t prebuf); /* might modify minreq, too */
 void pa_memblockq_set_minreq(pa_memblockq *memblockq, size_t minreq);
 /* Change metrics. Always call in order. */
 void pa_memblockq_set_maxlength(pa_memblockq *memblockq, size_t maxlength); /* might modify tlength, prebuf, minreq too */
 void pa_memblockq_set_tlength(pa_memblockq *memblockq, size_t tlength); /* might modify minreq, too */
 void pa_memblockq_set_prebuf(pa_memblockq *memblockq, size_t prebuf); /* might modify minreq, too */
 void pa_memblockq_set_minreq(pa_memblockq *memblockq, size_t minreq);
-void pa_memblockq_set_maxrewind(pa_memblockq *memblockq, size_t rewind); /* Set the maximum history size */
-void pa_memblockq_set_silence(pa_memblockq *memblockq, pa_memblock *silence);
+void pa_memblockq_set_maxrewind(pa_memblockq *memblockq, size_t maxrewind); /* Set the maximum history size */
+void pa_memblockq_set_silence(pa_memblockq *memblockq, pa_memchunk *silence);
+
+/* Apply the data from pa_buffer_attr */
+void pa_memblockq_apply_attr(pa_memblockq *memblockq, const pa_buffer_attr *a);
+void pa_memblockq_get_attr(pa_memblockq *bq, pa_buffer_attr *a);
 
 /* Call pa_memchunk_willneed() for every chunk in the queue from the current read pointer to the end */
 void pa_memblockq_willneed(pa_memblockq *bq);
 
 /* Call pa_memchunk_willneed() for every chunk in the queue from the current read pointer to the end */
 void pa_memblockq_willneed(pa_memblockq *bq);
@@ -162,4 +170,13 @@ void pa_memblockq_willneed(pa_memblockq *bq);
  * data for the future nor data in the backlog. */
 pa_bool_t pa_memblockq_is_empty(pa_memblockq *bq);
 
  * data for the future nor data in the backlog. */
 pa_bool_t pa_memblockq_is_empty(pa_memblockq *bq);
 
+/* Drop everything in the queue, but don't modify the indexes */
+void pa_memblockq_silence(pa_memblockq *bq);
+
+/* Check whether we currently are in prebuf state */
+pa_bool_t pa_memblockq_prebuf_active(pa_memblockq *bq);
+
+/* Return how many items are currently stored in the queue */
+unsigned pa_memblockq_get_nblocks(pa_memblockq *bq);
+
 #endif
 #endif