⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.h

📁 openmcu 是开源的H.323会议服务器,需要pwlib 和 openh323的编译库文件支持。
💻 H
📖 第 1 页 / 共 2 页
字号:
{
  public:
    void OnMemberJoining(Conference * conf, ConferenceMember *);
    void OnMemberLeaving(Conference * conf, ConferenceMember *);
};

class MyH323EndPoint : public H323EndPoint
{
  PCLASSINFO(MyH323EndPoint, H323EndPoint);

  public:
    MyH323EndPoint();
    
    Conference * ConferenceRequest(H323Connection & connection, 
                              const H323SignalPDU & setupPDU,
               H323Connection::AnswerCallResponse & response);

    // overrides from H323EndPoint
    virtual H323Connection * CreateConnection(unsigned callReference);
    virtual void TranslateTCPAddress(PIPSocket::Address &localAddr, const PIPSocket::Address &remoteAddr);

    BOOL behind_masq;
    PIPSocket::Address *masqAddressPtr;

    // new functions
    void Initialise(PConfig & cfg, PConfigPage * rsrc);

    PString GetRoomStatus(const PString & block);

    ConferenceManager & GetConferenceManager()
    { return conferenceManager; }

  protected:
#ifndef NO_MCU_VIDEO
    BOOL       videoLarge;
    int        videoBitRate;
    int        videoFill;
    int        videoFramesPS;
    int        videoTxQuality;
#endif

  protected:
    MyConferenceManager conferenceManager;
    //AudioDelay  writeDelay;

#ifndef NO_MCU_VIDEO
    BOOL        hasVideo;

    StringListDict spokenListDict; //Array of 'spoken lists' used to decide the
                                   //4 user images to display (one list room)
    VideoBufferDict videoBufferDict; //Array of VideoBuffers,(one for each room)
    StringListDict  videoPosnDict;   //Array of 'position lists' that describe
                                     //where video is displayed in the buffer.

#endif

    //PSyncPoint exitFlag;
};



class OpenMCU : public OpenMCUProcessAncestor
{
  PCLASSINFO(OpenMCU, OpenMCUProcessAncestor)

  public:
    OpenMCU();
    void Main();
    BOOL OnStart();
    void OnStop();
    void OnControl();
    void OnConfigChanged();
    BOOL Initialise(const char * initMsg);

    static OpenMCU & Current() { return (OpenMCU &)PProcess::Current(); }

    PString GetDefaultRoomName() const { return defaultRoomName; }
    PString GetNewRoomNumber();
    void LogMessage(const PString & str);

    MyH323EndPoint & GetEndpoint()
    { return *endpoint; }

    PFilePath GetConnectingWAVFile() const
    { return connectingWAVFile; }

    PFilePath GetLeavingWAVFile() const
    { return leavingWAVFile; }

    PFilePath GetEnteringWAVFile() const
    { return enteringWAVFile; }

  protected:
    MyH323EndPoint * endpoint;
    long GetCodec(const PString & codecname);
    OpalLineInterfaceDevice * GetDevice(const PString & device);

    PString    defaultRoomName;
    PFilePath  logFilename;
    BOOL       singleStream;
    PString    audioLoopbackRoom;

    PFilePath connectingWAVFile;
    PFilePath enteringWAVFile;
    PFilePath leavingWAVFile;
};

////////////////////////////////////////////////////

class OutgoingAudio : public PChannel
{
  PCLASSINFO(OutgoingAudio, PChannel);

  public:
    OutgoingAudio(H323EndPoint & ep, OpenMCUH323Connection & conn);
    
    BOOL Read(void * buffer, PINDEX amount);
    BOOL Close();

  protected:
    void CreateSilence(void * buffer, PINDEX amount);

    H323EndPoint & ep;
    OpenMCUH323Connection & conn;

    AudioDelay delay;
    PMutex audioChanMutex;
};

////////////////////////////////////////////////////

class IncomingAudio : public PChannel
{
  PCLASSINFO(IncomingAudio, PChannel);

