summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.h
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-07-16 21:41:35 -0700
committerAndy Hung <hunga@google.com>2014-07-18 18:05:19 -0700
commit34803d594232af5604d893eff7ee40bb57d459a4 (patch)
tree13991635bf72797e6ff00a3ec739b465af53614d /services/audioflinger/AudioMixer.h
parent1b2fdcb005f9fbe5ad465cec46ec5992b718b5e3 (diff)
downloadframeworks_av-34803d594232af5604d893eff7ee40bb57d459a4.zip
frameworks_av-34803d594232af5604d893eff7ee40bb57d459a4.tar.gz
frameworks_av-34803d594232af5604d893eff7ee40bb57d459a4.tar.bz2
Update DownmixerBufferProvider to use CopyBufferProvider
Change-Id: I6b1a8755a1e6c29b916662fd376e9509cda5df55
Diffstat (limited to 'services/audioflinger/AudioMixer.h')
-rw-r--r--services/audioflinger/AudioMixer.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index f08d9b5..7ad2e75 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -153,7 +153,6 @@ private:
struct state_t;
struct track_t;
- class DownmixerBufferProvider;
class CopyBufferProvider;
typedef void (*hook_t)(track_t* t, int32_t* output, size_t numOutFrames, int32_t* temp,
@@ -208,7 +207,7 @@ private:
// 16-byte boundary
AudioBufferProvider* mInputBufferProvider; // externally provided buffer provider.
CopyBufferProvider* mReformatBufferProvider; // provider wrapper for reformatting.
- DownmixerBufferProvider* downmixerBufferProvider; // 4 bytes
+ CopyBufferProvider* downmixerBufferProvider; // wrapper for channel conversion.
int32_t sessionId;
@@ -253,7 +252,8 @@ private:
track_t tracks[MAX_NUM_TRACKS] __attribute__((aligned(32)));
};
- // Base AudioBufferProvider class used for ReformatBufferProvider.
+ // Base AudioBufferProvider class used for ReformatBufferProvider and
+ // DownmixerBufferProvider.
// 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
@@ -299,17 +299,31 @@ private:
size_t mConsumed;
};
- // AudioBufferProvider that wraps a track AudioBufferProvider by a call to a downmix effect
- class DownmixerBufferProvider : public AudioBufferProvider {
+ // DownmixerBufferProvider wraps a track AudioBufferProvider to provide
+ // position dependent downmixing by an Audio Effect.
+ class DownmixerBufferProvider : public CopyBufferProvider {
public:
- virtual status_t getNextBuffer(Buffer* buffer, int64_t pts);
- virtual void releaseBuffer(Buffer* buffer);
- DownmixerBufferProvider();
+ DownmixerBufferProvider(audio_channel_mask_t inputChannelMask,
+ audio_channel_mask_t outputChannelMask, audio_format_t format,
+ uint32_t sampleRate, int32_t sessionId, size_t bufferFrameCount);
virtual ~DownmixerBufferProvider();
+ virtual void copyFrames(void *dst, const void *src, size_t frames);
+ bool isValid() const { return mDownmixHandle != NULL; }
- AudioBufferProvider* mTrackBufferProvider;
+ static status_t init();
+ static bool isMultichannelCapable() { return sIsMultichannelCapable; }
+
+ protected:
effect_handle_t mDownmixHandle;
effect_config_t mDownmixConfig;
+
+ // effect descriptor for the downmixer used by the mixer
+ static effect_descriptor_t sDwnmFxDesc;
+ // indicates whether a downmix effect has been found and is usable by this mixer
+ static bool sIsMultichannelCapable;
+ // FIXME: should we allow effects outside of the framework?
+ // We need to here. A special ioId that must be <= -2 so it does not map to a session.
+ static const int32_t SESSION_ID_INVALID_AND_IGNORED = -2;
};
// ReformatBufferProvider wraps a track AudioBufferProvider to convert the input data
@@ -342,11 +356,6 @@ public:
private:
state_t mState __attribute__((aligned(32)));
- // effect descriptor for the downmixer used by the mixer
- static effect_descriptor_t sDwnmFxDesc;
- // indicates whether a downmix effect has been found and is usable by this mixer
- static bool sIsMultichannelCapable;
-
// Call after changing either the enabled status of a track, or parameters of an enabled track.
// OK to call more often than that, but unnecessary.
void invalidateState(uint32_t mask);