This file is indexed.

/usr/include/sipxtapi/mp/MpOss.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
//
// Copyright (C) 2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////

// Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>

#ifndef _MpOss_h_
#define _MpOss_h_

// SYSTEM INCLUDES
#include <pthread.h>
#include <semaphore.h>

#include <sys/types.h>
#include <sys/soundcard.h>

// APPLICATION INCLUDES
#include "mp/MpInputDeviceDriver.h"
#include "mp/MpOutputDeviceDriver.h"
#include "mp/MpOssContainer.h"
#include "utl/UtlVoidPtr.h"

class MpidOss;
class MpodOss;

/**
*  @brief Wrapper for OSS device that use file descriptor to communicate.
*/
class MpOss : public UtlVoidPtr
{
   friend class MpidOss;
   friend class MpodOss;
   /* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

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

   /// @brief Constructor
   MpOss();

   /// @brief Destructor
   ~MpOss();

   //@}

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

   /// @brief Connect MpidOss class driver
   OsStatus setInputDevice(MpidOss* pIDD);
   /// @brief Connect MpodOss class driver
   OsStatus setOutputDevice(MpodOss* pODD);

   /// @brief Disconnect Input driver
   OsStatus freeInputDevice();
   /// @brief Disconnect Output driver
   OsStatus freeOutputDevice();

   /// @brief Enable input device
   OsStatus attachReader();
   /// @brief Enable output device
   OsStatus attachWriter();

   /// @brief Disable input device
   OsStatus detachReader();
   /// @brief Disable output device
   OsStatus detachWriter();

   //@}

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


   //@}

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

   /// @brief Inquire if the device is valid
   inline UtlBoolean isDeviceValid();

   /// @brief Inquire if the input device is connected
   inline UtlBoolean isReaderAttached();

   /// @brief Inquire if the output device is connected
   inline UtlBoolean isWriterAttached();
   inline UtlBoolean isDevCapBatch();
   inline UtlBoolean isDevCapDuplex();
   inline UtlBoolean isDevCapMmap();
   inline UtlBoolean isDevCapTrigger();

   /// @brief Inquire if OSS device is free, i.e. neither input nor output is connected
   inline UtlBoolean isNotUsed();

   //@}

   /* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
   int mfdDevice;               ///< The fd of the POSIX device (e.g. /dev/dsp)
   UtlBoolean mbReadCap;        ///< Device is able to play audio
   UtlBoolean mbWriteCap;       ///< Device is able to capture audio

   MpidOss* mReader;          ///< Input driver
   MpodOss* mWriter;          ///< Output driver

   int mDeviceCap;              ///< Device capabilities

   volatile UtlBoolean mStReader;        ///< Input device is enabled
   volatile UtlBoolean mStWriter;        ///< Output device is enabled
   volatile UtlBoolean mStShutdown;      ///< Thread exit flag
   volatile UtlBoolean mModeChanged;     ///< IO settings has changed

   unsigned mUsedSamplesPerSec;          ///< Used samples rate either for IO
   unsigned mUsedSamplesPerFrame;        ///< Used frame size for IO

   MpAudioSample* mResamplerBuffer;      ///< Buffer for conversions
   UtlBoolean mStereoOps;                ///< Use stereo output

   pthread_t mIoThread;                  ///< Internal IO thread
   sem_t mSleepSem;      ///< Control IO thread sleeping
   sem_t mSignalSem;     ///< Use for parameters synchronization

   /// @brief Pre initializations for OSS device
   OsStatus initDevice(const char* devname);
   /// @brief Final initializations for OSS device
   OsStatus initDeviceFinal(unsigned samplesPerSec, unsigned samplerPerFrame);
   /// @brief Free OSS device
   OsStatus freeDevice();

   /// @brief Because OSS device works in duplex mode we must ensure that
   /// input and output driver use one sample rate and perfrom final init
   OsStatus setSampleRate(unsigned samplesPerSec, unsigned samplerPerFrame);

   /// @brief Perform input operation of OSS device
   OsStatus doInput(char* buffer, int size);
   /// @brief Perform output operation of OSS device
   OsStatus doOutput(const char* buffer, int size);

   /// @brief Perform input operation of OSS device with siutable resampler
   OsStatus doInputRs(MpAudioSample* buffer, unsigned size);
   /// @brief Perform output operation of OSS device  with siutable resampler
   OsStatus doOutputRs(const MpAudioSample* buffer, unsigned size);

   /// @brief Deinitialization and freeing sequences
   void noMoreNeeded();

   /// @brief Thread subroutine
   void soundIoThread();

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

   void threadIoStatusChanged();
   void threadWakeUp();
   void threadKill();

   UtlBoolean ossSetTrigger(bool turnOn);
   UtlBoolean ossReset();

   /// @brief Thread subroutine
   static void* soundCardIoWrapper(void* arg);
};

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

UtlBoolean MpOss::isDeviceValid()
{
   return (mfdDevice != -1);
}

UtlBoolean MpOss::isReaderAttached()
{
   return (mReader != NULL);
}

UtlBoolean MpOss::isWriterAttached()
{
   return (mWriter != NULL);
}

UtlBoolean MpOss::isDevCapBatch()
{
   return (mDeviceCap & DSP_CAP_BATCH);
}

UtlBoolean MpOss::isDevCapDuplex()
{
   return (mDeviceCap & DSP_CAP_DUPLEX);
}

UtlBoolean MpOss::isDevCapMmap()
{
   return (mDeviceCap & DSP_CAP_MMAP);
}

UtlBoolean MpOss::isDevCapTrigger()
{
   return (mDeviceCap & DSP_CAP_TRIGGER);
}

UtlBoolean MpOss::isNotUsed()
{
   return ((mReader == NULL) && (mWriter == NULL));
}


#endif // _MpOss_h_