Hello to all, i need to develop an application that does VOIP call. In the same time, i need to send video capture from web cam to the callee.
I using pjlib for VOIP and QT for GUI.
http://nashruddin.com/Streaming_Open...k#introduction
I have this resources.
Do we need another thread for web cam frame grabber and one thread for voip calling ?
My task is to discover the callee IP using SIP URI register to public server. Then, i send the web cam to the calless' address.
How to discover IP after VOIP call of caller and callee ?
This is my final year project.
Please suggest the tool to use or idea to start.
I wonder does anyone do this before.
I plan to do this in Qt using QThread and QTcpSocket. Is this possible ? If yes, how to code ?
Code:
{ private: Q_OBJECT public: ~InteractiveMultiTouchCommunicationSystem(); protected: // Show Context Menu created by createStandardContextMenu(); // Event paramenet used to identify where mouse position event generated // Implement KeyBoard shortcut Event //private SIGNAL: // // SLOT private slots: // Main Slot void VOIPLogSlot(); void VOIPCallRedialSlot(); void VOIPCallRecordSlot(); void VOIPCallRecordValidateSlot(); void VOIPCallHoldSlot(); void VOIPCallReInvite(); void VOIPCallTransferSlot(); void VOIPConfigSlot(); void AddContactSlot(); void DeleteContactSlot(); void ManageContactSlot(); void VOIPHistorySlot(); void AboutSlot(); void AboutQTSlot(); // Slot for Child Widget // VOIP Widget Slot void VOIPCallSlot(); void VOIPHUSlot(); void DialPadSlot(); // VOIP Config Dialog Slot // First Tab void SIPSaveSlot(); void SIPAddSlot(); void SIPEditSlot(); void SIPRemoveSlot(); // Second Tab void NetworkSettingsSaveSlot(); void NetworkSettingsDefaultSlot(); // Third Tab // Add Contact Dialog Slot void AddContactDlgSlot(); // Delete Contact Dialog Slot void DeleteContactDlgSlot(); private: Ui::InteractiveMultiTouchCommunicationSystemClass ui; // ToolBar QToolBar* myTB; // Menu QMenu* VOIPMenu; QMenu* ConfigurationMenu; // Action *VOIPRecordAct, *VOIPHoldAct, *VOIPReinviteAct, *VOIPTransferAct; QAction* VOIPConfigAct; QAction* IncomingVOIPHistoryAct, *OutgoingVOIPHistoryAct, *MissedVOIPHistoryAct, *ReceivedVOIPHistoryAct; *ManageContactAct; QAction* ExitAct; // Child Widget Component // Selection Widget/Dialog/GO *DeleteContactDlg, *ManageContactDlg; // VOIP Widget Component QLineEdit* display; *Four, *Five, *Six, *Seven, *Eight, *Nine, *DotSign, *Zero, *Hash; QErrorMessage* errorMsg; // VOIP Log Dialog Component QDialog* VOIPDebugDlg; QTextEdit* logText; // VOIP Call Record Widget Componenet QDialog* CallRecordFileNameDlg; QLabel* fileName; QLineEdit* fileNameLE; QPushButton* confirm; QMessageBox* msgBox; // VOIP Configuration Dialog Component *SIPAccount, *Ports, *SIPPort, *audioVideoPort, *NAT, *StunServer; *RemoveSIPAcc, *SaveBtn, *DefaultBtn; // Third Tab QLineEdit* SIPURIAddLE; *RemoveSIPAdd; // Add Contact Dialog Component *myEmail; QLineEdit* myEmailLE; // Delete Contact Dialog Component *theEmail; QComboBox* myEmailCB; // Private Function void Init(); void createAction(); void createMenu(); void createToolBar(); void createVOIPWidget(); void createVOIPConfigDlg(); void createAddContactDlg(); void createDeleteContactDlg(); void createManageContactDlg(); // Utility Function bool ValidateSIP(const std::string&, bool&, int&) const; // =================== VOIP ==================== public: typedef boost::shared_ptr<VOIP> VOIPPtr; private: VOIPPtr obj; };
And this is my openCV Video streaming code.
Code:
{ Q_OBJECT public: typedef unsigned char uchar; public: ~OpenCVQT(); void operator()(); void StreamCamera(); void InitCam(); void ConvertImage(); void CreateQImage(); void SetDisplayImage(); private: Ui::OpenCVQTClass ui; QLabel* myLabel; QVBoxLayout* mainLayout; private: CvCapture* myCaptureHandler; IplImage* myOriginalIplImage, *myRGBIplImage; QImage myQImage; uchar* ImageData; void CreateImage(); }; myCaptureHandler(), myOriginalIplImage(&IplImage() ), myRGBIplImage(&IplImage() ), ImageData() { ui.setupUi(this); mainLayout->addWidget(myLabel); this->setLayout(mainLayout); myCaptureHandler = cvCreateCameraCapture(0); myOriginalIplImage = cvCreateImage(cvSize(320, 480), IPL_DEPTH_8U, 3); myRGBIplImage = cvCloneImage(myOriginalIplImage); } // ============================================= OpenCVQT::~OpenCVQT() { } // ============================================= void OpenCVQT::StreamCamera() { //InitCam(); //while (1) { myRGBIplImage = cvQueryFrame(myCaptureHandler); //cvNamedWindow("OpenCV"); //cvShowImage("OpenCV", myRGBIplImage); ConvertImage(); CreateQImage(); //SetDisplayImage(); } } // ============================================= void OpenCVQT::InitCam() { myCaptureHandler = cvCreateCameraCapture(0); if (!myCaptureHandler) { errMsg->showMessage("No Web Cam Plugin"); } } // ============================================= void OpenCVQT::ConvertImage() { cvCvtColor(myRGBIplImage, myRGBIplImage, CV_BGR2RGB); if (!myRGBIplImage) { errMsg->showMessage("Error Convert Image"); } else { ImageData = (uchar*) myRGBIplImage->imageData; } } // ============================================= void OpenCVQT::CreateQImage() { myRGBIplImage->width, myRGBIplImage->height, myRGBIplImage->widthStep, } // ============================================= void OpenCVQT::SetDisplayImage() { myPainter->drawImage(myQImage.rect(), myQImage); resize(myRGBIplImage->width, myRGBIplImage->height); } // ============================================= void OpenCVQT::CreateImage() { myOriginalIplImage = cvCreateImage( cvSize(myOriginalIplImage->width, myOriginalIplImage->height), IPL_DEPTH_8U, 3); ImageData = (uchar*)myOriginalIplImage->imageData; myOriginalIplImage->width, myOriginalIplImage->height, myOriginalIplImage->widthStep, } int main(int argc, char *argv[]) { OpenCVQT w; w.show(); w.StreamCamera(); return a.exec(); }
It just display a single image rather than sequence of live frame.
Please comment my code.
Please provide some guide to start.
Please help.
Thanks.