]> code.delx.au - pulseaudio/blobdiff - polyp/memblockq.c
Make the whole stuff LGPL only
[pulseaudio] / polyp / memblockq.c
index 0bba6581700d7395f075d88d1c37ec74afa687fe..0fbeaad09f482f0471aa7f4b643d5edb636a9395 100644 (file)
@@ -4,7 +4,7 @@
   This file is part of polypaudio.
  
   polypaudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
+  it under the terms of the GNU Lesser General Public License as published
   by the Free Software Foundation; either version 2 of the License,
   or (at your option) any later version.
  
@@ -13,7 +13,7 @@
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   General Public License for more details.
  
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with polypaudio; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
@@ -42,7 +42,7 @@ struct memblock_list {
 struct pa_memblockq {
     struct memblock_list *blocks, *blocks_tail;
     unsigned n_blocks;
-    size_t current_length, maxlength, tlength, base, prebuf, minreq;
+    size_t current_length, maxlength, tlength, base, prebuf, orig_prebuf, minreq;
     struct pa_mcalign *mcalign;
     struct pa_memblock_stat *memblock_stat;
 };
@@ -72,6 +72,8 @@ struct pa_memblockq* pa_memblockq_new(size_t maxlength, size_t tlength, size_t b
     bq->prebuf = (bq->prebuf/base)*base;
     if (bq->prebuf > bq->maxlength)
         bq->prebuf = bq->maxlength;
+
+    bq->orig_prebuf = bq->prebuf;
     
     bq->minreq = (minreq/base)*base;
     if (bq->minreq == 0)
@@ -149,9 +151,9 @@ int pa_memblockq_peek(struct pa_memblockq* bq, struct pa_memchunk *chunk) {
 void pa_memblockq_drop(struct pa_memblockq *bq, const struct pa_memchunk *chunk, size_t length) {
     assert(bq && chunk && length);
 
-    if (!bq->blocks || memcmp(&bq->blocks->chunk, chunk, sizeof(struct pa_memchunk)))
+    if (!bq->blocks || memcmp(&bq->blocks->chunk, chunk, sizeof(struct pa_memchunk))) 
         return;
-
+    
     assert(length <= bq->blocks->chunk.length);
     pa_memblockq_skip(bq, length);
 }
@@ -207,7 +209,7 @@ void pa_memblockq_shorten(struct pa_memblockq *bq, size_t length) {
     if (bq->current_length <= length)
         return;
 
-    pa_log(__FILE__": Warning! pa_memblockq_shorten()\n");
+    /*pa_log(__FILE__": Warning! pa_memblockq_shorten()\n");*/
     
     l = bq->current_length - length;
     l /= bq->base;
@@ -285,6 +287,11 @@ void pa_memblockq_prebuf_disable(struct pa_memblockq *bq) {
     bq->prebuf = 0;
 }
 
+void pa_memblockq_prebuf_reenable(struct pa_memblockq *bq) {
+    assert(bq);
+    bq->prebuf = bq->orig_prebuf;
+}
+
 void pa_memblockq_seek(struct pa_memblockq *bq, size_t length) {
     assert(bq);