Glenn Kasten | 99e53b8 | 2012-01-19 08:59:58 -0800 | [diff] [blame] | 1 | /* |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 2 | ** |
| 3 | ** Copyright 2007, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef ANDROID_AUDIO_MIXER_H |
| 19 | #define ANDROID_AUDIO_MIXER_H |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | #include <sys/types.h> |
| 23 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 24 | #include <utils/threads.h> |
| 25 | |
Glenn Kasten | 2dd4bdd | 2012-08-29 11:10:32 -0700 | [diff] [blame] | 26 | #include <media/AudioBufferProvider.h> |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 27 | #include "AudioResampler.h" |
| 28 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 29 | #include <audio_effects/effect_downmix.h> |
| 30 | #include <system/audio.h> |
| 31 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 32 | namespace android { |
| 33 | |
| 34 | // ---------------------------------------------------------------------------- |
| 35 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 36 | class AudioMixer |
| 37 | { |
| 38 | public: |
Glenn Kasten | 5c94b6c | 2012-03-20 17:01:29 -0700 | [diff] [blame] | 39 | AudioMixer(size_t frameCount, uint32_t sampleRate, |
| 40 | uint32_t maxNumTracks = MAX_NUM_TRACKS); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 41 | |
Glenn Kasten | c19e224 | 2012-01-30 14:54:39 -0800 | [diff] [blame] | 42 | /*virtual*/ ~AudioMixer(); // non-virtual saves a v-table, restore if sub-classed |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 43 | |
Glenn Kasten | 599fabc | 2012-03-08 12:33:37 -0800 | [diff] [blame] | 44 | |
| 45 | // This mixer has a hard-coded upper limit of 32 active track inputs. |
| 46 | // Adding support for > 32 tracks would require more than simply changing this value. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 47 | static const uint32_t MAX_NUM_TRACKS = 32; |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 48 | // maximum number of channels supported by the mixer |
Glenn Kasten | 599fabc | 2012-03-08 12:33:37 -0800 | [diff] [blame] | 49 | |
| 50 | // This mixer has a hard-coded upper limit of 2 channels for output. |
| 51 | // There is support for > 2 channel tracks down-mixed to 2 channel output via a down-mix effect. |
| 52 | // Adding support for > 2 channel output would require more than simply changing this value. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 53 | static const uint32_t MAX_NUM_CHANNELS = 2; |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 54 | // maximum number of channels supported for the content |
| 55 | static const uint32_t MAX_NUM_CHANNELS_TO_DOWNMIX = 8; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 56 | |
| 57 | static const uint16_t UNITY_GAIN = 0x1000; |
| 58 | |
| 59 | enum { // names |
| 60 | |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 61 | // track names (MAX_NUM_TRACKS units) |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 62 | TRACK0 = 0x1000, |
| 63 | |
Glenn Kasten | 1c48c3c | 2011-12-15 14:54:01 -0800 | [diff] [blame] | 64 | // 0x2000 is unused |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 65 | |
| 66 | // setParameter targets |
| 67 | TRACK = 0x3000, |
| 68 | RESAMPLE = 0x3001, |
| 69 | RAMP_VOLUME = 0x3002, // ramp to new volume |
| 70 | VOLUME = 0x3003, // don't ramp |
| 71 | |
| 72 | // set Parameter names |
| 73 | // for target TRACK |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 74 | CHANNEL_MASK = 0x4000, |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 75 | FORMAT = 0x4001, |
| 76 | MAIN_BUFFER = 0x4002, |
| 77 | AUX_BUFFER = 0x4003, |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 78 | DOWNMIX_TYPE = 0X4004, |
Glenn Kasten | 362c4e6 | 2011-12-14 10:28:06 -0800 | [diff] [blame] | 79 | // for target RESAMPLE |
Glenn Kasten | 4e2293f | 2012-04-12 09:39:07 -0700 | [diff] [blame] | 80 | SAMPLE_RATE = 0x4100, // Configure sample rate conversion on this track name; |
| 81 | // parameter 'value' is the new sample rate in Hz. |
| 82 | // Only creates a sample rate converter the first time that |
| 83 | // the track sample rate is different from the mix sample rate. |
| 84 | // If the new sample rate is the same as the mix sample rate, |
| 85 | // and a sample rate converter already exists, |
| 86 | // then the sample rate converter remains present but is a no-op. |
| 87 | RESET = 0x4101, // Reset sample rate converter without changing sample rate. |
| 88 | // This clears out the resampler's input buffer. |
| 89 | REMOVE = 0x4102, // Remove the sample rate converter on this track name; |
| 90 | // the track is restored to the mix sample rate. |
Glenn Kasten | 362c4e6 | 2011-12-14 10:28:06 -0800 | [diff] [blame] | 91 | // for target RAMP_VOLUME and VOLUME (8 channels max) |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 92 | VOLUME0 = 0x4200, |
| 93 | VOLUME1 = 0x4201, |
| 94 | AUXLEVEL = 0x4210, |
| 95 | }; |
| 96 | |
| 97 | |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 98 | // For all APIs with "name": TRACK0 <= name < TRACK0 + MAX_NUM_TRACKS |
Glenn Kasten | 17a736c | 2012-02-14 08:52:15 -0800 | [diff] [blame] | 99 | |
| 100 | // Allocate a track name. Returns new track name if successful, -1 on failure. |
Jean-Michel Trivi | d06e132 | 2012-09-12 15:47:07 -0700 | [diff] [blame] | 101 | int getTrackName(audio_channel_mask_t channelMask, int sessionId); |
Glenn Kasten | 17a736c | 2012-02-14 08:52:15 -0800 | [diff] [blame] | 102 | |
| 103 | // Free an allocated track by name |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 104 | void deleteTrackName(int name); |
| 105 | |
Glenn Kasten | 17a736c | 2012-02-14 08:52:15 -0800 | [diff] [blame] | 106 | // Enable or disable an allocated track by name |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 107 | void enable(int name); |
| 108 | void disable(int name); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 109 | |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 110 | void setParameter(int name, int target, int param, void *value); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 111 | |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 112 | void setBufferProvider(int name, AudioBufferProvider* bufferProvider); |
John Grossman | 4ff14ba | 2012-02-08 16:37:41 -0800 | [diff] [blame] | 113 | void process(int64_t pts); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 114 | |
| 115 | uint32_t trackNames() const { return mTrackNames; } |
| 116 | |
Glenn Kasten | c59c004 | 2012-02-02 14:06:11 -0800 | [diff] [blame] | 117 | size_t getUnreleasedFrames(int name) const; |
Eric Laurent | 071ccd5 | 2011-12-22 16:08:41 -0800 | [diff] [blame] | 118 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 119 | private: |
| 120 | |
| 121 | enum { |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 122 | NEEDS_CHANNEL_COUNT__MASK = 0x00000007, |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 123 | NEEDS_FORMAT__MASK = 0x000000F0, |
| 124 | NEEDS_MUTE__MASK = 0x00000100, |
| 125 | NEEDS_RESAMPLE__MASK = 0x00001000, |
| 126 | NEEDS_AUX__MASK = 0x00010000, |
| 127 | }; |
| 128 | |
| 129 | enum { |
| 130 | NEEDS_CHANNEL_1 = 0x00000000, |
| 131 | NEEDS_CHANNEL_2 = 0x00000001, |
| 132 | |
| 133 | NEEDS_FORMAT_16 = 0x00000010, |
| 134 | |
| 135 | NEEDS_MUTE_DISABLED = 0x00000000, |
| 136 | NEEDS_MUTE_ENABLED = 0x00000100, |
| 137 | |
| 138 | NEEDS_RESAMPLE_DISABLED = 0x00000000, |
| 139 | NEEDS_RESAMPLE_ENABLED = 0x00001000, |
| 140 | |
| 141 | NEEDS_AUX_DISABLED = 0x00000000, |
| 142 | NEEDS_AUX_ENABLED = 0x00010000, |
| 143 | }; |
| 144 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 145 | struct state_t; |
| 146 | struct track_t; |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 147 | class DownmixerBufferProvider; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 148 | |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 149 | typedef void (*hook_t)(track_t* t, int32_t* output, size_t numOutFrames, int32_t* temp, |
| 150 | int32_t* aux); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 151 | static const int BLOCKSIZE = 16; // 4 cache lines |
| 152 | |
| 153 | struct track_t { |
| 154 | uint32_t needs; |
| 155 | |
| 156 | union { |
Glenn Kasten | bf71f1e | 2011-12-13 11:52:35 -0800 | [diff] [blame] | 157 | int16_t volume[MAX_NUM_CHANNELS]; // [0]3.12 fixed point |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 158 | int32_t volumeRL; |
| 159 | }; |
| 160 | |
Glenn Kasten | bf71f1e | 2011-12-13 11:52:35 -0800 | [diff] [blame] | 161 | int32_t prevVolume[MAX_NUM_CHANNELS]; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 162 | |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 163 | // 16-byte boundary |
| 164 | |
Glenn Kasten | bf71f1e | 2011-12-13 11:52:35 -0800 | [diff] [blame] | 165 | int32_t volumeInc[MAX_NUM_CHANNELS]; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 166 | int32_t auxInc; |
| 167 | int32_t prevAuxLevel; |
| 168 | |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 169 | // 16-byte boundary |
| 170 | |
| 171 | int16_t auxLevel; // 0 <= auxLevel <= MAX_GAIN_INT, but signed for mul performance |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 172 | uint16_t frameCount; |
| 173 | |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 174 | uint8_t channelCount; // 1 or 2, redundant with (needs & NEEDS_CHANNEL_COUNT__MASK) |
| 175 | uint8_t format; // always 16 |
| 176 | uint16_t enabled; // actually bool |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 177 | audio_channel_mask_t channelMask; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 178 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 179 | // actual buffer provider used by the track hooks, see DownmixerBufferProvider below |
| 180 | // for how the Track buffer provider is wrapped by another one when dowmixing is required |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 181 | AudioBufferProvider* bufferProvider; |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 182 | |
| 183 | // 16-byte boundary |
| 184 | |
| 185 | mutable AudioBufferProvider::Buffer buffer; // 8 bytes |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 186 | |
| 187 | hook_t hook; |
Glenn Kasten | 54c3b66 | 2012-01-06 07:46:30 -0800 | [diff] [blame] | 188 | const void* in; // current location in buffer |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 189 | |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 190 | // 16-byte boundary |
| 191 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 192 | AudioResampler* resampler; |
| 193 | uint32_t sampleRate; |
| 194 | int32_t* mainBuffer; |
| 195 | int32_t* auxBuffer; |
| 196 | |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 197 | // 16-byte boundary |
| 198 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 199 | DownmixerBufferProvider* downmixerBufferProvider; // 4 bytes |
| 200 | |
Jean-Michel Trivi | d06e132 | 2012-09-12 15:47:07 -0700 | [diff] [blame] | 201 | int32_t sessionId; |
| 202 | |
Glenn Kasten | 7f5d335 | 2013-02-15 23:55:04 +0000 | [diff] [blame^] | 203 | int32_t padding[2]; |
Glenn Kasten | 3b81aca | 2012-01-27 15:26:23 -0800 | [diff] [blame] | 204 | |
| 205 | // 16-byte boundary |
| 206 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 207 | bool setResampler(uint32_t sampleRate, uint32_t devSampleRate); |
Glenn Kasten | c59c004 | 2012-02-02 14:06:11 -0800 | [diff] [blame] | 208 | bool doesResample() const { return resampler != NULL; } |
| 209 | void resetResampler() { if (resampler != NULL) resampler->reset(); } |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 210 | void adjustVolumeRamp(bool aux); |
Glenn Kasten | c59c004 | 2012-02-02 14:06:11 -0800 | [diff] [blame] | 211 | size_t getUnreleasedFrames() const { return resampler != NULL ? |
| 212 | resampler->getUnreleasedFrames() : 0; }; |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 213 | }; |
| 214 | |
| 215 | // pad to 32-bytes to fill cache line |
| 216 | struct state_t { |
| 217 | uint32_t enabledTracks; |
| 218 | uint32_t needsChanged; |
| 219 | size_t frameCount; |
Glenn Kasten | a111792 | 2012-01-26 10:53:32 -0800 | [diff] [blame] | 220 | void (*hook)(state_t* state, int64_t pts); // one of process__*, never NULL |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 221 | int32_t *outputTemp; |
| 222 | int32_t *resampleTemp; |
Glenn Kasten | 7f5d335 | 2013-02-15 23:55:04 +0000 | [diff] [blame^] | 223 | int32_t reserved[2]; |
Glenn Kasten | 5c94b6c | 2012-03-20 17:01:29 -0700 | [diff] [blame] | 224 | // FIXME allocate dynamically to save some memory when maxNumTracks < MAX_NUM_TRACKS |
Glenn Kasten | bf71f1e | 2011-12-13 11:52:35 -0800 | [diff] [blame] | 225 | track_t tracks[MAX_NUM_TRACKS]; __attribute__((aligned(32))); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 226 | }; |
| 227 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 228 | // AudioBufferProvider that wraps a track AudioBufferProvider by a call to a downmix effect |
| 229 | class DownmixerBufferProvider : public AudioBufferProvider { |
| 230 | public: |
| 231 | virtual status_t getNextBuffer(Buffer* buffer, int64_t pts); |
| 232 | virtual void releaseBuffer(Buffer* buffer); |
| 233 | DownmixerBufferProvider(); |
| 234 | virtual ~DownmixerBufferProvider(); |
| 235 | |
| 236 | AudioBufferProvider* mTrackBufferProvider; |
| 237 | effect_handle_t mDownmixHandle; |
| 238 | effect_config_t mDownmixConfig; |
| 239 | }; |
| 240 | |
Glenn Kasten | 9c56d4a | 2011-12-19 15:06:39 -0800 | [diff] [blame] | 241 | // bitmask of allocated track names, where bit 0 corresponds to TRACK0 etc. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 242 | uint32_t mTrackNames; |
Glenn Kasten | 5c94b6c | 2012-03-20 17:01:29 -0700 | [diff] [blame] | 243 | |
| 244 | // bitmask of configured track names; ~0 if maxNumTracks == MAX_NUM_TRACKS, |
| 245 | // but will have fewer bits set if maxNumTracks < MAX_NUM_TRACKS |
| 246 | const uint32_t mConfiguredNames; |
| 247 | |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 248 | const uint32_t mSampleRate; |
| 249 | |
| 250 | state_t mState __attribute__((aligned(32))); |
| 251 | |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 252 | // effect descriptor for the downmixer used by the mixer |
| 253 | static effect_descriptor_t dwnmFxDesc; |
| 254 | // indicates whether a downmix effect has been found and is usable by this mixer |
| 255 | static bool isMultichannelCapable; |
| 256 | |
Glenn Kasten | 4e2293f | 2012-04-12 09:39:07 -0700 | [diff] [blame] | 257 | // Call after changing either the enabled status of a track, or parameters of an enabled track. |
| 258 | // OK to call more often than that, but unnecessary. |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 259 | void invalidateState(uint32_t mask); |
Glenn Kasten | 4e2293f | 2012-04-12 09:39:07 -0700 | [diff] [blame] | 260 | |
Jean-Michel Trivi | 9bd2322 | 2012-04-16 13:43:48 -0700 | [diff] [blame] | 261 | static status_t initTrackDownmix(track_t* pTrack, int trackNum, audio_channel_mask_t mask); |
Jean-Michel Trivi | 7d5b262 | 2012-04-04 18:54:36 -0700 | [diff] [blame] | 262 | static status_t prepareTrackForDownmix(track_t* pTrack, int trackNum); |
Jean-Michel Trivi | 9bd2322 | 2012-04-16 13:43:48 -0700 | [diff] [blame] | 263 | static void unprepareTrackForDownmix(track_t* pTrack, int trackName); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 264 | |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 265 | static void track__genericResample(track_t* t, int32_t* out, size_t numFrames, int32_t* temp, |
| 266 | int32_t* aux); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 267 | static void track__nop(track_t* t, int32_t* out, size_t numFrames, int32_t* temp, int32_t* aux); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 268 | static void track__16BitsStereo(track_t* t, int32_t* out, size_t numFrames, int32_t* temp, |
| 269 | int32_t* aux); |
| 270 | static void track__16BitsMono(track_t* t, int32_t* out, size_t numFrames, int32_t* temp, |
| 271 | int32_t* aux); |
| 272 | static void volumeRampStereo(track_t* t, int32_t* out, size_t frameCount, int32_t* temp, |
| 273 | int32_t* aux); |
| 274 | static void volumeStereo(track_t* t, int32_t* out, size_t frameCount, int32_t* temp, |
| 275 | int32_t* aux); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 276 | |
John Grossman | 4ff14ba | 2012-02-08 16:37:41 -0800 | [diff] [blame] | 277 | static void process__validate(state_t* state, int64_t pts); |
| 278 | static void process__nop(state_t* state, int64_t pts); |
| 279 | static void process__genericNoResampling(state_t* state, int64_t pts); |
| 280 | static void process__genericResampling(state_t* state, int64_t pts); |
| 281 | static void process__OneTrack16BitsStereoNoResampling(state_t* state, |
| 282 | int64_t pts); |
Glenn Kasten | 81a028f | 2011-12-15 09:53:12 -0800 | [diff] [blame] | 283 | #if 0 |
John Grossman | 4ff14ba | 2012-02-08 16:37:41 -0800 | [diff] [blame] | 284 | static void process__TwoTracks16BitsStereoNoResampling(state_t* state, |
| 285 | int64_t pts); |
Glenn Kasten | 81a028f | 2011-12-15 09:53:12 -0800 | [diff] [blame] | 286 | #endif |
John Grossman | 4ff14ba | 2012-02-08 16:37:41 -0800 | [diff] [blame] | 287 | |
| 288 | static int64_t calculateOutputPTS(const track_t& t, int64_t basePTS, |
| 289 | int outputFrameIndex); |
Glenn Kasten | 52008f8 | 2012-03-18 09:34:41 -0700 | [diff] [blame] | 290 | |
| 291 | static uint64_t sLocalTimeFreq; |
| 292 | static pthread_once_t sOnceControl; |
| 293 | static void sInitRoutine(); |
Mathias Agopian | 65ab471 | 2010-07-14 17:59:35 -0700 | [diff] [blame] | 294 | }; |
| 295 | |
| 296 | // ---------------------------------------------------------------------------- |
| 297 | }; // namespace android |
| 298 | |
| 299 | #endif // ANDROID_AUDIO_MIXER_H |