📄 dspearly.h
字号:
#ifndef DSPEARLY_H_INCLUDED#define DSPEARLY_H_INCLUDED#include <qtimer.h>#include <netdb.h>#include <netinet/in.h>enum InetType { InetNone=0, Inet4=4, Inet6=6 };#include "../dissipate2/udpmessagesocket.h"#include "callaudio.h"#define GSM_ENC_BYTES 33#define GSM_DEC_SAMPLES 160#define ILBCNOOFWORDS (NO_OF_BYTES/2)#define TIME_PER_FRAME 30/** * @short RTP implementation of DspOut. * @author Billy Biggs <vektor@div8.net> * * This is the RTP implementation of DspOut. */class DspEarly : public QObject{ Q_OBJECTpublic: /** * Constructs a DspEarly object outputting to the given * hostname. */ DspEarly(void); /** * Destructor. Will close the device if it is open. */ ~DspEarly( void ); enum DeviceState { DeviceOpened, DeviceClosed }; enum DeviceMode { ReadOnly, WriteOnly, ReadWrite }; void start( const codecType newCodec, int newCodecNum, UDPMessageSocket *s, QString pipAddr,QString qpport ); void startExt(const codecType newCodec, int newCodecNum, int socket, QString ipAddr, QString qrport, QString lipAddr,QString qsport ); void stopExt(void); bool writeBuffer( void ); bool setPortNum( int newport ); int getPortNum( void ) const { return portnum; } bool readBuffer( int bytes = 0 ); void setPayload( int payload ) { fixedrtplen = (size_t)payload; } void setCodec( const codecType newCodec, int newCodecNum ); bool sendDTMF (int DTMFtone); void setDeviceName( const QString &newDevName ) {devname=newDevName;}private slots: void writeBuffer1( void );private: DeviceState devstate; // Current state DeviceMode devmode; // Current mode QString lasterror; // Informative text output of last error QString devname; // Device Name, (not necessarily filename!) int rate; // Sampling rate (in fps) int portnum; int videoPortnum; int output_fd; // The fd of the audio output unsigned char *packetbuf; // Buffer for the packet data double lasttime; short curseq; unsigned char *bufunsend; unsigned char *inbuf; unsigned char *outbuf; unsigned char *tmpbuf; unsigned char *quebuf; unsigned char *dtmfbuf;//codec codecType codec; int codecNum; gsm gsmInstEnc; gsm gsmInstDec; int qlen; iLBC_Enc_Inst_t ilbcEncInst_20; iLBC_Dec_Inst_t ilbcDecInst_20; iLBC_Enc_Inst_t ilbcEncInst_30; iLBC_Dec_Inst_t ilbcDecInst_30; //speex_Enc_Inst_t speexEncInst; //speex_Dec_Inst_t speexDecInst; size_t numunsend; size_t fixedrtplen; unsigned long deb_frag; unsigned long deb_rtp; int ts; int ssrc; int ref_sec; int ref_usec; int dsize; bool useStun; bool destroySocket; int min; int max; bool useSRTP; int sdebug; QTimer *sendTimer; UDPMessageSocket *socket;//--------------------- bool useExt; static InetType intype; bool didcomplain; struct hostent *he; int socketfd; int rsock; int tsock; unsigned int ourport; bool bound; int buffsize; char *ipaddress; char hostname[80]; char **a;// static unsigned int curseq; int soal; // Socket Info union ipaddr { unsigned char raw_addr[16]; struct in6_addr in6_addr; // in networkbyteorder struct in_addr in4_addr; // dto. }; union ipaddr ip_addr; union sockaddr_in46 { struct sockaddr soa; struct sockaddr_in soa4; struct sockaddr_in6 soa6; }; union sockaddr_in46 socketaddress; union sockaddr_in46 remoteaddress;};#endif // DSPEARLY_H_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -