This file is indexed.

/usr/include/sipxtapi/mp/MpResampler.h is in libsipxtapi-dev 3.3.0~test17-2.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
//  
// Copyright (C) 2007-2008 SIPfoundry Inc. 
// Licensed by SIPfoundry under the LGPL license. 
//  
// Copyright (C) 2007-2008 SIPez LLC. 
// Licensed to SIPfoundry under a Contributor Agreement. 
//  
// $$ 
////////////////////////////////////////////////////////////////////////////// 

// Author: Alexander Chemeris <Alexander DOT Chemeris AT SIPez DOT com> and Keith Kyzivat <kkyzivat AT SIPez DOT com>

#ifndef _MpResamplerBase_h_
#define _MpResamplerBase_h_

// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <mp/MpTypes.h>
#include <os/OsStatus.h>
#include <mp/MpMisc.h>

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS

/**
*  @brief Generic audio resampler.
*/
class MpResamplerBase
{
/* //////////////////////////////// PUBLIC //////////////////////////////// */
public:

/* =============================== CREATORS =============================== */
///@name Creators
//@{

   static
   MpResamplerBase *createResampler(uint32_t numChannels, 
                                    uint32_t inputRate, 
                                    uint32_t outputRate, 
                                    int32_t quality = -1);

     /// Constructor
   MpResamplerBase(uint32_t numChannels, 
                   uint32_t inputRate, 
                   uint32_t outputRate, 
                   int32_t quality);
     /**<
     *  @param[in] numChannels - The number of channels that the resampler will 
     *             process.
     *  @param[in] inputRate - The sample rate of the input audio.
     *  @param[in] outputRate - The sample rate of the output audio.
     *  @param[in] quality - The quality parameter is used by some resamplers to
     *             control the tradeoff of quality for latency and complexity.
     */

     /// Destructor
   virtual ~MpResamplerBase();

//@}

/* ============================= MANIPULATORS ============================= */
///@name Manipulators
//@{

     /// Reset resampler state to prepare for processing new (unrelated) stream.
   virtual OsStatus resetStream();

     /// Resample audio data coming from the specified channel.
   virtual OsStatus resample(uint32_t channelIndex,
                             const MpAudioSample* pInBuf,
                             uint32_t inBufLength,
                             uint32_t& inSamplesProcessed,
                             MpAudioSample* pOutBuf,
                             uint32_t outBufLength,
                             uint32_t& outSamplesWritten);
     /**<
     *  @param[in] channelIndex - The index of the channel to process - base 0.
     *  @copydoc MpResamplerBase::resampleInterleavedStereo()
     */

     /// Resample interleaved stereo audio data.
   virtual OsStatus resampleInterleavedStereo(const MpAudioSample* pInBuf,
                                              uint32_t inBufLength,
                                              uint32_t& inSamplesProcessed,
                                              MpAudioSample* pOutBuf,
                                              uint32_t outBufLength,
                                              uint32_t& outSamplesWritten);
     /**<
     *  @param[in] pInBuf - Pointer to the audio to resample.
     *  @param[in] inBufLength - The length in samples of the audio to resample.
     *  @param[out] inSamplesProcessed - The number of samples read from 
     *              /p pInBuf during resampling.
     *  @param[out] pOutBuf - A pointer where the resampled audio will be stored.
     *  @param[in] outBufLength - The length in samples of /p pOutBuf.
     *  @param[out] outSamplesWritten - The number of resampled samples written 
     *              to /p pOutBuf.
     *
     *  @retval OS_INVALID_ARGUMENT if the channelIndex is out of bounds.
     *  @retval OS_SUCCESS if the audio was resampled successfully.
     */

     /// @brief resample the buffer given, and return a new resampled one.
   OsStatus resampleBufPtr(const MpAudioBufPtr& inBuf, MpAudioBufPtr& outBuf,
                           uint32_t inRate, uint32_t outRate,
                           UtlString optionalIdStr = "");
     /**<
     *  Resample the buffer given.  If errors happen, they are logged, outBuf
     *  is left unchanged, and return status is set to a value that is not 
     *  OS_SUCCESS.
     *  
     *  @param[in] inBuf - the ptr to buffer to resample.
     *  @param[out] outBuf - the ptr to the destination that will hold 
     *              the resampled buffer.
     *  @param[in] inRate - The  sample rate that inBuf samples are recorded in.
     *  @param[in] outRate - The sample rate that is requested to be converted to.
     *  @param[in] optionalIdStr - an optional identifier string used when reporting errors.
     *  @retval OS_SUCCESS if the resampling happened without error, outBuf now
     *          will point to resampled buffer.
     *  @retval All other values - failure.
     */

     /// Set the input sample rate, in Hz
   virtual OsStatus setInputRate(const uint32_t inputRate);
     /**<
     *  @param[in] inputRate - The sample rate of the input audio.
     */

     /// Set the output sample rate, in Hz
   virtual OsStatus setOutputRate(const uint32_t outputRate);
     /**<
     *  @param[in] outputRate - The sample rate of the output audio.
     */

     /// Set the quality of resampling conversion
   virtual OsStatus setQuality(const int32_t quality);
     /**<
     *  @param[in] quality - The quality parameter is used by some resamplers to
     *             control the tradeoff of quality for latency and complexity.
     */

//@}

/* ============================== ACCESSORS =============================== */
///@name Accessors
//@{

     /// Return input sampling rate.
   uint32_t getInputRate() const;

     /// Return output sampling rate.
   uint32_t getOutputRate() const;

     /// Return quality of resampling conversion.
   int32_t getQuality() const;

   static inline
   int getNumSamplesConverted(uint32_t inputRate, uint32_t outputRate,
                              int numInputSamples, int &remainingSamplesNum);

   static inline
   int getNumSamplesOriginal(uint32_t inputRate, uint32_t outputRate,
                             int numOutputSamples, int &remainingSamplesNum);

//@}

/* =============================== INQUIRY ================================ */
///@name Inquiry
//@{


//@}

/* ////////////////////////////// PROTECTED /////////////////////////////// */
protected:
   uint32_t mNumChannels;
   uint32_t mInputRate;
   uint32_t mOutputRate;
   int32_t mQuality;

/* /////////////////////////////// PRIVATE //////////////////////////////// */
private:


};

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

int MpResamplerBase::getNumSamplesConverted(uint32_t inputRate, uint32_t outputRate,
                                            int numInputSamples, int &remainingSamplesNum)
{
   int numOutputSamples = outputRate*numInputSamples/inputRate;
   remainingSamplesNum = numInputSamples - inputRate*numOutputSamples/outputRate;
   return numOutputSamples;
}

int MpResamplerBase::getNumSamplesOriginal(uint32_t inputRate, uint32_t outputRate,
                                           int numOutputSamples, int &remainingSamplesNum)
{
   int numInputSamples = inputRate*numOutputSamples/outputRate;
   remainingSamplesNum = numOutputSamples - outputRate*numInputSamples/inputRate;
   return numInputSamples;
}

#endif  // _MpResamplerBase_h_