1 /* 2 * Copyright 2019, Ryan Leavengood. 3 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de. 4 * Copyright 2002, Marcus Overhagen. All Rights Reserved. 5 * Distributed under the terms of the MIT License. 6 */ 7 #ifndef _BUFFER_CACHE_H_ 8 #define _BUFFER_CACHE_H_ 9 10 11 #include <HashMap.h> 12 #include <MediaDefs.h> 13 14 15 class BBuffer; 16 17 18 namespace BPrivate { 19 20 21 struct buffer_cache_entry { 22 BBuffer* buffer; 23 port_id port; 24 }; 25 26 27 class BufferCache { 28 public: 29 BufferCache(); 30 ~BufferCache(); 31 32 BBuffer* GetBuffer(media_buffer_id id, port_id port); 33 34 void FlushCacheForPort(port_id port); 35 36 private: 37 typedef HashMap<HashKey32<media_buffer_id>, buffer_cache_entry> BufferMap; 38 39 BufferMap fMap; 40 }; 41 42 43 } // namespace BPrivate 44 45 46 #endif // _BUFFER_CACHE_H_ 47