diff --git a/headers/private/media/debug.h b/headers/private/media/debug.h index 8ea68a4d90..645aa8cba6 100644 --- a/headers/private/media/debug.h +++ b/headers/private/media/debug.h @@ -4,7 +4,8 @@ #include #include -#undef TRACE +#undef TRACE +#undef PRINT #ifndef DEBUG #define DEBUG 0 @@ -14,32 +15,32 @@ #if DEBUG >= 1 #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 #define UNIMPLEMENTED() ((void)0) - #define FATAL if (1) {} else printf + #define ERROR(a...) ((void)0) + #define PRINT(l, a...) ((void)0) #endif - + #if DEBUG >= 2 #define BROKEN() printf("BROKEN %s\n",__PRETTY_FUNCTION__) #define TRACE printf #else #define BROKEN() ((void)0) - #define TRACE if (1) {} else printf + #define TRACE(a...) ((void)0) #endif #if DEBUG >= 3 #define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) - #define INFO printf #else #define CALLED() ((void)0) - #define INFO if (1) {} else printf #endif #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_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_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_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[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[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 #define PRINT_FORMAT(_text, _fmt) ((void)0) #define PRINT_INPUT(_text, _in) ((void)0) @@ -51,12 +52,12 @@ #define PRINT_FORMAT(_text, _fmt) ((void)0) #define PRINT_INPUT(_text, _in) ((void)0) #define PRINT_OUTPUT(_text, _out) ((void)0) - #define UNIMPLEMENTED() ((void)0) - #define BROKEN() ((void)0) - #define CALLED() ((void)0) - #define FATAL if (1) {} else printf - #define TRACE if (1) {} else printf - #define INFO if (1) {} else printf + #define UNIMPLEMENTED() ((void)0) + #define BROKEN() ((void)0) + #define CALLED() ((void)0) + #define PRINT(l, a...) ((void)0) + #define ERROR(a...) ((void)0) + #define TRACE(a...) ((void)0) #endif diff --git a/src/kits/media/Buffer.cpp b/src/kits/media/Buffer.cpp index 5ca5c07b34..eb89a24653 100644 --- a/src/kits/media/Buffer.cpp +++ b/src/kits/media/Buffer.cpp @@ -135,7 +135,8 @@ media_buffer_id BBuffer::ID() { 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_reply area_reply; if (QueryServer(SERVER_GET_SHARED_BUFFER_AREA, &area_request, sizeof(area_request), &area_reply, sizeof(area_reply)) != B_OK) { - FATAL("BBuffer::BBuffer: SERVER_GET_SHARED_BUFFER_AREA failed\n"); + ERROR("BBuffer::BBuffer: SERVER_GET_SHARED_BUFFER_AREA failed\n"); return; } @@ -207,7 +208,7 @@ BBuffer::BBuffer(const buffer_clone_info & info) : fBufferList = _shared_buffer_list::Clone(area_reply.area); if (fBufferList == NULL) { - FATAL("BBuffer::BBuffer: _shared_buffer_list::Clone() failed\n"); + ERROR("BBuffer::BBuffer: _shared_buffer_list::Clone() failed\n"); 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. 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; } @@ -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); if (fArea <= B_OK) { // XXX should unregister buffer here - FATAL("BBuffer::BBuffer: buffer cloning failed\n"); + ERROR("BBuffer::BBuffer: buffer cloning failed\n"); fData = 0; return; } fData = (char *)fData + fOffset; fMediaHeader.size_used = 0; + fMediaHeader.buffer = fBufferID; } @@ -282,7 +284,7 @@ BBuffer::SetHeader(const media_header *header) { CALLED(); fMediaHeader = *header; - fMediaHeader.buffer = fBufferID; +// fMediaHeader.buffer = fBufferID; } diff --git a/src/kits/media/BufferConsumer.cpp b/src/kits/media/BufferConsumer.cpp index 4f11103f57..1a1bc16c97 100644 --- a/src/kits/media/BufferConsumer.cpp +++ b/src/kits/media/BufferConsumer.cpp @@ -356,7 +356,7 @@ BBufferConsumer::HandleMessage(int32 message, const void *data, 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; switch (message) { case CONSUMER_ACCEPT_FORMAT: diff --git a/src/kits/media/BufferGroup.cpp b/src/kits/media/BufferGroup.cpp index d1aea25683..5ad256a855 100644 --- a/src/kits/media/BufferGroup.cpp +++ b/src/kits/media/BufferGroup.cpp @@ -55,7 +55,7 @@ BBufferGroup::InitBufferGroup() // create the reclaim semaphore fReclaimSem = create_sem(0,"buffer reclaim sem"); if (fReclaimSem < B_OK) { - FATAL("BBufferGroup::InitBufferGroup: couldn't create fReclaimSem\n"); + ERROR("BBufferGroup::InitBufferGroup: couldn't create fReclaimSem\n"); fInitError = (status_t)fReclaimSem; return fInitError; } @@ -64,7 +64,7 @@ BBufferGroup::InitBufferGroup() server_get_shared_buffer_area_request area_request; server_get_shared_buffer_area_reply area_reply; if (QueryServer(SERVER_GET_SHARED_BUFFER_AREA, &area_request, sizeof(area_request), &area_reply, sizeof(area_reply)) != B_OK) { - FATAL("BBufferGroup::InitBufferGroup: SERVER_GET_SHARED_BUFFER_AREA failed\n"); + ERROR("BBufferGroup::InitBufferGroup: SERVER_GET_SHARED_BUFFER_AREA failed\n"); fInitError = B_ERROR; return fInitError; } @@ -72,7 +72,7 @@ BBufferGroup::InitBufferGroup() fBufferList = _shared_buffer_list::Clone(area_reply.area); if (fBufferList == NULL) { - FATAL("BBufferGroup::InitBufferGroup: _shared_buffer_list::Clone failed\n"); + ERROR("BBufferGroup::InitBufferGroup: _shared_buffer_list::Clone failed\n"); fInitError = B_ERROR; return fInitError; } @@ -110,7 +110,7 @@ BBufferGroup::BBufferGroup(size_t size, // don't allow all placement parameter values 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; } @@ -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); 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; return; } @@ -136,13 +136,13 @@ BBufferGroup::BBufferGroup(size_t size, buffer = new BBuffer(bci); if (0 == buffer->Data()) { // 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; fInitError = B_ERROR; break; } if (B_OK != fBufferList->AddBuffer(fReclaimSem,buffer)) { - FATAL("BBufferGroup: error when adding buffer\n"); + ERROR("BBufferGroup: error when adding buffer\n"); delete buffer; fInitError = B_ERROR; break; @@ -184,13 +184,13 @@ BBufferGroup::BBufferGroup(int32 count, buffer = new BBuffer(bci); if (0 == buffer->Data()) { // 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; fInitError = B_ERROR; break; } 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; fInitError = B_ERROR; break; @@ -231,12 +231,12 @@ BBufferGroup::AddBuffer(const buffer_clone_info &info, buffer = new BBuffer(info); if (0 == buffer->Data()) { // 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; return B_ERROR; } 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; fInitError = B_ERROR; return B_ERROR; diff --git a/src/kits/media/BufferProducer.cpp b/src/kits/media/BufferProducer.cpp index 4afb07b91c..d2a2a4982e 100644 --- a/src/kits/media/BufferProducer.cpp +++ b/src/kits/media/BufferProducer.cpp @@ -162,7 +162,7 @@ BBufferProducer::HandleMessage(int32 message, const void *data, 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; switch (message) { case PRODUCER_SET_RUN_MODE_DELAY: @@ -199,6 +199,7 @@ BBufferProducer::HandleMessage(int32 message, const producer_prepare_to_connect_request *request = static_cast(data); producer_prepare_to_connect_reply reply; reply.format = request->format; + reply.out_source = request->source; memcpy(reply.name, request->name, B_MEDIA_NAME_LENGTH); rv = PrepareToConnect(request->source, request->destination, &reply.format, &reply.out_source, reply.name); request->SendReply(rv, &reply, sizeof(reply)); diff --git a/src/kits/media/Controllable.cpp b/src/kits/media/Controllable.cpp index 45bc4f423e..715a43a759 100644 --- a/src/kits/media/Controllable.cpp +++ b/src/kits/media/Controllable.cpp @@ -132,7 +132,7 @@ BControllable::SetParameterWeb(BParameterWeb *web) status_t 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; switch (message) { @@ -151,7 +151,7 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size) // large data transfer, clone area area = clone_area("get parameter data clone", &data, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); 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)); return B_OK; } @@ -172,14 +172,14 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size) const void *data; if (request->area == -1) { - // small data transfer uses buffer in reply + // small data transfer uses buffer in request area = -1; data = request->rawdata; } else { // 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); 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)); return B_OK; } @@ -205,14 +205,14 @@ BControllable::HandleMessage(int32 message, const void *data, size_t size) area_id area; area = clone_area("cloned parameter web", &buffer, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); 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; } else { reply.code = fWeb->TypeCode(); reply.size = fWeb->FlattenedSize(); rv = fWeb->Flatten(buffer, reply.size); 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 { 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]); diff --git a/src/kits/media/DataExchange.cpp b/src/kits/media/DataExchange.cpp index 1f33bae596..7c6b309d06 100644 --- a/src/kits/media/DataExchange.cpp +++ b/src/kits/media/DataExchange.cpp @@ -54,7 +54,7 @@ void find_media_server_port() { MediaServerPort = find_port(MEDIA_SERVER_PORT_NAME); 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 } } @@ -63,7 +63,7 @@ void find_media_addon_server_port() { MediaAddonServerPort = find_port(MEDIA_ADDON_SERVER_PORT_NAME); 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 } } @@ -84,7 +84,7 @@ status_t SendToServer(BMessage *msg) status_t rv; rv = MediaServerMessenger->SendMessage(msg, static_cast(NULL), TIMEOUT); if (rv != B_OK) { - FATAL("SendToServer: SendMessage failed\n"); + ERROR("SendToServer: SendMessage failed\n"); } return rv; } @@ -120,7 +120,7 @@ status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size status_t rv; rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT); 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) { find_media_server_port(); 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); 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; } } @@ -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); 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) { find_media_server_port(); 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); 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); return rv; } @@ -173,7 +173,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in _PortPool->PutPort(request->reply_port); 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; diff --git a/src/kits/media/DefaultMediaTheme.cpp b/src/kits/media/DefaultMediaTheme.cpp index b0fa079d7e..b79f6aec9b 100644 --- a/src/kits/media/DefaultMediaTheme.cpp +++ b/src/kits/media/DefaultMediaTheme.cpp @@ -56,7 +56,7 @@ DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect) break; 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; } diff --git a/src/kits/media/DormantNodeManager.cpp b/src/kits/media/DormantNodeManager.cpp index 13c3865512..74adbd3ea2 100644 --- a/src/kits/media/DormantNodeManager.cpp +++ b/src/kits/media/DormantNodeManager.cpp @@ -80,7 +80,7 @@ DormantNodeManager::~DormantNodeManager() // force unloading all currently loaded images loaded_addon_info *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); } @@ -124,7 +124,7 @@ DormantNodeManager::GetAddon(media_addon_id id) // ok, it's not loaded, try to get the path BPath path; 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; } @@ -132,7 +132,7 @@ DormantNodeManager::GetAddon(media_addon_id id) BMediaAddOn *newaddon; image_id image; 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; } @@ -180,7 +180,7 @@ DormantNodeManager::PutAddon(media_addon_id id) fLock->Lock(); 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(); return; } @@ -212,26 +212,26 @@ DormantNodeManager::RegisterAddon(const char *path) rv = get_ref_for_path(path, &tempref); 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; } msg.ref = tempref; port = find_port(MEDIA_SERVER_PORT_NAME); 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; } msg.reply_port = _PortPool->GetPort(); rv = write_port(port, SERVER_REGISTER_MEDIAADDON, &msg, sizeof(msg)); if (rv != B_OK) { _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; } rv = read_port(msg.reply_port, &code, &reply, sizeof(reply)); _PortPool->PutPort(msg.reply_port); 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; } @@ -297,20 +297,20 @@ DormantNodeManager::LoadAddon(BMediaAddOn **newaddon, image_id *newimage, const image = load_add_on(path); 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; } rv = get_image_symbol(image, "make_media_addon", B_SYMBOL_TYPE_TEXT, (void**)&make_addon); if (rv < B_OK) { - FATAL("DormantNodeManager::LoadAddon: loading failed, function not found, 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); return B_ERROR; } addon = make_addon(image); if (addon == 0) { - FATAL("DormantNodeManager::LoadAddon: creating BMediaAddOn failed\n"); + ERROR("DormantNodeManager::LoadAddon: creating BMediaAddOn failed\n"); unload_add_on(image); return B_ERROR; } diff --git a/src/kits/media/FileInterface.cpp b/src/kits/media/FileInterface.cpp index 525b6d9041..6ca5165a05 100644 --- a/src/kits/media/FileInterface.cpp +++ b/src/kits/media/FileInterface.cpp @@ -39,7 +39,7 @@ BFileInterface::HandleMessage(int32 message, const void *data, 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; } diff --git a/src/kits/media/MediaDefs.cpp b/src/kits/media/MediaDefs.cpp index 77eb221b98..2b80a507db 100644 --- a/src/kits/media/MediaDefs.cpp +++ b/src/kits/media/MediaDefs.cpp @@ -511,7 +511,7 @@ multistream_format_specialize(media_multistream_format *format, const media_mult break; 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(); 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; } @@ -616,7 +616,7 @@ media_format::SpecializeTo(const media_format *otherFormat) return; 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); } } diff --git a/src/kits/media/MediaEventLooper.cpp b/src/kits/media/MediaEventLooper.cpp index c9717025be..6ca2c2f853 100644 --- a/src/kits/media/MediaEventLooper.cpp +++ b/src/kits/media/MediaEventLooper.cpp @@ -313,7 +313,7 @@ BMediaEventLooper::Priority() const int32 BMediaEventLooper::RunState() const { - CALLED(); + PRINT(6, "CALLED BMediaEventLooper::RunState()\n"); return fRunState; } @@ -348,8 +348,8 @@ BMediaEventLooper::SetPriority(int32 priority) CALLED(); // clamp to a valid value - if (priority < 1) - priority = 1; + if (priority < 5) + priority = 5; if (priority > 120) priority = 120; @@ -453,7 +453,7 @@ BMediaEventLooper::DispatchEvent(const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { - CALLED(); + PRINT(6, "CALLED BMediaEventLooper::DispatchEvent()\n"); HandleEvent(event,lateness,realTimeEvent); @@ -501,7 +501,7 @@ BMediaEventLooper::_ControlThreadStart(void *arg) BMediaEventLooper::_CleanUpEntry(const media_timed_event *event, void *context) { - CALLED(); + PRINT(6, "CALLED BMediaEventLooper::_CleanUpEntry()\n"); ((BMediaEventLooper *)context)->_DispatchCleanUp(event); } @@ -509,7 +509,7 @@ BMediaEventLooper::_CleanUpEntry(const media_timed_event *event, void 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 if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP) diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp index 892669dbe6..7c4bd75af9 100644 --- a/src/kits/media/MediaNode.cpp +++ b/src/kits/media/MediaNode.cpp @@ -171,7 +171,7 @@ BMediaNode::Release() TRACE("BMediaNode::Release() saving node %ld configuration\n", fNodeID); MediaRosterEx(BMediaRoster::Roster())->SaveNodeConfiguration(this); if (DeleteHook(this) != B_OK) { - FATAL("BMediaNode::Release(): DeleteHook failed\n"); + ERROR("BMediaNode::Release(): DeleteHook failed\n"); return Acquire(); } return NULL; @@ -227,7 +227,7 @@ BMediaNode::RunMode() const BTimeSource * BMediaNode::TimeSource() const { - CALLED(); + PRINT(7, "CALLED BMediaNode::TimeSource()\n"); // return the currently assigned time source if (fTimeSource != 0) @@ -249,7 +249,7 @@ BMediaNode::TimeSource() const ASSERT(fTimeSource == self->fTimeSource); if (fTimeSource == 0) { - FATAL("BMediaNode::TimeSource: Error, MakeTimeSourceFor failed\n"); + ERROR("BMediaNode::TimeSource: MakeTimeSourceFor failed\n"); } else { ASSERT(fTimeSourceID == fTimeSource->ID()); fTimeSource->AddMe(self); @@ -264,7 +264,7 @@ BMediaNode::TimeSource() const /* virtual */ port_id BMediaNode::ControlPort() const { - CALLED(); + PRINT(7, "CALLED BMediaNode::ControlPort()\n"); return fControlPort; } @@ -291,7 +291,7 @@ BMediaNode::ReportError(node_error what, case BMediaNode::B_NODE_IN_DISTRESS: break; default: - FATAL("BMediaNode::ReportError: invalid what!\n"); + ERROR("BMediaNode::ReportError: invalid what!\n"); return B_BAD_VALUE; } @@ -345,8 +345,8 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, uint32 flags, void *_reserved_) { - CALLED(); - ASSERT(this != 0); + PRINT(6, "CALLED BMediaNode::WaitForMessage()\n"); + // This function waits until either real time specified by // waitUntil or a message is received on the control port. // 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); if (size <= 0) { 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 } - 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) { - INFO("BMediaNode::WaitForMessage calling BMediaNode\n"); + PRINT(4, "BMediaNode::WaitForMessage calling BMediaNode\n"); if (B_OK == BMediaNode::HandleMessage(message, data, size)) return B_OK; } @@ -373,7 +373,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) { if (!fProducerThis) fProducerThis = dynamic_cast(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)) return B_OK; } @@ -381,7 +381,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) { if (!fConsumerThis) fConsumerThis = dynamic_cast(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)) return B_OK; } @@ -389,7 +389,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) { if (!fFileInterfaceThis) fFileInterfaceThis = dynamic_cast(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)) return B_OK; } @@ -397,7 +397,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, if (message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) { if (!fControllableThis) fControllableThis = dynamic_cast(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)) return B_OK; } @@ -405,12 +405,12 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, if (message > TIMESOURCE_MESSAGE_START && message < TIMESOURCE_MESSAGE_END) { if (!fTimeSourceThis) fTimeSourceThis = dynamic_cast(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)) return B_OK; } - INFO("BMediaNode::WaitForMessage calling default\n"); + PRINT(4, "BMediaNode::WaitForMessage calling default\n"); if (B_OK == HandleMessage(message, data, size)) return B_OK; @@ -520,7 +520,7 @@ BMediaNode::HandleMessage(int32 message, const void *data, size_t size) { - INFO("BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID); + PRINT(4, "BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID); switch (message) { 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); if (code < NODE_MESSAGE_START || code > TIMESOURCE_MESSAGE_END) { - FATAL("BMediaNode::HandleBadMessage: unknown code!\n"); + ERROR("BMediaNode::HandleBadMessage: unknown code!\n"); } else { /* All messages targeted to nodes should be handled here, * messages targetted to the wrong node should be handled diff --git a/src/kits/media/MediaRoster.cpp b/src/kits/media/MediaRoster.cpp index 4fa715a135..72af3dc64d 100644 --- a/src/kits/media/MediaRoster.cpp +++ b/src/kits/media/MediaRoster.cpp @@ -81,7 +81,7 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode *node) addon = node->AddOn(&flavorid); if (!addon) { // 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; } addonid = addon->AddonID(); @@ -188,6 +188,8 @@ BMediaRosterEx::GetAllOutputs(const media_node & node, List *list) status_t rv; status_t result; + PRINT(4, "BMediaRosterEx::GetAllOutputs() node %ld, port %ld\n", node.node, node.port); + result = B_OK; cookie = 0; list->MakeEmpty(); @@ -200,9 +202,13 @@ BMediaRosterEx::GetAllOutputs(const media_node & node, List *list) break; cookie = reply.cookie; if (!list->Insert(reply.output)) { - FATAL("GetAllOutputs: list->Insert failed\n"); + ERROR("GetAllOutputs: list->Insert failed\n"); result = B_ERROR; } + #if DEBUG >= 3 + PRINT(3," next cookie %ld, ", cookie); + PRINT_OUTPUT("output ", reply.output); + #endif } producer_dispose_output_cookie_request request; @@ -218,6 +224,8 @@ BMediaRosterEx::GetAllInputs(const media_node & node, List *list) int32 cookie; status_t rv; status_t result; + + PRINT(4, "BMediaRosterEx::GetAllInputs() node %ld, port %ld\n", node.node, node.port); result = B_OK; cookie = 0; @@ -231,9 +239,13 @@ BMediaRosterEx::GetAllInputs(const media_node & node, List *list) break; cookie = reply.cookie; if (!list->Insert(reply.input)) { - FATAL("GetAllInputs: list->Insert failed\n"); + ERROR("GetAllInputs: list->Insert failed\n"); result = B_ERROR; } + #if DEBUG >= 3 + PRINT(3," next cookie %ld, ", cookie); + PRINT_OUTPUT("input ", reply.input); + #endif } consumer_dispose_input_cookie_request request; @@ -264,7 +276,7 @@ BMediaRosterEx::PublishOutputs(const media_node & node, List *list 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); 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; } outputs = static_cast(start_addr); @@ -309,7 +321,7 @@ BMediaRosterEx::PublishInputs(const media_node & node, List *list) 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); 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; } inputs = static_cast(start_addr); @@ -554,7 +566,7 @@ BMediaRoster::ReleaseNode(const media_node & node) rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply, sizeof(reply)); 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; } @@ -574,7 +586,7 @@ BMediaRoster::MakeTimeSourceFor(const media_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; } @@ -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)); if (rv != B_OK) { - FATAL("BMediaRoster::MakeTimeSourceFor: request failed\n"); + ERROR("BMediaRoster::MakeTimeSourceFor: request failed\n"); return NULL; } @@ -607,13 +619,13 @@ BMediaRosterEx::MakeTimeSourceObject(media_node_id timesource_id) rv = GetNodeFor(timesource_id, &clone); if (rv != B_OK) { - FATAL("BMediaRosterEx::MakeTimeSourceObject: GetNodeFor failed\n"); + ERROR("BMediaRosterEx::MakeTimeSourceObject: GetNodeFor failed\n"); return NULL; } source = _TimeSourceObjectManager->GetTimeSource(clone); if (source == NULL) { - FATAL("BMediaRosterEx::MakeTimeSourceObject: GetTimeSource failed\n"); + ERROR("BMediaRosterEx::MakeTimeSourceObject: GetTimeSource failed\n"); return NULL; } @@ -647,11 +659,11 @@ BMediaRoster::Connect(const media_source & from, if (io_format == NULL || out_output == NULL || out_input == NULL) return B_BAD_VALUE; if (IS_INVALID_SOURCE(from)) { - FATAL("BMediaRoster::Connect: media_source invalid\n"); + ERROR("BMediaRoster::Connect: media_source invalid\n"); return B_MEDIA_BAD_SOURCE; } if (IS_INVALID_DESTINATION(to)) { - FATAL("BMediaRoster::Connect: media_destination invalid\n"); + ERROR("BMediaRoster::Connect: media_destination invalid\n"); return B_MEDIA_BAD_DESTINATION; } @@ -666,7 +678,7 @@ BMediaRoster::Connect(const media_source & from, request1.format = *io_format; rv = QueryPort(from.port, PRODUCER_FORMAT_PROPOSAL, &request1, sizeof(request1), &reply1, sizeof(reply1)); 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; } // reply1.format now contains the format proposed by the producer @@ -681,7 +693,7 @@ BMediaRoster::Connect(const media_source & from, request2.format = reply1.format; rv = QueryPort(to.port, CONSUMER_ACCEPT_FORMAT, &request2, sizeof(request2), &reply2, sizeof(reply2)); 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; } // 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 rv = QueryPort(from.port, PRODUCER_PREPARE_TO_CONNECT, &request3, sizeof(request3), &reply3, sizeof(reply3)); 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; } // 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)); 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! } // 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); rv = QueryPort(reply4.input.source.port, PRODUCER_CONNECT, &request5, sizeof(request5), &reply5, sizeof(reply5)); if (con_status != B_OK) { - FATAL("BMediaRoster::Connect: aborted\n"); + ERROR("BMediaRoster::Connect: aborted\n"); return con_status; } 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; } // reply5.name contains the name assigned to the connection by the producer @@ -803,19 +815,19 @@ BMediaRoster::Disconnect(media_node_id source_nodeid, { CALLED(); 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; } 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; } if (IS_INVALID_SOURCE(source)) { - FATAL("BMediaRoster::Disconnect: media_source invalid\n"); + ERROR("BMediaRoster::Disconnect: media_source invalid\n"); return B_MEDIA_BAD_SOURCE; } if (IS_INVALID_DESTINATION(destination)) { - FATAL("BMediaRoster::Disconnect: media_destination invalid\n"); + ERROR("BMediaRoster::Disconnect: media_destination invalid\n"); return B_MEDIA_BAD_DESTINATION; } @@ -846,14 +858,14 @@ BMediaRoster::Disconnect(media_node_id source_nodeid, MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist); ReleaseNode(sourcenode); } 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 == MediaRosterEx(this)->GetAllInputs(destnode , &inlist)) MediaRosterEx(this)->PublishInputs(destnode, &inlist); ReleaseNode(destnode); } 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(); if (IS_SYSTEM_TIMESOURCE(node)) { // 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; } if (IS_SHADOW_TIMESOURCE(node)) { // 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; } 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; } 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; } @@ -961,20 +973,20 @@ BMediaRoster::StopTimeSource(const media_node & node, CALLED(); if (IS_SYSTEM_TIMESOURCE(node)) { // 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; } if (IS_SHADOW_TIMESOURCE(node)) { // 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; } 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; } 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; } @@ -996,22 +1008,22 @@ BMediaRoster::SeekTimeSource(const media_node & node, CALLED(); if (IS_SYSTEM_TIMESOURCE(node)) { // 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 // returning B_ERROR would break StampTV return B_OK; } if (IS_SHADOW_TIMESOURCE(node)) { // 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; } 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; } 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; } @@ -1189,7 +1201,7 @@ BMediaRoster::GetLiveNodes(live_node_info * out_live_nodes, rv = QueryServer(SERVER_GET_LIVE_NODES, &request, sizeof(request), &reply, sizeof(reply)); if (rv != B_OK) { - FATAL("BMediaRoster::GetLiveNodes failed\n"); + ERROR("BMediaRoster::GetLiveNodes failed querying server\n"); *io_total_count = 0; return rv; } @@ -1200,7 +1212,7 @@ BMediaRoster::GetLiveNodes(live_node_info * out_live_nodes, clone = clone_area("live_node_info clone", reinterpret_cast(&live_info), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, reply.area); 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); *io_total_count = 0; return B_ERROR; @@ -1231,8 +1243,14 @@ BMediaRoster::GetFreeInputsFor(const media_node & node, media_type filter_type) { 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; + } + 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) return B_BAD_VALUE; @@ -1245,6 +1263,8 @@ BMediaRoster::GetFreeInputsFor(const media_node & node, rv = MediaRosterEx(this)->GetAllInputs(node, &list); if (B_OK != rv) return rv; + + PRINT(4, "BMediaRoster::GetFreeInputsFor node %ld, max %ld, filter-type %ld\n", node.node, buf_num_inputs, filter_type); int32 i; for (i = 0, list.Rewind(); list.GetNext(&input); i++) { @@ -1255,6 +1275,9 @@ BMediaRoster::GetFreeInputsFor(const media_node & node, out_free_inputs[i] = *input; *out_total_count += 1; buf_num_inputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" input", out_free_inputs[i]); + #endif if (buf_num_inputs == 0) break; } @@ -1286,6 +1309,8 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node, if (B_OK != rv) return rv; + PRINT(4, "BMediaRoster::GetConnectedInputsFor node %ld, max %ld\n", node.node, buf_num_inputs); + int32 i; for (i = 0, list.Rewind(); list.GetNext(&input); i++) { if (input->source == media_source::null) @@ -1293,6 +1318,9 @@ BMediaRoster::GetConnectedInputsFor(const media_node & node, out_active_inputs[i] = *input; *out_total_count += 1; buf_num_inputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" input ", out_active_inputs[i]); + #endif if (buf_num_inputs == 0) break; } @@ -1324,11 +1352,16 @@ BMediaRoster::GetAllInputsFor(const media_node & node, if (B_OK != rv) return rv; + PRINT(4, "BMediaRoster::GetAllInputsFor node %ld, max %ld\n", node.node, buf_num_inputs); + int32 i; for (i = 0, list.Rewind(); list.GetNext(&input); i++) { out_inputs[i] = *input; *out_total_count += 1; buf_num_inputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" input ", out_inputs[i]); + #endif if (buf_num_inputs == 0) break; } @@ -1361,6 +1394,8 @@ BMediaRoster::GetFreeOutputsFor(const media_node & node, if (B_OK != rv) return rv; + PRINT(4, "BMediaRoster::GetFreeOutputsFor node %ld, max %ld, filter-type %ld\n", node.node, buf_num_outputs, filter_type); + int32 i; for (i = 0, list.Rewind(); list.GetNext(&output); i++) { 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_total_count += 1; buf_num_outputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" output ", out_free_outputs[i]); + #endif if (buf_num_outputs == 0) break; } @@ -1401,6 +1439,8 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node, if (B_OK != rv) return rv; + PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %ld, max %ld\n", node.node, buf_num_outputs); + int32 i; for (i = 0, list.Rewind(); list.GetNext(&output); i++) { if (output->destination == media_destination::null) @@ -1408,6 +1448,9 @@ BMediaRoster::GetConnectedOutputsFor(const media_node & node, out_active_outputs[i] = *output; *out_total_count += 1; buf_num_outputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" output ", out_active_outputs[i]); + #endif if (buf_num_outputs == 0) break; } @@ -1439,11 +1482,16 @@ BMediaRoster::GetAllOutputsFor(const media_node & node, if (B_OK != rv) return rv; + PRINT(4, "BMediaRoster::GetAllOutputsFor node %ld, max %ld\n", node.node, buf_num_outputs); + int32 i; for (i = 0, list.Rewind(); list.GetNext(&output); i++) { out_outputs[i] = *output; *out_total_count += 1; buf_num_outputs -= 1; + #if DEBUG >= 3 + PRINT_OUTPUT(" output ", out_outputs[i]); + #endif if (buf_num_outputs == 0) break; } @@ -1458,7 +1506,7 @@ BMediaRoster::StartWatching(const BMessenger & where) { CALLED(); if (!where.IsValid()) { - FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); + ERROR("BMediaRoster::StartWatching: messenger invalid!\n"); return B_BAD_VALUE; } return BPrivate::media::notifications::Register(where, media_node::null, B_MEDIA_WILDCARD); @@ -1471,11 +1519,11 @@ BMediaRoster::StartWatching(const BMessenger & where, { CALLED(); if (!where.IsValid()) { - FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); + ERROR("BMediaRoster::StartWatching: messenger invalid!\n"); return B_BAD_VALUE; } 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 BPrivate::media::notifications::Register(where, media_node::null, notificationType); @@ -1489,15 +1537,15 @@ BMediaRoster::StartWatching(const BMessenger & where, { CALLED(); if (!where.IsValid()) { - FATAL("BMediaRoster::StartWatching: messenger invalid!\n"); + ERROR("BMediaRoster::StartWatching: messenger invalid!\n"); return B_BAD_VALUE; } if (IS_INVALID_NODE(node)) { - FATAL("BMediaRoster::StartWatching: node invalid!\n"); + ERROR("BMediaRoster::StartWatching: node invalid!\n"); return B_MEDIA_BAD_NODE; } 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 BPrivate::media::notifications::Register(where, node, notificationType); @@ -1520,7 +1568,7 @@ BMediaRoster::StopWatching(const BMessenger & where, CALLED(); // messenger may already be invalid, so we don't check this 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 BPrivate::media::notifications::Unregister(where, media_node::null, notificationType); @@ -1535,11 +1583,11 @@ BMediaRoster::StopWatching(const BMessenger & where, CALLED(); // messenger may already be invalid, so we don't check this if (IS_INVALID_NODE(node)) { - FATAL("BMediaRoster::StopWatching: node invalid!\n"); + ERROR("BMediaRoster::StopWatching: node invalid!\n"); return B_MEDIA_BAD_NODE; } 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 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)); 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; } @@ -1665,11 +1713,11 @@ BMediaRoster::UnregisterNode(BMediaNode * node) return B_OK; } 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; } 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! } @@ -1690,7 +1738,7 @@ BMediaRoster::UnregisterNode(BMediaNode * node) rv = QueryServer(SERVER_UNREGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply)); 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; } @@ -1704,7 +1752,7 @@ BMediaRoster::UnregisterNode(BMediaNode * node) rv = MediaRosterEx(this)->DecrementAddonFlavorInstancesCount(reply.addonid, reply.flavorid); 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 } } @@ -1762,7 +1810,7 @@ BMediaRoster::SetTimeSourceFor(media_node_id node, // we need to get a clone of the node to have a port id rv = GetNodeFor(node, &clone); 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; } @@ -1773,14 +1821,14 @@ BMediaRoster::SetTimeSourceFor(media_node_id node, cmd.timesource_id = time_source; rv = SendToPort(clone.port, NODE_SET_TIMESOURCE, &cmd, sizeof(cmd)); 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; } // we release the clone rv = ReleaseNode(clone); 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; } @@ -1814,21 +1862,21 @@ BMediaRoster::GetParameterWebFor(const media_node & node, void *data; area = create_area("parameter web data", &data, B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); 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; } request.maxsize = size; request.area = area; rv = QueryPort(node.port, CONTROLLABLE_GET_PARAMETER_WEB, &request, sizeof(request), &reply, sizeof(reply)); 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); return B_ERROR; } if (reply.size == 0) { // no parameter web available // 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(); delete_area(area); return B_OK; @@ -1842,7 +1890,7 @@ BMediaRoster::GetParameterWebFor(const media_node & node, rv = (*out_web)->Unflatten(reply.code, data, reply.size); 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 *out_web; return B_ERROR; @@ -1855,7 +1903,7 @@ BMediaRoster::GetParameterWebFor(const media_node & node, // parameter web data was too large // 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; } @@ -1972,13 +2020,13 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t status_t rv; rv = GetDormantFlavorInfo(addonid, flavorid, &node_info); 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; } //ASSERT(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; } @@ -1986,7 +2034,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t BMediaAddOn *addon; addon = _DormantNodeManager->GetAddon(addonid); if (!addon) { - FATAL("BMediaRosterEx::InstantiateDormantNode: GetAddon failed\n"); + ERROR("BMediaRosterEx::InstantiateDormantNode: GetAddon failed\n"); return B_ERROR; } @@ -1995,7 +2043,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t // flavor is limited. rv = IncrementAddonFlavorInstancesCount(addonid, flavorid); 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 _DormantNodeManager->PutAddon(addonid); return B_ERROR; @@ -2004,7 +2052,7 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t BMessage config; rv = LoadNodeConfiguration(addonid, flavorid, &config); 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 } @@ -2014,21 +2062,21 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonid, int32 flavorid, t out_error = B_OK; node = addon->InstantiateNodeFor(&node_info, &config, &out_error); if (!node) { - FATAL("BMediaRosterEx::InstantiateDormantNode: InstantiateNodeFor failed\n"); + ERROR("BMediaRosterEx::InstantiateDormantNode: InstantiateNodeFor failed\n"); // Put the addon back into the pool _DormantNodeManager->PutAddon(addonid); // We must decrement the use count of this addon flavor in the // server to compensate the increment done in the beginning. rv = DecrementAddonFlavorInstancesCount(addonid, flavorid); 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; } rv = RegisterNode(node, addonid, flavorid); if (rv != B_OK) { - FATAL("BMediaRosterEx::InstantiateDormantNode: RegisterNode failed\n"); + ERROR("BMediaRosterEx::InstantiateDormantNode: RegisterNode failed\n"); delete node; // Put the addon back into the pool _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. rv = DecrementAddonFlavorInstancesCount(addonid, flavorid); if (rv != B_OK) { - FATAL("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n"); + ERROR("BMediaRosterEx::InstantiateDormantNode: DecrementAddonFlavorInstancesCount failed\n"); } 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()); rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator); 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 } } @@ -2072,7 +2120,7 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info, if (out_node == 0) return B_BAD_VALUE; 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; } @@ -2085,7 +2133,7 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info, status_t rv; rv = MediaRosterEx(this)->GetDormantFlavorInfo(in_info.addon, in_info.flavor_id, &node_info); 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; } @@ -2108,11 +2156,11 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info, // Make sure that flags demanded by the dormant node and those requested // by the caller are not incompatible. 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; } 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; } @@ -2473,7 +2521,7 @@ BMediaRoster::NodeIDFor(port_id source_or_destination_port) rv = QueryServer(SERVER_NODE_ID_FOR, &request, sizeof(request), &reply, sizeof(reply)); if (rv != B_OK) { - FATAL("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv); + ERROR("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv); return -1; } @@ -2503,7 +2551,7 @@ BMediaRoster::GetInstancesFor(media_addon_id addon, rv = QueryServer(SERVER_GET_INSTANCES_FOR, &request, sizeof(request), &reply, sizeof(reply)); if (rv != B_OK) { - FATAL("BMediaRoster::GetLiveNodes failed\n"); + ERROR("BMediaRoster::GetLiveNodes failed\n"); return rv; } diff --git a/src/kits/media/ParameterWeb.cpp b/src/kits/media/ParameterWeb.cpp index 9b5c333d6b..5cf6cdd6f8 100644 --- a/src/kits/media/ParameterWeb.cpp +++ b/src/kits/media/ParameterWeb.cpp @@ -20,7 +20,7 @@ #ifdef DEBUG # undef DEBUG #endif -#define DEBUG 3 +//#define DEBUG 3 #include "debug.h" @@ -530,13 +530,13 @@ BParameterWeb::Flatten(void *buffer, ssize_t size) const for (int32 i = 0; i < count; i++) { BParameterGroup *group = static_cast(mGroups->ItemAt(i)); if (group == NULL) { - FATAL("BParameterWeb::Flatten(): group is NULL\n"); + ERROR("BParameterWeb::Flatten(): group is NULL\n"); continue; } ssize_t groupSize = group->FlattenedSize(); 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; } @@ -567,12 +567,12 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size) CALLED(); if (!AllowsTypeCode(code)) { - FATAL("BParameterWeb::Unflatten(): wrong type code\n"); + ERROR("BParameterWeb::Unflatten(): wrong type code\n"); return B_BAD_TYPE; } if (buffer == NULL) { - FATAL("BParameterWeb::Unflatten(): NULL buffer pointer\n"); + ERROR("BParameterWeb::Unflatten(): NULL buffer pointer\n"); 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 if (size < static_cast(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; } @@ -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 int32 version = read_from_buffer_swap32(&buffer, isSwapped); 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; } @@ -632,14 +632,14 @@ BParameterWeb::Unflatten(type_code code, const void *buffer, ssize_t size) for (int32 i = 0; i < count; i++) { ssize_t groupSize = read_from_buffer_swap32(&buffer, isSwapped); 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; } BParameterGroup *group = new BParameterGroup(this, "unnamed"); status_t status = group->Unflatten(group->TypeCode(), buffer, groupSize); if (status < B_OK) { - FATAL("BParameterWeb::Unflatten(): unflatten group failed\n"); + ERROR("BParameterWeb::Unflatten(): unflatten group failed\n"); delete group; return status; } @@ -965,7 +965,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const CALLED(); if (buffer == NULL) { - FATAL("BParameterGroup::Flatten buffer is NULL\n"); + ERROR("BParameterGroup::Flatten buffer is NULL\n"); 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. ssize_t actualSize = BParameterGroup::FlattenedSize(); if (size < actualSize) { - FATAL("BParameterGroup::Flatten size to small\n"); + ERROR("BParameterGroup::Flatten size to small\n"); return B_NO_MEMORY; } @@ -994,7 +994,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const for (int32 i = 0; i < count; i++) { BParameter *parameter = static_cast(mControls->ItemAt(i)); if (parameter == NULL) { - FATAL("BParameterGroup::Flatten(): NULL parameter\n"); + ERROR("BParameterGroup::Flatten(): NULL parameter\n"); continue; } @@ -1020,7 +1020,7 @@ BParameterGroup::Flatten(void *buffer, ssize_t size) const for (int32 i = 0; i < count; i++) { BParameterGroup *group = static_cast(mGroups->ItemAt(i)); if (group == NULL) { - FATAL("BParameterGroup::Flatten(): NULL group\n"); + ERROR("BParameterGroup::Flatten(): NULL group\n"); continue; } @@ -1057,19 +1057,19 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size) CALLED(); if (!AllowsTypeCode(code)) { - FATAL("BParameterGroup::Unflatten() wrong type code\n"); + ERROR("BParameterGroup::Unflatten() wrong type code\n"); return B_BAD_TYPE; } if (buffer == NULL) { - FATAL("BParameterGroup::Unflatten() buffer is NULL\n"); + ERROR("BParameterGroup::Unflatten() buffer is NULL\n"); return B_NO_INIT; } // if the buffer is smaller than the size needed to read the // signature field, then there is a problem if (size < static_cast(sizeof(int32))) { - FATAL("BParameterGroup::Unflatten() size to small\n"); + ERROR("BParameterGroup::Unflatten() size to small\n"); return B_ERROR; } @@ -1156,13 +1156,13 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size) BParameter *parameter = MakeControl(mediaType); if (parameter == NULL) { - FATAL("BParameterGroup::Unflatten(): MakeControl() failed\n"); + ERROR("BParameterGroup::Unflatten(): MakeControl() failed\n"); return B_ERROR; } status_t status = parameter->Unflatten(parameter->TypeCode(), buffer, parameterSize); if (status < B_OK) { - FATAL("BParameterGroup::Unflatten(): parameter->Unflatten() failed\n"); + ERROR("BParameterGroup::Unflatten(): parameter->Unflatten() failed\n"); delete parameter; return status; } @@ -1197,13 +1197,13 @@ BParameterGroup::Unflatten(type_code code, const void *buffer, ssize_t size) BParameterGroup *group = new BParameterGroup(mWeb, "sub-unnamed"); if (group == NULL) { - FATAL("BParameterGroup::Unflatten(): MakeGroup() failed\n"); + ERROR("BParameterGroup::Unflatten(): MakeGroup() failed\n"); return B_ERROR; } status_t status = group->Unflatten(type, buffer, groupSize); if (status != B_OK) { - FATAL("BParameterGroup::Unflatten(): group->Unflatten() failed\n"); + ERROR("BParameterGroup::Unflatten(): group->Unflatten() failed\n"); delete group; 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); default: - FATAL("BParameterGroup::MakeControl unknown type %ld\n", type); + ERROR("BParameterGroup::MakeControl unknown type %ld\n", type); return NULL; } } @@ -1347,13 +1347,13 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when) return B_NO_MEMORY; if (mWeb == 0) { - FATAL("BParameter::GetValue: no parent BParameterWeb\n"); + ERROR("BParameter::GetValue: no parent BParameterWeb\n"); return B_NO_INIT; } node = mWeb->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; } @@ -1361,7 +1361,7 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when) // 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); 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; } } else { @@ -1384,7 +1384,7 @@ BParameter::GetValue(void *buffer, size_t *ioSize, bigtime_t *when) if (when != 0) *when = reply.last_change; } else - FATAL("BParameter::GetValue querying node failed\n"); + ERROR("BParameter::GetValue querying node failed\n"); if (area != -1) delete_area(area); @@ -1411,13 +1411,13 @@ BParameter::SetValue(const void *buffer, size_t size, bigtime_t when) return B_NO_MEMORY; if (mWeb == 0) { - FATAL("BParameter::SetValue: no parent BParameterWeb\n"); + ERROR("BParameter::SetValue: no parent BParameterWeb\n"); return B_NO_INIT; } node = mWeb->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; } @@ -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 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) { - 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; } } 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)); if (rv != B_OK) - FATAL("BParameter::SetValue querying node failed\n"); + ERROR("BParameter::SetValue querying node failed\n"); if (area != -1) delete_area(area); @@ -1620,7 +1620,7 @@ BParameter::Flatten(void *buffer, ssize_t size) const CALLED(); if (buffer == NULL) { - FATAL("BParameter::Flatten buffer is NULL\n"); + ERROR("BParameter::Flatten buffer is NULL\n"); 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. ssize_t actualSize = BParameter::FlattenedSize(); if (size < actualSize) { - FATAL("BParameter::Flatten(): size too small\n"); + ERROR("BParameter::Flatten(): size too small\n"); return B_NO_MEMORY; } @@ -1679,19 +1679,19 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size) CALLED(); if (!AllowsTypeCode(code)) { - FATAL("BParameter::Unflatten(): wrong type code\n"); + ERROR("BParameter::Unflatten(): wrong type code\n"); return B_BAD_TYPE; } if (buffer == NULL) { - FATAL("BParameter::Unflatten(): buffer is NULL\n"); + ERROR("BParameter::Unflatten(): buffer is NULL\n"); return B_NO_INIT; } // if the buffer is smaller than the size needed to read the // signature and struct size fields, then there is a problem if (size < static_cast(sizeof(int32) + sizeof(ssize_t))) { - FATAL("BParameter::Unflatten() size too small\n"); + ERROR("BParameter::Unflatten() size too small\n"); return B_BAD_VALUE; } @@ -1705,13 +1705,13 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size) else if (magic == kParameterMagic) mSwapDetected = false; else { - FATAL("BParameter::Unflatten(): bad magic\n"); + ERROR("BParameter::Unflatten(): bad magic\n"); return B_BAD_TYPE; } ssize_t parameterSize = read_from_buffer_swap32(&buffer, mSwapDetected); 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; } @@ -1730,7 +1730,7 @@ BParameter::Unflatten(type_code code, const void *buffer, ssize_t size) //TOTAL: 27 bytes const ssize_t MinFlattenedParamSize(27); if (parameterSize < MinFlattenedParamSize) { - FATAL("BParameter::Unflatten out of memory (2)\n"); + ERROR("BParameter::Unflatten out of memory (2)\n"); return B_ERROR; } @@ -1846,7 +1846,7 @@ BParameter::FixRefs(BList &old, BList &updated) if (index >= 0) items[i] = updated.ItemAt(index); else { - FATAL("BParameter::FixRefs(): No mapping found for input"); + ERROR("BParameter::FixRefs(): No mapping found for input"); items[i] = NULL; } } @@ -1868,7 +1868,7 @@ BParameter::FixRefs(BList &old, BList &updated) if (index >= 0) items[i] = updated.ItemAt(index); else { - FATAL("BParameter::FixRefs(): No mapping found for output"); + ERROR("BParameter::FixRefs(): No mapping found for output"); items[i] = NULL; } } @@ -1954,19 +1954,19 @@ BContinuousParameter::Flatten(void *buffer, ssize_t size) const CALLED(); if (buffer == NULL) { - FATAL("BContinuousParameter::Flatten(): buffer is NULL\n"); + ERROR("BContinuousParameter::Flatten(): buffer is NULL\n"); return B_NO_INIT; } ssize_t parameterSize = BParameter::FlattenedSize(); if (size < (parameterSize + kAdditionalContinuousParameterSize)) { - FATAL("BContinuousParameter::Flatten(): size to small\n"); + ERROR("BContinuousParameter::Flatten(): size to small\n"); return B_NO_MEMORY; } status_t status = BParameter::Flatten(buffer, size); if (status != B_OK) { - FATAL("BContinuousParameter::Flatten(): BParameter::Flatten() failed\n"); + ERROR("BContinuousParameter::Flatten(): BParameter::Flatten() failed\n"); return status; } @@ -1994,25 +1994,25 @@ BContinuousParameter::Unflatten(type_code code, const void *buffer, ssize_t size // as early as possible. if (!AllowsTypeCode(code)) { - FATAL("BContinuousParameter::Unflatten wrong type code\n"); + ERROR("BContinuousParameter::Unflatten wrong type code\n"); return B_BAD_TYPE; } if (buffer == NULL) { - FATAL("BContinuousParameter::Unflatten buffer is NULL\n"); + ERROR("BContinuousParameter::Unflatten buffer is NULL\n"); return B_NO_INIT; } // if the buffer is smaller than the size needed to read the // signature and struct size fields, then there is a problem if (size < static_cast(sizeof(int32) + sizeof(ssize_t))) { - FATAL("BContinuousParameter::Unflatten size too small\n"); + ERROR("BContinuousParameter::Unflatten size too small\n"); return B_ERROR; } status_t status = BParameter::Unflatten(code, buffer, size); if (status != B_OK) { - FATAL("BContinuousParameter::Unflatten(): BParameter::Unflatten failed\n"); + ERROR("BContinuousParameter::Unflatten(): BParameter::Unflatten failed\n"); return status; } @@ -2020,7 +2020,7 @@ BContinuousParameter::Unflatten(type_code code, const void *buffer, ssize_t size skip_in_buffer(&buffer, parameterSize); if (size < (parameterSize + kAdditionalContinuousParameterSize)) { - FATAL("BContinuousParameter::Unflatten(): buffer too small\n"); + ERROR("BContinuousParameter::Unflatten(): buffer too small\n"); return B_BAD_VALUE; } @@ -2206,20 +2206,20 @@ BDiscreteParameter::Flatten(void *buffer, ssize_t size) const CALLED(); if (buffer == NULL) { - FATAL("BDiscreteParameter::Flatten(): buffer is NULL\n"); + ERROR("BDiscreteParameter::Flatten(): buffer is NULL\n"); return B_NO_INIT; } ssize_t parameterSize = BParameter::FlattenedSize(); if (size < FlattenedSize()) { - FATAL("BDiscreteParameter::Flatten(): size too small\n"); + ERROR("BDiscreteParameter::Flatten(): size too small\n"); return B_NO_MEMORY; } status_t status = BParameter::Flatten(buffer, size); if (status != B_OK) { - FATAL("BDiscreteParameter::Flatten(): BParameter::Flatten failed\n"); + ERROR("BDiscreteParameter::Flatten(): BParameter::Flatten failed\n"); return status; } @@ -2247,19 +2247,19 @@ BDiscreteParameter::Unflatten(type_code code, const void *buffer, ssize_t size) CALLED(); if (!AllowsTypeCode(code)) { - FATAL("BDiscreteParameter::Unflatten(): bad type code\n"); + ERROR("BDiscreteParameter::Unflatten(): bad type code\n"); return B_BAD_TYPE; } if (buffer == NULL) { - FATAL("BDiscreteParameter::Unflatten(): buffer is NULL\n"); + ERROR("BDiscreteParameter::Unflatten(): buffer is NULL\n"); return B_NO_INIT; } // if the buffer is smaller than the size needed to read the // signature and struct size fields, then there is a problem if (size < static_cast(sizeof(int32) + sizeof(ssize_t))) { - FATAL("BDiscreteParameter::Unflatten(): size too small\n"); + ERROR("BDiscreteParameter::Unflatten(): size too small\n"); 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); if (status != B_OK) { - FATAL("BDiscreteParameter::Unflatten(): BParameter::Unflatten failed\n"); + ERROR("BDiscreteParameter::Unflatten(): BParameter::Unflatten failed\n"); return status; } @@ -2275,7 +2275,7 @@ BDiscreteParameter::Unflatten(type_code code, const void *buffer, ssize_t size) skip_in_buffer(&buffer, parameterSize); if (size < (parameterSize + kAdditionalDiscreteParameterSize)) { - FATAL("BDiscreteParameter::Unflatten(): buffer too small\n"); + ERROR("BDiscreteParameter::Unflatten(): buffer too small\n"); return B_BAD_VALUE; } diff --git a/src/kits/media/SharedBufferList.cpp b/src/kits/media/SharedBufferList.cpp index fa058f6f1b..339e938949 100644 --- a/src/kits/media/SharedBufferList.cpp +++ b/src/kits/media/SharedBufferList.cpp @@ -241,7 +241,7 @@ _shared_buffer_list::RequestBufferInOtherGroups(sem_id group_reclaim_sem, media_ continue; if (info[i].reclaimed == false) { - FATAL("_shared_buffer_list: Error, BBuffer %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; } @@ -268,7 +268,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer) if (info[i].id == id) { reclaimed_count++; if (info[i].reclaimed) { - FATAL("_shared_buffer_list: Error, BBuffer %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")); continue; } @@ -280,7 +280,7 @@ _shared_buffer_list::RecycleBuffer(BBuffer *buffer) return B_ERROR; 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; } diff --git a/src/kits/media/SoundPlayNode.cpp b/src/kits/media/SoundPlayNode.cpp index 9e2fc804dd..376bbef10a 100644 --- a/src/kits/media/SoundPlayNode.cpp +++ b/src/kits/media/SoundPlayNode.cpp @@ -147,8 +147,7 @@ void _SoundPlayNode::SetTimeSource(BTimeSource *timeSource) void _SoundPlayNode::SetRunMode(run_mode mode) { - CALLED(); - PRINT(("_SoundPlayNode::SetRunMode mode:%i\n", mode)); + TRACE("_SoundPlayNode::SetRunMode mode:%i\n", mode); BMediaNode::SetRunMode(mode); } @@ -627,8 +626,7 @@ _SoundPlayNode::HandleDataStatus( bigtime_t lateness, bool realTimeEvent = false) { - CALLED(); - PRINT(("_SoundPlayNode::HandleDataStatus status:%li, lateness:%li\n", event->data, lateness)); + TRACE("_SoundPlayNode::HandleDataStatus status:%li, lateness:%li\n", event->data, lateness); switch(event->data) { case B_DATA_NOT_AVAILABLE: break; diff --git a/src/kits/media/SoundPlayer.cpp b/src/kits/media/SoundPlayer.cpp index 7bc205a713..0690f1fa33 100644 --- a/src/kits/media/SoundPlayer.cpp +++ b/src/kits/media/SoundPlayer.cpp @@ -610,9 +610,9 @@ BSoundPlayer::Init( fmt.buffer_size = 4096; 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) - FATAL("BSoundPlayer: framerate must be > 0\n"); + ERROR("BSoundPlayer: framerate must be > 0\n"); _m_bufsize = fmt.buffer_size; _m_buf = new char[_m_bufsize]; diff --git a/src/kits/media/TimeSource.cpp b/src/kits/media/TimeSource.cpp index a2fa018405..22d44397df 100644 --- a/src/kits/media/TimeSource.cpp +++ b/src/kits/media/TimeSource.cpp @@ -80,7 +80,7 @@ BTimeSource::SnoozeUntil(bigtime_t performance_time, bigtime_t BTimeSource::Now() { - CALLED(); + PRINT(8, "CALLED BTimeSource::Now()\n"); return PerformanceTimeFor(RealTime()); } @@ -88,7 +88,7 @@ BTimeSource::Now() bigtime_t BTimeSource::PerformanceTimeFor(bigtime_t real_time) { - CALLED(); + PRINT(8, "CALLED BTimeSource::PerformanceTimeFor()\n"); bigtime_t last_perf_time; bigtime_t last_real_time; float last_drift; @@ -104,7 +104,7 @@ bigtime_t BTimeSource::RealTimeFor(bigtime_t performance_time, bigtime_t with_latency) { - CALLED(); + PRINT(8, "CALLED BTimeSource::RealTimeFor()\n"); if (fIsRealtime) { return performance_time - with_latency; @@ -124,7 +124,7 @@ BTimeSource::RealTimeFor(bigtime_t performance_time, bool BTimeSource::IsRunning() { - CALLED(); + PRINT(8, "CALLED BTimeSource::IsRunning()\n"); bool isrunning; @@ -143,7 +143,7 @@ BTimeSource::GetTime(bigtime_t *performance_time, bigtime_t *real_time, float *drift) { - CALLED(); + PRINT(8, "CALLED BTimeSource::GetTime()\n"); if (fIsRealtime) { *performance_time = *real_time = system_time(); @@ -151,7 +151,7 @@ BTimeSource::GetTime(bigtime_t *performance_time, return B_OK; } // 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(); // *drift = 1.0f; // return B_OK; @@ -178,7 +178,7 @@ BTimeSource::GetTime(bigtime_t *performance_time, bigtime_t BTimeSource::RealTime() { - CALLED(); + PRINT(8, "CALLED BTimeSource::RealTime()\n"); return system_time(); } @@ -209,7 +209,7 @@ BTimeSource::BTimeSource() : // printf("##### BTimeSource::BTimeSource() name %s, id %ld\n", Name(), ID()); if (fSlaveNodes == NULL) { - FATAL("Error: BTimeSource::BTimeSource() fSlaveNodes == NULL\n"); + ERROR("BTimeSource::BTimeSource() fSlaveNodes == NULL\n"); return; } @@ -229,7 +229,7 @@ BTimeSource::HandleMessage(int32 message, const void *rawdata, size_t size) { - INFO("BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID); + PRINT(4, "BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID); switch (message) { case TIMESOURCE_OP: @@ -252,7 +252,7 @@ BTimeSource::HandleMessage(int32 message, status_t result; result = TimeSourceOp(*data, NULL); if (result != B_OK) { - FATAL("BTimeSource::HandleMessage: TimeSourceOp failed\n"); + ERROR("BTimeSource::HandleMessage: TimeSourceOp failed\n"); } 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); if (0 == fBuf) { - FATAL("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID()); + ERROR("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID()); fStarted = true; return; } @@ -383,13 +383,13 @@ BTimeSource::BTimeSource(media_node_id id) : sprintf(name, "__timesource_buf_%ld", id); area = find_area(name); 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; } sprintf(name, "__cloned_timesource_buf_%ld", id); fArea = clone_area(name, reinterpret_cast(const_cast(&fBuf)), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area); 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; } } @@ -405,7 +405,7 @@ BTimeSource::FinishCreate() sprintf(name, "__timesource_buf_%ld", ID()); fArea = create_area(name, reinterpret_cast(const_cast(&fBuf)), B_ANY_ADDRESS, B_PAGE_SIZE, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA); 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; return; } @@ -457,7 +457,7 @@ BTimeSource::DirectAddMe(const media_node &node) BAutolock lock(fSlaveNodes->locker); 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; } for (int i = 0; i < SLAVE_NODES_COUNT; i++) { @@ -476,7 +476,7 @@ BTimeSource::DirectAddMe(const media_node &node) return; } } - FATAL("BTimeSource::DirectAddMe failed\n"); + ERROR("BTimeSource::DirectAddMe failed\n"); } void @@ -488,7 +488,7 @@ BTimeSource::DirectRemoveMe(const media_node &node) BAutolock lock(fSlaveNodes->locker); if (fSlaveNodes->count == 0) { - FATAL("BTimeSource::DirectRemoveMe no slots used\n"); + ERROR("BTimeSource::DirectRemoveMe no slots used\n"); return; } for (int i = 0; i < SLAVE_NODES_COUNT; i++) { @@ -507,7 +507,7 @@ BTimeSource::DirectRemoveMe(const media_node &node) return; } } - FATAL("BTimeSource::DirectRemoveMe failed\n"); + ERROR("BTimeSource::DirectRemoveMe failed\n"); } void diff --git a/src/kits/media/TimeSourceObject.cpp b/src/kits/media/TimeSourceObject.cpp index e97538ac20..3501157902 100644 --- a/src/kits/media/TimeSourceObject.cpp +++ b/src/kits/media/TimeSourceObject.cpp @@ -85,6 +85,6 @@ SystemTimeSourceObject::SystemTimeSourceObject(const media_node &node) /* virtual */ status_t SystemTimeSourceObject::DeleteHook(BMediaNode * node) { - FATAL("SystemTimeSourceObject::DeleteHook called\n"); + ERROR("SystemTimeSourceObject::DeleteHook called\n"); return B_ERROR; } diff --git a/src/kits/media/TimeSourceObjectManager.cpp b/src/kits/media/TimeSourceObjectManager.cpp index 2cfaaa5d22..f8ec6c12df 100644 --- a/src/kits/media/TimeSourceObjectManager.cpp +++ b/src/kits/media/TimeSourceObjectManager.cpp @@ -40,11 +40,11 @@ TimeSourceObjectManager::~TimeSourceObjectManager() // force unloading all currently loaded BTimeSource **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; while ((*pts)->Release() != NULL) 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; @@ -112,7 +112,7 @@ TimeSourceObjectManager::GetTimeSource(const media_node &node) rv = BMediaRoster::Roster()->GetNodeFor(node.node, &clone); if (rv != B_OK) { - FATAL("TimeSourceObjectManager::GetTimeSource, GetNodeFor %ld failed\n", node.node); + ERROR("TimeSourceObjectManager::GetTimeSource, GetNodeFor %ld failed\n", node.node); return NULL; } @@ -143,13 +143,13 @@ TimeSourceObjectManager::ObjectDeleted(BTimeSource *timesource) bool b; b = fMap->Remove(timesource->ID()); if (!b) { - FATAL("TimeSourceObjectManager::ObjectDeleted, Remove failed\n"); + ERROR("TimeSourceObjectManager::ObjectDeleted, Remove failed\n"); } status_t rv; rv = BMediaRoster::Roster()->ReleaseNode(timesource->Node()); if (rv != B_OK) { - FATAL("TimeSourceObjectManager::ObjectDeleted, ReleaseNode failed\n"); + ERROR("TimeSourceObjectManager::ObjectDeleted, ReleaseNode failed\n"); } } diff --git a/src/kits/media/TimedEventQueuePrivate.cpp b/src/kits/media/TimedEventQueuePrivate.cpp index fdd1f70aca..38b332a48f 100644 --- a/src/kits/media/TimedEventQueuePrivate.cpp +++ b/src/kits/media/TimedEventQueuePrivate.cpp @@ -572,7 +572,7 @@ _event_queue_imp::CleanupEvent(media_timed_event *event) if (fCleanupHook) (*fCleanupHook)(event,fCleanupHookContext); } 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); } } diff --git a/src/kits/media/TrackReader.cpp b/src/kits/media/TrackReader.cpp index a50c29e9e9..1cd86822a5 100644 --- a/src/kits/media/TrackReader.cpp +++ b/src/kits/media/TrackReader.cpp @@ -93,7 +93,7 @@ BTrackReader::BTrackReader(BFile *file, media_raw_audio_format const &format) : int count = fMediaFile->CountTracks(); if (count == 0) { - FATAL("BTrackReader: no tracks in file\n"); + ERROR("BTrackReader: no tracks in file\n"); return; } @@ -114,7 +114,7 @@ BTrackReader::BTrackReader(BFile *file, media_raw_audio_format const &format) : fMediaFile->ReleaseTrack(track); } if (audiotrack == 0) { - FATAL("BTrackReader: no audio track in file\n"); + ERROR("BTrackReader: no audio track in file\n"); return; } @@ -165,7 +165,7 @@ BTrackReader::SetToTrack(BMediaTrack *track) } //we have failed - FATAL("BTrackReader::SetToTrack failed\n"); + ERROR("BTrackReader::SetToTrack failed\n"); } BTrackReader::~BTrackReader() diff --git a/src/servers/media/AppManager.cpp b/src/servers/media/AppManager.cpp index 979aa12064..491c03ef64 100644 --- a/src/servers/media/AppManager.cpp +++ b/src/servers/media/AppManager.cpp @@ -75,7 +75,7 @@ status_t AppManager::RegisterTeam(team_id team, BMessenger messenger) BAutolock lock(fLocker); TRACE("AppManager::RegisterTeam %ld\n", 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; } App app; @@ -126,12 +126,12 @@ void AppManager::RestartAddonServer() restart_tries = 0; } 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 snooze(5000000); StartAddonServer(); } else { - FATAL("AppManager: media_addon_server crashed too often, not restarted\n"); + PRINT(1, "AppManager: media_addon_server crashed too often, not restarted\n"); } } diff --git a/src/servers/media/BufferManager.cpp b/src/servers/media/BufferManager.cpp index d06436f0cd..b43e8ff63c 100644 --- a/src/servers/media/BufferManager.cpp +++ b/src/servers/media/BufferManager.cpp @@ -41,7 +41,7 @@ BufferManager::RegisterBuffer(team_id teamid, media_buffer_id bufferid, buffer_info *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; } @@ -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); 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; } @@ -98,18 +98,18 @@ BufferManager::UnregisterBuffer(team_id teamid, media_buffer_id bufferid) int index; 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; } index = info->teams.Find(teamid); 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; } 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; } 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 (!fBufferInfoMap->Remove(bufferid)) { - FATAL("UnregisterBuffer: failed to remove bufferid = %ld\n", bufferid); + ERROR("UnregisterBuffer: failed to remove bufferid = %ld\n", bufferid); return B_ERROR; } @@ -139,12 +139,12 @@ BufferManager::CleanupTeam(team_id team) team_id *otherteam; for (info->teams.Rewind(); info->teams.GetNext(&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(); } } 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(); } } diff --git a/src/servers/media/DefaultManager.cpp b/src/servers/media/DefaultManager.cpp index 97e13619c8..8433d25bad 100644 --- a/src/servers/media/DefaultManager.cpp +++ b/src/servers/media/DefaultManager.cpp @@ -70,7 +70,7 @@ DefaultManager::Set(node_type type, const media_node *node, const dormant_node_i 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; } } @@ -131,7 +131,7 @@ DefaultManager::Get(media_node_id *nodeid, char *input_name, int32 *inputid, nod 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; } } @@ -182,9 +182,9 @@ DefaultManager::RescanThread() if (!fMixerConnected && fAudioMixer != -1 && fPhysicalAudioOut != -1) { fMixerConnected = B_OK == ConnectMixerToOutput(); if (!fMixerConnected) - FATAL("DefaultManager: failed to connect mixer and soundcard\n"); + ERROR("DefaultManager: failed to connect mixer and soundcard\n"); } 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"); @@ -417,7 +417,7 @@ DefaultManager::ConnectMixerToOutput() case 0: printf("DefaultManager: Trying connect in native format\n"); if (B_OK != roster->GetFormatFor(input, &format)) { - FATAL("DefaultManager: GetFormatFor failed\n"); + ERROR("DefaultManager: GetFormatFor failed\n"); continue; } break; @@ -456,7 +456,7 @@ DefaultManager::ConnectMixerToOutput() break; } if (rv != B_OK) { - FATAL("DefaultManager: connect failed\n"); + ERROR("DefaultManager: connect failed\n"); goto finish; } diff --git a/src/servers/media/NodeManager.cpp b/src/servers/media/NodeManager.cpp index 9352e47c61..24eb4f74d4 100644 --- a/src/servers/media/NodeManager.cpp +++ b/src/servers/media/NodeManager.cpp @@ -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); b = fRegisteredNodeMap->Get(nodeid, &rn); 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; } 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; } 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; } *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); b = fRegisteredNodeMap->Get(nodeid, &rn); if (!b) { - FATAL("!!! NodeManager::IncrementGlobalRefCount: Error: node %ld not found\n", nodeid); + ERROR("NodeManager::IncrementGlobalRefCount: node %ld not found\n", nodeid); return B_ERROR; } 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); b = fRegisteredNodeMap->Get(nodeid, &rn); if (!b) { - FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld not found\n", nodeid); + ERROR("NodeManager::DecrementGlobalRefCount: node %ld not found\n", nodeid); return B_ERROR; } int32 *count; @@ -184,7 +184,7 @@ NodeManager::DecrementGlobalRefCount(media_node_id nodeid, team_id team) team = addon_server_team; //redirect! // the count variable was already redirected in if() statement above. } 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; } } @@ -216,12 +216,12 @@ NodeManager::SetNodeCreator(media_node_id nodeid, team_id creator) b = fRegisteredNodeMap->Get(nodeid, &rn); if (!b) { - FATAL("NodeManager::SetNodeCreator: Error: node %ld not found\n", nodeid); + ERROR("NodeManager::SetNodeCreator: node %ld not found\n", nodeid); return B_ERROR; } 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; } @@ -240,14 +240,14 @@ NodeManager::FinalReleaseNode(media_node_id nodeid) TRACE("NodeManager::FinalReleaseNode enter: node %ld\n", nodeid); b = fRegisteredNodeMap->Get(nodeid, &rn); if (!b) { - FATAL("NodeManager::FinalReleaseNode: Error: node %ld not found\n", nodeid); + ERROR("NodeManager::FinalReleaseNode: node %ld not found\n", nodeid); return; } node_final_release_command cmd; rv = SendToPort(rn->port, NODE_FINAL_RELEASE, &cmd, sizeof(cmd)); 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; } } @@ -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); 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; } b = fRegisteredNodeMap->Get(nodeid, &rn); if (!b) { - FATAL("!!! NodeManager::GetCloneForId: Error: node %ld not found\n", nodeid); + ERROR("NodeManager::GetCloneForId: node %ld not found\n", nodeid); DecrementGlobalRefCount(nodeid, team); 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); 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; return status; } @@ -305,7 +305,7 @@ NodeManager::GetClone(media_node *node, char *input_name, int32 *input_id, node_ status = GetCloneForId(node, id, team); 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; return status; } @@ -323,7 +323,7 @@ NodeManager::ReleaseNode(const media_node &node, team_id team) BAutolock lock(fLocker); TRACE("NodeManager::ReleaseNode enter: node %ld team %ld\n", 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); return B_OK; @@ -338,7 +338,7 @@ NodeManager::PublishInputs(const media_node &node, const media_input *inputs, in bool b; b = fRegisteredNodeMap->Get(node.node, &rn); 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; } rn->inputlist.MakeEmpty(); @@ -356,7 +356,7 @@ NodeManager::PublishOutputs(const media_node &node, const media_output *outputs, bool b; b = fRegisteredNodeMap->Get(node.node, &rn); 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; } 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; } @@ -419,7 +419,7 @@ NodeManager::GetDormantNodeInfo(dormant_node_info *node_info, const media_node & return B_OK; } } - FATAL("!!! NodeManager::GetDormantNodeInfo failed, node %ld\n", node.node); + ERROR("NodeManager::GetDormantNodeInfo failed, node %ld\n", node.node); return B_ERROR; } @@ -439,7 +439,7 @@ NodeManager::GetLiveNodeInfo(live_node_info *live_info, const media_node &node) return B_OK; } } - FATAL("!!! NodeManager::GetLiveNodeInfo failed, node %ld\n", node.node); + ERROR("NodeManager::GetLiveNodeInfo failed, node %ld\n", node.node); 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) continue; 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); dafi->MaxInstancesCount = dfi.possible_count > 0 ? dfi.possible_count : 0x7fffffff; @@ -669,7 +669,7 @@ NodeManager::IncrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl continue; 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 } @@ -685,7 +685,7 @@ NodeManager::IncrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl dafi->GlobalInstancesCount += 1; 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; } @@ -703,7 +703,7 @@ NodeManager::DecrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl int32 *count; b = dafi->TeamInstancesCount.Get(team, &count); 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; } *count -= 1; @@ -715,7 +715,7 @@ NodeManager::DecrementAddonFlavorInstancesCount(media_addon_id addonid, int32 fl dafi->GlobalInstancesCount -= 1; 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; } @@ -851,7 +851,7 @@ NodeManager::CleanupTeam(team_id 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 @@ -867,7 +867,7 @@ NodeManager::CleanupTeam(team_id team) } // if the team hosting this node is gone, remove node from database 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(); continue; } @@ -877,14 +877,14 @@ NodeManager::CleanupTeam(team_id team) for (rn->teamrefcount.Rewind(); rn->teamrefcount.GetNext(&prefcount); ) { rn->teamrefcount.GetCurrentKey(&pteam); 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(); break; } } // if the team refcount is now empty, also remove the node 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(); } } @@ -896,7 +896,7 @@ NodeManager::CleanupTeam(team_id team) int32 *count; b = dafi->TeamInstancesCount.Get(team, &count); 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; if (dafi->GlobalInstancesCount < 0) // avoid underflow dafi->GlobalInstancesCount = 0; diff --git a/src/servers/media/NotificationManager.cpp b/src/servers/media/NotificationManager.cpp index 43fb6d32d2..a30b8ac34c 100644 --- a/src/servers/media/NotificationManager.cpp +++ b/src/servers/media/NotificationManager.cpp @@ -245,7 +245,7 @@ NotificationManager::CleanupTeam(team_id team) } 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(); } diff --git a/src/servers/media/media_server.cpp b/src/servers/media/media_server.cpp index 5be8569906..192fa38410 100644 --- a/src/servers/media/media_server.cpp +++ b/src/servers/media/media_server.cpp @@ -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); reply.area = create_area("get live nodes", reinterpret_cast(&start_addr), B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); 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; rv = B_ERROR; } else { @@ -360,7 +360,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size) area_id clone; clone = clone_area("media_inputs clone", reinterpret_cast(&inputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); 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; } else { rv = gNodeManager->PublishInputs(request->node, inputs, request->count); @@ -382,7 +382,7 @@ ServerApp::HandleMessage(int32 code, void *data, size_t size) area_id clone; clone = clone_area("media_outputs clone", reinterpret_cast(&outputs), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request->area); 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; } else { 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; 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 - 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)); break; diff --git a/src/servers/media_addon/main.cpp b/src/servers/media_addon/main.cpp index 5fdd5cb76e..58c13f8a28 100644 --- a/src/servers/media_addon/main.cpp +++ b/src/servers/media_addon/main.cpp @@ -145,7 +145,7 @@ MediaAddonServer::HandleMessage(int32 code, const void *data, size_t size) BMediaAddOn *addon; addon = _DormantNodeManager->GetAddon(command->addonid); 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; } ScanAddOnFlavors(addon); @@ -154,7 +154,7 @@ MediaAddonServer::HandleMessage(int32 code, const void *data, size_t size) } 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; result = QueryServer(SERVER_REGISTER_ADDONSERVER, &request, sizeof(request), &reply, sizeof(reply)); if (result != B_OK) { - FATAL("Communication with server failed. Terminating.\n"); + ERROR("Communication with server failed. Terminating.\n"); PostMessage(B_QUIT_REQUESTED); return; } @@ -254,7 +254,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon) port = find_port(MEDIA_SERVER_PORT_NAME); if (port <= B_OK) { - FATAL("couldn't find media_server port\n"); + ERROR("couldn't find media_server port\n"); return; } @@ -276,7 +276,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon) const flavor_info *info; TRACE("flavor %d:\n",i); 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; } @@ -310,7 +310,7 @@ MediaAddonServer::ScanAddOnFlavors(BMediaAddOn *addon) rv = write_port(port, SERVER_REGISTER_DORMANT_NODE, msg, msgsize); if (rv != B_OK) { - FATAL("MediaAddonServer::ScanAddOnFlavors: couldn't register dormant node\n"); + ERROR("MediaAddonServer::ScanAddOnFlavors: couldn't register dormant node\n"); } free(msg); @@ -332,7 +332,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node) id = _DormantNodeManager->RegisterAddon(path); 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; } @@ -340,7 +340,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node) addon = _DormantNodeManager->GetAddon(id); 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); return; } @@ -371,7 +371,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node) info->wants_autostart = addon->WantsAutoStart(); 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 // nodes (flavors) representing physical inputs and outputs @@ -417,7 +417,7 @@ MediaAddonServer::InstantiatePhysialInputsAndOutputs(AddOnInfo *info) for (int i = 0; i < count; i++) { const flavor_info *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; } if (flavorinfo->kinds & (B_PHYSICAL_INPUT | B_PHYSICAL_OUTPUT)) { @@ -487,14 +487,14 @@ MediaAddonServer::AddOnRemoved(ino_t file_node) // XXX locking? 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; } id = *tempid; // tempid pointer is invalid after Removing() it from the map filemap->Remove(file_node); 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; } else { oldflavorcount = info->flavor_count; //same reason as above @@ -503,7 +503,7 @@ MediaAddonServer::AddOnRemoved(ino_t file_node) PutAddonIfPossible(info); 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); } }