[server] / trunk / server / src / confdevice.h Repository:
ViewVC logotype

View of /trunk/server/src/confdevice.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 959 - (download) (annotate)
Tue Oct 26 16:20:50 2010 UTC (2 years, 6 months ago) by jtarlton
File size: 6964 byte(s)
Regenerate caption after bridging external ipm device to a conf channel.
    1 /*
    2  * This file is part of Dialogic DiaStar Server project.
    3  *
    4  * More information about this project can be found at:
    5  * http://www.projectdiastar.org.
    6  *
    7  * Copyright (C) 2010 Dialogic Corp.
    8  *
    9  * This program is free software; you can redistribute it and/or
   10  * modify it under the terms of the GNU General Public License
   11  * as published by the Free Software Foundation; either version 2
   12  * of the License, or (at your option) any later version.
   13  *
   14  * This program is distributed in the hope that it will be useful,
   15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17  * GNU General Public License for more details.
   18  *
   19  * You should have received a copy of the GNU General Public License
   20  * along with this program; if not, write to the Free Software
   21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   22  * 02110-1301, USA.
   23  * Alternatively see <http://www.gnu.org/licenses/>.
   24  * Or see the LICENSE file included within the source tree.
   25  *
   26  */
   27 
   28 /*!
   29  * \file        confdevice.h
   30  * \brief       Conference device
   31  * \author      John Tarlton <john.tarlton@dialogic.com>
   32  * \version     15-JAN-2010
   33  */
   34 
   35 #ifndef _CONFDEVICE_H
   36 #define _CONFDEVICE_H
   37 
   38 /*-------------------------------- Dependencies ------------------------------*/
   39 
   40 #include <string>
   41 
   42 #include "srllib.h"
   43 #include "cnflib.h"
   44 
   45 #include "dialogicdevice.h"
   46 
   47 /*----------------------------------------------------------------------------*/
   48 
   49 class ConfBoard;
   50 class ConfPartyDevice;
   51 
   52 #define MAX_LAYOUT_COUNT      4
   53 #define MAX_REGION_COUNT      9
   54 #define MAX_CONFERENCE_COUNT  9
   55 
   56 /*!
   57  * \class ConfDevice
   58  * Wrapper class for a CNF conference device
   59  */
   60 class ConfDevice : public DialogicDevice
   61 {
   62 public:
   63 
   64   enum Mode { ADHOC, CONTROLLED };
   65 
   66   /*!
   67    * ctor
   68    * \param name - name of the device.
   69    * \param confBoard - conference board responsible for this device.
   70    * \param channelMgr - channel manager
   71    */
   72   ConfDevice( const std::string& name,
   73               ConfBoard& confBoard,
   74               DialogicChannelManager& channelMgr );
   75   /*!
   76    * dtor.
   77    */
   78   virtual ~ConfDevice();
   79 
   80   /*!
   81    * Get the parent board device object.
   82    */
   83   ConfBoard& getConfBoard() const { return confBoard_; }
   84 
   85   /*!
   86    * Open the device.
   87    */
   88   virtual bool open();
   89 
   90   /*!
   91    * Close the device.
   92    */
   93   virtual bool close();
   94 
   95   /*!
   96    * Configure the operating mode.
   97    * \param mode - the mode.
   98    */
   99   void setMode( Mode mode ) { mode_ = mode; }
  100 
  101   /*!
  102    * Configure the maximum number of parties allowed in the conference.
  103    * \param max_parties - maximum number of conference parties.
  104    */
  105   void setMaxParties( unsigned int max_parties ) { maxParties_ = max_parties; }
  106 
  107   /*!
  108    * Configure the initial layout (number of tiles).
  109    * \param tiles - number of tiles.
  110    */
  111   void setInitialLayout( unsigned int tiles ) { initialTiles_ = tiles; }
  112 
  113   /*!
  114    * Configure the length of time in milliseconds that the caller's id is
  115    * displayed for when they enter the conference.
  116    * \param  duration - milliseconds
  117    */
  118   void setCaptionDuration( unsigned int duration ) { captionDuration_ = duration; }
  119 
  120   unsigned int getCaptionDuration() const  { return captionDuration_ ; }
  121 
  122   /*!
  123    * Configure whether entry/exit tones are played whenever a party joins or
  124    * leaves this conference.
  125    * \param beep - true to enable, false to disable.
  126    */
  127   void setBeep( bool beep ) { beep_ = beep; }
  128 
  129   /*!
  130    * Configure whether dtmf are suppressed or passed through this conference.
  131    * \param clamp_dtmf - true to enable, false to disable.
  132    */
  133   void setDtmfClamping( bool clamp_dtmf ) { dtmfClamping_ = clamp_dtmf; }
  134 
  135   /*!
  136    * Configure whether or not automatic gain control should be applied to
  137    * conference parties.
  138    * \param agc - true to enable, false to disable.
  139    */
  140   void setAgc( bool agc ) { agc_ = agc; }
  141 
  142   /*!
  143    * Configure whether or not echo cancellation should be applied to
  144    * conference parties.
  145    * \param ec - true to enable, false to disable.
  146    */
  147   void setEchoCanceller( bool ec ) { ec_ = ec; }
  148 
  149   /*!
  150    * Configure whether or not active talker detection should be enabled.
  151    * \param active_talker - true to enable, false to disable.
  152    */
  153   void setActiveTalker( bool active_talker ) { activeTalker_ = active_talker; }
  154 
  155   /*!
  156    * Set the number of tiles to display.
  157    * Layouts of 1, 4, 6 and 9 tiles are supported. Specifying other values
  158    * results in the best supported value being used i.e. 2 => 4, 7 => 9 etc;
  159    * this makes it easier to choose the layout based on the number of
  160    * parties.
  161    * \param tiles - number of tiles
  162    * \return true, if a layout change has been requested; otherwise, false.
  163    */
  164   bool setLayout( unsigned int tiles );
  165 
  166   /*!
  167    * Add a party to this conference.
  168    */
  169   bool addParty( ConfPartyDevice* confParty );
  170 
  171   /*!
  172    * Remove a party from this conferences.
  173    */
  174   bool removeParty( ConfPartyDevice* confParty );
  175 
  176   /*!
  177    * Get the current parties.
  178    */
  179   const std::vector<ConfPartyDevice*>& getParties() const { return parties_.active; }
  180 
  181   /*!
  182    * Handle an event from the device.
  183    * \param metaevent - dialogic event information
  184    */
  185   virtual bool processEvent( METAEVENT& metaevent );
  186 
  187   void displayCaption( IpmDevice* ipm, const std::string& caption );
  188   void displayActiveTalker( IpmDevice* ipm );
  189 
  190 private:
  191 
  192   ConfDevice();
  193   ConfDevice( const ConfDevice& );
  194   ConfDevice& operator= ( const ConfDevice& );
  195 
  196   bool addParties();
  197   bool removeParties();
  198 
  199   bool refreshVisibleParties();
  200   bool setVisibleParties( CNF_VISIBLE_PARTY_LIST& visiblePartyList );
  201 
  202   /* event handlers */
  203   void onOpen( METAEVENT& metaevent );
  204   void onSetVideoLayout( METAEVENT& metaevent );
  205   void onSetVisiblePartyList( METAEVENT& metaevent );
  206   void onConfPartyAdded( METAEVENT& metaevent );
  207   void onConfPartyRemoved( METAEVENT& metaevent );
  208   void onActiveTalker( METAEVENT& metaevent );
  209 
  210 private:
  211 
  212   /* Parent board device.
  213    */
  214   ConfBoard&  confBoard_;
  215 
  216   /* Configuration params.
  217    */
  218   Mode         mode_;
  219   unsigned int maxParties_;
  220   unsigned int initialTiles_;
  221   unsigned int captionDuration_;
  222   bool         beep_;
  223   bool         dtmfClamping_;
  224   bool         agc_;
  225   bool         ec_;
  226   bool         activeTalker_;
  227 
  228   /* Run time params.
  229    */
  230   eLB_LAYOUT_SIZE layoutSize_;
  231   CNF_VIDEO_LAYOUT_INFO layoutInfo_;
  232   LB_FRAME_HANDLE layoutHandle_;
  233 
  234   LB_FRAME_HANDLE regionList_[MAX_REGION_COUNT];
  235   unsigned int regionListCount_;
  236 
  237   CNF_VISIBLE_PARTY_INFO visiblePartyInfo_[MAX_REGION_COUNT];
  238   CNF_VISIBLE_PARTY_LIST visiblePartyList_;
  239 
  240   struct Parties
  241   {
  242     Parties() : busy(false) {;}
  243 
  244     std::vector<ConfPartyDevice*> add;
  245     std::vector<ConfPartyDevice*> remove;
  246     std::vector<ConfPartyDevice*> active;
  247     bool busy;
  248 
  249   } parties_;
  250 
  251   bool dynamic_;        /*!< when true, tiles_ tracks the number of visible parties */
  252   unsigned int tiles_;  /*!< number of tiles being shown */
  253 
  254   bool haveController_; /*!< true, if a controller party has joined */
  255 
  256   long focus_;          /*!< active talker */
  257 };
  258 
  259 #endif // _CONFDEVICE_H
  260 
  261 /* vim:ts=4:set nu:
  262  * EOF
  263  */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8