launch_media_server: Use BLaunchRoster::Start
* Remove SyncToServices and the related code from BMediaRoster.
This commit is contained in:
@@ -44,10 +44,6 @@ public:
|
|||||||
// Check if the media services are running.
|
// Check if the media services are running.
|
||||||
static bool IsRunning();
|
static bool IsRunning();
|
||||||
|
|
||||||
// Wait until the media_server is running or the specified timeout
|
|
||||||
// is reached.
|
|
||||||
status_t SyncToServices(bigtime_t timeout);
|
|
||||||
|
|
||||||
// Getting common instances of system nodes:
|
// Getting common instances of system nodes:
|
||||||
status_t GetVideoInput(media_node* _node);
|
status_t GetVideoInput(media_node* _node);
|
||||||
status_t GetAudioInput(media_node* _node);
|
status_t GetAudioInput(media_node* _node);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <IconUtils.h>
|
#include <IconUtils.h>
|
||||||
|
#include <LaunchRoster.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
#include <MediaRoster.h>
|
#include <MediaRoster.h>
|
||||||
@@ -1433,18 +1434,7 @@ launch_media_server(bigtime_t timeout,
|
|||||||
|
|
||||||
progress_startup(50, progress, cookie);
|
progress_startup(50, progress, cookie);
|
||||||
|
|
||||||
err = roster->SyncToServices(2000000);
|
err = BLaunchRoster().Start(B_MEDIA_SERVER_SIGNATURE);
|
||||||
if (err != B_OK) {
|
|
||||||
// At this point, it might be that the launch_daemon isn't
|
|
||||||
// restarting us, then we'll attempt at launching the server
|
|
||||||
// ourselves.
|
|
||||||
err = be_roster->Launch(B_MEDIA_SERVER_SIGNATURE);
|
|
||||||
if (err != B_OK)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (roster->SyncToServices(2000000) != B_OK)
|
|
||||||
err = B_MEDIA_SYSTEM_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
progress_startup(90, progress, cookie);
|
progress_startup(90, progress, cookie);
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ static bool sServerIsUp = false;
|
|||||||
static List<RosterNotification> sNotificationList;
|
static List<RosterNotification> sNotificationList;
|
||||||
static BLocker sInitLocker("BMediaRoster::Roster locker");
|
static BLocker sInitLocker("BMediaRoster::Roster locker");
|
||||||
static List<LocalNode> sRegisteredNodes;
|
static List<LocalNode> sRegisteredNodes;
|
||||||
static List<SyncedMessage> sSyncedMessages;
|
|
||||||
|
|
||||||
|
|
||||||
class MediaRosterUndertaker {
|
class MediaRosterUndertaker {
|
||||||
@@ -3363,26 +3362,6 @@ BMediaRoster::IsRunning()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BMediaRoster::SyncToServices(bigtime_t timeout)
|
|
||||||
{
|
|
||||||
BMessenger messenger(this);
|
|
||||||
BMessage msg(MEDIA_ROSTER_REGISTER_SYNC);
|
|
||||||
BMessage reply;
|
|
||||||
|
|
||||||
if (!messenger.IsValid())
|
|
||||||
return B_MEDIA_SYSTEM_FAILURE;
|
|
||||||
|
|
||||||
status_t ret = messenger.SendMessage(&msg, &reply, timeout, timeout);
|
|
||||||
if (ret == B_TIMED_OUT || reply.what == B_NO_REPLY)
|
|
||||||
return B_TIMED_OUT;
|
|
||||||
else if (ret != B_OK)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
BMediaRoster::AudioBufferSizeFor(int32 channelCount, uint32 sampleFormat,
|
BMediaRoster::AudioBufferSizeFor(int32 channelCount, uint32 sampleFormat,
|
||||||
float frameRate, bus_type busKind)
|
float frameRate, bus_type busKind)
|
||||||
@@ -3471,20 +3450,6 @@ BMediaRoster::MessageReceived(BMessage* message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MEDIA_ROSTER_REGISTER_SYNC:
|
|
||||||
{
|
|
||||||
BMessage reply;
|
|
||||||
if (sServerIsUp)
|
|
||||||
message->SendReply(&reply);
|
|
||||||
else {
|
|
||||||
DetachCurrentMessage();
|
|
||||||
SyncedMessage msg;
|
|
||||||
msg.message = message;
|
|
||||||
sSyncedMessages.Insert(msg);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_SOME_APP_LAUNCHED:
|
case B_SOME_APP_LAUNCHED:
|
||||||
{
|
{
|
||||||
BString mimeSig;
|
BString mimeSig;
|
||||||
@@ -3552,16 +3517,6 @@ BMediaRoster::MessageReceived(BMessage* message)
|
|||||||
MediaRosterEx(this)->fLaunchNotification = false;
|
MediaRosterEx(this)->fLaunchNotification = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMessage reply;
|
|
||||||
for (int32 i = 0; i < sSyncedMessages.CountItems(); i++) {
|
|
||||||
SyncedMessage* msg;
|
|
||||||
if (sSyncedMessages.Get(i, &msg) == true) {
|
|
||||||
msg->message->SendReply(&reply);
|
|
||||||
delete msg->message;
|
|
||||||
}
|
|
||||||
sSyncedMessages.Remove(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the notification to our subscribers
|
// Send the notification to our subscribers
|
||||||
for (int32 i = 0; i < sNotificationList.CountItems(); i++) {
|
for (int32 i = 0; i < sNotificationList.CountItems(); i++) {
|
||||||
RosterNotification* current;
|
RosterNotification* current;
|
||||||
|
|||||||
Reference in New Issue
Block a user