This file is indexed.

/usr/include/sipxtapi/mp/MprSpeexPreProcess.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
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2006 ProfitFuel Inc.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//  
// Copyright (C) 2006 SIPez LLC. 
// Licensed to SIPfoundry under a Contributor Agreement. 
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MprSpeexPreprocess_h_
#define _MprSpeexPreprocess_h_

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "mp/MpAudioResource.h"
#include "mp/MpFlowGraphMsg.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
struct SpeexPreprocessState_;
typedef SpeexPreprocessState_ SpeexPreprocessState;

/// The "Speex Audio Preprocessor" media processing resource
/**
*  This resource is a wrapper over Speex's audio preprocessor. It is used
*  to do Automatic Gain Control, denoising and echo residue removal.
*  
*  MprSpeexPreprocess expects audio data on the first input and and produces
*  processed audio on its first output. Residual echo removal is activated
*  if MprSpeexPreprocess input is connected directly to MprSpeexEchoCancel
*  output.
*/
class MprSpeexPreprocess : public MpAudioResource
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

   enum GlobalEnableState {
      GLOBAL_ENABLE,   ///< All MprSpeexEchoCancel resources are forced to enable
      GLOBAL_DISABLE,  ///< All MprSpeexEchoCancel resources are forced to disable
      LOCAL_MODE       ///< Each resource respect its own enable/disable state
   };

/* ============================ CREATORS ================================== */

     /// Constructor
   MprSpeexPreprocess(const UtlString& rName, UtlBoolean isAgcEnabled=FALSE,
                      UtlBoolean isNoiseReductionEnabled=FALSE);

     /// Destructor
   virtual
   ~MprSpeexPreprocess();


/* ============================ MANIPULATORS ============================== */

     /// Enable or disable Automatic Gain Control
   UtlBoolean setAGC(UtlBoolean enable);

     /// Enable or disable noise reduction
   UtlBoolean setNoiseReduction(UtlBoolean enable);

     /// Set global AGC enable/disable state.
   static inline void setGlobalAgcEnableState(GlobalEnableState state);
     /**<
     *  @see smGlobalAgcEnableState for more details.
     */

     /// Set global Noise Reduction enable/disable state.
   static inline void setGlobalNoiseReductionEnableState(GlobalEnableState state);
     /**<
     *  @see smGlobalNoiseReductionEnableState for more details.
     */

/* ============================ ACCESSORS ================================= */

/* ============================ INQUIRY =================================== */

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
   typedef enum
   {
      SET_AGC  = MpFlowGraphMsg::RESOURCE_SPECIFIC_START,
      SET_NOISE_REDUCTION
   } AddlMsgTypes;

   SpeexPreprocessState *mpPreprocessState; ///< Structure containing internal
                                            ///<  state of Speex preprocessor.
   UtlBoolean mIsAgcEnabled;                ///< Should AGC be enabled?
   UtlBoolean mIsNoiseReductionEnabled;     ///< Should Noise Reduction be enabled?

   static volatile GlobalEnableState smGlobalAgcEnableState;
     ///< Global enable/disable switch for all Speex AGC resources. We need
     ///< this switch because sipXmediaAdapterLib exports only a static method
     ///< to turn AGC on and off.
   UtlBoolean mIsAgcEnabledReal; ///< Is AGC really enabled?
   static volatile GlobalEnableState smGlobalNoiseReductionEnableState;
     ///< Global enable/disable switch for all Speex Noise Reduction resources.
     ///< We need this switch because sipXmediaAdapterLib exports only a static
     ///< method to turn Noise Reduction on and off.
   UtlBoolean mIsNoiseReductionEnabledReal; ///< Is Noise Reduction really enabled?

   inline UtlBoolean getRealAgcState() const;
   inline UtlBoolean getRealNoiseReductionState() const;

   virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
                                     MpBufPtr outBufs[],
                                     int inBufsSize,
                                     int outBufsSize,
                                     UtlBoolean isEnabled,
                                     int samplesPerFrame,
                                     int samplesPerSecond);

     /// Handle messages for this resource.
   virtual UtlBoolean handleMessage(MpFlowGraphMsg& rMsg);

     /// Handle the @link MprSpeexPreprocess::SET_AGC SET_AGC @endlink message.
   UtlBoolean handleSetAGC(UtlBoolean enable);

     /// Handle the @link MprSpeexPreprocess::SET_NOISE_REDUCTION SET_NOISE_REDUCTION @endlink message.
   UtlBoolean handleSetNoiseReduction(UtlBoolean enable);

     /// @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
     */

     /// @copydoc MpResource::connectInput()
   UtlBoolean connectInput(MpResource& rFrom, int fromPortIdx, int toPortIdx);

     /// @copydoc MpResource::disconnectInput()
   UtlBoolean disconnectInput(int outPortIdx);

     /// Copy constructor (not implemented for this class)
   MprSpeexPreprocess(const MprSpeexPreprocess& rMprSpeexPreprocess);

     /// Assignment operator (not implemented for this class)
   MprSpeexPreprocess& operator=(const MprSpeexPreprocess& rhs);

};

void MprSpeexPreprocess::setGlobalAgcEnableState(GlobalEnableState state)
{
   smGlobalAgcEnableState = state;
}

void MprSpeexPreprocess::setGlobalNoiseReductionEnableState(GlobalEnableState state)
{
   smGlobalNoiseReductionEnableState = state;
}

UtlBoolean MprSpeexPreprocess::getRealAgcState() const
{
   return (smGlobalAgcEnableState==LOCAL_MODE) ? mIsAgcEnabled
          : (smGlobalAgcEnableState==GLOBAL_ENABLE);
}

UtlBoolean MprSpeexPreprocess::getRealNoiseReductionState() const
{
   return (smGlobalNoiseReductionEnableState==LOCAL_MODE) ? mIsNoiseReductionEnabled
          : (smGlobalAgcEnableState==GLOBAL_ENABLE);
}

/* ============================ INLINE METHODS ============================ */

#endif  // _MprSpeexPreprocess_h_