本文整理汇总了C++中BMediaRoster::GetInstancesFor方法的典型用法代码示例。如果您正苦于以下问题:C++ BMediaRoster::GetInstancesFor方法的具体用法?C++ BMediaRoster::GetInstancesFor怎么用?C++ BMediaRoster::GetInstancesFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMediaRoster
的用法示例。
在下文中一共展示了BMediaRoster::GetInstancesFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strerror
void
MediaWindow::SmartNode::SetTo(const dormant_node_info* info)
{
_FreeNode();
if (!info)
return;
fNode = new media_node();
BMediaRoster* roster = BMediaRoster::Roster();
status_t status = B_OK;
media_node_id node_id;
if (roster->GetInstancesFor(info->addon, info->flavor_id, &node_id) == B_OK)
status = roster->GetNodeFor(node_id, fNode);
else
status = roster->InstantiateDormantNode(*info, fNode, B_FLAVOR_IS_GLOBAL);
if (status != B_OK) {
fprintf(stderr, "SmartNode::SetTo error with node %" B_PRId32
": %s\n", fNode->node, strerror(status));
}
status = roster->StartWatching(fMessenger, *fNode, B_MEDIA_WILDCARD);
if (status != B_OK) {
fprintf(stderr, "SmartNode::SetTo can't start watching for"
" node %" B_PRId32 "\n", fNode->node);
}
}
示例2: message
void
AudioSettingsView::_FillChannelMenu(const dormant_node_info* nodeInfo)
{
_EmptyMenu(fChannelMenu);
BMediaRoster* roster = BMediaRoster::Roster();
media_node node;
media_node_id node_id;
status_t err = roster->GetInstancesFor(nodeInfo->addon,
nodeInfo->flavor_id, &node_id);
if (err != B_OK) {
err = roster->InstantiateDormantNode(*nodeInfo, &node,
B_FLAVOR_IS_GLOBAL);
} else {
err = roster->GetNodeFor(node_id, &node);
}
if (err == B_OK) {
int32 inputCount = 4;
media_input* inputs = new media_input[inputCount];
BPrivate::ArrayDeleter<media_input> inputDeleter(inputs);
while (true) {
int32 realInputCount = 0;
err = roster->GetAllInputsFor(node, inputs,
inputCount, &realInputCount);
if (realInputCount > inputCount) {
inputCount *= 2;
inputs = new media_input[inputCount];
inputDeleter.SetTo(inputs);
} else {
inputCount = realInputCount;
break;
}
}
if (err == B_OK) {
BMessage message(ML_DEFAULT_CHANNEL_CHANGED);
for (int32 i = 0; i < inputCount; i++) {
media_input* input = new media_input();
memcpy(input, &inputs[i], sizeof(*input));
ChannelMenuItem* channelItem = new ChannelMenuItem(input,
new BMessage(message));
fChannelMenu->AddItem(channelItem);
if (channelItem->DestinationID() == 0)
channelItem->SetMarked(true);
}
}
}
if (Window())
fChannelMenu->SetTargetForItems(BMessenger(this));
}
示例3:
void
MediaWindow::SmartNode::SetTo(const dormant_node_info* info)
{
_FreeNode();
if (!info)
return;
fNode = new media_node();
BMediaRoster* roster = BMediaRoster::Roster();
// TODO: error codes
media_node_id node_id;
if (roster->GetInstancesFor(info->addon, info->flavor_id, &node_id) == B_OK)
roster->GetNodeFor(node_id, fNode);
else
roster->InstantiateDormantNode(*info, fNode, B_FLAVOR_IS_GLOBAL);
roster->StartWatching(fMessenger, *fNode, B_MEDIA_WILDCARD);
}