1 /* 2 * Copyright 2002, Marcus Overhagen. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 struct _shared_buffer_list; 6 7 #include <TMap.h> 8 #include <TList.h> 9 10 class BufferManager 11 { 12 public: 13 BufferManager(); 14 ~BufferManager(); 15 16 area_id SharedBufferListID(); 17 18 status_t RegisterBuffer(team_id teamid, media_buffer_id bufferid, 19 size_t *size, int32 *flags, size_t *offset, area_id *area); 20 21 status_t RegisterBuffer(team_id teamid, size_t size, int32 flags, size_t offset, area_id area, 22 media_buffer_id *bufferid); 23 24 status_t UnregisterBuffer(team_id teamid, media_buffer_id bufferid); 25 26 void CleanupTeam(team_id teamid); 27 28 void Dump(); 29 30 private: 31 struct buffer_info 32 { 33 media_buffer_id id; 34 area_id area; 35 size_t offset; 36 size_t size; 37 int32 flags; 38 List<team_id> teams; 39 }; 40 41 _shared_buffer_list * fSharedBufferList; 42 area_id fSharedBufferListId; 43 media_buffer_id fNextBufferId; 44 BLocker * fLocker; 45 Map<media_buffer_id, buffer_info> *fBufferInfoMap; 46 }; 47 48