sipxmedialib  Version 3.3
MpidOss.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2007 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // $$
10 
11 // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>
12 
13 #ifndef _MpidOss_h_
14 #define _MpidOss_h_
15 
16 // SYSTEM INCLUDES
17 #include <pthread.h>
18 #include <semaphore.h>
19 
20 
21 // APPLICATION INCLUDES
22 #include "mp/MpInputDeviceDriver.h"
23 #include "mp/MpOss.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
34 
39 {
40  friend class MpOss;
41 /* //////////////////////////// PUBLIC //////////////////////////////////// */
42 public:
43 
44 /* ============================ CREATORS ================================== */
46 
47 
49  MpidOss(const UtlString& name,
50  MpInputDeviceManager& deviceManager);
58  ~MpidOss();
60 
62 
63 /* ============================ MANIPULATORS ============================== */
65 
66 
68  OsStatus enableDevice(unsigned samplesPerFrame,
69  unsigned samplesPerSec,
70  MpFrameTime currentFrameTime);
84  OsStatus disableDevice();
96 
97 /* ============================ ACCESSORS ================================= */
99 
100 
102 
103 /* ============================ INQUIRY =================================== */
105 
106 
108  inline UtlBoolean isDeviceValid();
109 
111 
112 /* //////////////////////////// PROTECTED ///////////////////////////////// */
113 protected:
116 
118  OsStatus initBuffers();
119 
121  void freeBuffers();
122 
125 
127  void pushFrame();
128 
130  void skipFrame();
131 
132 /* //////////////////////////// PRIVATE /////////////////////////////////// */
133 private:
135 
137  MpidOss(const MpidOss& rMpInputDeviceDriver);
138 
140  MpidOss& operator=(const MpidOss& rhs);
141 
142 };
143 
144 /* ============================ INLINE METHODS ============================ */
145 
147 {
148  //printf("MpRsIdOss::isDeviceValid()\n"); fflush(stdout);
149  return ((pDevWrapper != NULL) && pDevWrapper->isDeviceValid());
150 }
151 
152 #endif // _MpidOss_h_
void pushFrame()
Push audio frame to InputDeviceManager.
Definition: MpidOss.cpp:158
int samplesPerFrame
MpAudioSample * getBuffer()
Get buffer from internal buffers.
OsStatus disableDevice()
Uninitialize device driver.
Definition: MpidOss.cpp:128
uint32_t MpFrameTime
Definition: MpTypes.h:53
Container for device specific input OSS driver.
Definition: MpidOss.h:38
OsStatus initBuffers()
Allocate internal OSS buffers.
MpidOss & operator=(const MpidOss &rhs)
Assignment operator (not implemented for this class).
MpAudioSample * mAudioFrame
Wave buffer.
Definition: MpidOss.h:114
void freeBuffers()
Free internal OSS buffers.
OsStatus enableDevice(unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime)
Initialize device driver and state.
Definition: MpidOss.cpp:70
int16_t MpAudioSample
Definition: MpTypes.h:44
Container of input devices for input drivers and resources.
Definition: MpInputDeviceManager.h:79
void skipFrame()
Add frame time to mCurrentFrameTime.
Definition: MpidOss.cpp:169
MpidOss(const UtlString &name, MpInputDeviceManager &deviceManager)
Default constructor.
Definition: MpidOss.cpp:45
~MpidOss()
Destructor.
Definition: MpidOss.cpp:62
UtlBoolean isDeviceValid()
Inquire if the device is valid.
Definition: MpOss.h:178
MpOssContainer * mpCont
Pointer to Wrapper container.
Definition: MpidOss.h:115
Container for device specific input driver.
Definition: MpInputDeviceDriver.h:58
Definition: MpOssContainer.h:33
Wrapper for OSS device that use file descriptor to communicate.
Definition: MpOss.h:35
UtlBoolean isDeviceValid()
Inquire if the OSS device is valid.
Definition: MpidOss.h:146
MpOss * pDevWrapper
Definition: MpidOss.h:134