various bugfixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3339 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2003-05-26 12:58:06 +00:00
parent a4289a95c0
commit 21871f384e
5 changed files with 10 additions and 84 deletions

View File

@ -111,7 +111,6 @@ enum {
NODE_SET_TIMESOURCE,
NODE_REQUEST_COMPLETED,
NODE_FINAL_RELEASE,
NODE_PUBLISH_CONNECTIONS,
NODE_MESSAGE_END,
CONSUMER_MESSAGE_START = 0x300,

View File

@ -1554,25 +1554,6 @@ BMediaRosterEx::RegisterNode(BMediaNode * node, media_addon_id addonid, int32 fl
ts->FinishCreate();
}
// XXX XXX XXX
// Calling GetAllOutputs and GetAllInputs here,
// followed by PublishOutputs and PublishInputs,
// does not work, it is too early, and in some
// cases it will deadlock the node control thread.
// Posting a message to the roster thread here
// is also to early, the multi_audio add-on will
// no list any inputs
// XXX XXX XXX
BMessage msg(NODE_PUBLISH_CONNECTIONS);
media_node tempnode;
tempnode = node->Node();
msg.AddData("node", B_RAW_TYPE, &tempnode, sizeof(tempnode));
PostMessage(&msg);
/*
// register existing inputs and outputs with the
// media_server, this allows GetLiveNodes() to work
// with created, but unconnected nodes.
@ -1580,12 +1561,13 @@ BMediaRosterEx::RegisterNode(BMediaNode * node, media_addon_id addonid, int32 fl
List<media_output> list;
if (B_OK == GetAllOutputs(node->Node(), &list))
PublishOutputs(node->Node(), &list);
} else if (node->Kinds() & B_BUFFER_CONSUMER) {
}
if (node->Kinds() & B_BUFFER_CONSUMER) {
List<media_input> list;
if (B_OK == GetAllInputs(node->Node(), &list))
PublishInputs(node->Node(), &list);
}
*/
BPrivate::media::notifications::NodesCreated(&reply.nodeid, 1);
/*
TRACE("BMediaRoster::RegisterNode: registered node name '%s', id %ld, addon %ld, flavor %ld\n", node->Name(), node->ID(), addon_id, addon_flavor_id);
@ -1596,7 +1578,6 @@ BMediaRosterEx::RegisterNode(BMediaNode * node, media_addon_id addonid, int32 fl
TRACE("BMediaRoster::RegisterNode: node fControllableThis %p\n", node->fControllableThis);
TRACE("BMediaRoster::RegisterNode: node fTimeSourceThis %p\n", node->fTimeSourceThis);
*/
return B_OK;
}
@ -2462,34 +2443,6 @@ BMediaRoster::MessageReceived(BMessage * message)
message->SendReply(&pong, static_cast<BHandler *>(NULL), 2000000);
return;
}
case NODE_PUBLISH_CONNECTIONS:
{
const void *data;
ssize_t numBytes;
media_node node;
printf("NODE_PUBLISH_CONNECTIONS enter\n");
message->FindData("node", B_RAW_TYPE, &data, &numBytes);
node = *(const media_node *)data;
// register existing inputs and outputs with the
// media_server, this allows GetLiveNodes() to work
// with created, but unconnected nodes.
if (node.kind & B_BUFFER_PRODUCER) {
List<media_output> outputlist;
if (B_OK == MediaRosterEx(this)->GetAllOutputs(node, &outputlist))
MediaRosterEx(this)->PublishOutputs(node, &outputlist);
}
if (node.kind & B_BUFFER_CONSUMER) {
List<media_input> inputlist;
if (B_OK == MediaRosterEx(this)->GetAllInputs(node, &inputlist))
MediaRosterEx(this)->PublishInputs(node, &inputlist);
}
printf("NODE_PUBLISH_CONNECTIONS leave\n");
return;
}
case NODE_FINAL_RELEASE:
{

View File

@ -8,11 +8,8 @@
#include <TimeSource.h>
#include <string.h>
#include "DefaultManager.h"
#include "NodeManager.h"
#include "debug.h"
extern NodeManager *gNodeManager;
/* no locking used in this file, we assume that the caller (NodeManager) does it.
*/
@ -161,11 +158,7 @@ DefaultManager::RescanThread()
// We do not search for the system time source,
// it should already exist
ASSERT(fSystemTimeSource != -1);
/*
//for (int i = 0; i < 10; i++) { // XXX ugly workaround
gNodeManager->UpdateNodeConnections(); // XXX ugly workaround
snooze(1000000); // XXX ugly workaround
*/
if (fPhysicalVideoOut == -1)
FindPhysicalVideoOut();
if (fPhysicalVideoIn == -1)
@ -176,7 +169,6 @@ DefaultManager::RescanThread()
FindPhysicalAudioIn();
if (fAudioMixer == -1)
FindAudioMixer();
//}
// The normal time source is searched for after the
// Physical Audio Out has been created.
@ -383,6 +375,11 @@ DefaultManager::ConnectMixerToOutput()
memset(&format, 0, sizeof(format));
format.type = B_MEDIA_RAW_AUDIO;
format.u.raw_audio.frame_rate = 44100;
format.u.raw_audio.channel_count = 2;
format.u.raw_audio.format = 0x2;
//roster->GetFormatFor(input, &format);
rv = roster->Connect(output.source, input.destination, &format, &output, &input);
if (rv != B_OK) {
@ -404,6 +401,7 @@ DefaultManager::ConnectMixerToOutput()
finish:
roster->ReleaseNode(mixer);
roster->ReleaseNode(soundcard);
roster->ReleaseNode(timesource);
return rv;
}

View File

@ -543,28 +543,6 @@ NodeManager::GetLiveNodes(BMessage *msg)
return B_OK;
}
void
NodeManager::UpdateNodeConnections()
{
// XXX this is only a workaround because the multi_audio
// XXX addon does not publish inputs right after creation :(
BAutolock lock(fLocker);
registered_node *rn;
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
BMessage msg(NODE_PUBLISH_CONNECTIONS);
media_node tempnode;
tempnode.node = rn->nodeid;
tempnode.port = rn->port;
tempnode.kind = rn->kinds;
msg.AddData("node", B_RAW_TYPE, &tempnode, sizeof(tempnode));
gAppManager->SendMessage(rn->team, &msg);
}
}
/**********************************************************************
* Registration of BMediaAddOns
**********************************************************************/

View File

@ -105,8 +105,6 @@ public:
void CleanupTeam(team_id team);
void UpdateNodeConnections();
private:
media_addon_id fNextAddOnID;
media_node_id fNextNodeID;