/usr/include/sipxtapi/mp/MprBridge.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | //
// Copyright (C) 2006-2012 SIPez LLC. All rights reserved.
//
// Copyright (C) 2004-2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MprBridge_h_
#define _MprBridge_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <mp/MpAudioResource.h>
#include <mp/MpFlowGraphMsg.h>
#include <mp/MpDspUtils.h>
#include <mp/MpBridgeAlgBase.h>
#include <os/OsIntTypes.h>
// DEFINES
#define TEST_PRINT_CONTRIBUTORS
#undef TEST_PRINT_CONTRIBUTORS
//#define PRINT_CLIPPING_STATS
#define PRINT_CLIPPING_FREQUENCY 100
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// MACROS
// FORWARD DECLARATIONS
#ifdef TEST_PRINT_CONTRIBUTORS // [
class MpContributorVector;
#endif // TEST_PRINT_CONTRIBUTORS ]
/**
* @brief The conference bridge resource.
*
* Local input and output should be connected to the first input and output
* ports. Remote connections will be binded to the second input/output ports,
* third input/output ports, and so on.
*
* <H3>Enabled behaviour</H3>
* Mix together local and remote inputs onto outputs, according to mix matrix.
* By deafault matrix is defined so that no output receive its own input.
*
* <H3>Disabled behaviour</H3>
* Drop all input data, do not produce any data on output.
*/
class MprBridge : public MpAudioResource
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/// Type of the bridge mix algorithm to use.
enum AlgType
{
ALG_SIMPLE, ///< Simple O(n^2) algorithm (MpBridgeAlgSimple)
ALG_LINEAR ///< Linear O(n) algorithm (MpBridgeAlgLinear)
};
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Default constructor
MprBridge(const UtlString& rName,
int maxInOutputs,
UtlBoolean mixSilence=TRUE,
AlgType algorithm=ALG_LINEAR);
/// Destructor
virtual
~MprBridge();
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Send message to set mix weights for inputs to given output on bridge.
OsStatus setMixWeightsForOutput(int bridgeOutputPort,
int numWeights,
const MpBridgeGain gain[]);
/**<
* Set the mix weights for the inputs (indices 0 to \p numWeights) going
* to the output port: \p bridgeOutputPort of the named bridge.
*
* @param[in] bridgeOutputPort - index (starts at 0) of the output port to
* which the input weights are to be set.
* @param[in] numWeights - number of elements in \p gain array. If less,
* then only first \p numWeights elements would be set.
* @param[in] gain - the gain value or multiplier to apply to the
* corresponding input.
* * MP_BRIDGE_GAIN_PASSTHROUGH will add the unchanged input
* to the output.
* * MP_BRIDGE_GAIN_UNDEFINED will use the existing value of
* gain for the input.
*
* @note If gain is not set to MP_BRIDGE_GAIN_MUTED for the input
* corresponding to the output port, there will be echo.
*
* @see setMixWeightsForInput()
*/
/// Send message to set mix weights for inputs to given output on bridge.
static OsStatus setMixWeightsForOutput(const UtlString& namedResource,
OsMsgQ& fgQ,
int bridgeOutputPort,
int numWeights,
const MpBridgeGain gains[]);
/**<
* @see setMixWeightsForOutput(int,int,MpBridgeGain[]) for description.
*/
/// Send message to set mix weights for one input to given number of outputs.
OsStatus setMixWeightsForInput(int bridgeInputPort,
int numWeights,
const MpBridgeGain gain[]);
/**<
* @see This function is full analog of setMixWeightsForOutput(), applied
* for one input to outputs instead of inputs to one output.
*/
/// Send message to set mix weights for one input to given number of outputs.
static OsStatus setMixWeightsForInput(const UtlString& namedResource,
OsMsgQ& fgQ,
int bridgeInputPort,
int numWeights,
const MpBridgeGain gains[]);
/**<
* @see setMixWeightsForOutput(int,int,MpBridgeGain[]) for description.
*/
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
typedef enum
{
SET_WEIGHTS_FOR_INPUT = MpFlowGraphMsg::RESOURCE_SPECIFIC_START,
SET_WEIGHTS_FOR_OUTPUT
} AddlMsgTypes;
#ifdef TEST_PRINT_CONTRIBUTORS // [
MpContributorVector* mpMixContributors;
MpContributorVector** mpLastOutputContributors;
#endif // TEST_PRINT_CONTRIBUTORS ]
AlgType mAlgType; ///< Type of the bridge algorithm to use.
MpBridgeAlgBase *mpBridgeAlg; ///< Instance of algorithm, used to mix data.
UtlBoolean mMixSilence; ///< Should Bridge ignore or mix frames marked as silence?
#ifdef PRINT_CLIPPING_STATS
int mClippedFramesCounted;
int* mpOutputClippingCount;
#endif
/// @brief Associates this resource with the indicated flow graph.
OsStatus setFlowGraph(MpFlowGraphBase* pFlowGraph);
/**<
* We use this overloaded method for initialization of some of our member
* variables, which depend on flowgraph's properties (like frame size).
*
* @retval OS_SUCCESS - for now, this method always returns success
*/
/// @brief Mix together inputs onto outputs according to mpGainMatrix matrix.
UtlBoolean doMix(MpBufPtr inBufs[], int inBufsSize,
MpBufPtr outBufs[], int outBufsSize,
int samplesPerFrame);
virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
MpBufPtr outBufs[],
int inBufsSize,
int outBufsSize,
UtlBoolean isEnabled,
int samplesPerFrame,
int samplesPerSecond);
/// Handle flowgraph messages for this resource.
virtual UtlBoolean handleMessage(MpFlowGraphMsg& rMsg);
/// Handle resource messages for this resource.
virtual UtlBoolean handleMessage(MpResourceMsg& rMsg);
/// Actually set mix weights for inputs to given output on bridge.
virtual UtlBoolean handleSetMixWeightsForOutput(int bridgeOutputPort,
int numWeights,
const MpBridgeGain gain[]);
/**<
* @see setMixWeightsForOutput() for explanation of parameters.
*/
/// Actually set mix weights for one input to given number of outputs.
virtual UtlBoolean handleSetMixWeightsForInput(int bridgeInputPort,
int numWeights,
const MpBridgeGain gain[]);
/**<
* @see setMixWeightsForOutput() for explanation of parameters.
*/
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Copy constructor (not implemented for this class)
MprBridge(const MprBridge& rMprBridge);
/// Assignment operator (not implemented for this class)
MprBridge& operator=(const MprBridge& rhs);
};
/* ============================ INLINE METHODS ============================ */
#endif // _MprBridge_h_
|