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


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

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


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

示例1: getConnectedInputs

// +++++ broken?
status_t NodeRef::getConnectedInputs(
	vector<media_input>&		ioInputs,
	media_type							filterType) const {
	
	BMediaRoster* r = BMediaRoster::Roster();
	status_t err;

	int32 count;
	int32 bufferInc = 16;
	int32 inputBufferSize = 16;
	media_input* inputBuffer = new media_input[inputBufferSize];

	while(true) {
		err = r->GetConnectedInputsFor(
			m_info.node, inputBuffer, inputBufferSize, &count);
		if(err < B_OK)
			return err;
			
		if(count == inputBufferSize) {
			// buffer too small; increase & try again
			inputBufferSize += bufferInc;
			delete [] inputBuffer;
			inputBuffer = new media_input[inputBufferSize];
			continue;
		}
		
		if(count)
			// copy found inputs matching the given type into vector
			remove_copy_if(inputBuffer, inputBuffer + count,
				back_inserter(ioInputs),
				not1(match_endpoint_type<media_input>(filterType)));
			
		break;
	}

	// fix missing node info
	_fixInputs(ioInputs);

	delete [] inputBuffer;
	return B_OK;
}
开发者ID:mariuz,项目名称:haiku,代码行数:42,代码来源:NodeRef.cpp

示例2:

void
MediaAddonServer::_DestroyInstantiatedFlavors(AddOnInfo& info)
{
	printf("MediaAddonServer::_DestroyInstantiatedFlavors addon %ld\n", info.id);

	NodeVector::iterator iterator = info.active_flavors.begin();
	for (; iterator != info.active_flavors.end(); iterator++) {
		media_node& node = *iterator;
		
		printf("node %ld\n", node.node);
		
		if ((node.kind & B_TIME_SOURCE) != 0
			&& (fMediaRoster->StopTimeSource(node, 0, true) != B_OK)) {
			printf("MediaAddonServer::_DestroyInstantiatedFlavors couldn't stop "
				"timesource\n");
			continue;
		}

		if (fMediaRoster->StopNode(node, 0, true) != B_OK) {
			printf("MediaAddonServer::_DestroyInstantiatedFlavors couldn't stop "
				"node\n");
			continue;
		}

		if ((node.kind & B_BUFFER_CONSUMER) != 0) {
			media_input inputs[16];
			int32 count = 0;
			if (fMediaRoster->GetConnectedInputsFor(node, inputs, 16, &count)
					!= B_OK) {
				printf("MediaAddonServer::_DestroyInstantiatedFlavors couldn't "
					"get connected inputs\n");
				continue;
			}

			for (int32 i = 0; i < count; i++) {
				media_node_id sourceNode;
				if ((sourceNode = fMediaRoster->NodeIDFor(
						inputs[i].source.port)) < 0) {
					printf("MediaAddonServer::_DestroyInstantiatedFlavors "
						"couldn't get source node id\n");
					continue;
				}

				if (fMediaRoster->Disconnect(sourceNode, inputs[i].source,
						node.node, inputs[i].destination) != B_OK) {
					printf("MediaAddonServer::_DestroyInstantiatedFlavors "
						"couldn't disconnect input\n");
					continue;
				}
			}
		}

		if ((node.kind & B_BUFFER_PRODUCER) != 0) {
			media_output outputs[16];
			int32 count = 0;
			if (fMediaRoster->GetConnectedOutputsFor(node, outputs, 16,
					&count) != B_OK) {
				printf("MediaAddonServer::_DestroyInstantiatedFlavors couldn't "
					"get connected outputs\n");
				continue;
			}

			for (int32 i = 0; i < count; i++) {
				media_node_id destNode;
				if ((destNode = fMediaRoster->NodeIDFor(
						outputs[i].destination.port)) < 0) {
					printf("MediaAddonServer::_DestroyInstantiatedFlavors "
						"couldn't get destination node id\n");
					continue;
				}

				if (fMediaRoster->Disconnect(node.node, outputs[i].source,
						destNode, outputs[i].destination) != B_OK) {
					printf("MediaAddonServer::_DestroyInstantiatedFlavors "
						"couldn't disconnect output\n");
					continue;
				}
			}
		}
		
		MediaRosterEx(fMediaRoster)->ReleaseNodeAll(node);
	}

	info.active_flavors.clear();
}
开发者ID:,项目名称:,代码行数:85,代码来源:

