aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm/PcmBuffer.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-07 18:46:58 +0200
committerMax Kellermann <max@duempel.org>2013-08-07 18:51:21 +0200
commit44a0e21795dcbd94d45ff143123f8b085754ea81 (patch)
treede7572fad77f000357c6970360cfb5319aa8a64a /src/pcm/PcmBuffer.hxx
parentfafaf567f94ed08c04bd9aca73714aa3293854bc (diff)
downloadmpd-44a0e21795dcbd94d45ff143123f8b085754ea81.tar.gz
mpd-44a0e21795dcbd94d45ff143123f8b085754ea81.tar.xz
mpd-44a0e21795dcbd94d45ff143123f8b085754ea81.zip
PcmBuffer: move code to new class ReusableBuffer
ReusableBuffer is more generic.
Diffstat (limited to 'src/pcm/PcmBuffer.hxx')
-rw-r--r--src/pcm/PcmBuffer.hxx23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/pcm/PcmBuffer.hxx b/src/pcm/PcmBuffer.hxx
index ae7030f76..2eddfb7f9 100644
--- a/src/pcm/PcmBuffer.hxx
+++ b/src/pcm/PcmBuffer.hxx
@@ -20,33 +20,22 @@
#ifndef PCM_BUFFER_HXX
#define PCM_BUFFER_HXX
-#include "check.h"
+#include "util/ReusableArray.hxx"
#include "gcc.h"
-#include <glib.h>
-
-#include <assert.h>
+#include <stdint.h>
/**
* Manager for a temporary buffer which grows as needed. We could
* allocate a new buffer every time pcm_convert() is called, but that
* would put too much stress on the allocator.
*/
-struct PcmBuffer {
- void *buffer;
-
- size_t size;
-
- PcmBuffer():buffer(nullptr), size(0) {}
-
- ~PcmBuffer() {
- g_free(buffer);
- }
+class PcmBuffer {
+ ReusableArray<uint8_t, 8192> buffer;
+public:
void Clear() {
- g_free(buffer);
- buffer = nullptr;
- size = 0;
+ buffer.Clear();
}
/**