various small bugfixes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3321 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
359ac30644
commit
4f09fa2ff1
@ -15,6 +15,9 @@
|
||||
|
||||
#define NODE_UNREGISTERED_ID -2
|
||||
|
||||
#define BAD_MEDIA_SERVER_PORT -222
|
||||
#define BAD_MEDIA_ADDON_SERVER_PORT -444
|
||||
|
||||
#define SHADOW_TIMESOURCE_CONTROL_PORT -333
|
||||
#define IS_SHADOW_TIMESOURCE(_node) ((_node).node > 0 && (_node).port == SHADOW_TIMESOURCE_CONTROL_PORT)
|
||||
|
||||
|
@ -6,11 +6,15 @@
|
||||
#include <OS.h>
|
||||
#include <Messenger.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "debug.h"
|
||||
#include "PortPool.h"
|
||||
#include "MediaMisc.h"
|
||||
#include "DataExchange.h"
|
||||
#include "ServerInterface.h" // NEW_MEDIA_SERVER_SIGNATURE
|
||||
|
||||
#define CRASH_ON_ERRROR 0
|
||||
|
||||
#define TIMEOUT 15000000 // 15 seconds timeout!
|
||||
|
||||
namespace BPrivate {
|
||||
@ -27,6 +31,12 @@ static port_id MediaAddonServerPort;
|
||||
void find_media_server_port();
|
||||
void find_media_addon_server_port();
|
||||
|
||||
#if CRASH_ON_ERRROR
|
||||
#define crash_now() debugger("crash")
|
||||
#else
|
||||
#define crash_now() ((void)0)
|
||||
#endif
|
||||
|
||||
class initit
|
||||
{
|
||||
public:
|
||||
@ -53,7 +63,7 @@ void find_media_server_port()
|
||||
MediaServerPort = find_port("media_server port");
|
||||
if (MediaServerPort < 0) {
|
||||
FATAL("couldn't find MediaServerPort\n");
|
||||
MediaServerPort = -666; // make this a unique number
|
||||
MediaServerPort = BAD_MEDIA_SERVER_PORT; // make this a unique number
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +72,7 @@ void find_media_addon_server_port()
|
||||
MediaAddonServerPort = find_port("media_addon_server port");
|
||||
if (MediaAddonServerPort < 0) {
|
||||
FATAL("couldn't find MediaAddonServerPort\n");
|
||||
MediaAddonServerPort = -555; // make this a unique number
|
||||
MediaAddonServerPort = BAD_MEDIA_ADDON_SERVER_PORT; // make this a unique number
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,8 +91,10 @@ status_t SendToServer(BMessage *msg)
|
||||
{
|
||||
status_t rv;
|
||||
rv = MediaServerMessenger->SendMessage(msg, static_cast<BHandler *>(NULL), TIMEOUT);
|
||||
if (rv != B_OK)
|
||||
if (rv != B_OK) {
|
||||
FATAL("SendToServer: SendMessage failed\n");
|
||||
crash_now();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -125,11 +137,13 @@ status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size
|
||||
find_media_addon_server_port();
|
||||
sendport = MediaAddonServerPort;
|
||||
} else {
|
||||
crash_now();
|
||||
return rv;
|
||||
}
|
||||
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));
|
||||
crash_now();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@ -155,12 +169,14 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
|
||||
find_media_addon_server_port();
|
||||
requestport = MediaAddonServerPort;
|
||||
} else {
|
||||
crash_now();
|
||||
_PortPool->PutPort(request->reply_port);
|
||||
return rv;
|
||||
}
|
||||
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));
|
||||
crash_now();
|
||||
_PortPool->PutPort(request->reply_port);
|
||||
return rv;
|
||||
}
|
||||
@ -169,8 +185,10 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
|
||||
rv = read_port_etc(request->reply_port, &code, reply, replysize, B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||
_PortPool->PutPort(request->reply_port);
|
||||
|
||||
if (rv < B_OK)
|
||||
if (rv < B_OK) {
|
||||
FATAL("QueryPort: read_port failed, port %ld, error %#lx (%s)\n", request->reply_port, rv, strerror(rv));
|
||||
crash_now();
|
||||
}
|
||||
|
||||
return (rv < B_OK) ? rv : reply->result;
|
||||
}
|
||||
|
@ -788,12 +788,16 @@ BMediaRoster::Disconnect(media_node_id source_nodeid,
|
||||
if (B_OK == MediaRosterEx(this)->GetAllOutputs(sourcenode , &outlist))
|
||||
MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist);
|
||||
ReleaseNode(sourcenode);
|
||||
} else FATAL("BMediaRoster::Disconnect: source GetNodeFor failed\n");
|
||||
} else {
|
||||
FATAL("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");
|
||||
} else {
|
||||
FATAL("BMediaRoster::Disconnect: dest GetNodeFor failed\n");
|
||||
}
|
||||
|
||||
|
||||
// send a notification
|
||||
@ -1561,13 +1565,13 @@ BMediaRosterEx::RegisterNode(BMediaNode * node, media_addon_id addonid, int32 fl
|
||||
// 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
|
||||
@ -2477,7 +2481,8 @@ BMediaRoster::MessageReceived(BMessage * message)
|
||||
List<media_output> outputlist;
|
||||
if (B_OK == MediaRosterEx(this)->GetAllOutputs(node, &outputlist))
|
||||
MediaRosterEx(this)->PublishOutputs(node, &outputlist);
|
||||
} else if (node.kind & B_BUFFER_CONSUMER) {
|
||||
}
|
||||
if (node.kind & B_BUFFER_CONSUMER) {
|
||||
List<media_input> inputlist;
|
||||
if (B_OK == MediaRosterEx(this)->GetAllInputs(node, &inputlist))
|
||||
MediaRosterEx(this)->PublishInputs(node, &inputlist);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <OS.h>
|
||||
#include <MediaNode.h>
|
||||
#include <MediaRoster.h>
|
||||
#include <TimeSource.h>
|
||||
#include <string.h>
|
||||
#include "DefaultManager.h"
|
||||
#include "NodeManager.h"
|
||||
@ -160,11 +161,11 @@ 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
|
||||
/*
|
||||
//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)
|
||||
@ -175,7 +176,7 @@ for (int i = 0; i < 10; i++) { // XXX ugly workaround
|
||||
FindPhysicalAudioIn();
|
||||
if (fAudioMixer == -1)
|
||||
FindAudioMixer();
|
||||
}
|
||||
//}
|
||||
|
||||
// The normal time source is searched for after the
|
||||
// Physical Audio Out has been created.
|
||||
@ -187,6 +188,8 @@ for (int i = 0; i < 10; i++) { // XXX ugly workaround
|
||||
fMixerConnected = B_OK == ConnectMixerToOutput();
|
||||
if (!fMixerConnected)
|
||||
FATAL("DefaultManager: failed to connect mixer and soundcard\n");
|
||||
} else {
|
||||
FATAL("DefaultManager: Did not try to connect mixer and soundcard\n");
|
||||
}
|
||||
|
||||
printf("DefaultManager::RescanThread() leave\n");
|
||||
@ -334,11 +337,14 @@ status_t
|
||||
DefaultManager::ConnectMixerToOutput()
|
||||
{
|
||||
BMediaRoster *roster;
|
||||
media_node timesource;
|
||||
media_node mixer;
|
||||
media_node soundcard;
|
||||
media_input input;
|
||||
media_output output;
|
||||
media_format format;
|
||||
BTimeSource * ts;
|
||||
bigtime_t start_at;
|
||||
int32 count;
|
||||
status_t rv;
|
||||
|
||||
@ -383,6 +389,18 @@ DefaultManager::ConnectMixerToOutput()
|
||||
printf("DefaultManager: connect failed\n");
|
||||
}
|
||||
|
||||
roster->GetTimeSource(×ource);
|
||||
roster->SetTimeSourceFor(mixer.node, timesource.node);
|
||||
roster->SetTimeSourceFor(soundcard.node, timesource.node);
|
||||
roster->PrerollNode(mixer);
|
||||
roster->PrerollNode(soundcard);
|
||||
|
||||
ts = roster->MakeTimeSourceFor(timesource);
|
||||
start_at = ts->Now() + 50000;
|
||||
roster->StartNode(mixer, start_at);
|
||||
roster->StartNode(soundcard, start_at);
|
||||
ts->Release();
|
||||
|
||||
finish:
|
||||
roster->ReleaseNode(mixer);
|
||||
roster->ReleaseNode(soundcard);
|
||||
|
@ -998,7 +998,7 @@ NodeManager::Dump()
|
||||
output->node.node, output->node.port, output->source.port, output->source.id, output->destination.port, output->destination.id, output->name);
|
||||
}
|
||||
if (rn->outputlist.IsEmpty())
|
||||
printf(" media_input: none\n");
|
||||
printf(" media_output: none\n");
|
||||
}
|
||||
printf("NodeManager: list end\n");
|
||||
printf("\n");
|
||||
|
Loading…
Reference in New Issue
Block a user