mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
added transmission of data from voip service to audio popup chat dialog
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4991 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
db07053214
commit
528e822d8e
3 changed files with 31 additions and 3 deletions
|
@ -63,7 +63,9 @@ ConfigPage *VOIPPlugin::qt_config_page() const
|
||||||
|
|
||||||
PopupChatDialog *VOIPPlugin::qt_allocate_new_popup_chat_dialog() const
|
PopupChatDialog *VOIPPlugin::qt_allocate_new_popup_chat_dialog() const
|
||||||
{
|
{
|
||||||
return new AudioPopupChatDialog() ;
|
AudioPopupChatDialog *ap = new AudioPopupChatDialog() ;
|
||||||
|
|
||||||
|
return ap ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VOIPPlugin::qt_transfers_tab_name() const
|
std::string VOIPPlugin::qt_transfers_tab_name() const
|
||||||
|
|
|
@ -19,6 +19,7 @@ class AudioPopupChatDialog: public PopupChatDialog
|
||||||
inputDevice->stop() ;
|
inputDevice->stop() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addAudioData(const QString name, QByteArray* array) ;
|
||||||
private slots:
|
private slots:
|
||||||
void toggleAudioListen();
|
void toggleAudioListen();
|
||||||
void toggleAudioMuteCapture();
|
void toggleAudioMuteCapture();
|
||||||
|
@ -34,8 +35,6 @@ class AudioPopupChatDialog: public PopupChatDialog
|
||||||
|
|
||||||
virtual void updateStatus(const QString& peer_id,int status) ;
|
virtual void updateStatus(const QString& peer_id,int status) ;
|
||||||
|
|
||||||
void addAudioData(const QString name, QByteArray* array) ;
|
|
||||||
|
|
||||||
QPushButton *audioListenToggleButton ;
|
QPushButton *audioListenToggleButton ;
|
||||||
QPushButton *audioMuteCaptureToggleButton ;
|
QPushButton *audioMuteCaptureToggleButton ;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
#include <interface/rsvoip.h>
|
||||||
#include "PluginGUIHandler.h"
|
#include "PluginGUIHandler.h"
|
||||||
|
#include <gui/chat/ChatDialog.h>
|
||||||
|
#include <gui/AudioPopupChatDialog.h>
|
||||||
|
|
||||||
void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
|
void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
|
||||||
{
|
{
|
||||||
|
@ -9,5 +14,27 @@ void PluginGUIHandler::ReceivedInvitation(const QString& peer_id)
|
||||||
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
||||||
{
|
{
|
||||||
std::cerr << "****** Plugin GUI handler: received invitation!" << std::endl;
|
std::cerr << "****** Plugin GUI handler: received invitation!" << 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()) ;
|
||||||
|
|
||||||
|
AudioPopupChatDialog *adi = dynamic_cast<AudioPopupChatDialog*>(di) ;
|
||||||
|
|
||||||
|
if(adi != NULL)
|
||||||
|
for(unsigned int i=0;i<chunks.size();++i)
|
||||||
|
{
|
||||||
|
QByteArray qb(reinterpret_cast<const char *>(chunks[i].data),chunks[i].size) ;
|
||||||
|
adi->addAudioData(peer_id,&qb) ;
|
||||||
|
free(chunks[i].data) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue