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

📄 main.cxx

📁 这是一个OPENH323中的MCU程序
💻 CXX
📖 第 1 页 / 共 5 页
字号:
/*
 * main.cxx
 *
 * A simple H.323 MCU
 *
 * Copyright (C) 2000 Equivalence Pty. Ltd.
 * Copyright (C) 2004 Post Increment
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
 *
 * Portions of ths code were written by by Post Increment (http://www.postincrement.com) 
 * with the assistance of funding from Stonevoice, slc. http://www.stonevoice.com
 *
 * Portions of this code were written by Post Increment (http://www.postincrement.com) 
 * with the assistance of funding from Citron Networks (http://www.citron.com.tw)
 *
 * Contributor(s): Derek J Smithies (derek@indranet.co.nz)
 *                 Craig Southeren (craig@postincrement.com)
 *
 * $Log: main.cxx,v $
 * Revision 1.1  2007/10/17 19:44:31  shorne
 * Initial Commit
 *
 * Revision 2.16  2006/06/09 04:39:59  csoutheren
 * Migrated VideoBranch to main trunk
 *
 * Revision 2.15.2.13  2006/05/31 08:48:02  csoutheren
 * Fixed crash on second call when entry/exit files do not exist
 * Fix crash when Cisco HOLD used. Thanks to Christian Bongiovanni of Stonevoice
 *
 * Revision 2.15.2.12  2006/05/16 02:20:39  csoutheren
 * Fixed problems compiling without video
 *
 * Revision 2.15.2.11  2006/04/12 01:46:13  csoutheren
 * Added defaut image when audio-only member enters video conference
 * Added image to Web gui
 *
 * Revision 2.15.2.10  2006/03/28 05:13:38  csoutheren
 * Normalised file headers
 * Fixed problem with QCIF video
 * Seperated H.323 and MCU process functions into seperate files
 *
 */

#include <ptlib.h>
#include "mcu.h"

static const char DefaultConnectingWAVFile[] = "connecting.wav";
static const char DefaultEnteringWAVFile[]   = "entering.wav";
static const char DefaultLeavingWAVFile[]    = "leaving.wav";

static const char ConnectingWAVFileKey[]  = "Connecting WAV File";
static const char EnteringWAVFileKey[]    = "Entering WAV File";
static const char LeavingWAVFileKey[]     = "Leaving WAV File";

extern unsigned char ImageData[];

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

class MyMCU : public OpenMCU 
{
  public:
    MyMCU()
    { }

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

    ConferenceManager * CreateConferenceManager();

    void OnCreateConfigPage(PConfig & cfg, PConfigPage & page);

    PFilePath GetLeavingWAVFile() const
    { return leavingWAVFile; }

    PFilePath GetEnteringWAVFile() const
    { return enteringWAVFile; }

    BOOL GetConnectingWAVFile(PFilePath & fn) const
    { fn = connectingWAVFile; return TRUE; }

#if OPENMCU_VIDEO
    BOOL GetPreMediaFrame(void * buffer, int width, int height, PINDEX & amount);
#endif // OPENMCU_VIDEO

  protected:
    PFilePath connectingWAVFile;
    PFilePath enteringWAVFile;
    PFilePath leavingWAVFile;
};

class MyConferenceManager : public ConferenceManager
{
  public:
    void OnMemberJoining(Conference * conf, ConferenceMember *);
    void OnMemberLeaving(Conference * conf, ConferenceMember *);
};

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

ConferenceManager * MyMCU::CreateConferenceManager()
{ 
  return new MyConferenceManager; 
}

void MyMCU::OnCreateConfigPage(PConfig & cfg, PConfigPage & rsrc)
{
  // get WAV file played to a user when they enter a conference
  connectingWAVFile = cfg.GetString(ConnectingWAVFileKey, DefaultConnectingWAVFile);
  rsrc.Add(new PHTTPStringField(ConnectingWAVFileKey, 50, connectingWAVFile));

  // get WAV file played to a conference when a new user enters
  enteringWAVFile = cfg.GetString(EnteringWAVFileKey, DefaultEnteringWAVFile);
  rsrc.Add(new PHTTPStringField(EnteringWAVFileKey, 50, enteringWAVFile));

  // get WAV file played to a conference when a new user enters
  leavingWAVFile = cfg.GetString(LeavingWAVFileKey, DefaultLeavingWAVFile);
  rsrc.Add(new PHTTPStringField(LeavingWAVFileKey, 50, leavingWAVFile));
}

#if OPENMCU_VIDEO

BOOL MyMCU::GetPreMediaFrame(void * buffer, int width, int height, PINDEX & amount)
{
  if (width == QCIF_WIDTH && height == QCIF_HEIGHT) {
    memcpy(buffer, ImageData, QCIF_SIZE);
    return TRUE;
  }
  else if (width == CIF_WIDTH && height == CIF_HEIGHT) {
    MCUVideoMixer::ConvertQCIFToCIF(ImageData, buffer);
    return TRUE;
  }

  return FALSE;
}

#endif // OPENMCU_VIDEO

PCREATE_PROCESS(MyMCU);

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

void MyConferenceManager::OnMemberJoining(Conference * conf, ConferenceMember * member)
{ 

⌨️ 快捷键说明

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