Add some experimental media add-on instantiating support, more debugging and bugfixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@744 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-08-13 15:21:32 +00:00
parent 9270876b99
commit 16b7eea41a
5 changed files with 33 additions and 7 deletions

View File

@ -52,7 +52,7 @@ DormantNodeManager::~DormantNodeManager()
// force unloading all currently loaded images
loaded_addon_info *info;
for (int32 index = 0; fAddonmap->GetPointerAt(index,&info); index++) {
printf("Forcing unload of add-on %d with usecount %d\n",info->addon, info->usecount);
printf("Forcing unload of add-on id %d with usecount %d\n",info->addon->AddonID(), info->usecount);
UnloadAddon(info->addon, info->image);
}
@ -140,7 +140,6 @@ DormantNodeManager::PutAddon(media_addon_id id)
bool unload;
printf("DormantNodeManager::PutAddon, id %d\n",id);
fLock->Lock();
if (!fAddonmap->GetPointer(id, &info)) {
@ -291,7 +290,7 @@ void
DormantNodeManager::UnloadAddon(BMediaAddOn *addon, image_id image)
{
ASSERT(addon);
ASSERT(addon->Image() == image); // if this failes, something bad happends to the add-on
ASSERT(addon->Image() == image); // if this failes, something bad happened to the add-on
delete addon;
unload_add_on(image);
}

View File

@ -547,6 +547,7 @@ BMediaAddOn::AddonID()
status_t
BMediaAddOn::NotifyFlavorChange()
{
CALLED();
if (fAddon == 0)
return B_ERROR;

View File

@ -686,7 +686,7 @@ BMediaNode::BMediaNode(const char *name,
strncpy(fName,name,B_MEDIA_NAME_LENGTH - 1);
fName[B_MEDIA_NAME_LENGTH - 1] = 0;
}
TRACE("Media node name is: %s\n",fName);
TRACE("BMediaNode::BMediaNode: node name is: %s\n",fName);
// create control port
fControlPort = create_port(64,fName);

View File

@ -16,6 +16,7 @@
#include "debug.h"
#include "PortPool.h"
#include "ServerInterface.h"
#include "DormantNodeManager.h"
static BMessenger *ServerMessenger = 0;
static team_id team;
@ -1094,7 +1095,7 @@ status_t
BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info,
media_node * out_node)
{
UNIMPLEMENTED();
CALLED();
// to instantiate a dormant node in the current address space, we need to
// either load the add-on from file and create a new BMediaAddOn class, or
@ -1107,7 +1108,26 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info & in_info,
// RegisterNode() is called automatically for nodes instantiated from add-ons
return B_ERROR;
//XXX TEST!
BMediaAddOn *addon;
BMediaNode *node;
BMessage config;
status_t out_error;
addon = _DormantNodeManager->GetAddon(in_info.addon);
if (!addon) {
printf("BMediaRoster::InstantiateDormantNode: GetAddon failed\n");
return B_ERROR;
}
flavor_info temp;
temp.internal_id = in_info.flavor_id;
node = addon->InstantiateNodeFor(&temp, &config, &out_error);
if (!node) {
printf("BMediaRoster::InstantiateDormantNode: InstantiateNodeFor failed\n");
_DormantNodeManager->PutAddon(in_info.addon);
return B_ERROR;
}
*out_node = node->Node();
return B_OK;
}

View File

@ -17,6 +17,8 @@
#include "ServerInterface.h"
#include "DormantNodeManager.h"
#define USER_ADDON_PATH "/boot/home/Develop/OpenBeOS/current/distro/x86.R1/beos/system/add-ons/media"
void DumpFlavorInfo(const flavor_info *info);
class MediaAddonServer : BApplication
@ -125,7 +127,11 @@ MediaAddonServer::ReadyToRun()
DirNodeSystem = nref.node;
WatchDir(&e);
#ifdef USER_ADDON_PATH
BEntry e2(USER_ADDON_PATH);
#else
BEntry e2("/boot/home/config/add-ons/media");
#endif
e2.GetNodeRef(&nref);
DirNodeUser = nref.node;
WatchDir(&e2);
@ -216,7 +222,7 @@ MediaAddonServer::AddOnAdded(const char *path, ino_t file_node)
addon = _DormantNodeManager->GetAddon(id);
if (addon == NULL) {
printf("failed to get add-on\n");
printf("MediaAddonServer::AddOnAdded: failed to get add-on\n");
_DormantNodeManager->UnregisterAddon(id);
return;
}