summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.h
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-07-16 21:53:43 -0700
committerAndy Hung <hunga@google.com>2014-07-18 20:34:02 -0700
commita08810b2feafeec88870c7c1f01efc39ee8e0d78 (patch)
tree6c33f28c0c637f0d67530058493f653e453a131b /services/audioflinger/AudioMixer.h
parent34803d594232af5604d893eff7ee40bb57d459a4 (diff)
downloadframeworks_av-a08810b2feafeec88870c7c1f01efc39ee8e0d78.zip
frameworks_av-a08810b2feafeec88870c7c1f01efc39ee8e0d78.tar.gz
frameworks_av-a08810b2feafeec88870c7c1f01efc39ee8e0d78.tar.bz2
Add RemixBufferProvider to AudioMixer
This is used to convert between channel masks for input AudioTrack data. Change-Id: Iedffaeccb99c7053992152e7b1cb6b2d33b12eef
Diffstat (limited to 'services/audioflinger/AudioMixer.h')
-rw-r--r--services/audioflinger/AudioMixer.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 7ad2e75..09a4d89 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -252,8 +252,8 @@ private:
track_t tracks[MAX_NUM_TRACKS] __attribute__((aligned(32)));
};
- // Base AudioBufferProvider class used for ReformatBufferProvider and
- // DownmixerBufferProvider.
+ // Base AudioBufferProvider class used for DownMixerBufferProvider, RemixBufferProvider,
+ // and ReformatBufferProvider.
// It handles a private buffer for use in converting format or channel masks from the
// input data to a form acceptable by the mixer.
// TODO: Make a ResamplerBufferProvider when integers are entirely removed from the
@@ -326,6 +326,23 @@ private:
static const int32_t SESSION_ID_INVALID_AND_IGNORED = -2;
};
+ // RemixBufferProvider wraps a track AudioBufferProvider to perform an
+ // upmix or downmix to the proper channel count and mask.
+ class RemixBufferProvider : public CopyBufferProvider {
+ public:
+ RemixBufferProvider(audio_channel_mask_t inputChannelMask,
+ audio_channel_mask_t outputChannelMask, audio_format_t format,
+ size_t bufferFrameCount);
+ virtual void copyFrames(void *dst, const void *src, size_t frames);
+
+ protected:
+ const audio_format_t mFormat;
+ const size_t mSampleSize;
+ const size_t mInputChannels;
+ const size_t mOutputChannels;
+ int8_t mIdxAry[sizeof(uint32_t)*8]; // 32 bits => channel indices
+ };
+
// ReformatBufferProvider wraps a track AudioBufferProvider to convert the input data
// to an acceptable mixer input format type.
class ReformatBufferProvider : public CopyBufferProvider {