Use audio_format_t consistently
Was int, uint32_t, uint16_t, and uint8_t with 2-bit bitfield.
Also replace 0 by AUDIO_FORMAT_DEFAULT and replace 1 by
AUDIO_FORMAT_PCM_16_BIT.
Change-Id: Ia8804f53f1725669e368857d5bb2044917e17975
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index b106042..8f5e2d4 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -69,7 +69,8 @@
MUTE = 0x00000001
};
uint32_t flags;
- int format;
+ audio_format_t format; // but AUDIO_FORMAT_PCM_8_BIT -> AUDIO_FORMAT_PCM_16_BIT
+ // accessed directly by WebKit ANP callback
int channelCount; // will be removed in the future, do not use
size_t frameCount;
size_t size;
@@ -143,7 +144,7 @@
AudioTrack( int streamType,
uint32_t sampleRate = 0,
- int format = 0,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
int frameCount = 0,
uint32_t flags = 0,
@@ -163,7 +164,7 @@
AudioTrack( int streamType,
uint32_t sampleRate = 0,
- int format = 0,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
const sp<IMemory>& sharedBuffer = 0,
uint32_t flags = 0,
@@ -187,7 +188,7 @@
* */
status_t set(int streamType =-1,
uint32_t sampleRate = 0,
- int format = 0,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
int channelMask = 0,
int frameCount = 0,
uint32_t flags = 0,
@@ -215,7 +216,7 @@
/* getters, see constructor */
int streamType() const;
- int format() const;
+ audio_format_t format() const;
int channelCount() const;
uint32_t frameCount() const;
int frameSize() const;
@@ -434,7 +435,7 @@
bool processAudioBuffer(const sp<AudioTrackThread>& thread);
status_t createTrack_l(int streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -455,7 +456,7 @@
uint32_t mFrameCount;
audio_track_cblk_t* mCblk;
- uint32_t mFormat;
+ audio_format_t mFormat;
uint8_t mStreamType;
uint8_t mChannelCount;
uint8_t mMuted;
diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h
index 93bbe13..4f46fcd 100644
--- a/include/media/IMediaPlayerService.h
+++ b/include/media/IMediaPlayerService.h
@@ -23,6 +23,7 @@
#include <utils/String8.h>
#include <binder/IInterface.h>
#include <binder/Parcel.h>
+#include <system/audio.h>
#include <media/IMediaPlayerClient.h>
#include <media/IMediaPlayer.h>
@@ -43,8 +44,8 @@
virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0;
virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0;
- virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0;
- virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0;
+ virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
+ virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
virtual sp<IOMX> getOMX() = 0;
// codecs and audio devices usage tracking for the battery app
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index 80f43a3..1f6bdda 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -85,7 +85,7 @@
// audio data.
virtual status_t open(
uint32_t sampleRate, int channelCount,
- int format=AUDIO_FORMAT_PCM_16_BIT,
+ audio_format_t format=AUDIO_FORMAT_PCM_16_BIT,
int bufferCount=DEFAULT_AUDIOSINK_BUFFERCOUNT,
AudioCallback cb = NULL,
void *cookie = NULL) = 0;
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index e6a0cc5..2dc055e 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -190,8 +190,8 @@
bool isLooping();
status_t setVolume(float leftVolume, float rightVolume);
void notify(int msg, int ext1, int ext2, const Parcel *obj = NULL);
- static sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat);
- static sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat);
+ static sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat);
+ static sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat);
status_t invoke(const Parcel& request, Parcel *reply);
status_t setMetadataFilter(const Parcel& filter);
status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata);