sipxmedialib  Version 3.3
MpAndroidX_XAudioBinding.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010-2013 SIPez LLC. All rights reserved.
3 //
4 // $$
6 
7 // Author: Dan Petrie <dpetrie AT SIPez DOT com>
8 
9 #ifndef _MpAndroidX_XAudioBinding_h_
10 #define _MpAndroidX_XAudioBinding_h_
11 
12 // Must be included before Android utils/log.h so we define LOG_TAG first
13 
14 #ifdef ANDROID_2_0
15 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid2_0AudioBindingInterface
16 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid2_0AudioBindingInterface"
17 # ifndef LOG_TAG
18 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
19 # endif
20 #elif ANDROID_2_3
21 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid2_3AudioBindingInterface
22 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid2_3AudioBindingInterface"
23 # ifndef LOG_TAG
24 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
25 # endif
26  extern "C" int setpriority(int, int, int);
27 # define PRIO_PROCESS 0
28 #elif ANDROID_2_3_4
29 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid2_3_4AudioBindingInterface
30 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid2_3_4AudioBindingInterface"
31 # ifndef LOG_TAG
32 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
33 # endif
34  extern "C" int setpriority(int, int, int);
35 # define PRIO_PROCESS 0
36 #elif ANDROID_4_0_1
37 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid4_0_1AudioBindingInterface
38 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid4_0_1AudioBindingInterface"
39 # ifndef LOG_TAG
40 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
41 # endif
42  extern "C" int setpriority(int, int, int);
43 # define PRIO_PROCESS 0
44 #elif ANDROID_4_1_1
45 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid4_1_1AudioBindingInterface
46 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid4_1_1AudioBindingInterface"
47 # ifndef LOG_TAG
48 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
49 # endif
50  extern "C" int setpriority(int, int, int);
51 # define PRIO_PROCESS 0
52 # define LOGV ALOGV
53 # define LOGD ALOGD
54 #elif ANDROID_4_2_1
55 # define MP_ANDROID_AUDIO_BINDING_INTERFACE MpAndroid4_2_1AudioBindingInterface
56 # define QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE "MpAndroid4_2_1AudioBindingInterface"
57 # ifndef LOG_TAG
58 # define LOG_TAG QUOTED_MP_ANDROID_AUDIO_BINDING_INTERFACE
59 # endif
60  extern "C" int setpriority(int, int, int);
61 # define PRIO_PROCESS 0
62 # define LOGV ALOGV
63 # define LOGD ALOGD
64 #else
65 # error Unsupported version of Android AudioBindingInterface
66 #endif
67 
68 // SIPX INCLUDES
72 
73 // SYSTEM INCLUDES
74 #include <media/AudioSystem.h>
75 
76 // DEFINES
77 // MACROS
78 // EXTERNAL FUNCTIONS
80 
81 using namespace android;
82 
83 // EXTERNAL VARIABLES
84 // CONSTANTS
85 // STRUCTS
86 // TYPEDEFS
87 // FORWARD DECLARATIONS
88 
89 
96 {
97 /* //////////////////////////// PUBLIC //////////////////////////////////// */
98 public:
100 
101 /* ============================ CREATORS ================================== */
103 
104 
105 private:
108 
109 public:
112 
114 
115 /* ============================ MANIPULATORS ============================== */
117 
118 
120 
121 /* ============================ ACCESSORS ================================= */
123 
124 
125  MpAndroidAudioTrack* createAudioTrack(int streamType,
126  uint32_t sampleRate,
127  int format,
128  int channels,
129  int frameCount,
130  uint32_t flags,
131  sipXcallback_t cbf,
132  void* user,
133  int notificationFrames) const;
134 
135  MpAndroidAudioRecord* createAudioRecord() const;
136 
137  int getOutputLatency(uint32_t& outputLatency, StreamType streamType) const;
138 
140 
141 /* ============================ INQUIRY =================================== */
143 
144 
146 
147 /* //////////////////////////// PROTECTED ///////////////////////////////// */
148 
149 /* //////////////////////////// PRIVATE /////////////////////////////////// */
150 private:
151 
153  MP_ANDROID_AUDIO_BINDING_INTERFACE(const MP_ANDROID_AUDIO_BINDING_INTERFACE& rMpAndroidAudioBindingInterface);
154 
157 };
158 
159 /* ============================ INLINE METHODS ============================ */
160 
161 #endif // _MpAndroidX_XAudioBinding_h_
Audio input driver for Android OS.
Definition: MpAndroidAudioTrack.h:37
int frameCount
Definition: dmaTaskWnt.cpp:61
StreamType
Definition: MpAndroidAudioBindingInterface.h:50
MpAndroidAudioBindingInterface * CREATE_ANDROID_AUDIO_BINDING_SYMBOL()
Definition: MpAndroidX_XAudioBinding.cpp:38
void(* sipXcallback_t)(int event, void *user, void *info)
Definition: MpAndroidAudioBindingInterface.h:32
Audio interface for Android OS version specific differences.
Definition: MpAndroidX_XAudioBinding.h:95
Audio input driver for Android OS.
Definition: MpAndroidAudioRecord.h:34
Audio wrapper interface driver for Android OS version spesific differences.
Definition: MpAndroidAudioBindingInterface.h:45