  public:
    IncomingAudio(H323EndPoint & ep, OpenMCUH323Connection & conn);

    BOOL Write(const void * buffer, PINDEX amount);
    BOOL Close();

  protected:
    H323EndPoint & ep;
    OpenMCUH323Connection & conn;
    PMutex audioChanMutex;
    AudioDelay delay;
};

////////////////////////////////////////////////////

class H323Connection_ConferenceMember;

class OpenMCUH323Connection : public H323Connection
{
  PCLASSINFO(OpenMCUH323Connection, H323Connection);

  public:
    OpenMCUH323Connection(MyH323EndPoint &, unsigned);
    ~OpenMCUH323Connection();

    // overrides from H323Connection
    BOOL OpenAudioChannel(BOOL, unsigned,   H323AudioCodec & codec);
		void CleanUpOnCallEnd();

    AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
    BOOL OnSendSignalSetup( H323SignalPDU & callProceedingPDU );
    void OnUserInputString(const PString & value);

    // functions called for incoming and outgoing channels.
    // These provide a link between the audio/video channels and the endpoint.
    BOOL OnIncomingAudio(const void * buffer, PINDEX amount);
    BOOL OnOutgoingAudio(void * buffer, PINDEX amount);

    // functions called to put data in/out of the buffer array.
    BOOL ReadAudio (OpenMCUH323Connection * dest, void * buffer, PINDEX amount);
    BOOL WriteAudio(OpenMCUH323Connection * dest, const void * buffer, PINDEX amount);

#ifndef NO_MCU_VIDEO
    void EnableVideoReception(BOOL isOK) { hasVideo = isOK;  }
    BOOL OpenVideoChannel( BOOL isEncoding, H323VideoCodec & codec);
    BOOL OnIncomingVideo(const void * buffer, PINDEX amount);
    BOOL OnOutgoingVideo(void * buffer, PINDEX & amount);
    PString GetVideoTransmitCodecName() const { return videoTransmitCodecName; }
    PString GetVideoReceiveCodecName() const  { return videoReceiveCodecName; }
#endif

    PString GetAudioTransmitCodecName() const { return audioTransmitCodecName; }
    PString GetAudioReceiveCodecName() const  { return audioReceiveCodecName; }

  protected:
    void LogCall(const BOOL accepted = TRUE);

    MyH323EndPoint & ep;
    Conference * conference;
    H323Connection_ConferenceMember * conferenceMember;
    BOOL sendingAllowed;
    BOOL connected;

    OpalWAVFile playFile;

    PString audioTransmitCodecName;
    PString audioReceiveCodecName;

#ifndef NO_MCU_VIDEO
    PString videoTransmitCodecName;
    PString videoReceiveCodecName;
#endif

    IncomingAudio * incomingAudio;
    OutgoingAudio * outgoingAudio;
};

////////////////////////////////////////////////////

class H323Connection_ConferenceConnection : public ConferenceConnection
{
  PCLASSINFO(H323Connection_ConferenceConnection, ConferenceConnection);
  public:
    H323Connection_ConferenceConnection(void * id)
      : ConferenceConnection(id)
    { conn = (OpenMCUH323Connection *)id; }

    virtual PString GetName() const
    { return conn->GetCallToken(); }

  protected:
    OpenMCUH323Connection * conn;
};

class H323Connection_ConferenceMember : public ConferenceMember
{
  PCLASSINFO(H323Connection_ConferenceMember, ConferenceMember);
  public:
    H323Connection_ConferenceMember(OpenMCUH323Connection * _id)
      : ConferenceMember((void *)_id)
    { conn = _id; }

    virtual ConferenceConnection * CreateConnection()
    { return new H323Connection_ConferenceConnection(conn); }

    virtual PString GetName() const
    { return conn->GetCallToken(); }

    void OnReceivedUserInputIndication(const PString & str)
    { conn->SendUserInput(str); }

    OpenMCUH323Connection * GetConnection()
    { return conn; }

  protected:
    OpenMCUH323Connection * conn;
};

#endif  


// End of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -