Пример #1
0
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id) 
{
        std::cerr << "****** Plugin GUI handler: received VoipData!" << std::endl;

	std::vector<RsVoipDataChunk> chunks ;

	if(!rsVoip->getIncomingData(peer_id.toStdString(),chunks))
	{
		std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
		return ;
	}

	ChatDialog *di = ChatDialog::getExistingChat(peer_id.toStdString()) ;
	if (di) {
		ChatWidget *cw = di->getChatWidget();
		if (cw) {
			const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();

			foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList) {
				AudioChatWidgetHolder *acwh = dynamic_cast<AudioChatWidgetHolder*>(chatWidgetHolder) ;

				if (acwh) {
					for (unsigned int i = 0; i < chunks.size(); ++i) {
						for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
							QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);
							acwh->addAudioData(peer_id,&qb);
						}
					}
					break;
				}
			}
		}
	} else {
Пример #2
0
void VOIPGUIHandler::ReceivedInvitation(const RsPeerId &peer_id, int flags)
{
#ifdef VOIPGUIHANDLER_DEBUG
	std::cerr << "****** VOIPGUIHandler: received Invitation from peer " << peer_id.toStdString() << " with flags==" << flags << std::endl;
#endif
	ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
	if (di) {
		ChatWidget *cw = di->getChatWidget();
		if(cw) {
			const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();

			foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
			{
				VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;

				if (acwh)
					acwh->ReceivedInvitation(peer_id, flags);
			}
		}
	} else {
Пример #3
0
void VOIPGUIHandler::ReceivedVoipData(const RsPeerId &peer_id)
{
	std::vector<RsVOIPDataChunk> chunks ;

	if(!rsVOIP->getIncomingData(peer_id,chunks))
	{
		std::cerr << "VOIPGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
		return ;
	}

	ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
	if (di) {
		ChatWidget *cw = di->getChatWidget();
		if (cw) {
			const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();

			foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList) 
			{
				VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;

				if (acwh) {
						for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++)
						{
							QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);

							if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
							acwh->addAudioData(peer_id, &qb);
							else if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
							acwh->addVideoData(peer_id, &qb);
							else
								std::cerr << "VOIPGUIHandler: Unknown data type received. type=" << chunks[chunkIndex].type << std::endl;
						}
					break;
				}
			}
		}
	} else {