2 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
10 #include <MediaDefs.h>
11 #include <RealtimeAlloc.h>
15 #include "ReaderPlugin.h"
21 // Limit to 10 entries, we might want to instead limit to a length of time
22 #define CACHE_MAX_ENTRIES 10
32 typedef std::queue
<chunk_buffer
*> ChunkQueue
;
33 typedef std::deque
<chunk_buffer
*> ChunkList
;
35 class ChunkCache
: public BLocker
{
37 ChunkCache(sem_id waitSem
, size_t maxBytes
);
40 status_t
InitCheck() const;
43 bool SpaceLeft() const;
45 chunk_buffer
* NextChunk(Reader
* reader
, void* cookie
);
46 void RecycleChunk(chunk_buffer
* chunk
);
47 bool ReadNextChunk(Reader
* reader
, void* cookie
);
50 rtm_pool
* fRealTimePool
;
53 ChunkQueue fChunkCache
;
54 ChunkList fUnusedChunks
;
59 } // namespace BPrivate
61 using namespace BPrivate::media
;
63 #endif // _CHUNK_CACHE_H