sipxmedialib  Version 3.3
MpodAndroid.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010-2013 SIPez LLC. All rights reserved.
3 //
4 // $$
6 
7 // Author: Alexander Chemeris <Alexander DOT Chemeris AT SIPez DOT com>
8 
9 #ifndef _MpodAndroid_h_
10 #define _MpodAndroid_h_
11 
12 // SIPX INCLUDES
13 #include <os/OsIntTypes.h>
14 #include <os/OsStatus.h>
15 #include <utl/UtlString.h>
16 #include "mp/MpTypes.h"
18 
19 // SYSTEM INCLUDES
20 #include <utils/threads.h>
21 #include <mp/MpAndroidAudioTrack.h>
22 
23 // APPLICATION INCLUDES
24 // DEFINES
25 // MACROS
26 // EXTERNAL FUNCTIONS
27 // EXTERNAL VARIABLES
28 // CONSTANTS
29 // STRUCTS
30 // TYPEDEFS
31 // FORWARD DECLARATIONS
32 class OsNotification;
33 using namespace android;
34 
42 {
43 /* //////////////////////////// PUBLIC //////////////////////////////////// */
44 public:
45 
46 /* ============================ CREATORS ================================== */
48 
49 
51  explicit
57  virtual
59  ~MpodAndroid();
60 
62 
63 /* ============================ MANIPULATORS ============================== */
65 
66 
68  virtual OsStatus enableDevice(unsigned samplesPerFrame,
69  unsigned samplesPerSec,
70  MpFrameTime currentFrameTime,
71  OsCallback &frameTicker);
72 
74  virtual OsStatus disableDevice();
75 
77  virtual OsStatus pushFrame(unsigned int numSamples,
78  const MpAudioSample* samples,
79  MpFrameTime frameTime);
80 
82 
83 /* ============================ ACCESSORS ================================= */
85 
86 
88 
89 /* ============================ INQUIRY =================================== */
91 
92 
94 
95 /* //////////////////////////// PROTECTED ///////////////////////////////// */
96 protected:
97 
98  enum State {
104  DRIVER_STOPPED
105  };
106 
108  OsAtomicLightUInt mState;
110  Mutex mLock;
111  Condition mWaitCbkCond;
113  MpFrameTime mCurFrameTime;
115  OsNotification* mpNotifier;
116 
118 
121 
122 
124  UtlBoolean initAudioTrack();
125 
127  static void audioCallback(int event, void* user, void *info);
128 
129 /* //////////////////////////// PRIVATE /////////////////////////////////// */
130 private:
131 
133  MpodAndroid(const MpodAndroid& rMpodAndroid);
134 
136  MpodAndroid& operator=(const MpodAndroid& rhs);
137 };
138 
139 
140 /* ============================ INLINE METHODS ============================ */
141 
142 #endif // _MpodAndroid_h_
Audio input driver for Android OS.
Definition: MpAndroidAudioTrack.h:37
int samplesPerFrame
MpodAndroid is starting playing.
Definition: MpodAndroid.h:101
uint32_t MpFrameTime
Definition: MpTypes.h:53
OsAtomicLightUInt mState
Internal class state.
Definition: MpodAndroid.h:108
Mutex mLock
Definition: MpodAndroid.h:110
int mSampleBufferIndex
Index of the first sample not yet pushed to device.
Definition: MpodAndroid.h:120
OsNotification * mpNotifier
Event signaled when windows is ready to receive a new buffer.
Definition: MpodAndroid.h:115
MpodAndroid is being initialized or initialization failed.
Definition: MpodAndroid.h:99
int16_t MpAudioSample
Definition: MpTypes.h:44
StreamType
Definition: MpAndroidAudioBindingInterface.h:50
MpAudioSample * mpSampleBuffer
Buffer which pushBuffer should copy to.
Definition: MpodAndroid.h:119
MpAndroidAudioBindingInterface::StreamType mStreamType
Android type of the output stream.
Definition: MpodAndroid.h:107
MpodAndroid has been successfully initialized and is not playing.
Definition: MpodAndroid.h:100
Audio output driver for Android OS.
Definition: MpodAndroid.h:41
State
Definition: MpodAndroid.h:98
MpodAndroid is stopping.
Definition: MpodAndroid.h:103
MpAndroidAudioTrack * mpAudioTrack
Pointer to audio track used for playback.
Definition: MpodAndroid.h:109
MpodAndroid is playing.
Definition: MpodAndroid.h:102
Container for device specific output driver.
Definition: MpOutputDeviceDriver.h:53