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

📄 conference.h

📁 openmcu 是开源的H.323会议服务器,需要pwlib 和 openh323的编译库文件支持。
💻 H
📖 第 1 页 / 共 2 页
字号:

    /**
      *  Called when the conference member wants to read a block of audio from the conference
      */
    virtual void ReadAudio(void * buffer, PINDEX amount);

    /**
      * Called when another conference member wants to send audio to the endpoint
      * By default, the audio is added to the queue for the specified member
      * so it can be retreived by a later call to OnIncomingAudio
      */
    virtual void OnExternalAudio(void * id, const void * buffer, PINDEX amount);

    /*
     *  Used to create a conference connection for this member
     */
    virtual ConferenceConnection * CreateConnection() = 0;

    void WaitForClose()
    { lock.WaitForClose(); }

  protected:
    typedef std::map<void *, ConferenceConnection *> ConnectionList;
    typedef std::map<void *, ConferenceMember *> MemberList;

    Conference * conference;
    void * id;
    MCULock lock;
    ConnectionList connectionList;
    MemberList memberList;
};

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

/**
  * this class describes a conference or "room"
  */

class Conference : public PObject
{
  PCLASSINFO(Conference, PObject);
  public:
    typedef std::map<void *, ConferenceMember *> MemberList;

    Conference(ConferenceManager & manager,     
      const OpalGloballyUniqueID & _guid,
                   const PString & _number,
                   const PString & _name);

    ~Conference();

    PMutex & GetMutex()
    { return memberListMutex; }

    ConferenceManager & GetManager()
    { return manager; }

    /**
      * add the specified member to the conference
      */
    void AddMember(ConferenceMember * member);

    /**
     * remove the specifed member from the conference.
     * Note that this function does not actually delete the conference member
     * as sometimes a conference member needs to remove itself from a conference
     * 
     * @return if TRUE, the conference is now empty
     */
    BOOL RemoveMember(ConferenceMember * member);

    MemberList & GetMemberList() 
    { return memberList; }

    virtual PString GetName() const
    { return name; }

    virtual PString GetNumber() const
    { return number; }

    OpalGloballyUniqueID GetID() const
    { return guid; }

    virtual BOOL IsVisible() const
    { return TRUE; }

    virtual void OnMemberJoining(ConferenceMember *);

    virtual void OnMemberLeaving(ConferenceMember *);

  protected:
    ConferenceManager & manager;
    PMutex memberListMutex;
    MemberList memberList;

    OpalGloballyUniqueID guid;
    PString number;
    PString name;
};

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

typedef std::map<OpalGloballyUniqueID, Conference *> ConferenceList;

class ConferenceManager : public PObject
{
  PCLASSINFO(ConferenceManager, PObject);
  public:
    ConferenceManager();

    /**
     * Make a new conference with the specified conference ID, number and name
     */
    Conference * MakeConference(
      const OpalGloballyUniqueID & conferenceID, 
      const PString & number, 
      const PString & name
    );

    /**
     * Make a new conference with the specified number and name, and use a new conference ID
     */
    Conference * MakeConference(
      const PString & number, 
      const PString & name
    );

    /**
      * return true if a conference with the specified ID exists
      */
    BOOL HasConference(
      const OpalGloballyUniqueID & conferenceID
    );

    /**
      * return true if a conference with the specified number exists
      */
    BOOL HasConference(
      const PString & number
    );

    /**
      * Remove and delete the specified conference
      */
    void RemoveConference(const OpalGloballyUniqueID & confId);

    /**
      * Remove the specified member from the specified conference.
      * The member will will deleted, and if the conference is empty after the removal, 
      * it is deleted too
      */
    void RemoveMember(const OpalGloballyUniqueID & confId, ConferenceMember * toRemove);


    PMutex & GetConferenceListMutex()
    { return conferenceListMutex; }

    ConferenceList & GetConferenceList()
    { return conferenceList; }

    virtual void OnCreateConference(Conference *)
    { }

    virtual void OnDestroyConference(Conference *)
    { }

    virtual void OnMemberJoining(Conference *, ConferenceMember *)
    { }

    virtual void OnMemberLeaving(Conference *, ConferenceMember *)
    { }

  protected:
    virtual Conference * CreateConference(const OpalGloballyUniqueID & _guid,
                                                       const PString & _number,
                                                       const PString & _name);

    PMutex conferenceListMutex;       
    ConferenceList conferenceList;
};


#ifndef NO_MCU_VIDEO

////////////////////////////////////////////////////
/** OutGoingVideo describes the data leaving the computer,
    and then sent by TCP/IP methods to the remote computer.


    OutGoingVideo is the connection/channel which connects the
    codec and the connection class, for the transport of data.
     */
class OutgoingVideo : public PVideoChannel
{
  PCLASSINFO(OutgoingVideo, PVideoChannel);

  public:
    OutgoingVideo(H323EndPoint & ep, OpenMCUH323Connection & conn, int framesPerSec, BOOL videoLarge);

    ~OutgoingVideo();

    BOOL Close();
    
    /** uses over ride of Read function in the PChannel class.
      */
    BOOL Read(void * buffer, PINDEX  amount);
    
    void SetRenderFrameSize(int /*_width*/, int /*_height*/) 
      {PTRACE(3,"OutgoingVideo Set size");}
    
    BOOL Redraw(const BYTE * /*frame*/) 
        { return TRUE; }

    BOOL IsOpen() const   
        { return !closed; }

    BOOL IsGrabberOpen()
        { return TRUE; }


    PINDEX  GetGrabWidth()
        { return (videoLarge ? 352 : 176); }

    /**Return the height of the currently selected grabbing device.
     */
    PINDEX  GetGrabHeight()
      { return (videoLarge ? 288 : 144 ); }

    protected:
      H323EndPoint & ep;
      OpenMCUH323Connection & conn;

      PMutex videoChanMutex;
      BOOL videoLarge;

      VideoDelay delay;
      int        msBetweenFrames;
      BOOL       closed;
};

////////////////////////////////////////////////////
/** IncomingVideo describes the data entering the computer,
    which is placed in the video buffer.

     */
class IncomingVideo : public PVideoChannel
{
  PCLASSINFO(IncomingVideo, PVideoChannel);

  public:
    IncomingVideo(MyH323EndPoint & ep, OpenMCUH323Connection & conn);

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

    void SetRenderFrameSize(int _width, int _height);

    BOOL Redraw(const BYTE * frame) 
        { return Write(frame,0); }

    BOOL IsOpen() const   
        { return !closed; }

    PINDEX  GetGrabWidth()
        { PTRACE(3,"incomingvideo get grab width"); return width; }

    /**Return the height of the currently selected grabbing device.
     */
    PINDEX  GetGrabHeight()
      { return height; }

    protected:

    MyH323EndPoint & ep;
    OpenMCUH323Connection & conn;
    PMutex videoChanMutex;

    PINDEX  width;
    PINDEX  height;
    PINDEX  frameSize;

    VideoDelay delay;
    BOOL       closed;
};

#endif 

#endif

⌨️ 快捷键说明

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