2002-10-09 03:59:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2002, Marcus Overhagen. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
struct _shared_buffer_list;
|
|
|
|
|
2002-12-03 03:59:42 +03:00
|
|
|
#include <TMap.h>
|
|
|
|
#include <TList.h>
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
class BufferManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BufferManager();
|
|
|
|
~BufferManager();
|
|
|
|
|
|
|
|
area_id SharedBufferListID();
|
|
|
|
|
|
|
|
status_t RegisterBuffer(team_id teamid, media_buffer_id bufferid,
|
|
|
|
size_t *size, int32 *flags, size_t *offset, area_id *area);
|
|
|
|
|
|
|
|
status_t RegisterBuffer(team_id teamid, size_t size, int32 flags, size_t offset, area_id area,
|
|
|
|
media_buffer_id *bufferid);
|
|
|
|
|
|
|
|
status_t UnregisterBuffer(team_id teamid, media_buffer_id bufferid);
|
2002-11-24 03:27:09 +03:00
|
|
|
|
|
|
|
void CleanupTeam(team_id teamid);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-12-10 21:18:50 +03:00
|
|
|
void Dump();
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
private:
|
2002-12-03 03:59:42 +03:00
|
|
|
struct buffer_info
|
2002-07-09 16:24:59 +04:00
|
|
|
{
|
|
|
|
media_buffer_id id;
|
|
|
|
area_id area;
|
|
|
|
size_t offset;
|
|
|
|
size_t size;
|
|
|
|
int32 flags;
|
2002-12-03 03:59:42 +03:00
|
|
|
List<team_id> teams;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
2002-12-03 03:59:42 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
_shared_buffer_list * fSharedBufferList;
|
2002-12-03 03:59:42 +03:00
|
|
|
area_id fSharedBufferListId;
|
2002-07-09 16:24:59 +04:00
|
|
|
media_buffer_id fNextBufferId;
|
2002-12-03 03:59:42 +03:00
|
|
|
BLocker * fLocker;
|
|
|
|
Map<media_buffer_id, buffer_info> *fBufferInfoMap;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|