示例#1
0
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);
	}
}