sipxmedialib  Version 3.3
MpodOss.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007-2017 SIPez LLC.
3 //
4 //
5 // $$
7 
8 // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>
9 
10 #ifndef _MpodOss_h_
11 #define _MpodOss_h_
12 
13 // SYSTEM INCLUDES
14 #include <pthread.h>
15 #include <semaphore.h>
16 
17 #ifdef __linux__
18 #include <sys/types.h>
19 #include <sys/soundcard.h>
20 #endif // __linux__
21 
22 
23 // APPLICATION INCLUDES
25 #include "mp/MpOss.h"
26 
27 
28 // MACROS
29 // EXTERNAL FUNCTIONS
30 // EXTERNAL VARIABLES
31 // CONSTANTS
32 // STRUCTS
33 // TYPEDEFS
34 // FORWARD DECLARATIONS
36 
37 
42 {
43  friend class MpOss;
44 /* //////////////////////////// PUBLIC //////////////////////////////////// */
45 public:
46 
47 /* ============================ CREATORS ================================== */
49 
50 
52  MpodOss(const UtlString& name);
59  ~MpodOss();
61 
63 
64 /* ============================ MANIPULATORS ============================== */
66 
67 
69  OsStatus enableDevice(unsigned samplesPerFrame,
70  unsigned samplesPerSec,
71  MpFrameTime currentFrameTime,
72  OsCallback &frameTicker);
73 
75  OsStatus disableDevice();
76 
78  OsStatus pushFrame(unsigned int numSamples,
79  const MpAudioSample* samples,
80  MpFrameTime frameTime);
81 
82  OsStatus setNotificationMode(UtlBoolean bThreadNotification);
83 
85 
86 /* ============================ ACCESSORS ================================= */
88 
89 
91 
92 /* ============================ INQUIRY =================================== */
94 
95 
97  virtual OsStatus canEnable();
98  /* @see MpOutputDeviceDriver::canEnable */
99 
101  inline UtlBoolean isDeviceValid();
102 
104 
105 /* //////////////////////////// PROTECTED ///////////////////////////////// */
106 protected:
110 
112 
114  OsStatus signalForNextFrame();
115 
117  void skipFrame();
118 
119 /* //////////////////////////// PRIVATE /////////////////////////////////// */
120 private:
122 
124  MpodOss(const MpodOss& rMpOutputDeviceDriver);
125 
127  MpodOss& operator=(const MpodOss& rhs);
128 
129 
130 };
131 
132 /* ============================ INLINE METHODS ============================ */
133 
135 {
136  //printf("MpRsOdOss::isDeviceValid()\n"); fflush(stdout);
137  return ((pDevWrapper != NULL) && pDevWrapper->isDeviceValid());
138 }
139 
140 #endif // _MpodOss_h_
int samplesPerFrame
OsStatus enableDevice(unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime, OsCallback &frameTicker)
Initialize device driver and state.
Definition: MpodOss.cpp:83
~MpodOss()
Destructor.
Definition: MpodOss.cpp:61
uint32_t MpFrameTime
Definition: MpTypes.h:53
MpAudioSample * mAudioFrame
Wave buffer.
Definition: MpodOss.h:107
OsStatus pushFrame(unsigned int numSamples, const MpAudioSample *samples, MpFrameTime frameTime)
Send data to output device.
Definition: MpodOss.cpp:167
Container for device specific input OSS driver.
Definition: MpodOss.h:41
MpFrameTime mCurrentFrameTime
The current frame time for this device.
Definition: MpodOss.h:108
MpOss * pDevWrapper
Definition: MpodOss.h:121
OsStatus signalForNextFrame()
Signaling for next frame if notificator used do nothing otherwise.
Definition: MpodOss.cpp:217
void skipFrame()
Adding frame time to mCurrentFrameTime.
Definition: MpodOss.cpp:225
UtlBoolean isDeviceValid()
Inquire if the OSS device is valid.
Definition: MpodOss.h:134
int16_t MpAudioSample
Definition: MpTypes.h:44
MpodOss(const UtlString &name)
Default constructor.
Definition: MpodOss.cpp:45
UtlBoolean isDeviceValid()
Inquire if the device is valid.
Definition: MpOss.h:178
MpodOss & operator=(const MpodOss &rhs)
Assignment operator (not implemented for this class)
OsStatus disableDevice()
Uninitialize device driver.
Definition: MpodOss.cpp:140
Container of output devices.
Definition: MpOutputDeviceManager.h:66
Definition: MpOssContainer.h:33
virtual OsStatus canEnable()
Check if this device can connect.
Definition: MpodOss.cpp:197
Wrapper for OSS device that use file descriptor to communicate.
Definition: MpOss.h:35
UtlBoolean mNotificationThreadEn
Definition: MpodOss.h:109
OsStatus setNotificationMode(UtlBoolean bThreadNotification)
Definition: MpodOss.cpp:72
Container for device specific output driver.
Definition: MpOutputDeviceDriver.h:53
MpOssContainer * mpCont
Pointer to Wrapper container.
Definition: MpodOss.h:111