当前位置: 首页>>代码示例>>C++>>正文


C++ BMediaRoster::GetDormantNodeFor方法代码示例

本文整理汇总了C++中BMediaRoster::GetDormantNodeFor方法的典型用法代码示例。如果您正苦于以下问题:C++ BMediaRoster::GetDormantNodeFor方法的具体用法?C++ BMediaRoster::GetDormantNodeFor怎么用?C++ BMediaRoster::GetDormantNodeFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BMediaRoster的用法示例。


在下文中一共展示了BMediaRoster::GetDormantNodeFor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _findIconFor

void MediaIcon::_findIconFor(
	const live_node_info &nodeInfo) {
	D_INTERNAL(("MediaIcon::_findIconFor(live_node_info)\n"));

	BMediaRoster *roster = BMediaRoster::CurrentRoster();
	if (m_nodeKind & B_FILE_INTERFACE) {
		entry_ref ref;
		if ((roster && (roster->GetRefFor(nodeInfo.node, &ref) == B_OK))
		 && (BNodeInfo::GetTrackerIcon(&ref, this, m_size) == B_OK)) {
			return;
		}
	}
	dormant_node_info dormantNodeInfo;
	if  (roster
	 && (roster->GetDormantNodeFor(nodeInfo.node, &dormantNodeInfo) == B_OK)) {
		D_INTERNAL((" -> instantiated from dormant node\n"));
		_findIconFor(dormantNodeInfo);
	}
	else {
		D_INTERNAL((" -> application internal node\n"));
		port_info portInfo;
		app_info appInfo;
		if ((get_port_info(nodeInfo.node.port, &portInfo) == B_OK)
		 && (be_roster->GetRunningAppInfo(portInfo.team, &appInfo) == B_OK)) {
			D_INTERNAL((" -> application info found: %s\n", appInfo.signature));
			app_info thisAppInfo;
			if ((be_app->GetAppInfo(&thisAppInfo) != B_OK)
			 || ((strcmp(appInfo.signature, thisAppInfo.signature) != 0)
			 && (strcmp(appInfo.signature, addon_host::g_appSignature) != 0))) {
				// only use app icon if the node doesn't belong to our team
				// or the addon-host
				BNodeInfo::GetTrackerIcon(&appInfo.ref, this, m_size);
				return;
			}
		}
		bool audioIn = false, audioOut = false, videoIn = false, videoOut = false;
		_getMediaTypesFor(nodeInfo, &audioIn, &audioOut, &videoIn, &videoOut);
		_findDefaultIconFor(audioIn, audioOut, videoIn, videoOut);
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:40,代码来源:MediaIcon.cpp

示例2: if

status_t
MediaWindow::_InitMedia(bool first)
{
	status_t err = B_OK;
	BMediaRoster* roster = BMediaRoster::Roster(&err);

	if (first && err != B_OK) {
		BAlert* alert = new BAlert("start_media_server",
			B_TRANSLATE("Could not connect to the media server.\n"
				"Would you like to start it ?"),
			B_TRANSLATE("Quit"),
			B_TRANSLATE("Start media server"), NULL,
			B_WIDTH_AS_USUAL, B_WARNING_ALERT);
		alert->SetShortcut(0, B_ESCAPE);
		if (alert->Go() == 0)
			return B_ERROR;

		Show();

		launch_media_server();
	}

	Lock();

	bool isVideoSelected = true;
	if (!first && fListView->ItemAt(0) != NULL
		&& fListView->ItemAt(0)->IsSelected())
		isVideoSelected = false;

	while (fListView->CountItems() > 0)
		delete fListView->RemoveItem((int32)0);
	_EmptyNodeLists();

	// Grab Media Info
	_FindNodes();

	// Add video nodes first. They might have an additional audio
	// output or input, but still should be listed as video node.
	_AddNodeItems(fVideoOutputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fVideoInputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fAudioOutputs, MediaListItem::AUDIO_TYPE);
	_AddNodeItems(fAudioInputs, MediaListItem::AUDIO_TYPE);

	fAudioView->AddOutputNodes(fAudioOutputs);
	fAudioView->AddInputNodes(fAudioInputs);
	fVideoView->AddOutputNodes(fVideoOutputs);
	fVideoView->AddInputNodes(fVideoInputs);

	// build our list view
	DeviceListItem* audio = new DeviceListItem(B_TRANSLATE("Audio settings"),
		MediaListItem::AUDIO_TYPE);
	fListView->AddItem(audio);

	MidiListItem* midi = new MidiListItem(B_TRANSLATE("MIDI Settings"));
	fListView->AddItem(midi);

	MediaListItem* video = new DeviceListItem(B_TRANSLATE("Video settings"),
		MediaListItem::VIDEO_TYPE);
	fListView->AddItem(video);

	MediaListItem* mixer = new AudioMixerListItem(B_TRANSLATE("Audio mixer"));
	fListView->AddItem(mixer);

	fListView->SortItems(&MediaListItem::Compare);
	_UpdateListViewMinWidth();

	// Set default nodes for our setting views
	media_node defaultNode;
	dormant_node_info nodeInfo;
	int32 outputID;
	BString outputName;

	if (roster->GetAudioInput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fAudioView->SetDefaultInput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (roster->GetAudioOutput(&defaultNode, &outputID, &outputName) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fAudioView->SetDefaultOutput(&nodeInfo);
		fAudioView->SetDefaultChannel(outputID);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoInput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fVideoView->SetDefaultInput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoOutput(&defaultNode) == B_OK) {
		roster->GetDormantNodeFor(defaultNode, &nodeInfo);
		fVideoView->SetDefaultOutput(&nodeInfo);
			// this causes our listview to be updated as well
	}

	if (first)
		fListView->Select(fListView->IndexOf(mixer));
	else if (isVideoSelected)
//.........这里部分代码省略.........
开发者ID:bhanug,项目名称:haiku,代码行数:101,代码来源:MediaWindow.cpp

示例3: locker

status_t
MediaWindow::InitMedia(bool first)
{
	status_t err = B_OK;
	BMediaRoster* roster = BMediaRoster::Roster(&err);

	if (first && err != B_OK) {
		BAlert* alert = new BAlert("start_media_server",
			B_TRANSLATE("Could not connect to the media server.\n"
			"Would you like to start it ?"),
			B_TRANSLATE("Quit"),
			B_TRANSLATE("Start media server"), NULL,
			B_WIDTH_AS_USUAL, B_WARNING_ALERT);
		if (alert->Go()==0)
			return B_ERROR;

		fAlert = new MediaAlert(BRect(0, 0, 300, 60),
			"restart_alert", B_TRANSLATE(
				"Restarting media services\nStarting media server"
				B_UTF8_ELLIPSIS "\n"));
		fAlert->Show();

		Show();

		launch_media_server();
	}

	Lock();

	bool isVideoSelected = true;
	if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
		isVideoSelected = false;

	if ((!first || (first && err) ) && fAlert) {
		BAutolock locker(fAlert);
		if (locker.IsLocked())
			fAlert->TextView()->SetText(
				B_TRANSLATE("Ready for use" B_UTF8_ELLIPSIS));
	}

	while (fListView->CountItems() > 0)
		delete fListView->RemoveItem((int32)0);
	_EmptyNodeLists();

	// Grab Media Info
	_FindNodes();

	// Add video nodes first. They might have an additional audio
	// output or input, but still should be listed as video node.
	_AddNodeItems(fVideoOutputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fVideoInputs, MediaListItem::VIDEO_TYPE);
	_AddNodeItems(fAudioOutputs, MediaListItem::AUDIO_TYPE);
	_AddNodeItems(fAudioInputs, MediaListItem::AUDIO_TYPE);

	fAudioView->AddOutputNodes(fAudioOutputs);
	fAudioView->AddInputNodes(fAudioInputs);
	fVideoView->AddOutputNodes(fVideoOutputs);
	fVideoView->AddInputNodes(fVideoInputs);

	// build our list view
	DeviceListItem* audio = new DeviceListItem(B_TRANSLATE("Audio settings"),
		MediaListItem::AUDIO_TYPE);
	fListView->AddItem(audio);

	MediaListItem* video = new DeviceListItem(B_TRANSLATE("Video settings"),
		MediaListItem::VIDEO_TYPE);
	fListView->AddItem(video);

	MediaListItem* mixer = new AudioMixerListItem(B_TRANSLATE("Audio mixer"));
	fListView->AddItem(mixer);

	fListView->SortItems(&MediaListItem::Compare);
	_UpdateListViewMinWidth();

	// Set default nodes for our setting views
	media_node default_node;
	dormant_node_info node_info;
	int32 outputID;
	BString outputName;

	if (roster->GetAudioInput(&default_node) == B_OK) {
		roster->GetDormantNodeFor(default_node, &node_info);
		fAudioView->SetDefaultInput(&node_info);
			// this causes our listview to be updated as well
	}

	if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
		roster->GetDormantNodeFor(default_node, &node_info);
		fAudioView->SetDefaultOutput(&node_info);
		fAudioView->SetDefaultChannel(outputID);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoInput(&default_node)==B_OK) {
		roster->GetDormantNodeFor(default_node, &node_info);
		fVideoView->SetDefaultInput(&node_info);
			// this causes our listview to be updated as well
	}

	if (roster->GetVideoOutput(&default_node)==B_OK) {
//.........这里部分代码省略.........
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:101,代码来源:MediaWindow.cpp


注:本文中的BMediaRoster::GetDormantNodeFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。