clean up of debugging functions

FATAL is now replaced by ERROR and active at DEBUG=1 or above
TRACE is active at 2 or above
PRINT(level, ...) can be used for DEBUG= level or abode
INFO is removed


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3578 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2003-06-19 14:53:41 +00:00
parent 93780ea379
commit 5ac4fbd70d
30 changed files with 373 additions and 323 deletions
+15 -14
View File
@@ -5,6 +5,7 @@
#include <stdio.h> #include <stdio.h>
#undef TRACE #undef TRACE
#undef PRINT
#ifndef DEBUG #ifndef DEBUG
#define DEBUG 0 #define DEBUG 0
@@ -14,10 +15,12 @@
#if DEBUG >= 1 #if DEBUG >= 1
#define UNIMPLEMENTED() printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__) #define UNIMPLEMENTED() printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
#define FATAL printf inline void ERROR(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf("### ERROR: "); vprintf(fmt, ap); va_end(ap); }
inline void PRINT(int level, const char *fmt, ...) { va_list ap; if (level > DEBUG) return; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); }
#else #else
#define UNIMPLEMENTED() ((void)0) #define UNIMPLEMENTED() ((void)0)
#define FATAL if (1) {} else printf #define ERROR(a...) ((void)0)
#define PRINT(l, a...) ((void)0)
#endif #endif
#if DEBUG >= 2 #if DEBUG >= 2
@@ -25,21 +28,19 @@
#define TRACE printf #define TRACE printf
#else #else
#define BROKEN() ((void)0) #define BROKEN() ((void)0)
#define TRACE if (1) {} else printf #define TRACE(a...) ((void)0)
#endif #endif
#if DEBUG >= 3 #if DEBUG >= 3
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) #define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
#define INFO printf
#else #else
#define CALLED() ((void)0) #define CALLED() ((void)0)
#define INFO if (1) {} else printf
#endif #endif
#if DEBUG >= 1 #if DEBUG >= 1
#define PRINT_FORMAT(_text, _fmt) do { char _buf[100]; string_for_format((_fmt), _buf, sizeof(_buf)); printf("%s %s\n", (_text), (_buf)); } while (0) #define PRINT_FORMAT(_text, _fmt) do { char _buf[300]; string_for_format((_fmt), _buf, sizeof(_buf)); printf("%s %s\n", (_text), (_buf)); } while (0)
#define PRINT_INPUT(_text, _in) do { char _buf[100]; string_for_format((_in).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); fmt(%s); name(%s)\n", (_text), (_in).node.node, (_in).node.port, (_in).source.port, (_in).source.id, (_in).destination.port, (_in).destination.id, _buf, (_in).name); } while (0) #define PRINT_INPUT(_text, _in) do { char _buf[300]; string_for_format((_in).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); fmt(%s); name(%s)\n", (_text), (_in).node.node, (_in).node.port, (_in).source.port, (_in).source.id, (_in).destination.port, (_in).destination.id, _buf, (_in).name); } while (0)
#define PRINT_OUTPUT(_text, _out) do { char _buf[100]; string_for_format((_out).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); fmt(%s); name(%s)\n", (_text), (_out).node.node, (_out).node.port, (_out).source.port, (_out).source.id, (_out).destination.port, (_out).destination.id, _buf, (_out).name); } while (0) #define PRINT_OUTPUT(_text, _out) do { char _buf[300]; string_for_format((_out).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); fmt(%s); name(%s)\n", (_text), (_out).node.node, (_out).node.port, (_out).source.port, (_out).source.id, (_out).destination.port, (_out).destination.id, _buf, (_out).name); } while (0)
#else #else
#define PRINT_FORMAT(_text, _fmt) ((void)0) #define PRINT_FORMAT(_text, _fmt) ((void)0)
#define PRINT_INPUT(_text, _in) ((void)0) #define PRINT_INPUT(_text, _in) ((void)0)
@@ -51,12 +52,12 @@
#define PRINT_FORMAT(_text, _fmt) ((void)0) #define PRINT_FORMAT(_text, _fmt) ((void)0)
#define PRINT_INPUT(_text, _in) ((void)0) #define PRINT_INPUT(_text, _in) ((void)0)
#define PRINT_OUTPUT(_text, _out) ((void)0) #define PRINT_OUTPUT(_text, _out) ((void)0)
#define UNIMPLEMENTED() ((void)0) #define UNIMPLEMENTED() ((void)0)
#define BROKEN() ((void)0) #define BROKEN() ((void)0)
#define CALLED() ((void)0) #define CALLED() ((void)0)
#define FATAL if (1) {} else printf #define PRINT(l, a...) ((void)0)
#define TRACE if (1) {} else printf #define ERROR(a...) ((void)0)
#define INFO if (1) {} else printf #define TRACE(a...) ((void)0)
#endif #endif
+8 -6
View File
@@ -135,7 +135,8 @@ media_buffer_id
BBuffer::ID() BBuffer::ID()
{ {
CALLED(); CALLED();
return fBufferID; return fMediaHeader.buffer;
//return fBufferID;
} }
@@ -199,7 +200,7 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
server_get_shared_buffer_area_request area_request; server_get_shared_buffer_area_request area_request;
server_get_shared_buffer_area_reply area_reply; 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) { 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"); ERROR("BBuffer::BBuffer: SERVER_GET_SHARED_BUFFER_AREA failed\n");
return; return;
} }
@@ -207,7 +208,7 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
fBufferList = _shared_buffer_list::Clone(area_reply.area); fBufferList = _shared_buffer_list::Clone(area_reply.area);
if (fBufferList == NULL) { if (fBufferList == NULL) {
FATAL("BBuffer::BBuffer: _shared_buffer_list::Clone() failed\n"); ERROR("BBuffer::BBuffer: _shared_buffer_list::Clone() failed\n");
return; return;
} }
@@ -226,7 +227,7 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
// the area_id of the cached area is passed back to us, and we clone it. // the area_id of the cached area is passed back to us, and we clone it.
if (QueryServer(SERVER_REGISTER_BUFFER, &request, sizeof(request), &reply, sizeof(reply)) != 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"); ERROR("BBuffer::BBuffer: failed to register buffer with media_server\n");
return; return;
} }
@@ -244,13 +245,14 @@ BBuffer::BBuffer(const buffer_clone_info & info) :
fArea = clone_area("a cloned BBuffer", &fData, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.info.area); fArea = clone_area("a cloned BBuffer", &fData, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.info.area);
if (fArea <= B_OK) { if (fArea <= B_OK) {
// XXX should unregister buffer here // XXX should unregister buffer here
FATAL("BBuffer::BBuffer: buffer cloning failed\n"); ERROR("BBuffer::BBuffer: buffer cloning failed\n");
fData = 0; fData = 0;
return; return;
} }
fData = (char *)fData + fOffset; fData = (char *)fData + fOffset;
fMediaHeader.size_used = 0; fMediaHeader.size_used = 0;
fMediaHeader.buffer = fBufferID;
} }
@@ -282,7 +284,7 @@ BBuffer::SetHeader(const media_header *header)
{ {
CALLED(); CALLED();
fMediaHeader = *header; fMediaHeader = *header;
fMediaHeader.buffer = fBufferID; // fMediaHeader.buffer = fBufferID;
} }
+1 -1
View File
@@ -356,7 +356,7 @@ BBufferConsumer::HandleMessage(int32 message,
const void *data, const void *data,
size_t size) size_t size)
{ {
INFO("BBufferConsumer::HandleMessage %#lx, node %ld\n", message, ID()); PRINT(4, "BBufferConsumer::HandleMessage %#lx, node %ld\n", message, ID());
status_t rv; status_t rv;
switch (message) { switch (message) {
case CONSUMER_ACCEPT_FORMAT: case CONSUMER_ACCEPT_FORMAT:
+11 -11
View File
@@ -55,7 +55,7 @@ BBufferGroup::InitBufferGroup()
// create the reclaim semaphore // create the reclaim semaphore
fReclaimSem = create_sem(0,"buffer reclaim sem"); fReclaimSem = create_sem(0,"buffer reclaim sem");
if (fReclaimSem < B_OK) { if (fReclaimSem < B_OK) {
FATAL("BBufferGroup::InitBufferGroup: couldn't create fReclaimSem\n"); ERROR("BBufferGroup::InitBufferGroup: couldn't create fReclaimSem\n");
fInitError = (status_t)fReclaimSem; fInitError = (status_t)fReclaimSem;
return fInitError; return fInitError;
} }
@@ -64,7 +64,7 @@ BBufferGroup::InitBufferGroup()
server_get_shared_buffer_area_request area_request; server_get_shared_buffer_area_request area_request;
server_get_shared_buffer_area_reply area_reply; 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) { 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"); ERROR("BBufferGroup::InitBufferGroup: SERVER_GET_SHARED_BUFFER_AREA failed\n");
fInitError = B_ERROR; fInitError = B_ERROR;
return fInitError; return fInitError;
} }
@@ -72,7 +72,7 @@ BBufferGroup::InitBufferGroup()
fBufferList = _shared_buffer_list::Clone(area_reply.area); fBufferList = _shared_buffer_list::Clone(area_reply.area);
if (fBufferList == NULL) { if (fBufferList == NULL) {
FATAL("BBufferGroup::InitBufferGroup: _shared_buffer_list::Clone failed\n"); ERROR("BBufferGroup::InitBufferGroup: _shared_buffer_list::Clone failed\n");
fInitError = B_ERROR; fInitError = B_ERROR;
return fInitError; return fInitError;
} }
@@ -110,7 +110,7 @@ BBufferGroup::BBufferGroup(size_t size,
// don't allow all placement parameter values // don't allow all placement parameter values
if (placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS) { if (placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS) {
FATAL("BBufferGroup: placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS (0x%08lx)\n",placement); ERROR("BBufferGroup: placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS (0x%08lx)\n",placement);
placement = B_ANY_ADDRESS; placement = B_ANY_ADDRESS;
} }
@@ -122,7 +122,7 @@ BBufferGroup::BBufferGroup(size_t size,
buffer_area = create_area("some buffers area", &start_addr,placement,area_size,lock,B_READ_AREA | B_WRITE_AREA); buffer_area = create_area("some buffers area", &start_addr,placement,area_size,lock,B_READ_AREA | B_WRITE_AREA);
if (buffer_area < B_OK) { if (buffer_area < B_OK) {
FATAL("BBufferGroup: failed to allocate %ld bytes area\n",area_size); ERROR("BBufferGroup: failed to allocate %ld bytes area\n",area_size);
fInitError = (status_t)buffer_area; fInitError = (status_t)buffer_area;
return; return;
} }
@@ -136,13 +136,13 @@ BBufferGroup::BBufferGroup(size_t size,
buffer = new BBuffer(bci); buffer = new BBuffer(bci);
if (0 == buffer->Data()) { if (0 == buffer->Data()) {
// BBuffer::Data() will return 0 if an error occured // BBuffer::Data() will return 0 if an error occured
FATAL("BBufferGroup: error while creating buffer\n"); ERROR("BBufferGroup: error while creating buffer\n");
delete buffer; delete buffer;
fInitError = B_ERROR; fInitError = B_ERROR;
break; break;
} }
if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) { if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) {
FATAL("BBufferGroup: error when adding buffer\n"); ERROR("BBufferGroup: error when adding buffer\n");
delete buffer; delete buffer;
fInitError = B_ERROR; fInitError = B_ERROR;
break; break;
@@ -184,13 +184,13 @@ BBufferGroup::BBufferGroup(int32 count,
buffer = new BBuffer(bci); buffer = new BBuffer(bci);
if (0 == buffer->Data()) { if (0 == buffer->Data()) {
// BBuffer::Data() will return 0 if an error occured // BBuffer::Data() will return 0 if an error occured
FATAL("BBufferGroup(2): error while creating buffer\n"); ERROR("BBufferGroup(2): error while creating buffer\n");
delete buffer; delete buffer;
fInitError = B_ERROR; fInitError = B_ERROR;
break; break;
} }
if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) { if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) {
FATAL("BBufferGroup(2): error when adding buffer\n"); ERROR("BBufferGroup(2): error when adding buffer\n");
delete buffer; delete buffer;
fInitError = B_ERROR; fInitError = B_ERROR;
break; break;
@@ -231,12 +231,12 @@ BBufferGroup::AddBuffer(const buffer_clone_info &info,
buffer = new BBuffer(info); buffer = new BBuffer(info);
if (0 == buffer->Data()) { if (0 == buffer->Data()) {
// BBuffer::Data() will return 0 if an error occured // BBuffer::Data() will return 0 if an error occured
FATAL("BBufferGroup::AddBuffer: error while creating buffer\n"); ERROR("BBufferGroup::AddBuffer: error while creating buffer\n");
delete buffer; delete buffer;
return B_ERROR; return B_ERROR;
} }
if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) { if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) {
FATAL("BBufferGroup::AddBuffer: error when adding buffer\n"); ERROR("BBufferGroup::AddBuffer: error when adding buffer\n");
delete buffer; delete buffer;
fInitError = B_ERROR; fInitError = B_ERROR;
return B_ERROR; return B_ERROR;
+2 -1
View File
@@ -162,7 +162,7 @@ BBufferProducer::HandleMessage(int32 message,
const void *data, const void *data,
size_t size) size_t size)
{ {
INFO("BBufferProducer::HandleMessage %#lx, node %ld\n", message, fNodeID); PRINT(4, "BBufferProducer::HandleMessage %#lx, node %ld\n", message, fNodeID);
status_t rv; status_t rv;
switch (message) { switch (message) {
case PRODUCER_SET_RUN_MODE_DELAY: case PRODUCER_SET_RUN_MODE_DELAY:
@@ -199,6 +199,7 @@ BBufferProducer::HandleMessage(int32 message,
const producer_prepare_to_connect_request *request = static_cast<const producer_prepare_to_connect_request *>(data); const producer_prepare_to_connect_request *request = static_cast<const producer_prepare_to_connect_request *>(data);
producer_prepare_to_connect_reply reply; producer_prepare_to_connect_reply reply;
reply.format = request->format; reply.format = request->format;
reply.out_source = request->source;
memcpy(reply.name, request->name, B_MEDIA_NAME_LENGTH); memcpy(reply.name, request->name, B_MEDIA_NAME_LENGTH);
rv = PrepareToConnect(request->source, request->destination, &reply.format, &reply.out_source, reply.name); rv = PrepareToConnect(request->source, request->destination, &reply.format, &reply.out_source, reply.name);
request->SendReply(rv, &reply, sizeof(reply)); request->SendReply(rv, &reply, sizeof(reply));
+6 -6
View File
@@ -132,7 +132,7 @@ BControllable::SetParameterWeb(BParameterWeb *web)
status_t status_t
BControllable::HandleMessage(int32 message, const void *data, size_t size) BControllable::HandleMessage(int32 message, const void *data, size_t size)
{ {
INFO("BControllable::HandleMessage %#lx, node %ld\n", message, ID()); PRINT(4, "BControllable::HandleMessage %#lx, node %ld\n", message, ID());
status_t rv; status_t rv;
switch (message) { switch (message) {
@@ -151,7 +151,7 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size)
// large data transfer, clone area // large data transfer, clone area
area = clone_area("get parameter data clone", &data, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); area = clone_area("get parameter data clone", &data, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area);
if (area < B_OK) { if (area < B_OK) {
FATAL("CONTROLLABLE_GET_PARAMETER_DATA cloning area failed\n"); ERROR("CONTROLLABLE_GET_PARAMETER_DATA cloning area failed\n");
request->SendReply(B_NO_MEMORY, &reply, sizeof(reply)); request->SendReply(B_NO_MEMORY, &reply, sizeof(reply));
return B_OK; return B_OK;
} }
@@ -172,14 +172,14 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size)
const void *data; const void *data;
if (request->area == -1) { if (request->area == -1) {
// small data transfer uses buffer in reply // small data transfer uses buffer in request
area = -1; area = -1;
data = request->rawdata; data = request->rawdata;
} else { } else {
// large data transfer, clone area // large data transfer, clone area
area = clone_area("set parameter data clone", (void **)&data, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); area = clone_area("set parameter data clone", (void **)&data, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area);
if (area < B_OK) { if (area < B_OK) {
FATAL("CONTROLLABLE_SET_PARAMETER_DATA cloning area failed\n"); ERROR("CONTROLLABLE_SET_PARAMETER_DATA cloning area failed\n");
request->SendReply(B_NO_MEMORY, &reply, sizeof(reply)); request->SendReply(B_NO_MEMORY, &reply, sizeof(reply));
return B_OK; return B_OK;
} }
@@ -205,14 +205,14 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size)
area_id area; area_id area;
area = clone_area("cloned parameter web", &buffer, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); area = clone_area("cloned parameter web", &buffer, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area);
if (area < B_OK) { if (area < B_OK) {
FATAL("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB clone_area failed\n"); ERROR("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB clone_area failed\n");
rv = B_ERROR; rv = B_ERROR;
} else { } else {
reply.code = fWeb->TypeCode(); reply.code = fWeb->TypeCode();
reply.size = fWeb->FlattenedSize(); reply.size = fWeb->FlattenedSize();
rv = fWeb->Flatten(buffer, reply.size); rv = fWeb->Flatten(buffer, reply.size);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB Flatten failed\n"); ERROR("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB Flatten failed\n");
} else { } else {
printf("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB %ld bytes, 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", printf("BControllable::HandleMessage CONTROLLABLE_GET_PARAMETER_WEB %ld bytes, 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
reply.size, ((uint32*)buffer)[0], ((uint32*)buffer)[1], ((uint32*)buffer)[2], ((uint32*)buffer)[3]); reply.size, ((uint32*)buffer)[0], ((uint32*)buffer)[1], ((uint32*)buffer)[2], ((uint32*)buffer)[3]);
+8 -8
View File
@@ -54,7 +54,7 @@ void find_media_server_port()
{ {
MediaServerPort = find_port(MEDIA_SERVER_PORT_NAME); MediaServerPort = find_port(MEDIA_SERVER_PORT_NAME);
if (MediaServerPort < 0) { if (MediaServerPort < 0) {
FATAL("couldn't find MediaServerPort\n"); ERROR("couldn't find MediaServerPort\n");
MediaServerPort = BAD_MEDIA_SERVER_PORT; // make this a unique number MediaServerPort = BAD_MEDIA_SERVER_PORT; // make this a unique number
} }
} }
@@ -63,7 +63,7 @@ void find_media_addon_server_port()
{ {
MediaAddonServerPort = find_port(MEDIA_ADDON_SERVER_PORT_NAME); MediaAddonServerPort = find_port(MEDIA_ADDON_SERVER_PORT_NAME);
if (MediaAddonServerPort < 0) { if (MediaAddonServerPort < 0) {
FATAL("couldn't find MediaAddonServerPort\n"); ERROR("couldn't find MediaAddonServerPort\n");
MediaAddonServerPort = BAD_MEDIA_ADDON_SERVER_PORT; // make this a unique number MediaAddonServerPort = BAD_MEDIA_ADDON_SERVER_PORT; // make this a unique number
} }
} }
@@ -84,7 +84,7 @@ status_t SendToServer(BMessage *msg)
status_t rv; status_t rv;
rv = MediaServerMessenger->SendMessage(msg, static_cast<BHandler *>(NULL), TIMEOUT); rv = MediaServerMessenger->SendMessage(msg, static_cast<BHandler *>(NULL), TIMEOUT);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("SendToServer: SendMessage failed\n"); ERROR("SendToServer: SendMessage failed\n");
} }
return rv; return rv;
} }
@@ -120,7 +120,7 @@ status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size
status_t rv; status_t rv;
rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT); rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("SendToPort: write_port failed, port %ld, error %#lx (%s)\n", sendport, rv, strerror(rv)); ERROR("SendToPort: write_port failed, port %ld, error %#lx (%s)\n", sendport, rv, strerror(rv));
if (rv == B_BAD_PORT_ID && sendport == MediaServerPort) { if (rv == B_BAD_PORT_ID && sendport == MediaServerPort) {
find_media_server_port(); find_media_server_port();
sendport = MediaServerPort; sendport = MediaServerPort;
@@ -132,7 +132,7 @@ status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size
} }
rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT); rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("SendToPort: retrying write_port failed, port %ld, error %#lx (%s)\n", sendport, rv, strerror(rv)); ERROR("SendToPort: retrying write_port failed, port %ld, error %#lx (%s)\n", sendport, rv, strerror(rv));
return rv; return rv;
} }
} }
@@ -150,7 +150,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT); rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("QueryPort: write_port failed, port %ld, error %#lx (%s)\n", requestport, rv, strerror(rv)); ERROR("QueryPort: write_port failed, port %ld, error %#lx (%s)\n", requestport, rv, strerror(rv));
if (rv == B_BAD_PORT_ID && requestport == MediaServerPort) { if (rv == B_BAD_PORT_ID && requestport == MediaServerPort) {
find_media_server_port(); find_media_server_port();
requestport = MediaServerPort; requestport = MediaServerPort;
@@ -163,7 +163,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
} }
rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT); rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("QueryPort: retrying write_port failed, port %ld, error %#lx (%s)\n", requestport, rv, strerror(rv)); ERROR("QueryPort: retrying write_port failed, port %ld, error %#lx (%s)\n", requestport, rv, strerror(rv));
_PortPool->PutPort(request->reply_port); _PortPool->PutPort(request->reply_port);
return rv; return rv;
} }
@@ -173,7 +173,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
_PortPool->PutPort(request->reply_port); _PortPool->PutPort(request->reply_port);
if (rv < B_OK) { if (rv < B_OK) {
FATAL("QueryPort: read_port failed, port %ld, error %#lx (%s)\n", request->reply_port, rv, strerror(rv)); ERROR("QueryPort: read_port failed, port %ld, error %#lx (%s)\n", request->reply_port, rv, strerror(rv));
} }
return (rv < B_OK) ? rv : reply->result; return (rv < B_OK) ? rv : reply->result;
+1 -1
View File
@@ -56,7 +56,7 @@ DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
break; break;
default: default:
FATAL("BMediaTheme: Don't know parameter type: 0x%lx\n", parameter->Type()); ERROR("BMediaTheme: Don't know parameter type: 0x%lx\n", parameter->Type());
} }
return NULL; return NULL;
} }
+11 -11
View File
@@ -80,7 +80,7 @@ DormantNodeManager::~DormantNodeManager()
// force unloading all currently loaded images // force unloading all currently loaded images
loaded_addon_info *info; loaded_addon_info *info;
for (fAddonmap->Rewind(); fAddonmap->GetNext(&info); ) { for (fAddonmap->Rewind(); fAddonmap->GetNext(&info); ) {
FATAL("Forcing unload of add-on id %ld with usecount %ld\n", info->addon->AddonID(), info->usecount); ERROR("Forcing unload of add-on id %ld with usecount %ld\n", info->addon->AddonID(), info->usecount);
UnloadAddon(info->addon, info->image); UnloadAddon(info->addon, info->image);
} }
@@ -124,7 +124,7 @@ DormantNodeManager::GetAddon(media_addon_id id)
// ok, it's not loaded, try to get the path // ok, it's not loaded, try to get the path
BPath path; BPath path;
if (B_OK != FindAddonPath(&path, id)) { if (B_OK != FindAddonPath(&path, id)) {
FATAL("DormantNodeManager::GetAddon: can't find path for add-on %ld\n",id); ERROR("DormantNodeManager::GetAddon: can't find path for add-on %ld\n",id);
return NULL; return NULL;
} }
@@ -132,7 +132,7 @@ DormantNodeManager::GetAddon(media_addon_id id)
BMediaAddOn *newaddon; BMediaAddOn *newaddon;
image_id image; image_id image;
if (B_OK != LoadAddon(&newaddon, &image, path.Path(), id)) { if (B_OK != LoadAddon(&newaddon, &image, path.Path(), id)) {
FATAL("DormantNodeManager::GetAddon: can't load add-on %ld from path %s\n",id, path.Path()); ERROR("DormantNodeManager::GetAddon: can't load add-on %ld from path %s\n",id, path.Path());
return NULL; return NULL;
} }
@@ -180,7 +180,7 @@ DormantNodeManager::PutAddon(media_addon_id id)
fLock->Lock(); fLock->Lock();
if (!fAddonmap->Get(id, &info)) { if (!fAddonmap->Get(id, &info)) {
FATAL("DormantNodeManager::PutAddon: failed to find add-on %ld\n",id); ERROR("DormantNodeManager::PutAddon: failed to find add-on %ld\n",id);
fLock->Unlock(); fLock->Unlock();
return; return;
} }
@@ -212,26 +212,26 @@ DormantNodeManager::RegisterAddon(const char *path)
rv = get_ref_for_path(path, &tempref); rv = get_ref_for_path(path, &tempref);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("DormantNodeManager::RegisterAddon failed, couldn't get ref for path %s\n",path); ERROR("DormantNodeManager::RegisterAddon failed, couldn't get ref for path %s\n",path);
return 0; return 0;
} }
msg.ref = tempref; msg.ref = tempref;
port = find_port(MEDIA_SERVER_PORT_NAME); port = find_port(MEDIA_SERVER_PORT_NAME);
if (port <= B_OK) { if (port <= B_OK) {
FATAL("DormantNodeManager::RegisterAddon failed, couldn't find media server\n"); ERROR("DormantNodeManager::RegisterAddon failed, couldn't find media server\n");
return 0; return 0;
} }
msg.reply_port = _PortPool->GetPort(); msg.reply_port = _PortPool->GetPort();
rv = write_port(port, SERVER_REGISTER_MEDIAADDON, &msg, sizeof(msg)); rv = write_port(port, SERVER_REGISTER_MEDIAADDON, &msg, sizeof(msg));
if (rv != B_OK) { if (rv != B_OK) {
_PortPool->PutPort(msg.reply_port); _PortPool->PutPort(msg.reply_port);
FATAL("DormantNodeManager::RegisterAddon failed, couldn't talk to media server\n"); ERROR("DormantNodeManager::RegisterAddon failed, couldn't talk to media server\n");
return 0; return 0;
} }
rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); rv = read_port(msg.reply_port, &code, &reply, sizeof(reply));
_PortPool->PutPort(msg.reply_port); _PortPool->PutPort(msg.reply_port);
if (rv < B_OK) { if (rv < B_OK) {
FATAL("DormantNodeManager::RegisterAddon failed, couldn't talk to media server (2)\n"); ERROR("DormantNodeManager::RegisterAddon failed, couldn't talk to media server (2)\n");
return 0; return 0;
} }
@@ -297,20 +297,20 @@ DormantNodeManager::LoadAddon(BMediaAddOn **newaddon, image_id *newimage, const
image = load_add_on(path); image = load_add_on(path);
if (image < B_OK) { if (image < B_OK) {
FATAL("DormantNodeManager::LoadAddon: loading failed, error %lx (%s), path %s\n", image, strerror(image), path); ERROR("DormantNodeManager::LoadAddon: loading failed, error %lx (%s), path %s\n", image, strerror(image), path);
return B_ERROR; return B_ERROR;
} }
rv = get_image_symbol(image, "make_media_addon", B_SYMBOL_TYPE_TEXT, (void**)&make_addon); rv = get_image_symbol(image, "make_media_addon", B_SYMBOL_TYPE_TEXT, (void**)&make_addon);
if (rv < B_OK) { if (rv < B_OK) {
FATAL("DormantNodeManager::LoadAddon: loading failed, function not found, error %lx (%s)\n", rv, strerror(rv)); ERROR("DormantNodeManager::LoadAddon: loading failed, function not found, error %lx (%s)\n", rv, strerror(rv));
unload_add_on(image); unload_add_on(image);
return B_ERROR; return B_ERROR;
} }
addon = make_addon(image); addon = make_addon(image);
if (addon == 0) { if (addon == 0) {
FATAL("DormantNodeManager::LoadAddon: creating BMediaAddOn failed\n"); ERROR("DormantNodeManager::LoadAddon: creating BMediaAddOn failed\n");
unload_add_on(image); unload_add_on(image);
return B_ERROR; return B_ERROR;
} }
+1 -1
View File
@@ -39,7 +39,7 @@ BFileInterface::HandleMessage(int32 message,
const void *data, const void *data,
size_t size) size_t size)
{ {
INFO("BFileInterface::HandleMessage %#lx, node %ld\n", message, ID()); PRINT(4, "BFileInterface::HandleMessage %#lx, node %ld\n", message, ID());
return B_OK; return B_OK;
} }
+3 -3
View File
@@ -511,7 +511,7 @@ multistream_format_specialize(media_multistream_format *format, const media_mult
break; break;
default: default:
FATAL("media_format::SpecializeTo can't specialize media_multistream_format of format %d\n", format->format); ERROR("media_format::SpecializeTo can't specialize media_multistream_format of format %d\n", format->format);
} }
} }
@@ -587,7 +587,7 @@ media_format::SpecializeTo(const media_format *otherFormat)
{ {
CALLED(); CALLED();
if (type == 0 && otherFormat->type == 0) { if (type == 0 && otherFormat->type == 0) {
FATAL("media_format::SpecializeTo can't specialize wildcard to other wildcard format\n"); ERROR("media_format::SpecializeTo can't specialize wildcard to other wildcard format\n");
return; return;
} }
@@ -616,7 +616,7 @@ media_format::SpecializeTo(const media_format *otherFormat)
return; return;
default: default:
FATAL("media_format::SpecializeTo can't specialize format type %d\n", type); ERROR("media_format::SpecializeTo can't specialize format type %d\n", type);
} }
} }
+6 -6
View File
@@ -313,7 +313,7 @@ BMediaEventLooper::Priority() const
int32 int32
BMediaEventLooper::RunState() const BMediaEventLooper::RunState() const
{ {
CALLED(); PRINT(6, "CALLED BMediaEventLooper::RunState()\n");
return fRunState; return fRunState;
} }
@@ -348,8 +348,8 @@ BMediaEventLooper::SetPriority(int32 priority)
CALLED(); CALLED();
// clamp to a valid value // clamp to a valid value
if (priority < 1) if (priority < 5)
priority = 1; priority = 5;
if (priority > 120) if (priority > 120)
priority = 120; priority = 120;
@@ -453,7 +453,7 @@ BMediaEventLooper::DispatchEvent(const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent) bool realTimeEvent)
{ {
CALLED(); PRINT(6, "CALLED BMediaEventLooper::DispatchEvent()\n");
HandleEvent(event,lateness,realTimeEvent); HandleEvent(event,lateness,realTimeEvent);
@@ -501,7 +501,7 @@ BMediaEventLooper::_ControlThreadStart(void *arg)
BMediaEventLooper::_CleanUpEntry(const media_timed_event *event, BMediaEventLooper::_CleanUpEntry(const media_timed_event *event,
void *context) void *context)
{ {
CALLED(); PRINT(6, "CALLED BMediaEventLooper::_CleanUpEntry()\n");
((BMediaEventLooper *)context)->_DispatchCleanUp(event); ((BMediaEventLooper *)context)->_DispatchCleanUp(event);
} }
@@ -509,7 +509,7 @@ BMediaEventLooper::_CleanUpEntry(const media_timed_event *event,
void void
BMediaEventLooper::_DispatchCleanUp(const media_timed_event *event) BMediaEventLooper::_DispatchCleanUp(const media_timed_event *event)
{ {
CALLED(); PRINT(6, "CALLED BMediaEventLooper::_DispatchCleanUp()\n");
// this function to clean up after custom events you've created // this function to clean up after custom events you've created
if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP) if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP)
+18 -18
View File
@@ -171,7 +171,7 @@ BMediaNode::Release()
TRACE("BMediaNode::Release() saving node %ld configuration\n", fNodeID); TRACE("BMediaNode::Release() saving node %ld configuration\n", fNodeID);
MediaRosterEx(BMediaRoster::Roster())->SaveNodeConfiguration(this); MediaRosterEx(BMediaRoster::Roster())->SaveNodeConfiguration(this);
if (DeleteHook(this) != B_OK) { if (DeleteHook(this) != B_OK) {
FATAL("BMediaNode::Release(): DeleteHook failed\n"); ERROR("BMediaNode::Release(): DeleteHook failed\n");
return Acquire(); return Acquire();
} }
return NULL; return NULL;
@@ -227,7 +227,7 @@ BMediaNode::RunMode() const
BTimeSource * BTimeSource *
BMediaNode::TimeSource() const BMediaNode::TimeSource() const
{ {
CALLED(); PRINT(7, "CALLED BMediaNode::TimeSource()\n");
// return the currently assigned time source // return the currently assigned time source
if (fTimeSource != 0) if (fTimeSource != 0)
@@ -249,7 +249,7 @@ BMediaNode::TimeSource() const
ASSERT(fTimeSource == self->fTimeSource); ASSERT(fTimeSource == self->fTimeSource);
if (fTimeSource == 0) { if (fTimeSource == 0) {
FATAL("BMediaNode::TimeSource: Error, MakeTimeSourceFor failed\n"); ERROR("BMediaNode::TimeSource: MakeTimeSourceFor failed\n");
} else { } else {
ASSERT(fTimeSourceID == fTimeSource->ID()); ASSERT(fTimeSourceID == fTimeSource->ID());
fTimeSource->AddMe(self); fTimeSource->AddMe(self);
@@ -264,7 +264,7 @@ BMediaNode::TimeSource() const
/* virtual */ port_id /* virtual */ port_id
BMediaNode::ControlPort() const BMediaNode::ControlPort() const
{ {
CALLED(); PRINT(7, "CALLED BMediaNode::ControlPort()\n");
return fControlPort; return fControlPort;
} }
@@ -291,7 +291,7 @@ BMediaNode::ReportError(node_error what,
case BMediaNode::B_NODE_IN_DISTRESS: case BMediaNode::B_NODE_IN_DISTRESS:
break; break;
default: default:
FATAL("BMediaNode::ReportError: invalid what!\n"); ERROR("BMediaNode::ReportError: invalid what!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -345,8 +345,8 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
uint32 flags, uint32 flags,
void *_reserved_) void *_reserved_)
{ {
CALLED(); PRINT(6, "CALLED BMediaNode::WaitForMessage()\n");
ASSERT(this != 0);
// This function waits until either real time specified by // This function waits until either real time specified by
// waitUntil or a message is received on the control port. // waitUntil or a message is received on the control port.
// The flags are currently unused and should be 0. // The flags are currently unused and should be 0.
@@ -358,14 +358,14 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
size = read_port_etc(ControlPort(), &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil); size = read_port_etc(ControlPort(), &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
if (size <= 0) { if (size <= 0) {
if (size != B_TIMED_OUT) if (size != B_TIMED_OUT)
FATAL("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size); ERROR("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size);
return size; // returns the error code return size; // returns the error code
} }
TRACE("BMediaNode::WaitForMessage %#lx, node %ld, this %p\n", message, fNodeID, this); PRINT(7, "BMediaNode::WaitForMessage %#lx, node %ld, this %p\n", message, fNodeID, this);
if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) { if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) {
INFO("BMediaNode::WaitForMessage calling BMediaNode\n"); PRINT(4, "BMediaNode::WaitForMessage calling BMediaNode\n");
if (B_OK == BMediaNode::HandleMessage(message, data, size)) if (B_OK == BMediaNode::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
@@ -373,7 +373,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) { if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) {
if (!fProducerThis) if (!fProducerThis)
fProducerThis = dynamic_cast<BBufferProducer *>(this); fProducerThis = dynamic_cast<BBufferProducer *>(this);
INFO("BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis); PRINT(4, "BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis);
if (fProducerThis && B_OK == fProducerThis->BBufferProducer::HandleMessage(message, data, size)) if (fProducerThis && B_OK == fProducerThis->BBufferProducer::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
@@ -381,7 +381,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) { if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) {
if (!fConsumerThis) if (!fConsumerThis)
fConsumerThis = dynamic_cast<BBufferConsumer *>(this); fConsumerThis = dynamic_cast<BBufferConsumer *>(this);
INFO("BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis); PRINT(4, "BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis);
if (fConsumerThis && B_OK == fConsumerThis->BBufferConsumer::HandleMessage(message, data, size)) if (fConsumerThis && B_OK == fConsumerThis->BBufferConsumer::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
@@ -389,7 +389,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) { if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) {
if (!fFileInterfaceThis) if (!fFileInterfaceThis)
fFileInterfaceThis = dynamic_cast<BFileInterface *>(this); fFileInterfaceThis = dynamic_cast<BFileInterface *>(this);
INFO("BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis); PRINT(4, "BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis);
if (fFileInterfaceThis && B_OK == fFileInterfaceThis->BFileInterface::HandleMessage(message, data, size)) if (fFileInterfaceThis && B_OK == fFileInterfaceThis->BFileInterface::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
@@ -397,7 +397,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) { if (message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) {
if (!fControllableThis) if (!fControllableThis)
fControllableThis = dynamic_cast<BControllable *>(this); fControllableThis = dynamic_cast<BControllable *>(this);
INFO("BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis); PRINT(4, "BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis);
if (fControllableThis && B_OK == fControllableThis->BControllable::HandleMessage(message, data, size)) if (fControllableThis && B_OK == fControllableThis->BControllable::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
@@ -405,12 +405,12 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > TIMESOURCE_MESSAGE_START && message < TIMESOURCE_MESSAGE_END) { if (message > TIMESOURCE_MESSAGE_START && message < TIMESOURCE_MESSAGE_END) {
if (!fTimeSourceThis) if (!fTimeSourceThis)
fTimeSourceThis = dynamic_cast<BTimeSource *>(this); fTimeSourceThis = dynamic_cast<BTimeSource *>(this);
INFO("BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis); PRINT(4, "BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis);
if (fTimeSourceThis && B_OK == fTimeSourceThis->BTimeSource::HandleMessage(message, data, size)) if (fTimeSourceThis && B_OK == fTimeSourceThis->BTimeSource::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
INFO("BMediaNode::WaitForMessage calling default\n"); PRINT(4, "BMediaNode::WaitForMessage calling default\n");
if (B_OK == HandleMessage(message, data, size)) if (B_OK == HandleMessage(message, data, size))
return B_OK; return B_OK;
@@ -520,7 +520,7 @@ BMediaNode::HandleMessage(int32 message,
const void *data, const void *data,
size_t size) size_t size)
{ {
INFO("BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID); PRINT(4, "BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID);
switch (message) { switch (message) {
case NODE_FINAL_RELEASE: case NODE_FINAL_RELEASE:
{ {
@@ -646,7 +646,7 @@ BMediaNode::HandleBadMessage(int32 code,
TRACE("BMediaNode::HandleBadMessage: code %#08lx, buffer %p, size %ld\n", code, buffer, size); TRACE("BMediaNode::HandleBadMessage: code %#08lx, buffer %p, size %ld\n", code, buffer, size);
if (code < NODE_MESSAGE_START || code > TIMESOURCE_MESSAGE_END) { if (code < NODE_MESSAGE_START || code > TIMESOURCE_MESSAGE_END) {
FATAL("BMediaNode::HandleBadMessage: unknown code!\n"); ERROR("BMediaNode::HandleBadMessage: unknown code!\n");
} else { } else {
/* All messages targeted to nodes should be handled here, /* All messages targeted to nodes should be handled here,
* messages targetted to the wrong node should be handled * messages targetted to the wrong node should be handled
+125 -77
View File
@@ -81,7 +81,7 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode *node)
addon = node->AddOn(&flavorid); addon = node->AddOn(&flavorid);
if (!addon) { if (!addon) {
// XXX this check incorrectly triggers on BeOS R5 BT848 node // XXX this check incorrectly triggers on BeOS R5 BT848 node
FATAL("BMediaRosterEx::SaveNodeConfiguration node %ld not instantiated from BMediaAddOn!\n", node->ID()); ERROR("BMediaRosterEx::SaveNodeConfiguration node %ld not instantiated from BMediaAddOn!\n", node->ID());
return B_ERROR; return B_ERROR;
} }
addonid = addon->AddonID(); addonid = addon->AddonID();
@@ -188,6 +188,8 @@ BMediaRosterEx::GetAllOutputs(const media_node & node, List<media_output> *list)
status_t rv; status_t rv;
status_t result; status_t result;
PRINT(4, "BMediaRosterEx::GetAllOutputs() node %ld, port %ld\n", node.node, node.port);
result = B_OK; result = B_OK;
cookie = 0; cookie = 0;
list->MakeEmpty(); list->MakeEmpty();
@@ -200,9 +202,13 @@ BMediaRosterEx::GetAllOutputs(const media_node & node, List<media_output> *list)
break; break;
cookie = reply.cookie; cookie = reply.cookie;
if (!list->Insert(reply.output)) { if (!list->Insert(reply.output)) {
FATAL("GetAllOutputs: list->Insert failed\n"); ERROR("GetAllOutputs: list->Insert failed\n");
result = B_ERROR; result = B_ERROR;
} }
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT_OUTPUT("output ", reply.output);
#endif
} }
producer_dispose_output_cookie_request request; producer_dispose_output_cookie_request request;
@@ -219,6 +225,8 @@ BMediaRosterEx::GetAllInputs(const media_node & node, List<media_input> *list)
status_t rv; status_t rv;
status_t result; status_t result;
PRINT(4, "BMediaRosterEx::GetAllInputs() node %ld, port %ld\n", node.node, node.port);
result = B_OK; result = B_OK;
cookie = 0; cookie = 0;
list->MakeEmpty(); list->MakeEmpty();
@@ -231,9 +239,13 @@ BMediaRosterEx::GetAllInputs(const media_node & node, List<media_input> *list)
break; break;
cookie = reply.cookie; cookie = reply.cookie;
if (!list->Insert(reply.input)) { if (!list->Insert(reply.input)) {
FATAL("GetAllInputs: list->Insert failed\n"); ERROR("GetAllInputs: list->Insert failed\n");
result = B_ERROR; result = B_ERROR;
} }
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT_OUTPUT("input ", reply.input);
#endif
} }
consumer_dispose_input_cookie_request request; consumer_dispose_input_cookie_request request;
@@ -264,7 +276,7 @@ BMediaRosterEx::PublishOutputs(const media_node & node, List<media_output> *list
size = ROUND_UP_TO_PAGE(count * sizeof(media_output)); size = ROUND_UP_TO_PAGE(count * sizeof(media_output));
request.area = create_area("publish outputs", &start_addr, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); request.area = create_area("publish outputs", &start_addr, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (request.area < B_OK) { if (request.area < B_OK) {
FATAL("PublishOutputs: failed to create area, %#lx\n", request.area); ERROR("PublishOutputs: failed to create area, %#lx\n", request.area);
return (status_t)request.area; return (status_t)request.area;
} }
outputs = static_cast<media_output *>(start_addr); outputs = static_cast<media_output *>(start_addr);
@@ -309,7 +321,7 @@ BMediaRosterEx::PublishInputs(const media_node & node, List<media_input> *list)
size = ROUND_UP_TO_PAGE(count * sizeof(media_input)); size = ROUND_UP_TO_PAGE(count * sizeof(media_input));
request.area = create_area("publish inputs", &start_addr, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); request.area = create_area("publish inputs", &start_addr, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (request.area < B_OK) { if (request.area < B_OK) {
FATAL("PublishInputs: failed to create area, %#lx\n", request.area); ERROR("PublishInputs: failed to create area, %#lx\n", request.area);
return (status_t)request.area; return (status_t)request.area;
} }
inputs = static_cast<media_input *>(start_addr); inputs = static_cast<media_input *>(start_addr);
@@ -554,7 +566,7 @@ BMediaRoster::ReleaseNode(const media_node & node)
rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::ReleaseNode FAILED, node %ld, port %ld, team %ld!\n", node.node, node.port, team); ERROR("BMediaRoster::ReleaseNode FAILED, node %ld, port %ld, team %ld!\n", node.node, node.port, team);
} }
return rv; return rv;
} }
@@ -574,7 +586,7 @@ BMediaRoster::MakeTimeSourceFor(const media_node & for_node)
} }
if (IS_INVALID_NODE(for_node)) { if (IS_INVALID_NODE(for_node)) {
FATAL("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %ld, port %ld, kinds 0x%lx\n", for_node.node, for_node.port, for_node.kind); ERROR("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %ld, port %ld, kinds 0x%lx\n", for_node.node, for_node.port, for_node.kind);
return NULL; return NULL;
} }
@@ -587,7 +599,7 @@ BMediaRoster::MakeTimeSourceFor(const media_node & for_node)
rv = QueryPort(for_node.port, NODE_GET_TIMESOURCE, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryPort(for_node.port, NODE_GET_TIMESOURCE, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::MakeTimeSourceFor: request failed\n"); ERROR("BMediaRoster::MakeTimeSourceFor: request failed\n");
return NULL; return NULL;
} }
@@ -607,13 +619,13 @@ BMediaRosterEx::MakeTimeSourceObject(media_node_id timesource_id)
rv = GetNodeFor(timesource_id, &clone); rv = GetNodeFor(timesource_id, &clone);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::MakeTimeSourceObject: GetNodeFor failed\n"); ERROR("BMediaRosterEx::MakeTimeSourceObject: GetNodeFor failed\n");
return NULL; return NULL;
} }
source = _TimeSourceObjectManager->GetTimeSource(clone); source = _TimeSourceObjectManager->GetTimeSource(clone);
if (source == NULL) { if (source == NULL) {
FATAL("BMediaRosterEx::MakeTimeSourceObject: GetTimeSource failed\n"); ERROR("BMediaRosterEx::MakeTimeSourceObject: GetTimeSource failed\n");
return NULL; return NULL;
} }
@@ -647,11 +659,11 @@ BMediaRoster::Connect(const media_source & from,
if (io_format == NULL || out_output == NULL || out_input == NULL) if (io_format == NULL || out_output == NULL || out_input == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
if (IS_INVALID_SOURCE(from)) { if (IS_INVALID_SOURCE(from)) {
FATAL("BMediaRoster::Connect: media_source invalid\n"); ERROR("BMediaRoster::Connect: media_source invalid\n");
return B_MEDIA_BAD_SOURCE; return B_MEDIA_BAD_SOURCE;
} }
if (IS_INVALID_DESTINATION(to)) { if (IS_INVALID_DESTINATION(to)) {
FATAL("BMediaRoster::Connect: media_destination invalid\n"); ERROR("BMediaRoster::Connect: media_destination invalid\n");
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
} }
@@ -666,7 +678,7 @@ BMediaRoster::Connect(const media_source & from,
request1.format = *io_format; request1.format = *io_format;
rv = QueryPort(from.port, PRODUCER_FORMAT_PROPOSAL, &request1, sizeof(request1), &reply1, sizeof(reply1)); rv = QueryPort(from.port, PRODUCER_FORMAT_PROPOSAL, &request1, sizeof(request1), &reply1, sizeof(reply1));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::Connect: aborted after BBufferProducer::FormatProposal, status = %#lx\n",rv); ERROR("BMediaRoster::Connect: aborted after BBufferProducer::FormatProposal, status = %#lx\n",rv);
return rv; return rv;
} }
// reply1.format now contains the format proposed by the producer // reply1.format now contains the format proposed by the producer
@@ -681,7 +693,7 @@ BMediaRoster::Connect(const media_source & from,
request2.format = reply1.format; request2.format = reply1.format;
rv = QueryPort(to.port, CONSUMER_ACCEPT_FORMAT, &request2, sizeof(request2), &reply2, sizeof(reply2)); rv = QueryPort(to.port, CONSUMER_ACCEPT_FORMAT, &request2, sizeof(request2), &reply2, sizeof(reply2));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::Connect: aborted after BBufferConsumer::AcceptFormat, status = %#lx\n",rv); ERROR("BMediaRoster::Connect: aborted after BBufferConsumer::AcceptFormat, status = %#lx\n",rv);
return rv; return rv;
} }
// reply2.format now contains the format accepted by the consumer // reply2.format now contains the format accepted by the consumer
@@ -698,7 +710,7 @@ BMediaRoster::Connect(const media_source & from,
strcpy(request3.name, "XXX some default name"); // XXX fix this strcpy(request3.name, "XXX some default name"); // XXX fix this
rv = QueryPort(from.port, PRODUCER_PREPARE_TO_CONNECT, &request3, sizeof(request3), &reply3, sizeof(reply3)); rv = QueryPort(from.port, PRODUCER_PREPARE_TO_CONNECT, &request3, sizeof(request3), &reply3, sizeof(reply3));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::Connect: aborted after BBufferProducer::PrepareToConnect, status = %#lx\n",rv); ERROR("BMediaRoster::Connect: aborted after BBufferProducer::PrepareToConnect, status = %#lx\n",rv);
return rv; return rv;
} }
// reply3.format is still our pretty media format // reply3.format is still our pretty media format
@@ -730,7 +742,7 @@ BMediaRoster::Connect(const media_source & from,
con_status = QueryPort(to.port, CONSUMER_CONNECTED, &request4, sizeof(request4), &reply4, sizeof(reply4)); con_status = QueryPort(to.port, CONSUMER_CONNECTED, &request4, sizeof(request4), &reply4, sizeof(reply4));
if (con_status != B_OK) { if (con_status != B_OK) {
FATAL("BMediaRoster::Connect: aborting after BBufferConsumer::Connected, status = %#lx\n",con_status); ERROR("BMediaRoster::Connect: aborting after BBufferConsumer::Connected, status = %#lx\n",con_status);
// we do NOT return here! // we do NOT return here!
} }
// con_status contains the status code to be supplied to BBufferProducer::Connect's status argument // con_status contains the status code to be supplied to BBufferProducer::Connect's status argument
@@ -749,11 +761,11 @@ BMediaRoster::Connect(const media_source & from,
strcpy(request5.name, reply4.input.name); strcpy(request5.name, reply4.input.name);
rv = QueryPort(reply4.input.source.port, PRODUCER_CONNECT, &request5, sizeof(request5), &reply5, sizeof(reply5)); rv = QueryPort(reply4.input.source.port, PRODUCER_CONNECT, &request5, sizeof(request5), &reply5, sizeof(reply5));
if (con_status != B_OK) { if (con_status != B_OK) {
FATAL("BMediaRoster::Connect: aborted\n"); ERROR("BMediaRoster::Connect: aborted\n");
return con_status; return con_status;
} }
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::Connect: aborted after BBufferProducer::Connect, status = %#lx\n",rv); ERROR("BMediaRoster::Connect: aborted after BBufferProducer::Connect, status = %#lx\n",rv);
return rv; return rv;
} }
// reply5.name contains the name assigned to the connection by the producer // reply5.name contains the name assigned to the connection by the producer
@@ -803,19 +815,19 @@ BMediaRoster::Disconnect(media_node_id source_nodeid,
{ {
CALLED(); CALLED();
if (IS_INVALID_NODEID(source_nodeid)) { if (IS_INVALID_NODEID(source_nodeid)) {
FATAL("BMediaRoster::Disconnect: source media_node_id invalid\n"); ERROR("BMediaRoster::Disconnect: source media_node_id invalid\n");
return B_MEDIA_BAD_SOURCE; return B_MEDIA_BAD_SOURCE;
} }
if (IS_INVALID_NODEID(destination_nodeid)) { if (IS_INVALID_NODEID(destination_nodeid)) {
FATAL("BMediaRoster::Disconnect: destination media_node_id invalid\n"); ERROR("BMediaRoster::Disconnect: destination media_node_id invalid\n");
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
} }
if (IS_INVALID_SOURCE(source)) { if (IS_INVALID_SOURCE(source)) {
FATAL("BMediaRoster::Disconnect: media_source invalid\n"); ERROR("BMediaRoster::Disconnect: media_source invalid\n");
return B_MEDIA_BAD_SOURCE; return B_MEDIA_BAD_SOURCE;
} }
if (IS_INVALID_DESTINATION(destination)) { if (IS_INVALID_DESTINATION(destination)) {
FATAL("BMediaRoster::Disconnect: media_destination invalid\n"); ERROR("BMediaRoster::Disconnect: media_destination invalid\n");
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
} }
@@ -846,14 +858,14 @@ BMediaRoster::Disconnect(media_node_id source_nodeid,
MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist); MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist);
ReleaseNode(sourcenode); ReleaseNode(sourcenode);
} else { } else {
FATAL("BMediaRoster::Disconnect: source GetNodeFor failed\n"); ERROR("BMediaRoster::Disconnect: source GetNodeFor failed\n");
} }
if (B_OK == GetNodeFor(destination_nodeid, &destnode)) { if (B_OK == GetNodeFor(destination_nodeid, &destnode)) {
if (B_OK == MediaRosterEx(this)->GetAllInputs(destnode , &inlist)) if (B_OK == MediaRosterEx(this)->GetAllInputs(destnode , &inlist))
MediaRosterEx(this)->PublishInputs(destnode, &inlist); MediaRosterEx(this)->PublishInputs(destnode, &inlist);
ReleaseNode(destnode); ReleaseNode(destnode);
} else { } else {
FATAL("BMediaRoster::Disconnect: dest GetNodeFor failed\n"); ERROR("BMediaRoster::Disconnect: dest GetNodeFor failed\n");
} }
@@ -926,20 +938,20 @@ BMediaRoster::StartTimeSource(const media_node & node,
CALLED(); CALLED();
if (IS_SYSTEM_TIMESOURCE(node)) { if (IS_SYSTEM_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
//FATAL("BMediaRoster::StartTimeSource node %ld is system timesource\n", node.node); //ERROR("BMediaRoster::StartTimeSource node %ld is system timesource\n", node.node);
return B_OK; return B_OK;
} }
if (IS_SHADOW_TIMESOURCE(node)) { if (IS_SHADOW_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
FATAL("BMediaRoster::StartTimeSource node %ld is shadow timesource\n", node.node); ERROR("BMediaRoster::StartTimeSource node %ld is shadow timesource\n", node.node);
return B_OK; return B_OK;
} }
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BMediaRoster::StartTimeSource node %ld invalid\n", node.node); ERROR("BMediaRoster::StartTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
if ((node.kind & B_TIME_SOURCE) == 0) { if ((node.kind & B_TIME_SOURCE) == 0) {
FATAL("BMediaRoster::StartTimeSource node %ld is no timesource\n", node.node); ERROR("BMediaRoster::StartTimeSource node %ld is no timesource\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
@@ -961,20 +973,20 @@ BMediaRoster::StopTimeSource(const media_node & node,
CALLED(); CALLED();
if (IS_SYSTEM_TIMESOURCE(node)) { if (IS_SYSTEM_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
//FATAL("BMediaRoster::StopTimeSource node %ld is system timesource\n", node.node); //ERROR("BMediaRoster::StopTimeSource node %ld is system timesource\n", node.node);
return B_OK; return B_OK;
} }
if (IS_SHADOW_TIMESOURCE(node)) { if (IS_SHADOW_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
FATAL("BMediaRoster::StopTimeSource node %ld is shadow timesource\n", node.node); ERROR("BMediaRoster::StopTimeSource node %ld is shadow timesource\n", node.node);
return B_OK; return B_OK;
} }
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BMediaRoster::StopTimeSource node %ld invalid\n", node.node); ERROR("BMediaRoster::StopTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
if ((node.kind & B_TIME_SOURCE) == 0) { if ((node.kind & B_TIME_SOURCE) == 0) {
FATAL("BMediaRoster::StopTimeSource node %ld is no timesource\n", node.node); ERROR("BMediaRoster::StopTimeSource node %ld is no timesource\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
@@ -996,22 +1008,22 @@ BMediaRoster::SeekTimeSource(const media_node & node,
CALLED(); CALLED();
if (IS_SYSTEM_TIMESOURCE(node)) { if (IS_SYSTEM_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
// FATAL("BMediaRoster::SeekTimeSource node %ld is system timesource\n", node.node); // ERROR("BMediaRoster::SeekTimeSource node %ld is system timesource\n", node.node);
// you can't seek the system time source, but // you can't seek the system time source, but
// returning B_ERROR would break StampTV // returning B_ERROR would break StampTV
return B_OK; return B_OK;
} }
if (IS_SHADOW_TIMESOURCE(node)) { if (IS_SHADOW_TIMESOURCE(node)) {
// XXX debug this // XXX debug this
FATAL("BMediaRoster::SeekTimeSource node %ld is shadow timesource\n", node.node); ERROR("BMediaRoster::SeekTimeSource node %ld is shadow timesource\n", node.node);
return B_OK; return B_OK;
} }
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BMediaRoster::SeekTimeSource node %ld invalid\n", node.node); ERROR("BMediaRoster::SeekTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
if ((node.kind & B_TIME_SOURCE) == 0) { if ((node.kind & B_TIME_SOURCE) == 0) {
FATAL("BMediaRoster::SeekTimeSource node %ld is no timesource\n", node.node); ERROR("BMediaRoster::SeekTimeSource node %ld is no timesource\n", node.node);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
@@ -1189,7 +1201,7 @@ BMediaRoster::GetLiveNodes(live_node_info * out_live_nodes,
rv = QueryServer(SERVER_GET_LIVE_NODES, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_GET_LIVE_NODES, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::GetLiveNodes failed\n"); ERROR("BMediaRoster::GetLiveNodes failed querying server\n");
*io_total_count = 0; *io_total_count = 0;
return rv; return rv;
} }
@@ -1200,7 +1212,7 @@ BMediaRoster::GetLiveNodes(live_node_info * out_live_nodes,
clone = clone_area("live_node_info clone", reinterpret_cast<void **>(&live_info), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.area); clone = clone_area("live_node_info clone", reinterpret_cast<void **>(&live_info), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.area);
if (clone < B_OK) { if (clone < B_OK) {
FATAL("BMediaRoster::GetLiveNodes failed to clone area, %#lx\n", clone); ERROR("BMediaRoster::GetLiveNodes failed to clone area, %#lx\n", clone);
delete_area(reply.area); delete_area(reply.area);
*io_total_count = 0; *io_total_count = 0;
return B_ERROR; return B_ERROR;
@@ -1231,8 +1243,14 @@ BMediaRoster::GetFreeInputsFor(const media_node & node,
media_type filter_type) media_type filter_type)
{ {
CALLED(); CALLED();
if (IS_INVALID_NODE(node) || (node.kind & B_BUFFER_CONSUMER) == 0) if (IS_INVALID_NODE(node)) {
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld invalid\n", node.node, node.port);
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
}
if ((node.kind & B_BUFFER_CONSUMER) == 0) {
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld is not a consumer\n", node.node, node.port);
return B_MEDIA_BAD_NODE;
}
if (out_free_inputs == NULL || out_total_count == NULL) if (out_free_inputs == NULL || out_total_count == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -1246,6 +1264,8 @@ BMediaRoster::GetFreeInputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetFreeInputsFor node %ld, max %ld, filter-type %ld\n", node.node, buf_num_inputs, filter_type);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&input); i++) { for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != input->format.type) if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != input->format.type)
@@ -1255,6 +1275,9 @@ BMediaRoster::GetFreeInputsFor(const media_node & node,
out_free_inputs[i] = *input; out_free_inputs[i] = *input;
*out_total_count += 1; *out_total_count += 1;
buf_num_inputs -= 1; buf_num_inputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" input", out_free_inputs[i]);
#endif
if (buf_num_inputs == 0) if (buf_num_inputs == 0)
break; break;
} }
@@ -1286,6 +1309,8 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetConnectedInputsFor node %ld, max %ld\n", node.node, buf_num_inputs);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&input); i++) { for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
if (input->source == media_source::null) if (input->source == media_source::null)
@@ -1293,6 +1318,9 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node,
out_active_inputs[i] = *input; out_active_inputs[i] = *input;
*out_total_count += 1; *out_total_count += 1;
buf_num_inputs -= 1; buf_num_inputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" input ", out_active_inputs[i]);
#endif
if (buf_num_inputs == 0) if (buf_num_inputs == 0)
break; break;
} }
@@ -1324,11 +1352,16 @@ BMediaRoster::GetAllInputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetAllInputsFor node %ld, max %ld\n", node.node, buf_num_inputs);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&input); i++) { for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
out_inputs[i] = *input; out_inputs[i] = *input;
*out_total_count += 1; *out_total_count += 1;
buf_num_inputs -= 1; buf_num_inputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" input ", out_inputs[i]);
#endif
if (buf_num_inputs == 0) if (buf_num_inputs == 0)
break; break;
} }
@@ -1361,6 +1394,8 @@ BMediaRoster::GetFreeOutputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetFreeOutputsFor node %ld, max %ld, filter-type %ld\n", node.node, buf_num_outputs, filter_type);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&output); i++) { for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != output->format.type) if (filter_type != B_MEDIA_UNKNOWN_TYPE && filter_type != output->format.type)
@@ -1370,6 +1405,9 @@ BMediaRoster::GetFreeOutputsFor(const media_node & node,
out_free_outputs[i] = *output; out_free_outputs[i] = *output;
*out_total_count += 1; *out_total_count += 1;
buf_num_outputs -= 1; buf_num_outputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" output ", out_free_outputs[i]);
#endif
if (buf_num_outputs == 0) if (buf_num_outputs == 0)
break; break;
} }
@@ -1401,6 +1439,8 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %ld, max %ld\n", node.node, buf_num_outputs);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&output); i++) { for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
if (output->destination == media_destination::null) if (output->destination == media_destination::null)
@@ -1408,6 +1448,9 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node,
out_active_outputs[i] = *output; out_active_outputs[i] = *output;
*out_total_count += 1; *out_total_count += 1;
buf_num_outputs -= 1; buf_num_outputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" output ", out_active_outputs[i]);
#endif
if (buf_num_outputs == 0) if (buf_num_outputs == 0)
break; break;
} }
@@ -1439,11 +1482,16 @@ BMediaRoster::GetAllOutputsFor(const media_node & node,
if (B_OK != rv) if (B_OK != rv)
return rv; return rv;
PRINT(4, "BMediaRoster::GetAllOutputsFor node %ld, max %ld\n", node.node, buf_num_outputs);
int32 i; int32 i;
for (i = 0, list.Rewind(); list.GetNext(&output); i++) { for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
out_outputs[i] = *output; out_outputs[i] = *output;
*out_total_count += 1; *out_total_count += 1;
buf_num_outputs -= 1; buf_num_outputs -= 1;
#if DEBUG >= 3
PRINT_OUTPUT(" output ", out_outputs[i]);
#endif
if (buf_num_outputs == 0) if (buf_num_outputs == 0)
break; break;
} }
@@ -1458,7 +1506,7 @@ BMediaRoster::StartWatching(const BMessenger & where)
{ {
CALLED(); CALLED();
if (!where.IsValid()) { if (!where.IsValid()) {
FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); ERROR("BMediaRoster::StartWatching: messenger invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
return BPrivate::media::notifications::Register(where, media_node::null, B_MEDIA_WILDCARD); return BPrivate::media::notifications::Register(where, media_node::null, B_MEDIA_WILDCARD);
@@ -1471,11 +1519,11 @@ BMediaRoster::StartWatching(const BMessenger & where,
{ {
CALLED(); CALLED();
if (!where.IsValid()) { if (!where.IsValid()) {
FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); ERROR("BMediaRoster::StartWatching: messenger invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
if (false == BPrivate::media::notifications::IsValidNotificationRequest(false, notificationType)) { if (false == BPrivate::media::notifications::IsValidNotificationRequest(false, notificationType)) {
FATAL("BMediaRoster::StartWatching: notificationType invalid!\n"); ERROR("BMediaRoster::StartWatching: notificationType invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
return BPrivate::media::notifications::Register(where, media_node::null, notificationType); return BPrivate::media::notifications::Register(where, media_node::null, notificationType);
@@ -1489,15 +1537,15 @@ BMediaRoster::StartWatching(const BMessenger & where,
{ {
CALLED(); CALLED();
if (!where.IsValid()) { if (!where.IsValid()) {
FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); ERROR("BMediaRoster::StartWatching: messenger invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BMediaRoster::StartWatching: node invalid!\n"); ERROR("BMediaRoster::StartWatching: node invalid!\n");
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
if (false == BPrivate::media::notifications::IsValidNotificationRequest(true, notificationType)) { if (false == BPrivate::media::notifications::IsValidNotificationRequest(true, notificationType)) {
FATAL("BMediaRoster::StartWatching: notificationType invalid!\n"); ERROR("BMediaRoster::StartWatching: notificationType invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
return BPrivate::media::notifications::Register(where, node, notificationType); return BPrivate::media::notifications::Register(where, node, notificationType);
@@ -1520,7 +1568,7 @@ BMediaRoster::StopWatching(const BMessenger & where,
CALLED(); CALLED();
// messenger may already be invalid, so we don't check this // messenger may already be invalid, so we don't check this
if (false == BPrivate::media::notifications::IsValidNotificationRequest(false, notificationType)) { if (false == BPrivate::media::notifications::IsValidNotificationRequest(false, notificationType)) {
FATAL("BMediaRoster::StopWatching: notificationType invalid!\n"); ERROR("BMediaRoster::StopWatching: notificationType invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
return BPrivate::media::notifications::Unregister(where, media_node::null, notificationType); return BPrivate::media::notifications::Unregister(where, media_node::null, notificationType);
@@ -1535,11 +1583,11 @@ BMediaRoster::StopWatching(const BMessenger & where,
CALLED(); CALLED();
// messenger may already be invalid, so we don't check this // messenger may already be invalid, so we don't check this
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BMediaRoster::StopWatching: node invalid!\n"); ERROR("BMediaRoster::StopWatching: node invalid!\n");
return B_MEDIA_BAD_NODE; return B_MEDIA_BAD_NODE;
} }
if (false == BPrivate::media::notifications::IsValidNotificationRequest(true, notificationType)) { if (false == BPrivate::media::notifications::IsValidNotificationRequest(true, notificationType)) {
FATAL("BMediaRoster::StopWatching: notificationType invalid!\n"); ERROR("BMediaRoster::StopWatching: notificationType invalid!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
return BPrivate::media::notifications::Unregister(where, node, notificationType); return BPrivate::media::notifications::Unregister(where, node, notificationType);
@@ -1591,7 +1639,7 @@ BMediaRosterEx::RegisterNode(BMediaNode * node, media_addon_id addonid, int32 fl
rv = QueryServer(SERVER_REGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_REGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::RegisterNode: failed to register node %s (error %#lx)\n", node->Name(), rv); ERROR("BMediaRoster::RegisterNode: failed to register node %s (error %#lx)\n", node->Name(), rv);
return rv; return rv;
} }
@@ -1665,11 +1713,11 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
return B_OK; return B_OK;
} }
if (node->ID() == NODE_UNREGISTERED_ID) { if (node->ID() == NODE_UNREGISTERED_ID) {
FATAL("BMediaRoster::UnregisterNode: Warning node id %ld, name '%s' already unregistered\n", node->ID(), node->Name()); PRINT(1, "Warning: BMediaRoster::UnregisterNode: node id %ld, name '%s' already unregistered\n", node->ID(), node->Name());
return B_OK; return B_OK;
} }
if (node->fRefCount != 0) { if (node->fRefCount != 0) {
FATAL("BMediaRoster::UnregisterNode: Warning node id %ld, name '%s' has local reference count of %ld\n", node->ID(), node->Name(), node->fRefCount); PRINT(1, "Warning: BMediaRoster::UnregisterNode: node id %ld, name '%s' has local reference count of %ld\n", node->ID(), node->Name(), node->fRefCount);
// no return here, we continue and unregister! // no return here, we continue and unregister!
} }
@@ -1690,7 +1738,7 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
rv = QueryServer(SERVER_UNREGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_UNREGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::UnregisterNode: failed to unregister node id %ld, name '%s' (error %#lx)\n", node->ID(), node->Name(), rv); ERROR("BMediaRoster::UnregisterNode: failed to unregister node id %ld, name '%s' (error %#lx)\n", node->ID(), node->Name(), rv);
return rv; return rv;
} }
@@ -1704,7 +1752,7 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
rv = MediaRosterEx(this)->DecrementAddonFlavorInstancesCount(reply.addonid, reply.flavorid); rv = MediaRosterEx(this)->DecrementAddonFlavorInstancesCount(reply.addonid, reply.flavorid);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::UnregisterNode: DecrementAddonFlavorInstancesCount failed\n"); ERROR("BMediaRoster::UnregisterNode: DecrementAddonFlavorInstancesCount failed\n");
// this is really a problem, but we can't fail now // this is really a problem, but we can't fail now
} }
} }
@@ -1762,7 +1810,7 @@ BMediaRoster::SetTimeSourceFor(media_node_id node,
// we need to get a clone of the node to have a port id // we need to get a clone of the node to have a port id
rv = GetNodeFor(node, &clone); rv = GetNodeFor(node, &clone);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id %ld\n", node); ERROR("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id %ld\n", node);
return B_ERROR; return B_ERROR;
} }
@@ -1773,14 +1821,14 @@ BMediaRoster::SetTimeSourceFor(media_node_id node,
cmd.timesource_id = time_source; cmd.timesource_id = time_source;
rv = SendToPort(clone.port, NODE_SET_TIMESOURCE, &cmd, sizeof(cmd)); rv = SendToPort(clone.port, NODE_SET_TIMESOURCE, &cmd, sizeof(cmd));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::SetTimeSourceFor, sending NODE_SET_TIMESOURCE failed, node id %ld\n", node); ERROR("BMediaRoster::SetTimeSourceFor, sending NODE_SET_TIMESOURCE failed, node id %ld\n", node);
result = B_ERROR; result = B_ERROR;
} }
// we release the clone // we release the clone
rv = ReleaseNode(clone); rv = ReleaseNode(clone);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id %ld\n", node); ERROR("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id %ld\n", node);
result = B_ERROR; result = B_ERROR;
} }
@@ -1814,21 +1862,21 @@ BMediaRoster::GetParameterWebFor(const media_node & node,
void *data; void *data;
area = create_area("parameter web data", &data, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); area = create_area("parameter web data", &data, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (area < B_OK) { if (area < B_OK) {
FATAL("BMediaRoster::GetParameterWebFor couldn't create area of size %ld\n", size); ERROR("BMediaRoster::GetParameterWebFor couldn't create area of size %ld\n", size);
return B_ERROR; return B_ERROR;
} }
request.maxsize = size; request.maxsize = size;
request.area = area; request.area = area;
rv = QueryPort(node.port, CONTROLLABLE_GET_PARAMETER_WEB, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryPort(node.port, CONTROLLABLE_GET_PARAMETER_WEB, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::GetParameterWebFor CONTROLLABLE_GET_PARAMETER_WEB failed\n"); ERROR("BMediaRoster::GetParameterWebFor CONTROLLABLE_GET_PARAMETER_WEB failed\n");
delete_area(area); delete_area(area);
return B_ERROR; return B_ERROR;
} }
if (reply.size == 0) { if (reply.size == 0) {
// no parameter web available // no parameter web available
// XXX should we return an error? // XXX should we return an error?
FATAL("BMediaRoster::GetParameterWebFor node %ld has no parameter web\n", node.node); ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter web\n", node.node);
*out_web = new BParameterWeb(); *out_web = new BParameterWeb();
delete_area(area); delete_area(area);
return B_OK; return B_OK;
@@ -1842,7 +1890,7 @@ BMediaRoster::GetParameterWebFor(const media_node & node,
rv = (*out_web)->Unflatten(reply.code, data, reply.size); rv = (*out_web)->Unflatten(reply.code, data, reply.size);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::GetParameterWebFor Unflatten failed, %s\n", strerror(rv)); ERROR("BMediaRoster::GetParameterWebFor Unflatten failed, %s\n", strerror(rv));
delete_area(area); delete_area(area);
delete *out_web; delete *out_web;
return B_ERROR; return B_ERROR;
@@ -1855,7 +1903,7 @@ BMediaRoster::GetParameterWebFor(const media_node & node,
// parameter web data was too large // parameter web data was too large
// loop and try a larger size // loop and try a larger size
} }
FATAL("BMediaRoster::GetParameterWebFor node %ld has no parameter web larger than %ld\n", node.node, size); ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter web larger than %ld\n", node.node, size);
return B_ERROR; return B_ERROR;
} }
@@ -1972,13 +2020,13 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
status_t rv; status_t rv;
rv = GetDormantFlavorInfo(addonid, flavorid, &node_info); rv = GetDormantFlavorInfo(addonid, flavorid, &node_info);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode error: failed to get dormant_flavor_info for addon-id %ld, flavor-id %ld\n", addonid, flavorid); ERROR("BMediaRosterEx::InstantiateDormantNode error: failed to get dormant_flavor_info for addon-id %ld, flavor-id %ld\n", addonid, flavorid);
return B_ERROR; return B_ERROR;
} }
//ASSERT(node_info.internal_id == flavorid); //ASSERT(node_info.internal_id == flavorid);
if (node_info.internal_id != flavorid) { if (node_info.internal_id != flavorid) {
FATAL("BMediaRosterEx::InstantiateDormantNode failed: ID mismatch for addon-id %ld, flavor-id %ld, node_info.internal_id %ld, node_info.name %s\n", addonid, flavorid, node_info.internal_id, node_info.name); ERROR("BMediaRosterEx::InstantiateDormantNode failed: ID mismatch for addon-id %ld, flavor-id %ld, node_info.internal_id %ld, node_info.name %s\n", addonid, flavorid, node_info.internal_id, node_info.name);
return B_ERROR; return B_ERROR;
} }
@@ -1986,7 +2034,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
BMediaAddOn *addon; BMediaAddOn *addon;
addon = _DormantNodeManager->GetAddon(addonid); addon = _DormantNodeManager->GetAddon(addonid);
if (!addon) { if (!addon) {
FATAL("BMediaRosterEx::InstantiateDormantNode: GetAddon failed\n"); ERROR("BMediaRosterEx::InstantiateDormantNode: GetAddon failed\n");
return B_ERROR; return B_ERROR;
} }
@@ -1995,7 +2043,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
// flavor is limited. // flavor is limited.
rv = IncrementAddonFlavorInstancesCount(addonid, flavorid); rv = IncrementAddonFlavorInstancesCount(addonid, flavorid);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode error: can't create more nodes for addon-id %ld, flavor-id %ld\n", addonid, flavorid); ERROR("BMediaRosterEx::InstantiateDormantNode error: can't create more nodes for addon-id %ld, flavor-id %ld\n", addonid, flavorid);
// Put the addon back into the pool // Put the addon back into the pool
_DormantNodeManager->PutAddon(addonid); _DormantNodeManager->PutAddon(addonid);
return B_ERROR; return B_ERROR;
@@ -2004,7 +2052,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
BMessage config; BMessage config;
rv = LoadNodeConfiguration(addonid, flavorid, &config); rv = LoadNodeConfiguration(addonid, flavorid, &config);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode: couldn't load configuration for addon-id %ld, flavor-id %ld\n", addonid, flavorid); ERROR("BMediaRosterEx::InstantiateDormantNode: couldn't load configuration for addon-id %ld, flavor-id %ld\n", addonid, flavorid);
// do not return, this is a minor problem, not a reason to fail // do not return, this is a minor problem, not a reason to fail
} }
@@ -2014,21 +2062,21 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
out_error = B_OK; out_error = B_OK;
node = addon->InstantiateNodeFor(&node_info, &config, &out_error); node = addon->InstantiateNodeFor(&node_info, &config, &out_error);
if (!node) { if (!node) {
FATAL("BMediaRosterEx::InstantiateDormantNode: InstantiateNodeFor failed\n"); ERROR("BMediaRosterEx::InstantiateDormantNode: InstantiateNodeFor failed\n");
// Put the addon back into the pool // Put the addon back into the pool
_DormantNodeManager->PutAddon(addonid); _DormantNodeManager->PutAddon(addonid);
// We must decrement the use count of this addon flavor in the // We must decrement the use count of this addon flavor in the
// server to compensate the increment done in the beginning. // server to compensate the increment done in the beginning.
rv = DecrementAddonFlavorInstancesCount(addonid, flavorid); rv = DecrementAddonFlavorInstancesCount(addonid, flavorid);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n"); ERROR("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n");
} }
return (out_error != B_OK) ? out_error : B_ERROR; return (out_error != B_OK) ? out_error : B_ERROR;
} }
rv = RegisterNode(node, addonid, flavorid); rv = RegisterNode(node, addonid, flavorid);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode: RegisterNode failed\n"); ERROR("BMediaRosterEx::InstantiateDormantNode: RegisterNode failed\n");
delete node; delete node;
// Put the addon back into the pool // Put the addon back into the pool
_DormantNodeManager->PutAddon(addonid); _DormantNodeManager->PutAddon(addonid);
@@ -2036,7 +2084,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
// server to compensate the increment done in the beginning. // server to compensate the increment done in the beginning.
rv = DecrementAddonFlavorInstancesCount(addonid, flavorid); rv = DecrementAddonFlavorInstancesCount(addonid, flavorid);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n"); ERROR("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n");
} }
return B_ERROR; return B_ERROR;
} }
@@ -2046,7 +2094,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t
printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team %ld as creator of node %ld\n", creator, node->ID()); printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team %ld as creator of node %ld\n", creator, node->ID());
rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator); rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRosterEx::InstantiateDormantNode failed to assign team %ld as creator of node %ld\n", creator, node->ID()); ERROR("BMediaRosterEx::InstantiateDormantNode failed to assign team %ld as creator of node %ld\n", creator, node->ID());
// do not return, this is a minor problem, not a reason to fail // do not return, this is a minor problem, not a reason to fail
} }
} }
@@ -2072,7 +2120,7 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info,
if (out_node == 0) if (out_node == 0)
return B_BAD_VALUE; return B_BAD_VALUE;
if (in_info.addon <= 0) { if (in_info.addon <= 0) {
FATAL("BMediaRoster::InstantiateDormantNode error: addon-id %ld invalid.\n", in_info.addon); ERROR("BMediaRoster::InstantiateDormantNode error: addon-id %ld invalid.\n", in_info.addon);
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -2085,7 +2133,7 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info,
status_t rv; status_t rv;
rv = MediaRosterEx(this)->GetDormantFlavorInfo(in_info.addon, in_info.flavor_id, &node_info); rv = MediaRosterEx(this)->GetDormantFlavorInfo(in_info.addon, in_info.flavor_id, &node_info);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::InstantiateDormantNode error: failed to get dormant_flavor_info for addon-id %ld, flavor-id %ld\n", in_info.addon, in_info.flavor_id); ERROR("BMediaRoster::InstantiateDormantNode: failed to get dormant_flavor_info for addon-id %ld, flavor-id %ld\n", in_info.addon, in_info.flavor_id);
return B_NAME_NOT_FOUND; return B_NAME_NOT_FOUND;
} }
@@ -2108,11 +2156,11 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info,
// Make sure that flags demanded by the dormant node and those requested // Make sure that flags demanded by the dormant node and those requested
// by the caller are not incompatible. // by the caller are not incompatible.
if ((node_info.flavor_flags & B_FLAVOR_IS_GLOBAL) && (flags & B_FLAVOR_IS_LOCAL)) { if ((node_info.flavor_flags & B_FLAVOR_IS_GLOBAL) && (flags & B_FLAVOR_IS_LOCAL)) {
FATAL("BMediaRoster::InstantiateDormantNode Error: requested B_FLAVOR_IS_LOCAL, but dormant node has B_FLAVOR_IS_GLOBAL\n"); ERROR("BMediaRoster::InstantiateDormantNode: requested B_FLAVOR_IS_LOCAL, but dormant node has B_FLAVOR_IS_GLOBAL\n");
return B_NAME_NOT_FOUND; return B_NAME_NOT_FOUND;
} }
if ((node_info.flavor_flags & B_FLAVOR_IS_LOCAL) && (flags & B_FLAVOR_IS_GLOBAL)) { if ((node_info.flavor_flags & B_FLAVOR_IS_LOCAL) && (flags & B_FLAVOR_IS_GLOBAL)) {
FATAL("BMediaRoster::InstantiateDormantNode Error: requested B_FLAVOR_IS_GLOBAL, but dormant node has B_FLAVOR_IS_LOCAL\n"); ERROR("BMediaRoster::InstantiateDormantNode: requested B_FLAVOR_IS_GLOBAL, but dormant node has B_FLAVOR_IS_LOCAL\n");
return B_NAME_NOT_FOUND; return B_NAME_NOT_FOUND;
} }
@@ -2473,7 +2521,7 @@ BMediaRoster::NodeIDFor(port_id source_or_destination_port)
rv = QueryServer(SERVER_NODE_ID_FOR, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_NODE_ID_FOR, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv); ERROR("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv);
return -1; return -1;
} }
@@ -2503,7 +2551,7 @@ BMediaRoster::GetInstancesFor(media_addon_id addon,
rv = QueryServer(SERVER_GET_INSTANCES_FOR, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryServer(SERVER_GET_INSTANCES_FOR, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("BMediaRoster::GetLiveNodes failed\n"); ERROR("BMediaRoster::GetLiveNodes failed\n");
return rv; return rv;
} }
+55 -55
View File
@@ -20,7 +20,7 @@
#ifdef DEBUG #ifdef DEBUG
# undef DEBUG # undef DEBUG
#endif #endif
#define DEBUG 3 //#define DEBUG 3
#include "debug.h" #include "debug.h"
@@ -530,13 +530,13 @@ BParameterWeb::Flatten(void *buffer, ssize_t size) const
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
BParameterGroup *group = static_cast<BParameterGroup *>(mGroups->ItemAt(i)); BParameterGroup *group = static_cast<BParameterGroup *>(mGroups->ItemAt(i));
if (group == NULL) { if (group == NULL) {
FATAL("BParameterWeb::Flatten(): group is NULL\n"); ERROR("BParameterWeb::Flatten(): group is NULL\n");
continue; continue;
} }
ssize_t groupSize = group->FlattenedSize(); ssize_t groupSize = group->FlattenedSize();
if (groupSize > size_left(size, bufferStart, buffer)) { if (groupSize > size_left(size, bufferStart, buffer)) {
FATAL("BParameterWeb::Flatten(): buffer too small\n"); ERROR("BParameterWeb::Flatten(): buffer too small\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -567,12 +567,12 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size)
CALLED(); CALLED();
if (!AllowsTypeCode(code)) { if (!AllowsTypeCode(code)) {
FATAL("BParameterWeb::Unflatten(): wrong type code\n"); ERROR("BParameterWeb::Unflatten(): wrong type code\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BParameterWeb::Unflatten(): NULL buffer pointer\n"); ERROR("BParameterWeb::Unflatten(): NULL buffer pointer\n");
return B_NO_INIT; return B_NO_INIT;
} }
@@ -580,7 +580,7 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size)
// signature field, the mystery field, the group count, and the Node, then there is a problem // signature field, the mystery field, the group count, and the Node, then there is a problem
if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(int32) + sizeof(ssize_t) + sizeof(media_node)) ) if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(int32) + sizeof(ssize_t) + sizeof(media_node)) )
{ {
FATAL("BParameterWeb::Unflatten(): size to small\n"); ERROR("BParameterWeb::Unflatten(): size to small\n");
return B_ERROR; return B_ERROR;
} }
@@ -600,7 +600,7 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size)
// information - but it doesn't seem to have another purpose // information - but it doesn't seem to have another purpose
int32 version = read_from_buffer_swap32<int32>(&buffer, isSwapped); int32 version = read_from_buffer_swap32<int32>(&buffer, isSwapped);
if (version != kCurrentParameterWebVersion) { if (version != kCurrentParameterWebVersion) {
FATAL("BParameterWeb::Unflatten(): wrong version %ld (%lx)?!\n", version, version); ERROR("BParameterWeb::Unflatten(): wrong version %ld (%lx)?!\n", version, version);
return B_ERROR; return B_ERROR;
} }
@@ -632,14 +632,14 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size)
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
ssize_t groupSize = read_from_buffer_swap32<ssize_t>(&buffer, isSwapped); ssize_t groupSize = read_from_buffer_swap32<ssize_t>(&buffer, isSwapped);
if (groupSize > size_left(size, bufferStart, buffer)) { if (groupSize > size_left(size, bufferStart, buffer)) {
FATAL("BParameterWeb::Unflatten(): buffer too small\n"); ERROR("BParameterWeb::Unflatten(): buffer too small\n");
return B_BAD_DATA; return B_BAD_DATA;
} }
BParameterGroup *group = new BParameterGroup(this, "unnamed"); BParameterGroup *group = new BParameterGroup(this, "unnamed");
status_t status = group->Unflatten(group->TypeCode(), buffer, groupSize); status_t status = group->Unflatten(group->TypeCode(), buffer, groupSize);
if (status < B_OK) { if (status < B_OK) {
FATAL("BParameterWeb::Unflatten(): unflatten group failed\n"); ERROR("BParameterWeb::Unflatten(): unflatten group failed\n");
delete group; delete group;
return status; return status;
} }
@@ -965,7 +965,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const
CALLED(); CALLED();
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BParameterGroup::Flatten buffer is NULL\n"); ERROR("BParameterGroup::Flatten buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
@@ -976,7 +976,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const
// BParameterGroup::FlattenedSize, not by a descendent's override of this method. // BParameterGroup::FlattenedSize, not by a descendent's override of this method.
ssize_t actualSize = BParameterGroup::FlattenedSize(); ssize_t actualSize = BParameterGroup::FlattenedSize();
if (size < actualSize) { if (size < actualSize) {
FATAL("BParameterGroup::Flatten size to small\n"); ERROR("BParameterGroup::Flatten size to small\n");
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@@ -994,7 +994,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
BParameter *parameter = static_cast<BParameter *>(mControls->ItemAt(i)); BParameter *parameter = static_cast<BParameter *>(mControls->ItemAt(i));
if (parameter == NULL) { if (parameter == NULL) {
FATAL("BParameterGroup::Flatten(): NULL parameter\n"); ERROR("BParameterGroup::Flatten(): NULL parameter\n");
continue; continue;
} }
@@ -1020,7 +1020,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
BParameterGroup *group = static_cast<BParameterGroup *>(mGroups->ItemAt(i)); BParameterGroup *group = static_cast<BParameterGroup *>(mGroups->ItemAt(i));
if (group == NULL) { if (group == NULL) {
FATAL("BParameterGroup::Flatten(): NULL group\n"); ERROR("BParameterGroup::Flatten(): NULL group\n");
continue; continue;
} }
@@ -1057,19 +1057,19 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size)
CALLED(); CALLED();
if (!AllowsTypeCode(code)) { if (!AllowsTypeCode(code)) {
FATAL("BParameterGroup::Unflatten() wrong type code\n"); ERROR("BParameterGroup::Unflatten() wrong type code\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BParameterGroup::Unflatten() buffer is NULL\n"); ERROR("BParameterGroup::Unflatten() buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
// if the buffer is smaller than the size needed to read the // if the buffer is smaller than the size needed to read the
// signature field, then there is a problem // signature field, then there is a problem
if (size < static_cast<ssize_t>(sizeof(int32))) { if (size < static_cast<ssize_t>(sizeof(int32))) {
FATAL("BParameterGroup::Unflatten() size to small\n"); ERROR("BParameterGroup::Unflatten() size to small\n");
return B_ERROR; return B_ERROR;
} }
@@ -1156,13 +1156,13 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size)
BParameter *parameter = MakeControl(mediaType); BParameter *parameter = MakeControl(mediaType);
if (parameter == NULL) { if (parameter == NULL) {
FATAL("BParameterGroup::Unflatten(): MakeControl() failed\n"); ERROR("BParameterGroup::Unflatten(): MakeControl() failed\n");
return B_ERROR; return B_ERROR;
} }
status_t status = parameter->Unflatten(parameter->TypeCode(), buffer, parameterSize); status_t status = parameter->Unflatten(parameter->TypeCode(), buffer, parameterSize);
if (status < B_OK) { if (status < B_OK) {
FATAL("BParameterGroup::Unflatten(): parameter->Unflatten() failed\n"); ERROR("BParameterGroup::Unflatten(): parameter->Unflatten() failed\n");
delete parameter; delete parameter;
return status; return status;
} }
@@ -1197,13 +1197,13 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size)
BParameterGroup *group = new BParameterGroup(mWeb, "sub-unnamed"); BParameterGroup *group = new BParameterGroup(mWeb, "sub-unnamed");
if (group == NULL) { if (group == NULL) {
FATAL("BParameterGroup::Unflatten(): MakeGroup() failed\n"); ERROR("BParameterGroup::Unflatten(): MakeGroup() failed\n");
return B_ERROR; return B_ERROR;
} }
status_t status = group->Unflatten(type, buffer, groupSize); status_t status = group->Unflatten(type, buffer, groupSize);
if (status != B_OK) { if (status != B_OK) {
FATAL("BParameterGroup::Unflatten(): group->Unflatten() failed\n"); ERROR("BParameterGroup::Unflatten(): group->Unflatten() failed\n");
delete group; delete group;
return status; return status;
} }
@@ -1253,7 +1253,7 @@ BParameterGroup::MakeControl(int32 type)
return new BContinuousParameter(-1, B_MEDIA_UNKNOWN_TYPE, mWeb, "continuousParameter", B_GENERIC,"",0,100,1); return new BContinuousParameter(-1, B_MEDIA_UNKNOWN_TYPE, mWeb, "continuousParameter", B_GENERIC,"",0,100,1);
default: default:
FATAL("BParameterGroup::MakeControl unknown type %ld\n", type); ERROR("BParameterGroup::MakeControl unknown type %ld\n", type);
return NULL; return NULL;
} }
} }
@@ -1347,13 +1347,13 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when)
return B_NO_MEMORY; return B_NO_MEMORY;
if (mWeb == 0) { if (mWeb == 0) {
FATAL("BParameter::GetValue: no parent BParameterWeb\n"); ERROR("BParameter::GetValue: no parent BParameterWeb\n");
return B_NO_INIT; return B_NO_INIT;
} }
node = mWeb->Node(); node = mWeb->Node();
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BParameter::GetValue: the parent BParameterWeb is not assigned to a BMediaNode\n"); ERROR("BParameter::GetValue: the parent BParameterWeb is not assigned to a BMediaNode\n");
return B_NO_INIT; return B_NO_INIT;
} }
@@ -1361,7 +1361,7 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when)
// create an area if large data needs to be transfered // create an area if large data needs to be transfered
area = create_area("get parameter data", &data, B_ANY_ADDRESS, ROUND_UP_TO_PAGE(*ioSize), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); area = create_area("get parameter data", &data, B_ANY_ADDRESS, ROUND_UP_TO_PAGE(*ioSize), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (area < B_OK) { if (area < B_OK) {
FATAL("BParameter::GetValue can't create area of %ld bytes\n", *ioSize); ERROR("BParameter::GetValue can't create area of %ld bytes\n", *ioSize);
return B_NO_MEMORY; return B_NO_MEMORY;
} }
} else { } else {
@@ -1384,7 +1384,7 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when)
if (when != 0) if (when != 0)
*when = reply.last_change; *when = reply.last_change;
} else } else
FATAL("BParameter::GetValue querying node failed\n"); ERROR("BParameter::GetValue querying node failed\n");
if (area != -1) if (area != -1)
delete_area(area); delete_area(area);
@@ -1411,13 +1411,13 @@ BParameter::SetValue(const void *buffer, size_t size, bigtime_t when)
return B_NO_MEMORY; return B_NO_MEMORY;
if (mWeb == 0) { if (mWeb == 0) {
FATAL("BParameter::SetValue: no parent BParameterWeb\n"); ERROR("BParameter::SetValue: no parent BParameterWeb\n");
return B_NO_INIT; return B_NO_INIT;
} }
node = mWeb->Node(); node = mWeb->Node();
if (IS_INVALID_NODE(node)) { if (IS_INVALID_NODE(node)) {
FATAL("BParameter::SetValue: the parent BParameterWeb is not assigned to a BMediaNode\n"); ERROR("BParameter::SetValue: the parent BParameterWeb is not assigned to a BMediaNode\n");
return B_NO_INIT; return B_NO_INIT;
} }
@@ -1425,7 +1425,7 @@ BParameter::SetValue(const void *buffer, size_t size, bigtime_t when)
// create an area if large data needs to be transfered // create an area if large data needs to be transfered
area = create_area("set parameter data", &data, B_ANY_ADDRESS, ROUND_UP_TO_PAGE(size), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); area = create_area("set parameter data", &data, B_ANY_ADDRESS, ROUND_UP_TO_PAGE(size), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (area < B_OK) { if (area < B_OK) {
FATAL("BParameter::SetValue can't create area of %ld bytes\n", size); ERROR("BParameter::SetValue can't create area of %ld bytes\n", size);
return B_NO_MEMORY; return B_NO_MEMORY;
} }
} else { } else {
@@ -1441,7 +1441,7 @@ BParameter::SetValue(const void *buffer, size_t size, bigtime_t when)
rv = QueryPort(node.port, CONTROLLABLE_SET_PARAMETER_DATA, &request, sizeof(request), &reply, sizeof(reply)); rv = QueryPort(node.port, CONTROLLABLE_SET_PARAMETER_DATA, &request, sizeof(request), &reply, sizeof(reply));
if (rv != B_OK) if (rv != B_OK)
FATAL("BParameter::SetValue querying node failed\n"); ERROR("BParameter::SetValue querying node failed\n");
if (area != -1) if (area != -1)
delete_area(area); delete_area(area);
@@ -1620,7 +1620,7 @@ BParameter::Flatten(void *buffer, ssize_t size) const
CALLED(); CALLED();
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BParameter::Flatten buffer is NULL\n"); ERROR("BParameter::Flatten buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
@@ -1628,7 +1628,7 @@ BParameter::Flatten(void *buffer, ssize_t size) const
// BParameter::FlattenedSize(), not by a descendent's override of this method. // BParameter::FlattenedSize(), not by a descendent's override of this method.
ssize_t actualSize = BParameter::FlattenedSize(); ssize_t actualSize = BParameter::FlattenedSize();
if (size < actualSize) { if (size < actualSize) {
FATAL("BParameter::Flatten(): size too small\n"); ERROR("BParameter::Flatten(): size too small\n");
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@@ -1679,19 +1679,19 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
CALLED(); CALLED();
if (!AllowsTypeCode(code)) { if (!AllowsTypeCode(code)) {
FATAL("BParameter::Unflatten(): wrong type code\n"); ERROR("BParameter::Unflatten(): wrong type code\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BParameter::Unflatten(): buffer is NULL\n"); ERROR("BParameter::Unflatten(): buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
// if the buffer is smaller than the size needed to read the // if the buffer is smaller than the size needed to read the
// signature and struct size fields, then there is a problem // signature and struct size fields, then there is a problem
if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) { if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) {
FATAL("BParameter::Unflatten() size too small\n"); ERROR("BParameter::Unflatten() size too small\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -1705,13 +1705,13 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
else if (magic == kParameterMagic) else if (magic == kParameterMagic)
mSwapDetected = false; mSwapDetected = false;
else { else {
FATAL("BParameter::Unflatten(): bad magic\n"); ERROR("BParameter::Unflatten(): bad magic\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
ssize_t parameterSize = read_from_buffer_swap32<ssize_t>(&buffer, mSwapDetected); ssize_t parameterSize = read_from_buffer_swap32<ssize_t>(&buffer, mSwapDetected);
if (parameterSize > size) { if (parameterSize > size) {
FATAL("BParameter::Unflatten(): buffer too small (%ld > %ld)\n", parameterSize, size); ERROR("BParameter::Unflatten(): buffer too small (%ld > %ld)\n", parameterSize, size);
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -1730,7 +1730,7 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
//TOTAL: 27 bytes //TOTAL: 27 bytes
const ssize_t MinFlattenedParamSize(27); const ssize_t MinFlattenedParamSize(27);
if (parameterSize < MinFlattenedParamSize) { if (parameterSize < MinFlattenedParamSize) {
FATAL("BParameter::Unflatten out of memory (2)\n"); ERROR("BParameter::Unflatten out of memory (2)\n");
return B_ERROR; return B_ERROR;
} }
@@ -1846,7 +1846,7 @@ BParameter::FixRefs(BList &old, BList &updated)
if (index >= 0) if (index >= 0)
items[i] = updated.ItemAt(index); items[i] = updated.ItemAt(index);
else { else {
FATAL("BParameter::FixRefs(): No mapping found for input"); ERROR("BParameter::FixRefs(): No mapping found for input");
items[i] = NULL; items[i] = NULL;
} }
} }
@@ -1868,7 +1868,7 @@ BParameter::FixRefs(BList &old, BList &updated)
if (index >= 0) if (index >= 0)
items[i] = updated.ItemAt(index); items[i] = updated.ItemAt(index);
else { else {
FATAL("BParameter::FixRefs(): No mapping found for output"); ERROR("BParameter::FixRefs(): No mapping found for output");
items[i] = NULL; items[i] = NULL;
} }
} }
@@ -1954,19 +1954,19 @@ BContinuousParameter::Flatten(void *buffer, ssize_t size) const
CALLED(); CALLED();
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BContinuousParameter::Flatten(): buffer is NULL\n"); ERROR("BContinuousParameter::Flatten(): buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
ssize_t parameterSize = BParameter::FlattenedSize(); ssize_t parameterSize = BParameter::FlattenedSize();
if (size < (parameterSize + kAdditionalContinuousParameterSize)) { if (size < (parameterSize + kAdditionalContinuousParameterSize)) {
FATAL("BContinuousParameter::Flatten(): size to small\n"); ERROR("BContinuousParameter::Flatten(): size to small\n");
return B_NO_MEMORY; return B_NO_MEMORY;
} }
status_t status = BParameter::Flatten(buffer, size); status_t status = BParameter::Flatten(buffer, size);
if (status != B_OK) { if (status != B_OK) {
FATAL("BContinuousParameter::Flatten(): BParameter::Flatten() failed\n"); ERROR("BContinuousParameter::Flatten(): BParameter::Flatten() failed\n");
return status; return status;
} }
@@ -1994,25 +1994,25 @@ BContinuousParameter::Unflatten(type_code code, const void *buffer, ssize_t size
// as early as possible. // as early as possible.
if (!AllowsTypeCode(code)) { if (!AllowsTypeCode(code)) {
FATAL("BContinuousParameter::Unflatten wrong type code\n"); ERROR("BContinuousParameter::Unflatten wrong type code\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BContinuousParameter::Unflatten buffer is NULL\n"); ERROR("BContinuousParameter::Unflatten buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
// if the buffer is smaller than the size needed to read the // if the buffer is smaller than the size needed to read the
// signature and struct size fields, then there is a problem // signature and struct size fields, then there is a problem
if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) { if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) {
FATAL("BContinuousParameter::Unflatten size too small\n"); ERROR("BContinuousParameter::Unflatten size too small\n");
return B_ERROR; return B_ERROR;
} }
status_t status = BParameter::Unflatten(code, buffer, size); status_t status = BParameter::Unflatten(code, buffer, size);
if (status != B_OK) { if (status != B_OK) {
FATAL("BContinuousParameter::Unflatten(): BParameter::Unflatten failed\n"); ERROR("BContinuousParameter::Unflatten(): BParameter::Unflatten failed\n");
return status; return status;
} }
@@ -2020,7 +2020,7 @@ BContinuousParameter::Unflatten(type_code code, const void *buffer, ssize_t size
skip_in_buffer(&buffer, parameterSize); skip_in_buffer(&buffer, parameterSize);
if (size < (parameterSize + kAdditionalContinuousParameterSize)) { if (size < (parameterSize + kAdditionalContinuousParameterSize)) {
FATAL("BContinuousParameter::Unflatten(): buffer too small\n"); ERROR("BContinuousParameter::Unflatten(): buffer too small\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -2206,20 +2206,20 @@ BDiscreteParameter::Flatten(void *buffer, ssize_t size) const
CALLED(); CALLED();
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BDiscreteParameter::Flatten(): buffer is NULL\n"); ERROR("BDiscreteParameter::Flatten(): buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
ssize_t parameterSize = BParameter::FlattenedSize(); ssize_t parameterSize = BParameter::FlattenedSize();
if (size < FlattenedSize()) { if (size < FlattenedSize()) {
FATAL("BDiscreteParameter::Flatten(): size too small\n"); ERROR("BDiscreteParameter::Flatten(): size too small\n");
return B_NO_MEMORY; return B_NO_MEMORY;
} }
status_t status = BParameter::Flatten(buffer, size); status_t status = BParameter::Flatten(buffer, size);
if (status != B_OK) { if (status != B_OK) {
FATAL("BDiscreteParameter::Flatten(): BParameter::Flatten failed\n"); ERROR("BDiscreteParameter::Flatten(): BParameter::Flatten failed\n");
return status; return status;
} }
@@ -2247,19 +2247,19 @@ BDiscreteParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
CALLED(); CALLED();
if (!AllowsTypeCode(code)) { if (!AllowsTypeCode(code)) {
FATAL("BDiscreteParameter::Unflatten(): bad type code\n"); ERROR("BDiscreteParameter::Unflatten(): bad type code\n");
return B_BAD_TYPE; return B_BAD_TYPE;
} }
if (buffer == NULL) { if (buffer == NULL) {
FATAL("BDiscreteParameter::Unflatten(): buffer is NULL\n"); ERROR("BDiscreteParameter::Unflatten(): buffer is NULL\n");
return B_NO_INIT; return B_NO_INIT;
} }
// if the buffer is smaller than the size needed to read the // if the buffer is smaller than the size needed to read the
// signature and struct size fields, then there is a problem // signature and struct size fields, then there is a problem
if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) { if (size < static_cast<ssize_t>(sizeof(int32) + sizeof(ssize_t))) {
FATAL("BDiscreteParameter::Unflatten(): size too small\n"); ERROR("BDiscreteParameter::Unflatten(): size too small\n");
return B_ERROR; return B_ERROR;
} }
@@ -2267,7 +2267,7 @@ BDiscreteParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
status_t status = BParameter::Unflatten(code, buffer, size); status_t status = BParameter::Unflatten(code, buffer, size);
if (status != B_OK) { if (status != B_OK) {
FATAL("BDiscreteParameter::Unflatten(): BParameter::Unflatten failed\n"); ERROR("BDiscreteParameter::Unflatten(): BParameter::Unflatten failed\n");
return status; return status;
} }
@@ -2275,7 +2275,7 @@ BDiscreteParameter::Unflatten(type_code code, const void *buffer, ssize_t size)
skip_in_buffer(&buffer, parameterSize); skip_in_buffer(&buffer, parameterSize);
if (size < (parameterSize + kAdditionalDiscreteParameterSize)) { if (size < (parameterSize + kAdditionalDiscreteParameterSize)) {
FATAL("BDiscreteParameter::Unflatten(): buffer too small\n"); ERROR("BDiscreteParameter::Unflatten(): buffer too small\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
+3 -3
View File
@@ -241,7 +241,7 @@ _shared_buffer_list::RequestBufferInOtherGroups(sem_id group_reclaim_sem, media_
continue; continue;
if (info[i].reclaimed == false) { if (info[i].reclaimed == false) {
FATAL("_shared_buffer_list: Error, BBuffer %p, id = %ld not reclaimed while requesting\n", info[i].buffer, id); ERROR("_shared_buffer_list:: RequestBufferInOtherGroups BBuffer %p, id = %ld not reclaimed while requesting\n", info[i].buffer, id);
continue; continue;
} }
@@ -268,7 +268,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer)
if (info[i].id == id) { if (info[i].id == id) {
reclaimed_count++; reclaimed_count++;
if (info[i].reclaimed) { if (info[i].reclaimed) {
FATAL("_shared_buffer_list: Error, BBuffer %p, id = %ld already reclaimed\n", buffer, id); ERROR("_shared_buffer_list::RecycleBuffer, BBuffer %p, id = %ld already reclaimed\n", buffer, id);
DEBUG_ONLY(debugger("buffer already reclaimed")); DEBUG_ONLY(debugger("buffer already reclaimed"));
continue; continue;
} }
@@ -280,7 +280,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer)
return B_ERROR; return B_ERROR;
if (reclaimed_count == 0) { if (reclaimed_count == 0) {
FATAL("shared_buffer_list: Error, BBuffer %p, id = %ld NOT reclaimed\n", buffer, id); ERROR("shared_buffer_list::RecycleBuffer, BBuffer %p, id = %ld NOT reclaimed\n", buffer, id);
return B_ERROR; return B_ERROR;
} }
+2 -4
View File
@@ -147,8 +147,7 @@ void _SoundPlayNode::SetTimeSource(BTimeSource *timeSource)
void void
_SoundPlayNode::SetRunMode(run_mode mode) _SoundPlayNode::SetRunMode(run_mode mode)
{ {
CALLED(); TRACE("_SoundPlayNode::SetRunMode mode:%i\n", mode);
PRINT(("_SoundPlayNode::SetRunMode mode:%i\n", mode));
BMediaNode::SetRunMode(mode); BMediaNode::SetRunMode(mode);
} }
@@ -627,8 +626,7 @@ _SoundPlayNode::HandleDataStatus(
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent = false)
{ {
CALLED(); TRACE("_SoundPlayNode::HandleDataStatus status:%li, lateness:%li\n", event->data, lateness);
PRINT(("_SoundPlayNode::HandleDataStatus status:%li, lateness:%li\n", event->data, lateness));
switch(event->data) { switch(event->data) {
case B_DATA_NOT_AVAILABLE: case B_DATA_NOT_AVAILABLE:
break; break;
+2 -2
View File
@@ -610,9 +610,9 @@ BSoundPlayer::Init(
fmt.buffer_size = 4096; fmt.buffer_size = 4096;
if (fmt.channel_count != 1 && fmt.channel_count != 2) if (fmt.channel_count != 1 && fmt.channel_count != 2)
FATAL("BSoundPlayer: not a 1 or 2 channel audio format\n"); ERROR("BSoundPlayer: not a 1 or 2 channel audio format\n");
if (fmt.frame_rate <= 0.0f) if (fmt.frame_rate <= 0.0f)
FATAL("BSoundPlayer: framerate must be > 0\n"); ERROR("BSoundPlayer: framerate must be > 0\n");
_m_bufsize = fmt.buffer_size; _m_bufsize = fmt.buffer_size;
_m_buf = new char[_m_bufsize]; _m_buf = new char[_m_bufsize];
+18 -18
View File
@@ -80,7 +80,7 @@ BTimeSource::SnoozeUntil(bigtime_t performance_time,
bigtime_t bigtime_t
BTimeSource::Now() BTimeSource::Now()
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::Now()\n");
return PerformanceTimeFor(RealTime()); return PerformanceTimeFor(RealTime());
} }
@@ -88,7 +88,7 @@ BTimeSource::Now()
bigtime_t bigtime_t
BTimeSource::PerformanceTimeFor(bigtime_t real_time) BTimeSource::PerformanceTimeFor(bigtime_t real_time)
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::PerformanceTimeFor()\n");
bigtime_t last_perf_time; bigtime_t last_perf_time;
bigtime_t last_real_time; bigtime_t last_real_time;
float last_drift; float last_drift;
@@ -104,7 +104,7 @@ bigtime_t
BTimeSource::RealTimeFor(bigtime_t performance_time, BTimeSource::RealTimeFor(bigtime_t performance_time,
bigtime_t with_latency) bigtime_t with_latency)
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::RealTimeFor()\n");
if (fIsRealtime) { if (fIsRealtime) {
return performance_time - with_latency; return performance_time - with_latency;
@@ -124,7 +124,7 @@ BTimeSource::RealTimeFor(bigtime_t performance_time,
bool bool
BTimeSource::IsRunning() BTimeSource::IsRunning()
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::IsRunning()\n");
bool isrunning; bool isrunning;
@@ -143,7 +143,7 @@ BTimeSource::GetTime(bigtime_t *performance_time,
bigtime_t *real_time, bigtime_t *real_time,
float *drift) float *drift)
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::GetTime()\n");
if (fIsRealtime) { if (fIsRealtime) {
*performance_time = *real_time = system_time(); *performance_time = *real_time = system_time();
@@ -151,7 +151,7 @@ BTimeSource::GetTime(bigtime_t *performance_time,
return B_OK; return B_OK;
} }
// if (fBuf == 0) { // if (fBuf == 0) {
// FATAL("BTimeSource::GetTime: fBuf == 0, name %s, id %ld\n",Name(),ID()); // PRINT(1, "BTimeSource::GetTime: fBuf == 0, name %s, id %ld\n",Name(),ID());
// *performance_time = *real_time = system_time(); // *performance_time = *real_time = system_time();
// *drift = 1.0f; // *drift = 1.0f;
// return B_OK; // return B_OK;
@@ -178,7 +178,7 @@ BTimeSource::GetTime(bigtime_t *performance_time,
bigtime_t bigtime_t
BTimeSource::RealTime() BTimeSource::RealTime()
{ {
CALLED(); PRINT(8, "CALLED BTimeSource::RealTime()\n");
return system_time(); return system_time();
} }
@@ -209,7 +209,7 @@ BTimeSource::BTimeSource() :
// printf("##### BTimeSource::BTimeSource() name %s, id %ld\n", Name(), ID()); // printf("##### BTimeSource::BTimeSource() name %s, id %ld\n", Name(), ID());
if (fSlaveNodes == NULL) { if (fSlaveNodes == NULL) {
FATAL("Error: BTimeSource::BTimeSource() fSlaveNodes == NULL\n"); ERROR("BTimeSource::BTimeSource() fSlaveNodes == NULL\n");
return; return;
} }
@@ -229,7 +229,7 @@ BTimeSource::HandleMessage(int32 message,
const void *rawdata, const void *rawdata,
size_t size) size_t size)
{ {
INFO("BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID); PRINT(4, "BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID);
switch (message) { switch (message) {
case TIMESOURCE_OP: case TIMESOURCE_OP:
@@ -252,7 +252,7 @@ BTimeSource::HandleMessage(int32 message,
status_t result; status_t result;
result = TimeSourceOp(*data, NULL); result = TimeSourceOp(*data, NULL);
if (result != B_OK) { if (result != B_OK) {
FATAL("BTimeSource::HandleMessage: TimeSourceOp failed\n"); ERROR("BTimeSource::HandleMessage: TimeSourceOp failed\n");
} }
return B_OK; return B_OK;
} }
@@ -282,7 +282,7 @@ BTimeSource::PublishTime(bigtime_t performance_time,
{ {
TRACE_TIMESOURCE("BTimeSource::PublishTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), performance_time, real_time, drift); TRACE_TIMESOURCE("BTimeSource::PublishTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), performance_time, real_time, drift);
if (0 == fBuf) { if (0 == fBuf) {
FATAL("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID()); ERROR("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID());
fStarted = true; fStarted = true;
return; return;
} }
@@ -383,13 +383,13 @@ BTimeSource::BTimeSource(media_node_id id) :
sprintf(name, "__timesource_buf_%ld", id); sprintf(name, "__timesource_buf_%ld", id);
area = find_area(name); area = find_area(name);
if (area <= 0) { if (area <= 0) {
FATAL("BTimeSource::BTimeSource couldn't find area, node %ld\n", id); ERROR("BTimeSource::BTimeSource couldn't find area, node %ld\n", id);
return; return;
} }
sprintf(name, "__cloned_timesource_buf_%ld", id); sprintf(name, "__cloned_timesource_buf_%ld", id);
fArea = clone_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area); fArea = clone_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
if (fArea <= 0) { if (fArea <= 0) {
FATAL("BTimeSource::BTimeSource couldn't clone area, node %ld\n", id); ERROR("BTimeSource::BTimeSource couldn't clone area, node %ld\n", id);
return; return;
} }
} }
@@ -405,7 +405,7 @@ BTimeSource::FinishCreate()
sprintf(name, "__timesource_buf_%ld", ID()); sprintf(name, "__timesource_buf_%ld", ID());
fArea = create_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_PAGE_SIZE, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA); fArea = create_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_PAGE_SIZE, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
if (fArea <= 0) { if (fArea <= 0) {
FATAL("BTimeSource::BTimeSource couldn't create area, node %ld\n", ID()); ERROR("BTimeSource::BTimeSource couldn't create area, node %ld\n", ID());
fBuf = NULL; fBuf = NULL;
return; return;
} }
@@ -457,7 +457,7 @@ BTimeSource::DirectAddMe(const media_node &node)
BAutolock lock(fSlaveNodes->locker); BAutolock lock(fSlaveNodes->locker);
if (fSlaveNodes->count == SLAVE_NODES_COUNT) { if (fSlaveNodes->count == SLAVE_NODES_COUNT) {
FATAL("BTimeSource::DirectAddMe out of slave node slots\n"); ERROR("BTimeSource::DirectAddMe out of slave node slots\n");
return; return;
} }
for (int i = 0; i < SLAVE_NODES_COUNT; i++) { for (int i = 0; i < SLAVE_NODES_COUNT; i++) {
@@ -476,7 +476,7 @@ BTimeSource::DirectAddMe(const media_node &node)
return; return;
} }
} }
FATAL("BTimeSource::DirectAddMe failed\n"); ERROR("BTimeSource::DirectAddMe failed\n");
} }
void void
@@ -488,7 +488,7 @@ BTimeSource::DirectRemoveMe(const media_node &node)
BAutolock lock(fSlaveNodes->locker); BAutolock lock(fSlaveNodes->locker);
if (fSlaveNodes->count == 0) { if (fSlaveNodes->count == 0) {
FATAL("BTimeSource::DirectRemoveMe no slots used\n"); ERROR("BTimeSource::DirectRemoveMe no slots used\n");
return; return;
} }
for (int i = 0; i < SLAVE_NODES_COUNT; i++) { for (int i = 0; i < SLAVE_NODES_COUNT; i++) {
@@ -507,7 +507,7 @@ BTimeSource::DirectRemoveMe(const media_node &node)
return; return;
} }
} }
FATAL("BTimeSource::DirectRemoveMe failed\n"); ERROR("BTimeSource::DirectRemoveMe failed\n");
} }
void void
+1 -1
View File
@@ -85,6 +85,6 @@ SystemTimeSourceObject::SystemTimeSourceObject(const media_node &node)
/* virtual */ status_t /* virtual */ status_t
SystemTimeSourceObject::DeleteHook(BMediaNode * node) SystemTimeSourceObject::DeleteHook(BMediaNode * node)
{ {
FATAL("SystemTimeSourceObject::DeleteHook called\n"); ERROR("SystemTimeSourceObject::DeleteHook called\n");
return B_ERROR; return B_ERROR;
} }
+5 -5
View File
@@ -40,11 +40,11 @@ TimeSourceObjectManager::~TimeSourceObjectManager()
// force unloading all currently loaded // force unloading all currently loaded
BTimeSource **pts; BTimeSource **pts;
for (fMap->Rewind(); fMap->GetNext(&pts); ) { for (fMap->Rewind(); fMap->GetNext(&pts); ) {
FATAL("Forcing release of TimeSource id %ld...\n", (*pts)->ID()); PRINT(1, "Forcing release of TimeSource id %ld...\n", (*pts)->ID());
int debugcnt = 0; int debugcnt = 0;
while ((*pts)->Release() != NULL) while ((*pts)->Release() != NULL)
debugcnt++; debugcnt++;
FATAL("Forcing release of TimeSource done, released %d times\n", debugcnt); PRINT(1, "Forcing release of TimeSource done, released %d times\n", debugcnt);
} }
delete fMap; delete fMap;
@@ -112,7 +112,7 @@ TimeSourceObjectManager::GetTimeSource(const media_node &node)
rv = BMediaRoster::Roster()->GetNodeFor(node.node, &clone); rv = BMediaRoster::Roster()->GetNodeFor(node.node, &clone);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("TimeSourceObjectManager::GetTimeSource, GetNodeFor %ld failed\n", node.node); ERROR("TimeSourceObjectManager::GetTimeSource, GetNodeFor %ld failed\n", node.node);
return NULL; return NULL;
} }
@@ -143,13 +143,13 @@ TimeSourceObjectManager::ObjectDeleted(BTimeSource *timesource)
bool b; bool b;
b = fMap->Remove(timesource->ID()); b = fMap->Remove(timesource->ID());
if (!b) { if (!b) {
FATAL("TimeSourceObjectManager::ObjectDeleted, Remove failed\n"); ERROR("TimeSourceObjectManager::ObjectDeleted, Remove failed\n");
} }
status_t rv; status_t rv;
rv = BMediaRoster::Roster()->ReleaseNode(timesource->Node()); rv = BMediaRoster::Roster()->ReleaseNode(timesource->Node());
if (rv != B_OK) { if (rv != B_OK) {
FATAL("TimeSourceObjectManager::ObjectDeleted, ReleaseNode failed\n"); ERROR("TimeSourceObjectManager::ObjectDeleted, ReleaseNode failed\n");
} }
} }
+1 -1
View File
@@ -572,7 +572,7 @@ _event_queue_imp::CleanupEvent(media_timed_event *event)
if (fCleanupHook) if (fCleanupHook)
(*fCleanupHook)(event,fCleanupHookContext); (*fCleanupHook)(event,fCleanupHookContext);
} else { } else {
FATAL("BTimedEventQueue cleanup unhandled! type = %ld, cleanup = %ld\n", event->type, event->cleanup); ERROR("BTimedEventQueue cleanup unhandled! type = %ld, cleanup = %ld\n", event->type, event->cleanup);
} }
} }
+3 -3
View File
@@ -93,7 +93,7 @@ BTrackReader::BTrackReader(BFile *file, media_raw_audio_format const &format) :
int count = fMediaFile->CountTracks(); int count = fMediaFile->CountTracks();
if (count == 0) { if (count == 0) {
FATAL("BTrackReader: no tracks in file\n"); ERROR("BTrackReader: no tracks in file\n");
return; return;
} }
@@ -114,7 +114,7 @@ BTrackReader::BTrackReader(BFile *file, media_raw_audio_format const &format) :
fMediaFile->ReleaseTrack(track); fMediaFile->ReleaseTrack(track);
} }
if (audiotrack == 0) { if (audiotrack == 0) {
FATAL("BTrackReader: no audio track in file\n"); ERROR("BTrackReader: no audio track in file\n");
return; return;
} }
@@ -165,7 +165,7 @@ BTrackReader::SetToTrack(BMediaTrack *track)
} }
//we have failed //we have failed
FATAL("BTrackReader::SetToTrack failed\n"); ERROR("BTrackReader::SetToTrack failed\n");
} }
BTrackReader::~BTrackReader() BTrackReader::~BTrackReader()
+3 -3
View File
@@ -75,7 +75,7 @@ status_t AppManager::RegisterTeam(team_id team, BMessenger messenger)
BAutolock lock(fLocker); BAutolock lock(fLocker);
TRACE("AppManager::RegisterTeam %ld\n", team); TRACE("AppManager::RegisterTeam %ld\n", team);
if (HasTeam(team)) { if (HasTeam(team)) {
FATAL("Erorr: AppManager::RegisterTeam: team %ld already registered\n", team); ERROR("AppManager::RegisterTeam: team %ld already registered\n", team);
return B_ERROR; return B_ERROR;
} }
App app; App app;
@@ -126,12 +126,12 @@ void AppManager::RestartAddonServer()
restart_tries = 0; restart_tries = 0;
} }
if (restart_tries < 5) { if (restart_tries < 5) {
FATAL("AppManager: Restarting media_addon_server...\n"); PRINT(1, "AppManager: Restarting media_addon_server...\n");
// XXX fixme. We should wait until it is *really* gone // XXX fixme. We should wait until it is *really* gone
snooze(5000000); snooze(5000000);
StartAddonServer(); StartAddonServer();
} else { } else {
FATAL("AppManager: media_addon_server crashed too often, not restarted\n"); PRINT(1, "AppManager: media_addon_server crashed too often, not restarted\n");
} }
} }
+8 -8
View File
@@ -41,7 +41,7 @@ BufferManager::RegisterBuffer(team_id teamid, media_buffer_id bufferid,
buffer_info *info; buffer_info *info;
if (!fBufferInfoMap->Get(bufferid, &info)) { if (!fBufferInfoMap->Get(bufferid, &info)) {
FATAL("failed to register buffer! team = %ld, bufferid = %ld\n", teamid, bufferid); ERROR("failed to register buffer! team = %ld, bufferid = %ld\n", teamid, bufferid);
return B_ERROR; return B_ERROR;
} }
@@ -66,7 +66,7 @@ BufferManager::RegisterBuffer(team_id teamid, size_t size, int32 flags, size_t o
newarea = clone_area("media_server cloned buffer", &adr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area); newarea = clone_area("media_server cloned buffer", &adr, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
if (newarea <= B_OK) { if (newarea <= B_OK) {
FATAL("RegisterBuffer: failed to clone buffer! error = %#lx, team = %ld, areaid = %ld, offset = %ld, size = %ld\n", newarea, teamid, area, offset, size); ERROR("RegisterBuffer: failed to clone buffer! error = %#lx, team = %ld, areaid = %ld, offset = %ld, size = %ld\n", newarea, teamid, area, offset, size);
return B_ERROR; return B_ERROR;
} }
@@ -98,18 +98,18 @@ BufferManager::UnregisterBuffer(team_id teamid, media_buffer_id bufferid)
int index; int index;
if (!fBufferInfoMap->Get(bufferid, &info)) { if (!fBufferInfoMap->Get(bufferid, &info)) {
FATAL("UnregisterBuffer: failed to unregister buffer! team = %ld, bufferid = %ld\n", teamid, bufferid); ERROR("UnregisterBuffer: failed to unregister buffer! team = %ld, bufferid = %ld\n", teamid, bufferid);
return B_ERROR; return B_ERROR;
} }
index = info->teams.Find(teamid); index = info->teams.Find(teamid);
if (index < 0) { if (index < 0) {
FATAL("UnregisterBuffer: failed to find team = %ld belonging to bufferid = %ld\n", teamid, bufferid); ERROR("UnregisterBuffer: failed to find team = %ld belonging to bufferid = %ld\n", teamid, bufferid);
return B_ERROR; return B_ERROR;
} }
if (!info->teams.Remove(index)) { if (!info->teams.Remove(index)) {
FATAL("UnregisterBuffer: failed to remove team = %ld from bufferid = %ld\n", teamid, bufferid); ERROR("UnregisterBuffer: failed to remove team = %ld from bufferid = %ld\n", teamid, bufferid);
return B_ERROR; return B_ERROR;
} }
TRACE("UnregisterBuffer: team = %ld removed from bufferid = %ld\n", teamid, bufferid); TRACE("UnregisterBuffer: team = %ld removed from bufferid = %ld\n", teamid, bufferid);
@@ -117,7 +117,7 @@ BufferManager::UnregisterBuffer(team_id teamid, media_buffer_id bufferid)
if (info->teams.IsEmpty()) { if (info->teams.IsEmpty()) {
if (!fBufferInfoMap->Remove(bufferid)) { if (!fBufferInfoMap->Remove(bufferid)) {
FATAL("UnregisterBuffer: failed to remove bufferid = %ld\n", bufferid); ERROR("UnregisterBuffer: failed to remove bufferid = %ld\n", bufferid);
return B_ERROR; return B_ERROR;
} }
@@ -139,12 +139,12 @@ BufferManager::CleanupTeam(team_id team)
team_id *otherteam; team_id *otherteam;
for (info->teams.Rewind(); info->teams.GetNext(&otherteam); ) { for (info->teams.Rewind(); info->teams.GetNext(&otherteam); ) {
if (team == *otherteam) { if (team == *otherteam) {
FATAL("BufferManager::CleanupTeam: removing team %ld from buffer id %ld\n", team, info->id); PRINT(1, "BufferManager::CleanupTeam: removing team %ld from buffer id %ld\n", team, info->id);
info->teams.RemoveCurrent(); info->teams.RemoveCurrent();
} }
} }
if (info->teams.IsEmpty()) { if (info->teams.IsEmpty()) {
FATAL("BufferManager::CleanupTeam: removing buffer id %ld that has no teams\n", info->id); PRINT(1, "BufferManager::CleanupTeam: removing buffer id %ld that has no teams\n", info->id);
fBufferInfoMap->RemoveCurrent(); fBufferInfoMap->RemoveCurrent();
} }
} }
+6 -6
View File
@@ -70,7 +70,7 @@ DefaultManager::Set(node_type type, const media_node *node, const dormant_node_i
default: default:
{ {
FATAL("DefaultManager::Set Error: called with unknown type %d\n", type); ERROR("DefaultManager::Set Error: called with unknown type %d\n", type);
return B_ERROR; return B_ERROR;
} }
} }
@@ -131,7 +131,7 @@ DefaultManager::Get(media_node_id *nodeid, char *input_name, int32 *inputid, nod
default: default:
{ {
FATAL("DefaultManager::Get Error: called with unknown type %d\n", type); ERROR("DefaultManager::Get Error: called with unknown type %d\n", type);
return B_ERROR; return B_ERROR;
} }
} }
@@ -182,9 +182,9 @@ DefaultManager::RescanThread()
if (!fMixerConnected && fAudioMixer != -1 && fPhysicalAudioOut != -1) { if (!fMixerConnected && fAudioMixer != -1 && fPhysicalAudioOut != -1) {
fMixerConnected = B_OK == ConnectMixerToOutput(); fMixerConnected = B_OK == ConnectMixerToOutput();
if (!fMixerConnected) if (!fMixerConnected)
FATAL("DefaultManager: failed to connect mixer and soundcard\n"); ERROR("DefaultManager: failed to connect mixer and soundcard\n");
} else { } else {
FATAL("DefaultManager: Did not try to connect mixer and soundcard\n"); ERROR("DefaultManager: Did not try to connect mixer and soundcard\n");
} }
printf("DefaultManager::RescanThread() leave\n"); printf("DefaultManager::RescanThread() leave\n");
@@ -417,7 +417,7 @@ DefaultManager::ConnectMixerToOutput()
case 0: case 0:
printf("DefaultManager: Trying connect in native format\n"); printf("DefaultManager: Trying connect in native format\n");
if (B_OK != roster->GetFormatFor(input, &format)) { if (B_OK != roster->GetFormatFor(input, &format)) {
FATAL("DefaultManager: GetFormatFor failed\n"); ERROR("DefaultManager: GetFormatFor failed\n");
continue; continue;
} }
break; break;
@@ -456,7 +456,7 @@ DefaultManager::ConnectMixerToOutput()
break; break;
} }
if (rv != B_OK) { if (rv != B_OK) {
FATAL("DefaultManager: connect failed\n"); ERROR("DefaultManager: connect failed\n");
goto finish; goto finish;
} }
+30 -30
View File
@@ -109,15 +109,15 @@ NodeManager::UnregisterNode(media_addon_id *addonid, int32 *flavorid, media_node
TRACE("NodeManager::UnregisterNode enter: node %ld, team %ld\n", nodeid, team); TRACE("NodeManager::UnregisterNode enter: node %ld, team %ld\n", nodeid, team);
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::UnregisterNode: Error: couldn't finde node %ld (team %ld)\n", nodeid, team); ERROR("NodeManager::UnregisterNode: couldn't finde node %ld (team %ld)\n", nodeid, team);
return B_ERROR; return B_ERROR;
} }
if (rn->team != team) { if (rn->team != team) {
FATAL("!!! NodeManager::UnregisterNode: Error: team %ld tried to unregister node %ld, but it was instantiated by team %ld\n", team, nodeid, rn->team); ERROR("NodeManager::UnregisterNode: team %ld tried to unregister node %ld, but it was instantiated by team %ld\n", team, nodeid, rn->team);
return B_ERROR; return B_ERROR;
} }
if (rn->globalrefcount != 1) { if (rn->globalrefcount != 1) {
FATAL("!!! NodeManager::UnregisterNode: Error: node %ld, team %ld, globalrefcount %ld\n", nodeid, team, rn->globalrefcount); ERROR("NodeManager::UnregisterNode: node %ld, team %ld has globalrefcount %ld (should be 1)\n", nodeid, team, rn->globalrefcount);
//return B_ERROR; //return B_ERROR;
} }
*addonid = rn->addon_id; *addonid = rn->addon_id;
@@ -138,7 +138,7 @@ NodeManager::IncrementGlobalRefCount(media_node_id nodeid, team_id team)
TRACE("NodeManager::IncrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team); TRACE("NodeManager::IncrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::IncrementGlobalRefCount: Error: node %ld not found\n", nodeid); ERROR("NodeManager::IncrementGlobalRefCount: node %ld not found\n", nodeid);
return B_ERROR; return B_ERROR;
} }
int32 *count; int32 *count;
@@ -167,7 +167,7 @@ NodeManager::DecrementGlobalRefCount(media_node_id nodeid, team_id team)
TRACE("NodeManager::DecrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team); TRACE("NodeManager::DecrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld not found\n", nodeid); ERROR("NodeManager::DecrementGlobalRefCount: node %ld not found\n", nodeid);
return B_ERROR; return B_ERROR;
} }
int32 *count; int32 *count;
@@ -184,7 +184,7 @@ NodeManager::DecrementGlobalRefCount(media_node_id nodeid, team_id team)
team = addon_server_team; //redirect! team = addon_server_team; //redirect!
// the count variable was already redirected in if() statement above. // the count variable was already redirected in if() statement above.
} else { } else {
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld has no team %ld references\n", nodeid, team); ERROR("NodeManager::DecrementGlobalRefCount: node %ld has no team %ld references\n", nodeid, team);
return B_ERROR; return B_ERROR;
} }
} }
@@ -216,12 +216,12 @@ NodeManager::SetNodeCreator(media_node_id nodeid, team_id creator)
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("NodeManager::SetNodeCreator: Error: node %ld not found\n", nodeid); ERROR("NodeManager::SetNodeCreator: node %ld not found\n", nodeid);
return B_ERROR; return B_ERROR;
} }
if (rn->creator != -1) { if (rn->creator != -1) {
FATAL("NodeManager::SetNodeCreator: Error: node %ld is already assigned creator %ld\n", nodeid, rn->creator); ERROR("NodeManager::SetNodeCreator: node %ld is already assigned creator %ld\n", nodeid, rn->creator);
return B_ERROR; return B_ERROR;
} }
@@ -240,14 +240,14 @@ NodeManager::FinalReleaseNode(media_node_id nodeid)
TRACE("NodeManager::FinalReleaseNode enter: node %ld\n", nodeid); TRACE("NodeManager::FinalReleaseNode enter: node %ld\n", nodeid);
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("NodeManager::FinalReleaseNode: Error: node %ld not found\n", nodeid); ERROR("NodeManager::FinalReleaseNode: node %ld not found\n", nodeid);
return; return;
} }
node_final_release_command cmd; node_final_release_command cmd;
rv = SendToPort(rn->port, NODE_FINAL_RELEASE, &cmd, sizeof(cmd)); rv = SendToPort(rn->port, NODE_FINAL_RELEASE, &cmd, sizeof(cmd));
if (rv != B_OK) { if (rv != B_OK) {
FATAL("NodeManager::FinalReleaseNode: Error: can't send command to node %ld\n", nodeid); ERROR("NodeManager::FinalReleaseNode: can't send command to node %ld\n", nodeid);
return; return;
} }
} }
@@ -262,13 +262,13 @@ NodeManager::GetCloneForId(media_node *node, media_node_id nodeid, team_id team)
TRACE("NodeManager::GetCloneForId enter: node %ld team %ld\n", nodeid, team); TRACE("NodeManager::GetCloneForId enter: node %ld team %ld\n", nodeid, team);
if (B_OK != IncrementGlobalRefCount(nodeid, team)) { if (B_OK != IncrementGlobalRefCount(nodeid, team)) {
FATAL("!!! NodeManager::GetCloneForId: Error: couldn't increment ref count, node %ld team %ld\n", nodeid, team); ERROR("NodeManager::GetCloneForId: couldn't increment ref count, node %ld team %ld\n", nodeid, team);
return B_ERROR; return B_ERROR;
} }
b = fRegisteredNodeMap->Get(nodeid, &rn); b = fRegisteredNodeMap->Get(nodeid, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::GetCloneForId: Error: node %ld not found\n", nodeid); ERROR("NodeManager::GetCloneForId: node %ld not found\n", nodeid);
DecrementGlobalRefCount(nodeid, team); DecrementGlobalRefCount(nodeid, team);
return B_ERROR; return B_ERROR;
} }
@@ -297,7 +297,7 @@ NodeManager::GetClone(media_node *node, char *input_name, int32 *input_id, node_
status = GetDefaultNode(&id, input_name, input_id, type); status = GetDefaultNode(&id, input_name, input_id, type);
if (status != B_OK) { if (status != B_OK) {
FATAL("NodeManager::GetClone Error: couldn't GetDefaultNode, team %ld, type %d (%s)\n", team, type, get_node_type(type)); ERROR("NodeManager::GetClone: couldn't GetDefaultNode, team %ld, type %d (%s)\n", team, type, get_node_type(type));
*node = media_node::null; *node = media_node::null;
return status; return status;
} }
@@ -305,7 +305,7 @@ NodeManager::GetClone(media_node *node, char *input_name, int32 *input_id, node_
status = GetCloneForId(node, id, team); status = GetCloneForId(node, id, team);
if (status != B_OK) { if (status != B_OK) {
FATAL("NodeManager::GetClone Error: couldn't GetCloneForId, id %ld, team %ld, type %d (%s)\n", id, team, type, get_node_type(type)); ERROR("NodeManager::GetClone: couldn't GetCloneForId, id %ld, team %ld, type %d (%s)\n", id, team, type, get_node_type(type));
*node = media_node::null; *node = media_node::null;
return status; return status;
} }
@@ -323,7 +323,7 @@ NodeManager::ReleaseNode(const media_node &node, team_id team)
BAutolock lock(fLocker); BAutolock lock(fLocker);
TRACE("NodeManager::ReleaseNode enter: node %ld team %ld\n", node.node, team); TRACE("NodeManager::ReleaseNode enter: node %ld team %ld\n", node.node, team);
if (B_OK != DecrementGlobalRefCount(node.node, team)) { if (B_OK != DecrementGlobalRefCount(node.node, team)) {
FATAL("!!! NodeManager::ReleaseNode: Error: couldn't decrement node %ld team %ld ref count\n", node.node, team); ERROR("NodeManager::ReleaseNode: couldn't decrement node %ld team %ld ref count\n", node.node, team);
} }
TRACE("NodeManager::ReleaseNode leave: node %ld team %ld\n", node.node, team); TRACE("NodeManager::ReleaseNode leave: node %ld team %ld\n", node.node, team);
return B_OK; return B_OK;
@@ -338,7 +338,7 @@ NodeManager::PublishInputs(const media_node &node, const media_input *inputs, in
bool b; bool b;
b = fRegisteredNodeMap->Get(node.node, &rn); b = fRegisteredNodeMap->Get(node.node, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::PublishInputs: Error: node %ld not found\n", node.node); ERROR("NodeManager::PublishInputs: node %ld not found\n", node.node);
return B_ERROR; return B_ERROR;
} }
rn->inputlist.MakeEmpty(); rn->inputlist.MakeEmpty();
@@ -356,7 +356,7 @@ NodeManager::PublishOutputs(const media_node &node, const media_output *outputs,
bool b; bool b;
b = fRegisteredNodeMap->Get(node.node, &rn); b = fRegisteredNodeMap->Get(node.node, &rn);
if (!b) { if (!b) {
FATAL("!!! NodeManager::PublishOutputs: Error: node %ld not found\n", node.node); ERROR("NodeManager::PublishOutputs: node %ld not found\n", node.node);
return B_ERROR; return B_ERROR;
} }
rn->outputlist.MakeEmpty(); rn->outputlist.MakeEmpty();
@@ -394,7 +394,7 @@ NodeManager::FindNodeId(media_node_id *nodeid, port_id port)
} }
} }
} }
FATAL("!!! NodeManager::FindNodeId failed, port %ld\n", port); ERROR("NodeManager::FindNodeId failed, port %ld\n", port);
return B_ERROR; return B_ERROR;
} }
@@ -419,7 +419,7 @@ NodeManager::GetDormantNodeInfo(dormant_node_info *node_info, const media_node &
return B_OK; return B_OK;
} }
} }
FATAL("!!! NodeManager::GetDormantNodeInfo failed, node %ld\n", node.node); ERROR("NodeManager::GetDormantNodeInfo failed, node %ld\n", node.node);
return B_ERROR; return B_ERROR;
} }
@@ -439,7 +439,7 @@ NodeManager::GetLiveNodeInfo(live_node_info *live_info, const media_node &node)
return B_OK; return B_OK;
} }
} }
FATAL("!!! NodeManager::GetLiveNodeInfo failed, node %ld\n", node.node); ERROR("NodeManager::GetLiveNodeInfo failed, node %ld\n", node.node);
return B_ERROR; return B_ERROR;
} }
@@ -605,7 +605,7 @@ NodeManager::AddDormantFlavorInfo(const dormant_flavor_info &dfi)
if (dafi->AddonID != dfi.node_info.addon || dafi->AddonFlavorID != dfi.node_info.flavor_id) if (dafi->AddonID != dfi.node_info.addon || dafi->AddonFlavorID != dfi.node_info.flavor_id)
continue; continue;
if (dafi->InfoValid) { if (dafi->InfoValid) {
FATAL("NodeManager::AddDormantFlavorInfo, addon-id %ld, flavor-id %ld does already exist\n", dafi->Info.node_info.addon, dafi->Info.node_info.flavor_id); ERROR("NodeManager::AddDormantFlavorInfo, addon-id %ld, flavor-id %ld does already exist\n", dafi->Info.node_info.addon, dafi->Info.node_info.flavor_id);
} }
TRACE("NodeManager::AddDormantFlavorInfo, updating addon-id %ld, flavor-id %ld\n", dafi->Info.node_info.addon, dafi->Info.node_info.flavor_id); TRACE("NodeManager::AddDormantFlavorInfo, updating addon-id %ld, flavor-id %ld\n", dafi->Info.node_info.addon, dafi->Info.node_info.flavor_id);
dafi->MaxInstancesCount = dfi.possible_count > 0 ? dfi.possible_count : 0x7fffffff; dafi->MaxInstancesCount = dfi.possible_count > 0 ? dfi.possible_count : 0x7fffffff;
@@ -669,7 +669,7 @@ NodeManager::IncrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl
continue; continue;
if (dafi->GlobalInstancesCount >= dafi->MaxInstancesCount) { if (dafi->GlobalInstancesCount >= dafi->MaxInstancesCount) {
FATAL("NodeManager::IncrementAddonFlavorInstancesCount addonid %ld, flavorid %ld maximum (or more) instances already exist\n", addonid, flavorid); ERROR("NodeManager::IncrementAddonFlavorInstancesCount addonid %ld, flavorid %ld maximum (or more) instances already exist\n", addonid, flavorid);
return B_ERROR; // maximum (or more) instances already exist return B_ERROR; // maximum (or more) instances already exist
} }
@@ -685,7 +685,7 @@ NodeManager::IncrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl
dafi->GlobalInstancesCount += 1; dafi->GlobalInstancesCount += 1;
return B_OK; return B_OK;
} }
FATAL("NodeManager::IncrementAddonFlavorInstancesCount addonid %ld, flavorid %ld not found\n", addonid, flavorid); ERROR("NodeManager::IncrementAddonFlavorInstancesCount addonid %ld, flavorid %ld not found\n", addonid, flavorid);
return B_ERROR; return B_ERROR;
} }
@@ -703,7 +703,7 @@ NodeManager::DecrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl
int32 *count; int32 *count;
b = dafi->TeamInstancesCount.Get(team, &count); b = dafi->TeamInstancesCount.Get(team, &count);
if (!b) { if (!b) {
FATAL("NodeManager::DecrementAddonFlavorInstancesCount addonid %ld, flavorid %ld team %ld has no references\n", addonid, flavorid, team); ERROR("NodeManager::DecrementAddonFlavorInstancesCount addonid %ld, flavorid %ld team %ld has no references\n", addonid, flavorid, team);
return B_ERROR; return B_ERROR;
} }
*count -= 1; *count -= 1;
@@ -715,7 +715,7 @@ NodeManager::DecrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl
dafi->GlobalInstancesCount -= 1; dafi->GlobalInstancesCount -= 1;
return B_OK; return B_OK;
} }
FATAL("NodeManager::DecrementAddonFlavorInstancesCount addonid %ld, flavorid %ld not found\n", addonid, flavorid); ERROR("NodeManager::DecrementAddonFlavorInstancesCount addonid %ld, flavorid %ld not found\n", addonid, flavorid);
return B_ERROR; return B_ERROR;
} }
@@ -851,7 +851,7 @@ NodeManager::CleanupTeam(team_id team)
fDefaultManager->CleanupTeam(team); fDefaultManager->CleanupTeam(team);
FATAL("NodeManager::CleanupTeam: team %ld\n", team); PRINT(1, "NodeManager::CleanupTeam: team %ld\n", team);
// XXX send notifications after removing nodes // XXX send notifications after removing nodes
@@ -867,7 +867,7 @@ NodeManager::CleanupTeam(team_id team)
} }
// if the team hosting this node is gone, remove node from database // if the team hosting this node is gone, remove node from database
if (rn->team == team) { if (rn->team == team) {
FATAL("NodeManager::CleanupTeam: removing node id %ld, team %ld\n", rn->nodeid, team); PRINT(1, "NodeManager::CleanupTeam: removing node id %ld, team %ld\n", rn->nodeid, team);
fRegisteredNodeMap->RemoveCurrent(); fRegisteredNodeMap->RemoveCurrent();
continue; continue;
} }
@@ -877,14 +877,14 @@ NodeManager::CleanupTeam(team_id team)
for (rn->teamrefcount.Rewind(); rn->teamrefcount.GetNext(&prefcount); ) { for (rn->teamrefcount.Rewind(); rn->teamrefcount.GetNext(&prefcount); ) {
rn->teamrefcount.GetCurrentKey(&pteam); rn->teamrefcount.GetCurrentKey(&pteam);
if (*pteam == team) { if (*pteam == team) {
FATAL("NodeManager::CleanupTeam: removing %ld refs from node id %ld, team %ld\n", *prefcount, rn->nodeid, team); PRINT(1, "NodeManager::CleanupTeam: removing %ld refs from node id %ld, team %ld\n", *prefcount, rn->nodeid, team);
rn->teamrefcount.RemoveCurrent(); rn->teamrefcount.RemoveCurrent();
break; break;
} }
} }
// if the team refcount is now empty, also remove the node // if the team refcount is now empty, also remove the node
if (rn->teamrefcount.IsEmpty()) { if (rn->teamrefcount.IsEmpty()) {
FATAL("NodeManager::CleanupTeam: removing node id %ld that has no teams\n", rn->nodeid); PRINT(1, "NodeManager::CleanupTeam: removing node id %ld that has no teams\n", rn->nodeid);
fRegisteredNodeMap->RemoveCurrent(); fRegisteredNodeMap->RemoveCurrent();
} }
} }
@@ -896,7 +896,7 @@ NodeManager::CleanupTeam(team_id team)
int32 *count; int32 *count;
b = dafi->TeamInstancesCount.Get(team, &count); b = dafi->TeamInstancesCount.Get(team, &count);
if (b) { if (b) {
FATAL("NodeManager::CleanupTeam: removing %ld instances from addon %ld, flavor %ld\n", *count, dafi->AddonID, dafi->AddonFlavorID); PRINT(1, "NodeManager::CleanupTeam: removing %ld instances from addon %ld, flavor %ld\n", *count, dafi->AddonID, dafi->AddonFlavorID);
dafi->GlobalInstancesCount -= *count; dafi->GlobalInstancesCount -= *count;
if (dafi->GlobalInstancesCount < 0) // avoid underflow if (dafi->GlobalInstancesCount < 0) // avoid underflow
dafi->GlobalInstancesCount = 0; dafi->GlobalInstancesCount = 0;
+1 -1
View File
@@ -245,7 +245,7 @@ NotificationManager::CleanupTeam(team_id team)
} }
if (debugcount != 0) if (debugcount != 0)
FATAL("NotificationManager::CleanupTeam: removed %d notifications for team %ld\n", debugcount, team); ERROR("NotificationManager::CleanupTeam: removed %d notifications for team %ld\n", debugcount, team);
fLocker->Unlock(); fLocker->Unlock();
} }
+4 -4
View File
@@ -299,7 +299,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size)
size = ((reply.count * sizeof(live_node_info)) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); size = ((reply.count * sizeof(live_node_info)) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
reply.area = create_area("get live nodes", reinterpret_cast<void **>(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); reply.area = create_area("get live nodes", reinterpret_cast<void **>(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (reply.area < B_OK) { if (reply.area < B_OK) {
FATAL("SERVER_GET_LIVE_NODES: failed to create area, error %#lx\n", reply.area); ERROR("SERVER_GET_LIVE_NODES: failed to create area, error %#lx\n", reply.area);
reply.count = 0; reply.count = 0;
rv = B_ERROR; rv = B_ERROR;
} else { } else {
@@ -360,7 +360,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size)
area_id clone; area_id clone;
clone = clone_area("media_inputs clone", reinterpret_cast<void **>(&inputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); clone = clone_area("media_inputs clone", reinterpret_cast<void **>(&inputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area);
if (clone < B_OK) { if (clone < B_OK) {
FATAL("SERVER_PUBLISH_INPUTS: failed to clone area, error %#lx\n", clone); ERROR("SERVER_PUBLISH_INPUTS: failed to clone area, error %#lx\n", clone);
rv = B_ERROR; rv = B_ERROR;
} else { } else {
rv = gNodeManager->PublishInputs(request->node, inputs, request->count); rv = gNodeManager->PublishInputs(request->node, inputs, request->count);
@@ -382,7 +382,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size)
area_id clone; area_id clone;
clone = clone_area("media_outputs clone", reinterpret_cast<void **>(&outputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); clone = clone_area("media_outputs clone", reinterpret_cast<void **>(&outputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area);
if (clone < B_OK) { if (clone < B_OK) {
FATAL("SERVER_PUBLISH_OUTPUTS: failed to clone area, error %#lx\n", clone); ERROR("SERVER_PUBLISH_OUTPUTS: failed to clone area, error %#lx\n", clone);
rv = B_ERROR; rv = B_ERROR;
} else { } else {
rv = gNodeManager->PublishOutputs(request->node, outputs, request->count); rv = gNodeManager->PublishOutputs(request->node, outputs, request->count);
@@ -426,7 +426,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size)
server_get_instances_for_reply reply; server_get_instances_for_reply reply;
rv = gNodeManager->GetInstances(reply.node_id, &reply.count, min_c(request->maxcount, MAX_NODE_ID), request->addon_id, request->addon_flavor_id); rv = gNodeManager->GetInstances(reply.node_id, &reply.count, min_c(request->maxcount, MAX_NODE_ID), request->addon_id, request->addon_flavor_id);
if (reply.count == MAX_NODE_ID && request->maxcount > MAX_NODE_ID) { // XXX might be fixed by using an area if (reply.count == MAX_NODE_ID && request->maxcount > MAX_NODE_ID) { // XXX might be fixed by using an area
FATAL("SERVER_GET_INSTANCES_FOR: WARNING! returning possibly truncated list of node id's\n"); PRINT(1, "Warning: SERVER_GET_INSTANCES_FOR: returning possibly truncated list of node id's\n");
} }
request->SendReply(rv, &reply, sizeof(reply)); request->SendReply(rv, &reply, sizeof(reply));
break; break;
+13 -13
View File
@@ -145,7 +145,7 @@ MediaAddonServer::HandleMessage(int32 code, const void *data, size_t size)
BMediaAddOn *addon; BMediaAddOn *addon;
addon = _DormantNodeManager->GetAddon(command->addonid); addon = _DormantNodeManager->GetAddon(command->addonid);
if (!addon) { if (!addon) {
FATAL("rescan flavors: Can't find a addon object for id %d\n",(int)command->addonid); ERROR("rescan flavors: Can't find a addon object for id %d\n",(int)command->addonid);
break; break;
} }
ScanAddOnFlavors(addon); ScanAddOnFlavors(addon);
@@ -154,7 +154,7 @@ MediaAddonServer::HandleMessage(int32 code, const void *data, size_t size)
} }
default: default:
FATAL("media_addon_server: received unknown message code %#08lx\n",code); ERROR("media_addon_server: received unknown message code %#08lx\n",code);
} }
} }
@@ -187,7 +187,7 @@ MediaAddonServer::ReadyToRun()
request.team = BPrivate::media::team; request.team = BPrivate::media::team;
result = QueryServer(SERVER_REGISTER_ADDONSERVER, &request, sizeof(request), &reply, sizeof(reply)); result = QueryServer(SERVER_REGISTER_ADDONSERVER, &request, sizeof(request), &reply, sizeof(reply));
if (result != B_OK) { if (result != B_OK) {
FATAL("Communication with server failed. Terminating.\n"); ERROR("Communication with server failed. Terminating.\n");
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
return; return;
} }
@@ -254,7 +254,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon)
port = find_port(MEDIA_SERVER_PORT_NAME); port = find_port(MEDIA_SERVER_PORT_NAME);
if (port <= B_OK) { if (port <= B_OK) {
FATAL("couldn't find media_server port\n"); ERROR("couldn't find media_server port\n");
return; return;
} }
@@ -276,7 +276,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon)
const flavor_info *info; const flavor_info *info;
TRACE("flavor %d:\n",i); TRACE("flavor %d:\n",i);
if (B_OK != addon->GetFlavorAt(i, &info)) { if (B_OK != addon->GetFlavorAt(i, &info)) {
FATAL("MediaAddonServer::ScanAddOnFlavors GetFlavorAt failed for index %d!\n", i); ERROR("MediaAddonServer::ScanAddOnFlavors GetFlavorAt failed for index %d!\n", i);
continue; continue;
} }
@@ -310,7 +310,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon)
rv = write_port(port, SERVER_REGISTER_DORMANT_NODE, msg, msgsize); rv = write_port(port, SERVER_REGISTER_DORMANT_NODE, msg, msgsize);
if (rv != B_OK) { if (rv != B_OK) {
FATAL("MediaAddonServer::ScanAddOnFlavors: couldn't register dormant node\n"); ERROR("MediaAddonServer::ScanAddOnFlavors: couldn't register dormant node\n");
} }
free(msg); free(msg);
@@ -332,7 +332,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node)
id = _DormantNodeManager->RegisterAddon(path); id = _DormantNodeManager->RegisterAddon(path);
if (id <= 0) { if (id <= 0) {
FATAL("MediaAddonServer::AddOnAdded: failed to register add-on %s\n", path); ERROR("MediaAddonServer::AddOnAdded: failed to register add-on %s\n", path);
return; return;
} }
@@ -340,7 +340,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node)
addon = _DormantNodeManager->GetAddon(id); addon = _DormantNodeManager->GetAddon(id);
if (addon == NULL) { if (addon == NULL) {
FATAL("MediaAddonServer::AddOnAdded: failed to get add-on %s\n", path); ERROR("MediaAddonServer::AddOnAdded: failed to get add-on %s\n", path);
_DormantNodeManager->UnregisterAddon(id); _DormantNodeManager->UnregisterAddon(id);
return; return;
} }
@@ -371,7 +371,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node)
info->wants_autostart = addon->WantsAutoStart(); info->wants_autostart = addon->WantsAutoStart();
if (info->wants_autostart) if (info->wants_autostart)
FATAL("#### add-on %ld WantsAutoStart!\n", id); TRACE("add-on %ld WantsAutoStart!\n", id);
// During startup, first all add-ons are loaded, then all // During startup, first all add-ons are loaded, then all
// nodes (flavors) representing physical inputs and outputs // nodes (flavors) representing physical inputs and outputs
@@ -417,7 +417,7 @@ MediaAddonServer::InstantiatePhysialInputsAndOutputs(AddOnInfo *info)
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
const flavor_info *flavorinfo; const flavor_info *flavorinfo;
if (B_OK != info->addon->GetFlavorAt(i, &flavorinfo)) { if (B_OK != info->addon->GetFlavorAt(i, &flavorinfo)) {
FATAL("MediaAddonServer::InstantiatePhysialInputsAndOutputs GetFlavorAt failed for index %d!\n", i); ERROR("MediaAddonServer::InstantiatePhysialInputsAndOutputs GetFlavorAt failed for index %d!\n", i);
continue; continue;
} }
if (flavorinfo->kinds & (B_PHYSICAL_INPUT | B_PHYSICAL_OUTPUT)) { if (flavorinfo->kinds & (B_PHYSICAL_INPUT | B_PHYSICAL_OUTPUT)) {
@@ -487,14 +487,14 @@ MediaAddonServer::AddOnRemoved(ino_t file_node)
// XXX locking? // XXX locking?
if (!filemap->Get(file_node, &tempid)) { if (!filemap->Get(file_node, &tempid)) {
FATAL("MediaAddonServer::AddOnRemoved: inode %Ld removed, but no media add-on found\n", file_node); ERROR("MediaAddonServer::AddOnRemoved: inode %Ld removed, but no media add-on found\n", file_node);
return; return;
} }
id = *tempid; // tempid pointer is invalid after Removing() it from the map id = *tempid; // tempid pointer is invalid after Removing() it from the map
filemap->Remove(file_node); filemap->Remove(file_node);
if (!infomap->Get(id, &info)) { if (!infomap->Get(id, &info)) {
FATAL("MediaAddonServer::AddOnRemoved: couldn't get addon info for add-on %ld\n", id); ERROR("MediaAddonServer::AddOnRemoved: couldn't get addon info for add-on %ld\n", id);
oldflavorcount = 1000; oldflavorcount = 1000;
} else { } else {
oldflavorcount = info->flavor_count; //same reason as above oldflavorcount = info->flavor_count; //same reason as above
@@ -503,7 +503,7 @@ MediaAddonServer::AddOnRemoved(ino_t file_node)
PutAddonIfPossible(info); PutAddonIfPossible(info);
if (info->addon) { if (info->addon) {
FATAL("MediaAddonServer::AddOnRemoved: couldn't unload addon %ld since flavors are in use\n", id); ERROR("MediaAddonServer::AddOnRemoved: couldn't unload addon %ld since flavors are in use\n", id);
} }
} }