示例3:

void
MediaIcon::_getMediaTypesFor(const live_node_info &nodeInfo, bool *audioIn,
	bool *audioOut, bool *videoIn, bool *videoOut)
{
	D_INTERNAL(("MediaIcon::_getMediaTypeFor(live_node_info)\n"));

	// get the media_types supported by this node
	const int32 numberOfInputs = 4;
	int32 numberOfFreeInputs, numberOfConnectedInputs;
	media_input inputs[numberOfInputs];
	const int32 numberOfOutputs = 4;
	int32 numberOfFreeOutputs, numberOfConnectedOutputs;
	media_output outputs[numberOfOutputs];
	BMediaRoster *roster = BMediaRoster::CurrentRoster();
	if (roster->GetFreeInputsFor(nodeInfo.node, inputs, numberOfInputs, &numberOfFreeInputs) == B_OK) {
		for (int32 i = 0; i < numberOfFreeInputs; i++) {
			if ((inputs[i].format.type == B_MEDIA_RAW_AUDIO)
			 || (inputs[i].format.type == B_MEDIA_ENCODED_AUDIO)) {
				*audioIn = true;
				continue;
			}
			if ((inputs[i].format.type == B_MEDIA_RAW_VIDEO)
			 || (inputs[i].format.type == B_MEDIA_ENCODED_VIDEO)) {
				*videoIn = true;
			}
		}
	}
	if (roster->GetConnectedInputsFor(nodeInfo.node, inputs, numberOfInputs, &numberOfConnectedInputs) == B_OK) {
		for (int32 i = 0; i < numberOfConnectedInputs; i++) {
			if ((inputs[i].format.type == B_MEDIA_RAW_AUDIO)
			 || (inputs[i].format.type == B_MEDIA_ENCODED_AUDIO)) {
				*audioIn = true;
				continue;
			}
			if ((inputs[i].format.type == B_MEDIA_RAW_VIDEO)
			 || (inputs[i].format.type == B_MEDIA_ENCODED_VIDEO)) {
				*videoIn = true;
			}
		}
	}
	if (roster->GetFreeOutputsFor(nodeInfo.node, outputs, numberOfOutputs, &numberOfFreeOutputs) == B_OK) {
		for (int32 i = 0; i < numberOfFreeOutputs; i++) {
			if ((outputs[i].format.type == B_MEDIA_RAW_AUDIO)
			 || (outputs[i].format.type == B_MEDIA_ENCODED_AUDIO)) {
				*audioOut = true;
				continue;
			}
			if ((outputs[i].format.type == B_MEDIA_RAW_VIDEO)
			 || (outputs[i].format.type == B_MEDIA_ENCODED_VIDEO)) {
				*videoOut = true;
			}
		}
	}
	if (roster->GetConnectedOutputsFor(nodeInfo.node, outputs, numberOfOutputs, &numberOfConnectedOutputs) == B_OK) {
		for (int32 i = 0; i < numberOfConnectedOutputs; i++) {
			if ((outputs[i].format.type == B_MEDIA_RAW_AUDIO)
			 || (outputs[i].format.type == B_MEDIA_ENCODED_AUDIO)) {
				*audioOut = true;
				continue;
			}
			if ((outputs[i].format.type == B_MEDIA_RAW_VIDEO)
			 || (outputs[i].format.type == B_MEDIA_ENCODED_VIDEO)) {
				*videoOut = true;
			}
		}
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:67,代码来源:MediaIcon.cpp


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