changed use of port communication, debugging functions, map, list and stack
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2196 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2bb039ccf5
commit
76669a292a
@ -5,18 +5,14 @@
|
||||
***********************************************************************/
|
||||
#include <MediaDefs.h>
|
||||
#include <Buffer.h>
|
||||
#include <Message.h>
|
||||
#include "SharedBufferList.h"
|
||||
#include "debug.h"
|
||||
#include "ServerInterface.h"
|
||||
#include "DataExchange.h"
|
||||
|
||||
static team_id CurrentTeam();
|
||||
team_id CurrentTeam()
|
||||
{
|
||||
thread_info info;
|
||||
get_thread_info(find_thread(NULL),&info);
|
||||
return info.team;
|
||||
}
|
||||
namespace BPrivate { namespace media {
|
||||
extern team_id team;
|
||||
} } // BPrivate::media
|
||||
using namespace BPrivate::media;
|
||||
|
||||
/*************************************************************
|
||||
* public struct buffer_clone_info
|
||||
@ -173,28 +169,26 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
|
||||
return;
|
||||
|
||||
// ask media_server to get the area_id of the shared buffer list
|
||||
area_id id;
|
||||
BMessage request(MEDIA_SERVER_GET_SHARED_BUFFER_AREA);
|
||||
BMessage reply;
|
||||
|
||||
if (QueryServer(&request, &reply) != B_OK)
|
||||
server_get_shared_buffer_area_request area_request;
|
||||
server_get_shared_buffer_area_reply area_reply;
|
||||
if (QueryServer(SERVER_GET_SHARED_BUFFER_AREA, &area_request, sizeof(area_request), &area_reply, sizeof(area_reply)) != B_OK) {
|
||||
FATAL("BBuffer::BBuffer: SERVER_GET_SHARED_BUFFER_AREA failed\n");
|
||||
return;
|
||||
|
||||
id = reply.FindInt32("area");
|
||||
|
||||
fBufferList = _shared_buffer_list::Clone(id);
|
||||
if (fBufferList == NULL)
|
||||
}
|
||||
|
||||
ASSERT(area_reply.area > 0);
|
||||
|
||||
fBufferList = _shared_buffer_list::Clone(area_reply.area);
|
||||
if (fBufferList == NULL) {
|
||||
FATAL("BBuffer::BBuffer: _shared_buffer_list::Clone() failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BMessage response;
|
||||
BMessage create(MEDIA_SERVER_REGISTER_BUFFER);
|
||||
create.AddInt32("team",CurrentTeam());
|
||||
create.AddInt32("area",info.area);
|
||||
create.AddInt32("offset",info.offset);
|
||||
create.AddInt32("size",info.size);
|
||||
create.AddInt32("flags",info.flags);
|
||||
create.AddInt32("buffer",info.buffer);
|
||||
server_register_buffer_request request;
|
||||
server_register_buffer_reply reply;
|
||||
|
||||
request.team = team;
|
||||
request.info = info;
|
||||
|
||||
// ask media_server to register this buffer,
|
||||
// either identified by "buffer" or by area information.
|
||||
@ -204,19 +198,25 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
|
||||
// until the last buffer has been unregistered
|
||||
// the area_id of the cached area is passed back to us, and we clone it.
|
||||
|
||||
if (QueryServer(&create, &response) != B_OK)
|
||||
if (QueryServer(SERVER_REGISTER_BUFFER, &request, sizeof(request), &reply, sizeof(reply)) != B_OK) {
|
||||
FATAL("BBuffer::BBuffer: failed to register buffer with media_server\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(reply.info.buffer > 0);
|
||||
ASSERT(reply.info.area > 0);
|
||||
ASSERT(reply.info.size > 0);
|
||||
|
||||
// the response from media server contains enough information
|
||||
// to clone the memory for this buffer
|
||||
fBufferID = response.FindInt32("buffer");
|
||||
fSize = response.FindInt32("size");
|
||||
fFlags = response.FindInt32("flags");
|
||||
fOffset = response.FindInt32("offset");
|
||||
id = response.FindInt32("area");
|
||||
|
||||
fArea = clone_area("a cloned BBuffer", &fData, B_ANY_ADDRESS,B_READ_AREA | B_WRITE_AREA,id);
|
||||
fBufferID = reply.info.buffer;
|
||||
fSize = reply.info.size;
|
||||
fFlags = reply.info.flags;
|
||||
fOffset = reply.info.offset;
|
||||
|
||||
fArea = clone_area("a cloned BBuffer", &fData, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.info.area);
|
||||
if (fArea <= B_OK) {
|
||||
// XXX should unregister buffer here
|
||||
FATAL("BBuffer::BBuffer: buffer cloning failed\n");
|
||||
fData = 0;
|
||||
return;
|
||||
@ -236,18 +236,16 @@ BBuffer::~BBuffer()
|
||||
}
|
||||
// unmap the Data
|
||||
if (fData != NULL) {
|
||||
BMessage unregister(MEDIA_SERVER_UNREGISTER_BUFFER);
|
||||
BMessage response;
|
||||
unregister.AddInt32("team",(int32)CurrentTeam());
|
||||
unregister.AddInt32("buffer",fBufferID);
|
||||
|
||||
delete_area(fArea);
|
||||
|
||||
// ask media_server to unregister the buffer
|
||||
// when the last clone of this buffer is gone,
|
||||
// media_server will also remove it's cached area
|
||||
|
||||
QueryServer(&unregister, &response);
|
||||
|
||||
delete_area(fArea);
|
||||
server_unregister_buffer_command cmd;
|
||||
cmd.team = team;
|
||||
cmd.bufferid = fBufferID;
|
||||
SendToServer(SERVER_UNREGISTER_BUFFER, &cmd, sizeof(cmd));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,9 @@
|
||||
***********************************************************************/
|
||||
#include <BufferGroup.h>
|
||||
#include <Buffer.h>
|
||||
#include <Message.h>
|
||||
#include "debug.h"
|
||||
#include "SharedBufferList.h"
|
||||
#include "ServerInterface.h"
|
||||
#include "DataExchange.h"
|
||||
|
||||
/*************************************************************
|
||||
* private BBufferGroup
|
||||
@ -18,7 +17,6 @@ status_t
|
||||
BBufferGroup::InitBufferGroup()
|
||||
{
|
||||
CALLED();
|
||||
area_id id;
|
||||
|
||||
// some defaults
|
||||
fBufferList = 0;
|
||||
@ -30,24 +28,29 @@ BBufferGroup::InitBufferGroup()
|
||||
// create the reclaim semaphore
|
||||
fReclaimSem = create_sem(0,"buffer reclaim sem");
|
||||
if (fReclaimSem < B_OK) {
|
||||
FATAL("BBufferGroup::InitBufferGroup: couldn't create fReclaimSem\n");
|
||||
fInitError = (status_t)fReclaimSem;
|
||||
return fInitError;
|
||||
}
|
||||
|
||||
// ask media_server to get the area_id of the shared buffer list
|
||||
BMessage request(MEDIA_SERVER_GET_SHARED_BUFFER_AREA);
|
||||
BMessage reply;
|
||||
|
||||
fInitError = QueryServer(&request, &reply);
|
||||
if (fInitError != B_OK)
|
||||
return fInitError;
|
||||
|
||||
id = reply.FindInt32("area");
|
||||
|
||||
fBufferList = _shared_buffer_list::Clone(id);
|
||||
if (fBufferList == NULL)
|
||||
server_get_shared_buffer_area_request area_request;
|
||||
server_get_shared_buffer_area_reply area_reply;
|
||||
if (QueryServer(SERVER_GET_SHARED_BUFFER_AREA, &area_request, sizeof(area_request), &area_reply, sizeof(area_reply)) != B_OK) {
|
||||
FATAL("BBufferGroup::InitBufferGroup: SERVER_GET_SHARED_BUFFER_AREA failed\n");
|
||||
fInitError = B_ERROR;
|
||||
return fInitError;
|
||||
}
|
||||
ASSERT(area_reply.area > 0);
|
||||
|
||||
fBufferList = _shared_buffer_list::Clone(area_reply.area);
|
||||
if (fBufferList == NULL) {
|
||||
FATAL("BBufferGroup::InitBufferGroup: _shared_buffer_list::Clone failed\n");
|
||||
fInitError = B_ERROR;
|
||||
return fInitError;
|
||||
}
|
||||
|
||||
fInitError = B_OK;
|
||||
return fInitError;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ status_t SendToServer(BMessage *msg)
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
status_t QueryServer(BMessage *request, BMessage *reply)
|
||||
{
|
||||
status_t rv;
|
||||
@ -74,7 +74,7 @@ status_t QueryServer(BMessage *request, BMessage *reply)
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
// Raw data based data exchange with the media_server
|
||||
status_t SendToServer(int32 msgcode, command_data *msg, int size)
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ DormantNodeManager::~DormantNodeManager()
|
||||
|
||||
// force unloading all currently loaded images
|
||||
loaded_addon_info *info;
|
||||
for (int32 index = 0; fAddonmap->GetPointerAt(index,&info); index++) {
|
||||
for (fAddonmap->Rewind(); fAddonmap->GetNext(&info); ) {
|
||||
FATAL("Forcing unload of add-on id %ld with usecount %ld\n",info->addon->AddonID(), info->usecount);
|
||||
UnloadAddon(info->addon, info->image);
|
||||
}
|
||||
@ -67,7 +67,7 @@ DormantNodeManager::TryGetAddon(media_addon_id id)
|
||||
BMediaAddOn *addon;
|
||||
|
||||
fLock->Lock();
|
||||
if (fAddonmap->GetPointer(id,&info)) {
|
||||
if (fAddonmap->Get(id, &info)) {
|
||||
info->usecount += 1;
|
||||
addon = info->addon;
|
||||
ASSERT(id == addon->AddonID());
|
||||
@ -142,7 +142,7 @@ DormantNodeManager::PutAddon(media_addon_id id)
|
||||
TRACE("DormantNodeManager::PutAddon, id %ld\n",id);
|
||||
|
||||
fLock->Lock();
|
||||
if (!fAddonmap->GetPointer(id, &info)) {
|
||||
if (!fAddonmap->Get(id, &info)) {
|
||||
FATAL("DormantNodeManager::PutAddon: failed to find add-on %ld\n",id);
|
||||
fLock->Unlock();
|
||||
return;
|
||||
@ -260,13 +260,13 @@ DormantNodeManager::LoadAddon(BMediaAddOn **newaddon, image_id *newimage, const
|
||||
|
||||
image = load_add_on(path);
|
||||
if (image < B_OK) {
|
||||
FATAL("DormantNodeManager::LoadAddon: loading failed %lx (%s), path %s\n", image, strerror(image), path);
|
||||
FATAL("DormantNodeManager::LoadAddon: loading failed, error %lx (%s), path %s\n", image, strerror(image), path);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
rv = get_image_symbol(image, "make_media_addon", B_SYMBOL_TYPE_TEXT, (void**)&make_addon);
|
||||
if (rv < B_OK) {
|
||||
FATAL("DormantNodeManager::LoadAddon: loading failed, function not found %lx %s\n", rv, strerror(rv));
|
||||
FATAL("DormantNodeManager::LoadAddon: loading failed, function not found, error %lx (%s)\n", rv, strerror(rv));
|
||||
unload_add_on(image);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <String.h>
|
||||
#include <TimeSource.h>
|
||||
#include "debug.h"
|
||||
#include "TStack.h"
|
||||
#include "TList.h"
|
||||
#include "PortPool.h"
|
||||
#include "SystemTimeSource.h"
|
||||
#include "ServerInterface.h"
|
||||
@ -45,10 +45,10 @@ namespace BPrivate { namespace media { namespace mediaroster {
|
||||
|
||||
status_t GetNode(node_type type, media_node * out_node, int32 * out_input_id = NULL, BString * out_input_name = NULL);
|
||||
status_t SetNode(node_type type, const media_node *node, const dormant_node_info *info = NULL, const media_input *input = NULL);
|
||||
status_t GetAllOutputs(const media_node & node, Stack<media_output> *stack);
|
||||
status_t GetAllInputs(const media_node & node, Stack<media_input> *stack);
|
||||
status_t PublishOutputs(const media_node & node, Stack<media_output> *stack);
|
||||
status_t PublishInputs(const media_node & node, Stack<media_input> *stack);
|
||||
status_t GetAllOutputs(const media_node & node, List<media_output> *list);
|
||||
status_t GetAllInputs(const media_node & node, List<media_input> *list);
|
||||
status_t PublishOutputs(const media_node & node, List<media_output> *list);
|
||||
status_t PublishInputs(const media_node & node, List<media_input> *list);
|
||||
|
||||
status_t
|
||||
GetNode(node_type type, media_node * out_node, int32 * out_input_id, BString * out_input_name)
|
||||
@ -95,7 +95,7 @@ SetNode(node_type type, const media_node *node, const dormant_node_info *info, c
|
||||
}
|
||||
|
||||
status_t
|
||||
GetAllOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
GetAllOutputs(const media_node & node, List<media_output> *list)
|
||||
{
|
||||
int32 cookie;
|
||||
status_t rv;
|
||||
@ -103,6 +103,7 @@ GetAllOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
|
||||
result = B_OK;
|
||||
cookie = 0;
|
||||
list->MakeEmpty();
|
||||
for (;;) {
|
||||
producer_get_next_output_request request;
|
||||
producer_get_next_output_reply reply;
|
||||
@ -111,8 +112,8 @@ GetAllOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
if (rv != B_OK)
|
||||
break;
|
||||
cookie = reply.cookie;
|
||||
if (!stack->Push(reply.output)) {
|
||||
FATAL("GetAllOutputs: stack->Push failed\n");
|
||||
if (!list->Insert(reply.output)) {
|
||||
FATAL("GetAllOutputs: list->Insert failed\n");
|
||||
result = B_ERROR;
|
||||
}
|
||||
}
|
||||
@ -125,7 +126,7 @@ GetAllOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
}
|
||||
|
||||
status_t
|
||||
GetAllInputs(const media_node & node, Stack<media_input> *stack)
|
||||
GetAllInputs(const media_node & node, List<media_input> *list)
|
||||
{
|
||||
int32 cookie;
|
||||
status_t rv;
|
||||
@ -133,6 +134,7 @@ GetAllInputs(const media_node & node, Stack<media_input> *stack)
|
||||
|
||||
result = B_OK;
|
||||
cookie = 0;
|
||||
list->MakeEmpty();
|
||||
for (;;) {
|
||||
consumer_get_next_input_request request;
|
||||
consumer_get_next_input_reply reply;
|
||||
@ -141,8 +143,8 @@ GetAllInputs(const media_node & node, Stack<media_input> *stack)
|
||||
if (rv != B_OK)
|
||||
break;
|
||||
cookie = reply.cookie;
|
||||
if (!stack->Push(reply.input)) {
|
||||
FATAL("GetAllInputs: stack->Push failed\n");
|
||||
if (!list->Insert(reply.input)) {
|
||||
FATAL("GetAllInputs: list->Insert failed\n");
|
||||
result = B_ERROR;
|
||||
}
|
||||
}
|
||||
@ -155,7 +157,7 @@ GetAllInputs(const media_node & node, Stack<media_input> *stack)
|
||||
}
|
||||
|
||||
status_t
|
||||
PublishOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
PublishOutputs(const media_node & node, List<media_output> *list)
|
||||
{
|
||||
server_publish_outputs_request request;
|
||||
server_publish_outputs_reply reply;
|
||||
@ -164,7 +166,7 @@ PublishOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
int32 count;
|
||||
status_t rv;
|
||||
|
||||
count = stack->CountItems();
|
||||
count = list->CountItems();
|
||||
TRACE("PublishOutputs: publishing %ld\n", count);
|
||||
|
||||
request.node = node;
|
||||
@ -183,10 +185,11 @@ PublishOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
request.area = -1;
|
||||
outputs = request.outputs;
|
||||
}
|
||||
TRACE("PublishOutputs: area %#lx\n", request.area);
|
||||
TRACE("PublishOutputs: area %ld\n", request.area);
|
||||
|
||||
for (int32 i = 0; i != count; i++) {
|
||||
stack->GetPointerAt(i, &output);
|
||||
int i;
|
||||
for (i = 0, list->Rewind(); list->GetNext(&output); i++) {
|
||||
ASSERT(i < count);
|
||||
outputs[i] = *output;
|
||||
}
|
||||
|
||||
@ -199,7 +202,7 @@ PublishOutputs(const media_node & node, Stack<media_output> *stack)
|
||||
}
|
||||
|
||||
status_t
|
||||
PublishInputs(const media_node & node, Stack<media_input> *stack)
|
||||
PublishInputs(const media_node & node, List<media_input> *list)
|
||||
{
|
||||
server_publish_inputs_request request;
|
||||
server_publish_inputs_reply reply;
|
||||
@ -208,7 +211,7 @@ PublishInputs(const media_node & node, Stack<media_input> *stack)
|
||||
int32 count;
|
||||
status_t rv;
|
||||
|
||||
count = stack->CountItems();
|
||||
count = list->CountItems();
|
||||
TRACE("PublishInputs: publishing %ld\n", count);
|
||||
|
||||
request.node = node;
|
||||
@ -227,10 +230,11 @@ PublishInputs(const media_node & node, Stack<media_input> *stack)
|
||||
request.area = -1;
|
||||
inputs = request.inputs;
|
||||
}
|
||||
TRACE("PublishInputs: area %#lx\n", request.area);
|
||||
TRACE("PublishInputs: area %ld\n", request.area);
|
||||
|
||||
for (int32 i = 0; i != count; i++) {
|
||||
stack->GetPointerAt(i, &input);
|
||||
int i;
|
||||
for (i = 0, list->Rewind(); list->GetNext(&input); i++) {
|
||||
ASSERT(i < count);
|
||||
inputs[i] = *input;
|
||||
}
|
||||
|
||||
@ -571,12 +575,12 @@ BMediaRoster::Connect(const media_source & from,
|
||||
|
||||
// XXX register connection with server
|
||||
// XXX we should just send a notification, instead of republishing all endpoints
|
||||
Stack<media_output> outstack;
|
||||
Stack<media_input> instack;
|
||||
if (B_OK == GetAllOutputs(out_output->node , &outstack))
|
||||
PublishOutputs(out_output->node , &outstack);
|
||||
if (B_OK == GetAllInputs(out_input->node , &instack))
|
||||
PublishInputs(out_input->node, &instack);
|
||||
List<media_output> outlist;
|
||||
List<media_input> inlist;
|
||||
if (B_OK == GetAllOutputs(out_output->node , &outlist))
|
||||
PublishOutputs(out_output->node , &outlist);
|
||||
if (B_OK == GetAllInputs(out_input->node , &inlist))
|
||||
PublishInputs(out_input->node, &inlist);
|
||||
|
||||
|
||||
// XXX if (mute) BBufferProducer::EnableOutput(false)
|
||||
@ -633,18 +637,18 @@ BMediaRoster::Disconnect(media_node_id source_nodeid,
|
||||
|
||||
// XXX unregister connection with server
|
||||
// XXX we should just send a notification, instead of republishing all endpoints
|
||||
Stack<media_output> outstack;
|
||||
Stack<media_input> instack;
|
||||
List<media_output> outlist;
|
||||
List<media_input> inlist;
|
||||
media_node sourcenode;
|
||||
media_node destnode;
|
||||
if (B_OK == GetNodeFor(source_nodeid, &sourcenode)) {
|
||||
if (B_OK == GetAllOutputs(sourcenode , &outstack))
|
||||
PublishOutputs(sourcenode , &outstack);
|
||||
if (B_OK == GetAllOutputs(sourcenode , &outlist))
|
||||
PublishOutputs(sourcenode , &outlist);
|
||||
ReleaseNode(sourcenode);
|
||||
} else FATAL("BMediaRoster::Disconnect: source GetNodeFor failed\n");
|
||||
if (B_OK == GetNodeFor(destination_nodeid, &destnode)) {
|
||||
if (B_OK == GetAllInputs(destnode , &instack))
|
||||
PublishInputs(destnode, &instack);
|
||||
if (B_OK == GetAllInputs(destnode , &inlist))
|
||||
PublishInputs(destnode, &inlist);
|
||||
ReleaseNode(destnode);
|
||||
} else FATAL("BMediaRoster::Disconnect: dest GetNodeFor failed\n");
|
||||
|
||||
@ -963,17 +967,18 @@ BMediaRoster::GetFreeInputsFor(const media_node & node,
|
||||
if (out_free_inputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_input> stack;
|
||||
List<media_input> list;
|
||||
media_input *input;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllInputs(node, &stack);
|
||||
rv = GetAllInputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &input); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
|
||||
if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != input->format.type)
|
||||
continue; // media_type used, but doesn't match
|
||||
if (input->source != media_source::null)
|
||||
@ -985,7 +990,7 @@ BMediaRoster::GetFreeInputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishInputs(node, &stack);
|
||||
PublishInputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1002,17 +1007,18 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node,
|
||||
if (out_active_inputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_input> stack;
|
||||
List<media_input> list;
|
||||
media_input *input;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllInputs(node, &stack);
|
||||
rv = GetAllInputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &input); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
|
||||
if (input->source == media_source::null)
|
||||
continue; // consumer source not connected
|
||||
out_active_inputs[i] = *input;
|
||||
@ -1022,7 +1028,7 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishInputs(node, &stack);
|
||||
PublishInputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1039,17 +1045,18 @@ BMediaRoster::GetAllInputsFor(const media_node & node,
|
||||
if (out_inputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_input> stack;
|
||||
List<media_input> list;
|
||||
media_input *input;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllInputs(node, &stack);
|
||||
rv = GetAllInputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &input); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
|
||||
out_inputs[i] = *input;
|
||||
*out_total_count += 1;
|
||||
buf_num_inputs -= 1;
|
||||
@ -1057,7 +1064,7 @@ BMediaRoster::GetAllInputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishInputs(node, &stack);
|
||||
PublishInputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1075,17 +1082,18 @@ BMediaRoster::GetFreeOutputsFor(const media_node & node,
|
||||
if (out_free_outputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_output> stack;
|
||||
List<media_output> list;
|
||||
media_output *output;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllOutputs(node, &stack);
|
||||
rv = GetAllOutputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &output); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
|
||||
if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != output->format.type)
|
||||
continue; // media_type used, but doesn't match
|
||||
if (output->destination != media_destination::null)
|
||||
@ -1097,7 +1105,7 @@ BMediaRoster::GetFreeOutputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishOutputs(node, &stack);
|
||||
PublishOutputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1114,17 +1122,18 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node,
|
||||
if (out_active_outputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_output> stack;
|
||||
List<media_output> list;
|
||||
media_output *output;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllOutputs(node, &stack);
|
||||
rv = GetAllOutputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &output); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
|
||||
if (output->destination == media_destination::null)
|
||||
continue; // producer destination not connected
|
||||
out_active_outputs[i] = *output;
|
||||
@ -1134,7 +1143,7 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishOutputs(node, &stack);
|
||||
PublishOutputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -1151,17 +1160,18 @@ BMediaRoster::GetAllOutputsFor(const media_node & node,
|
||||
if (out_outputs == NULL || out_total_count == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
Stack<media_output> stack;
|
||||
List<media_output> list;
|
||||
media_output *output;
|
||||
status_t rv;
|
||||
|
||||
*out_total_count = 0;
|
||||
|
||||
rv = GetAllOutputs(node, &stack);
|
||||
rv = GetAllOutputs(node, &list);
|
||||
if (B_OK != rv)
|
||||
return rv;
|
||||
|
||||
for (int32 i = 0; stack.GetPointerAt(i, &output); i++) {
|
||||
int32 i;
|
||||
for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
|
||||
out_outputs[i] = *output;
|
||||
*out_total_count += 1;
|
||||
buf_num_outputs -= 1;
|
||||
@ -1169,7 +1179,7 @@ BMediaRoster::GetAllOutputsFor(const media_node & node,
|
||||
break;
|
||||
}
|
||||
|
||||
PublishOutputs(node, &stack);
|
||||
PublishOutputs(node, &list);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * n
|
||||
{
|
||||
BROKEN();
|
||||
*out_pool = (rtm_pool *) 0x55557777;
|
||||
TRACE(" new pool = 0x%08x\n",(int)*out_pool);
|
||||
TRACE(" new pool = %p\n", *out_pool);
|
||||
/* If out_pool is NULL, the default pool will be created if it isn't already. */
|
||||
/* If the default pool is already created, it will return EALREADY. */
|
||||
return B_OK;
|
||||
@ -33,24 +33,24 @@ status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * n
|
||||
status_t rtm_delete_pool(rtm_pool * pool)
|
||||
{
|
||||
BROKEN();
|
||||
TRACE(" pool = 0x%08x\n",(int)pool);
|
||||
TRACE(" pool = %p\n", pool);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void * rtm_alloc(rtm_pool * pool, size_t size)
|
||||
{
|
||||
BROKEN();
|
||||
TRACE(" pool = 0x%08x\n",(int)pool);
|
||||
TRACE(" pool = %p\n", pool);
|
||||
/* If NULL is passed for pool, the default pool is used (if created). */
|
||||
void *p = malloc(size);
|
||||
TRACE(" returning ptr = 0x%08x\n",(int)p);
|
||||
TRACE(" returning ptr = %p\n", p);
|
||||
return p;
|
||||
}
|
||||
|
||||
status_t rtm_free(void * data)
|
||||
{
|
||||
BROKEN();
|
||||
TRACE(" ptr = 0x%08x\n",(int)data);
|
||||
TRACE(" ptr = %p\n", data);
|
||||
free(data);
|
||||
return B_OK;
|
||||
}
|
||||
@ -58,11 +58,11 @@ status_t rtm_free(void * data)
|
||||
status_t rtm_realloc(void ** data, size_t new_size)
|
||||
{
|
||||
BROKEN();
|
||||
TRACE(" ptr = 0x%08x\n",(int)*data);
|
||||
TRACE(" ptr = %p\n", *data);
|
||||
void * newptr = realloc(*data, new_size);
|
||||
if (newptr) {
|
||||
*data = newptr;
|
||||
TRACE(" new ptr = 0x%08x\n",(int)*data);
|
||||
TRACE(" new ptr = %p\n", *data);
|
||||
return B_OK;
|
||||
} else
|
||||
return B_ERROR;
|
||||
@ -71,14 +71,14 @@ status_t rtm_realloc(void ** data, size_t new_size)
|
||||
status_t rtm_size_for(void * data)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
TRACE(" ptr = 0x%08x\n",(int)data);
|
||||
TRACE(" ptr = %p\n", data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
status_t rtm_phys_size_for(void * data)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
TRACE(" ptr = 0x%08x\n",(int)data);
|
||||
TRACE(" ptr = %p\n",(int)data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ rtm_pool * rtm_default_pool()
|
||||
{
|
||||
BROKEN();
|
||||
/* Return the default pool, or NULL if not yet initialized */
|
||||
TRACE(" returning pool = 0x%08x\n",0x22229999);
|
||||
TRACE(" returning pool = %p\n", 0x22229999);
|
||||
return (rtm_pool *) 0x22229999;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ status_t rtm_create_pool_etc(rtm_pool ** out_pool, size_t total_size, const char
|
||||
{
|
||||
BROKEN();
|
||||
*out_pool = (rtm_pool *) 0x44448888;
|
||||
TRACE(" new pool = 0x%08x\n",(int)*out_pool);
|
||||
TRACE(" new pool = %p\n", *out_pool);
|
||||
TRACE(" size = %d\n",(int)total_size);
|
||||
TRACE(" name = %s\n",name);
|
||||
TRACE(" param4 = 0x%08x\n",(int)param4);
|
||||
@ -133,8 +133,8 @@ status_t rtm_create_pool_etc(rtm_pool ** out_pool, size_t total_size, const char
|
||||
void rtm_get_pool(rtm_pool *pool,void *data,int32 param3, int32 param4, ...)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
TRACE(" pool = 0x%08x\n",(int)pool);
|
||||
TRACE(" ptr = 0x%08x\n",(int)data);
|
||||
TRACE(" pool = %p\n", pool);
|
||||
TRACE(" ptr = %p\n", data);
|
||||
TRACE(" param3 = 0x%08x\n",(int)param3);
|
||||
TRACE(" param4 = 0x%08x\n",(int)param4);
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ _shared_buffer_list::RequestBufferInOtherGroups(sem_id group_reclaim_sem, media_
|
||||
continue;
|
||||
|
||||
if (info[i].reclaimed == false) {
|
||||
FATAL("_shared_buffer_list: Error, BBuffer 0x%08x, id = 0x%08x not reclaimed while requesting\n",(int)info[i].buffer,(int)id);
|
||||
FATAL("_shared_buffer_list: Error, BBuffer %p, id = %ld not reclaimed while requesting\n", info[i].buffer, id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer)
|
||||
if (info[i].id == id) {
|
||||
reclaimed_count++;
|
||||
if (info[i].reclaimed) {
|
||||
FATAL("_shared_buffer_list: Error, BBuffer 0x%08x, id = 0x%08x already reclaimed\n",(int)buffer,(int)id);
|
||||
FATAL("_shared_buffer_list: Error, BBuffer %p, id = %ld already reclaimed\n", buffer, id);
|
||||
continue;
|
||||
}
|
||||
info[i].reclaimed = true;
|
||||
@ -279,7 +279,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer)
|
||||
return B_ERROR;
|
||||
|
||||
if (reclaimed_count == 0) {
|
||||
FATAL("shared_buffer_list: Error, BBuffer 0x%08x, id = 0x%08x NOT reclaimed\n",(int)buffer,(int)id);
|
||||
FATAL("shared_buffer_list: Error, BBuffer %p, id = %ld NOT reclaimed\n", buffer, id);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ MediaAddonServer::~MediaAddonServer()
|
||||
wait_for_thread(control_thread,&err);
|
||||
|
||||
// unregister all media add-ons
|
||||
media_addon_id id;
|
||||
for (int32 index = 0; filemap->GetAt(index,&id); index++)
|
||||
_DormantNodeManager->UnregisterAddon(id);
|
||||
media_addon_id *id;
|
||||
for (filemap->Rewind(); filemap->GetNext(&id); )
|
||||
_DormantNodeManager->UnregisterAddon(*id);
|
||||
|
||||
delete filemap;
|
||||
delete flavorcountmap;
|
||||
@ -184,7 +184,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon)
|
||||
addon_id = addon->AddonID();
|
||||
|
||||
// update the cached flavor count, get oldflavorcount and newflavorcount
|
||||
b = flavorcountmap->GetPointer(addon->AddonID(), &flavorcount);
|
||||
b = flavorcountmap->Get(addon->AddonID(), &flavorcount);
|
||||
ASSERT(b);
|
||||
oldflavorcount = *flavorcount;
|
||||
newflavorcount = addon->CountFlavors();
|
||||
@ -325,14 +325,17 @@ flavor 0:
|
||||
void
|
||||
MediaAddonServer::AddOnRemoved(ino_t file_node)
|
||||
{
|
||||
media_addon_id id;
|
||||
if (!filemap->Get(file_node,&id)) {
|
||||
media_addon_id *id;
|
||||
|
||||
// XXX locking?
|
||||
|
||||
if (!filemap->Get(file_node, &id)) {
|
||||
FATAL("MediaAddonServer::AddOnRemoved: inode %Ld removed, but no media add-on found\n", file_node);
|
||||
return;
|
||||
}
|
||||
filemap->Remove(file_node);
|
||||
flavorcountmap->Remove(id);
|
||||
_DormantNodeManager->UnregisterAddon(id);
|
||||
flavorcountmap->Remove(*id);
|
||||
_DormantNodeManager->UnregisterAddon(*id);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user