Use audio_format_t consistently, continued
Was int or uint32_t.
When AudioFlinger::format can't determine the correct format,
return INVALID rather than DEFAULT.
Init mFormat to INVALID rather than DEFAULT in the constructor.
Subclass constructors will set mFormat to the correct value.
Change-Id: I9b62640aa107d24d2d27925f5563d0d7407d1b73
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 44925f2..756e91d 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -68,7 +68,7 @@
};
uint32_t flags;
int channelCount;
- int format;
+ audio_format_t format;
size_t frameCount;
size_t size;
union {
@@ -112,7 +112,7 @@
static status_t getMinFrameCount(int* frameCount,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
int channelCount);
/* Constructs an uninitialized AudioRecord. No connection with
@@ -151,7 +151,7 @@
AudioRecord(int inputSource,
uint32_t sampleRate = 0,
- int format = 0,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
int frameCount = 0,
uint32_t flags = 0,
@@ -177,7 +177,7 @@
* */
status_t set(int inputSource = 0,
uint32_t sampleRate = 0,
- int format = 0,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
int frameCount = 0,
uint32_t flags = 0,
@@ -203,7 +203,7 @@
/* getters, see constructor */
- int format() const;
+ audio_format_t format() const;
int channelCount() const;
int channels() const;
uint32_t frameCount() const;
@@ -349,7 +349,7 @@
bool processAudioBuffer(const sp<ClientRecordThread>& thread);
status_t openRecord_l(uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -365,7 +365,7 @@
uint32_t mFrameCount;
audio_track_cblk_t* mCblk;
- uint32_t mFormat;
+ audio_format_t mFormat;
uint8_t mChannelCount;
uint8_t mInputSource;
uint8_t mReserved[2];
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index 49e5690..c6368fb 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -95,7 +95,7 @@
static bool routedToA2dpOutput(audio_stream_type_t streamType);
- static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount,
+ static status_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount,
size_t* buffSize);
static status_t setVoiceVolume(float volume);
@@ -134,7 +134,7 @@
class OutputDescriptor {
public:
OutputDescriptor()
- : samplingRate(0), format(0), channels(0), frameCount(0), latency(0) {}
+ : samplingRate(0), format(AUDIO_FORMAT_DEFAULT), channels(0), frameCount(0), latency(0) {}
uint32_t samplingRate;
int32_t format;
@@ -153,7 +153,7 @@
static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
static audio_io_handle_t getOutput(audio_stream_type_t stream,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = AUDIO_CHANNEL_OUT_STEREO,
audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT);
static status_t startOutput(audio_io_handle_t output,
@@ -165,7 +165,7 @@
static void releaseOutput(audio_io_handle_t output);
static audio_io_handle_t getInput(int inputSource,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = AUDIO_CHANNEL_IN_MONO,
audio_in_acoustics_t acoustics = (audio_in_acoustics_t)0,
int sessionId = 0);
@@ -242,7 +242,7 @@
static size_t gInBuffSize;
// previous parameters for recording buffer size queries
static uint32_t gPrevInSamplingRate;
- static int gPrevInFormat;
+ static audio_format_t gPrevInFormat;
static int gPrevInChannelCount;
static sp<IAudioPolicyService> gAudioPolicyService;
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 3999479..7c0d886 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -48,7 +48,7 @@
pid_t pid,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -61,7 +61,7 @@
pid_t pid,
int input,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -73,7 +73,7 @@
*/
virtual uint32_t sampleRate(int output) const = 0;
virtual int channelCount(int output) const = 0;
- virtual uint32_t format(int output) const = 0;
+ virtual audio_format_t format(int output) const = 0;
virtual size_t frameCount(int output) const = 0;
virtual uint32_t latency(int output) const = 0;
@@ -109,11 +109,11 @@
virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0;
// retrieve the audio recording buffer size
- virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0;
+ virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount) = 0;
virtual int openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
uint32_t flags) = 0;
@@ -124,7 +124,7 @@
virtual int openInput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics) = 0;
virtual status_t closeInput(int input) = 0;
diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h
index 8ddbe0a..07d17c5 100644
--- a/include/media/IAudioPolicyService.h
+++ b/include/media/IAudioPolicyService.h
@@ -50,7 +50,7 @@
virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) = 0;
virtual audio_io_handle_t getOutput(audio_stream_type_t stream,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = 0,
audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT) = 0;
virtual status_t startOutput(audio_io_handle_t output,
@@ -62,7 +62,7 @@
virtual void releaseOutput(audio_io_handle_t output) = 0;
virtual audio_io_handle_t getInput(int inputSource,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = 0,
audio_in_acoustics_t acoustics = (audio_in_acoustics_t)0,
int audioSession = 0) = 0;
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 32b5bac..5b5b076 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -48,7 +48,7 @@
status_t AudioRecord::getMinFrameCount(
int* frameCount,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
int channelCount)
{
size_t size = 0;
@@ -86,7 +86,7 @@
AudioRecord::AudioRecord(
int inputSource,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -121,7 +121,7 @@
status_t AudioRecord::set(
int inputSource,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -148,7 +148,7 @@
sampleRate = DEFAULT_SAMPLE_RATE;
}
// these below should probably come from the audioFlinger too...
- if (format == 0) {
+ if (format == AUDIO_FORMAT_DEFAULT) {
format = AUDIO_FORMAT_PCM_16_BIT;
}
// validate parameters
@@ -248,7 +248,7 @@
return mLatency;
}
-int AudioRecord::format() const
+audio_format_t AudioRecord::format() const
{
return mFormat;
}
@@ -448,7 +448,7 @@
// must be called with mLock held
status_t AudioRecord::openRecord_l(
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 5ca868a..952d634 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -40,7 +40,7 @@
// Cached values for recording queries, all protected by gLock
uint32_t AudioSystem::gPrevInSamplingRate = 16000;
-int AudioSystem::gPrevInFormat = AUDIO_FORMAT_PCM_16_BIT;
+audio_format_t AudioSystem::gPrevInFormat = AUDIO_FORMAT_PCM_16_BIT;
int AudioSystem::gPrevInChannelCount = 1;
size_t AudioSystem::gInBuffSize = 0;
@@ -308,7 +308,7 @@
return NO_ERROR;
}
-status_t AudioSystem::getInputBufferSize(uint32_t sampleRate, int format, int channelCount,
+status_t AudioSystem::getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount,
size_t* buffSize)
{
gLock.lock();
@@ -572,7 +572,7 @@
audio_io_handle_t AudioSystem::getOutput(audio_stream_type_t stream,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_policy_output_flags_t flags)
{
@@ -632,7 +632,7 @@
audio_io_handle_t AudioSystem::getInput(int inputSource,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_in_acoustics_t acoustics,
int sessionId)
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index eef551c..0d442ef 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -84,7 +84,7 @@
pid_t pid,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -131,7 +131,7 @@
pid_t pid,
int input,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -188,13 +188,13 @@
return reply.readInt32();
}
- virtual uint32_t format(int output) const
+ virtual audio_format_t format(int output) const
{
Parcel data, reply;
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
data.writeInt32(output);
remote()->transact(FORMAT, data, &reply);
- return reply.readInt32();
+ return (audio_format_t) reply.readInt32();
}
virtual size_t frameCount(int output) const
@@ -343,7 +343,7 @@
remote()->transact(REGISTER_CLIENT, data, &reply);
}
- virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
+ virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
@@ -356,7 +356,7 @@
virtual int openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
uint32_t flags)
@@ -364,7 +364,7 @@
Parcel data, reply;
uint32_t devices = pDevices ? *pDevices : 0;
uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0;
- uint32_t format = pFormat ? *pFormat : 0;
+ audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT;
uint32_t channels = pChannels ? *pChannels : 0;
uint32_t latency = pLatencyMs ? *pLatencyMs : 0;
@@ -382,7 +382,7 @@
if (pDevices) *pDevices = devices;
samplingRate = reply.readInt32();
if (pSamplingRate) *pSamplingRate = samplingRate;
- format = reply.readInt32();
+ format = (audio_format_t) reply.readInt32();
if (pFormat) *pFormat = format;
channels = reply.readInt32();
if (pChannels) *pChannels = channels;
@@ -430,14 +430,14 @@
virtual int openInput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics)
{
Parcel data, reply;
uint32_t devices = pDevices ? *pDevices : 0;
uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0;
- uint32_t format = pFormat ? *pFormat : 0;
+ audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT;
uint32_t channels = pChannels ? *pChannels : 0;
data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
@@ -452,7 +452,7 @@
if (pDevices) *pDevices = devices;
samplingRate = reply.readInt32();
if (pSamplingRate) *pSamplingRate = samplingRate;
- format = reply.readInt32();
+ format = (audio_format_t) reply.readInt32();
if (pFormat) *pFormat = format;
channels = reply.readInt32();
if (pChannels) *pChannels = channels;
@@ -678,7 +678,7 @@
pid_t pid = data.readInt32();
int streamType = data.readInt32();
uint32_t sampleRate = data.readInt32();
- int format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
int channelCount = data.readInt32();
size_t bufferCount = data.readInt32();
uint32_t flags = data.readInt32();
@@ -699,7 +699,7 @@
pid_t pid = data.readInt32();
int input = data.readInt32();
uint32_t sampleRate = data.readInt32();
- int format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
int channelCount = data.readInt32();
size_t bufferCount = data.readInt32();
uint32_t flags = data.readInt32();
@@ -825,7 +825,7 @@
case GET_INPUTBUFFERSIZE: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
uint32_t sampleRate = data.readInt32();
- int format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
int channelCount = data.readInt32();
reply->writeInt32( getInputBufferSize(sampleRate, format, channelCount) );
return NO_ERROR;
@@ -834,7 +834,7 @@
CHECK_INTERFACE(IAudioFlinger, data, reply);
uint32_t devices = data.readInt32();
uint32_t samplingRate = data.readInt32();
- uint32_t format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
uint32_t latency = data.readInt32();
uint32_t flags = data.readInt32();
@@ -879,7 +879,7 @@
CHECK_INTERFACE(IAudioFlinger, data, reply);
uint32_t devices = data.readInt32();
uint32_t samplingRate = data.readInt32();
- uint32_t format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
uint32_t acoutics = data.readInt32();
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index e363101..b5c857f 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -122,7 +122,7 @@
virtual audio_io_handle_t getOutput(
audio_stream_type_t stream,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_policy_output_flags_t flags)
{
@@ -174,7 +174,7 @@
virtual audio_io_handle_t getInput(
int inputSource,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_in_acoustics_t acoustics,
int audioSession)
@@ -416,7 +416,7 @@
audio_stream_type_t stream =
static_cast <audio_stream_type_t>(data.readInt32());
uint32_t samplingRate = data.readInt32();
- uint32_t format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
audio_policy_output_flags_t flags =
static_cast <audio_policy_output_flags_t>(data.readInt32());
@@ -463,7 +463,7 @@
CHECK_INTERFACE(IAudioPolicyService, data, reply);
int inputSource = data.readInt32();
uint32_t samplingRate = data.readInt32();
- uint32_t format = data.readInt32();
+ audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
audio_in_acoustics_t acoustics =
static_cast <audio_in_acoustics_t>(data.readInt32());
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 53b13f7..c6a9c77 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -382,7 +382,7 @@
pid_t pid,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -502,13 +502,13 @@
return thread->channelCount();
}
-uint32_t AudioFlinger::format(int output) const
+audio_format_t AudioFlinger::format(int output) const
{
Mutex::Autolock _l(mLock);
PlaybackThread *thread = checkPlaybackThread_l(output);
if (thread == NULL) {
ALOGW("format() unknown thread %d", output);
- return 0;
+ return AUDIO_FORMAT_INVALID;
}
return thread->format();
}
@@ -849,7 +849,7 @@
return String8("");
}
-size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
+size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount)
{
status_t ret = initCheck();
if (ret != NO_ERROR) {
@@ -990,7 +990,7 @@
AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, int id, uint32_t device)
: Thread(false),
mAudioFlinger(audioFlinger), mSampleRate(0), mFrameCount(0), mChannelCount(0),
- mFrameSize(1), mFormat(0), mStandby(false), mId(id), mExiting(false),
+ mFrameSize(1), mFormat(AUDIO_FORMAT_INVALID), mStandby(false), mId(id), mExiting(false),
mDevice(device)
{
mDeathRecipient = new PMDeathRecipient(this);
@@ -1033,7 +1033,7 @@
return (int)mChannelCount;
}
-uint32_t AudioFlinger::ThreadBase::format() const
+audio_format_t AudioFlinger::ThreadBase::format() const
{
return mFormat;
}
@@ -1495,7 +1495,7 @@
const sp<AudioFlinger::Client>& client,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
@@ -2394,7 +2394,7 @@
reconfig = true;
}
if (param.getInt(String8(AudioParameter::keyFormat), value) == NO_ERROR) {
- if (value != AUDIO_FORMAT_PCM_16_BIT) {
+ if ((audio_format_t) value != AUDIO_FORMAT_PCM_16_BIT) {
status = BAD_VALUE;
} else {
reconfig = true;
@@ -3233,7 +3233,7 @@
const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -3395,7 +3395,7 @@
const sp<Client>& client,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
@@ -3701,7 +3701,7 @@
const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -3814,7 +3814,7 @@
const wp<ThreadBase>& thread,
DuplicatingThread *sourceThread,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount)
: Track(thread, NULL, AUDIO_STREAM_CNT, sampleRate, format, channelMask, frameCount, NULL, 0),
@@ -4147,7 +4147,7 @@
pid_t pid,
int input,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -4492,7 +4492,7 @@
sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createRecordTrack_l(
const sp<AudioFlinger::Client>& client,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
int channelMask,
int frameCount,
uint32_t flags,
@@ -4704,7 +4704,7 @@
String8 keyValuePair = mNewParameters[0];
AudioParameter param = AudioParameter(keyValuePair);
int value;
- int reqFormat = mFormat;
+ audio_format_t reqFormat = mFormat;
int reqSamplingRate = mReqSampleRate;
int reqChannelCount = mReqChannelCount;
@@ -4713,7 +4713,7 @@
reconfig = true;
}
if (param.getInt(String8(AudioParameter::keyFormat), value) == NO_ERROR) {
- reqFormat = value;
+ reqFormat = (audio_format_t) value;
reconfig = true;
}
if (param.getInt(String8(AudioParameter::keyChannels), value) == NO_ERROR) {
@@ -4924,7 +4924,7 @@
int AudioFlinger::openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
uint32_t flags)
@@ -4933,7 +4933,7 @@
PlaybackThread *thread = NULL;
mHardwareStatus = AUDIO_HW_OUTPUT_OPEN;
uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0;
- uint32_t format = pFormat ? *pFormat : 0;
+ audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT;
uint32_t channels = pChannels ? *pChannels : 0;
uint32_t latency = pLatencyMs ? *pLatencyMs : 0;
audio_stream_out_t *outStream;
@@ -4956,7 +4956,7 @@
if (outHwDev == NULL)
return 0;
- status = outHwDev->open_output_stream(outHwDev, *pDevices, (int *)&format,
+ status = outHwDev->open_output_stream(outHwDev, *pDevices, &format,
&channels, &samplingRate, &outStream);
ALOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d",
outStream,
@@ -5084,17 +5084,17 @@
int AudioFlinger::openInput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics)
{
status_t status;
RecordThread *thread = NULL;
uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0;
- uint32_t format = pFormat ? *pFormat : 0;
+ audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT;
uint32_t channels = pChannels ? *pChannels : 0;
uint32_t reqSamplingRate = samplingRate;
- uint32_t reqFormat = format;
+ audio_format_t reqFormat = format;
uint32_t reqChannels = channels;
audio_stream_in_t *inStream;
audio_hw_device_t *inHwDev;
@@ -5109,7 +5109,7 @@
if (inHwDev == NULL)
return 0;
- status = inHwDev->open_input_stream(inHwDev, *pDevices, (int *)&format,
+ status = inHwDev->open_input_stream(inHwDev, *pDevices, &format,
&channels, &samplingRate,
(audio_in_acoustics_t)acoustics,
&inStream);
@@ -5129,7 +5129,7 @@
(samplingRate <= 2 * reqSamplingRate) &&
(popcount(channels) < 3) && (popcount(reqChannels) < 3)) {
ALOGV("openInput() reopening with proposed sampling rate and channels");
- status = inHwDev->open_input_stream(inHwDev, *pDevices, (int *)&format,
+ status = inHwDev->open_input_stream(inHwDev, *pDevices, &format,
&channels, &samplingRate,
(audio_in_acoustics_t)acoustics,
&inStream);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 8a82bdb..d862c1d 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -72,7 +72,7 @@
pid_t pid,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -83,7 +83,7 @@
virtual uint32_t sampleRate(int output) const;
virtual int channelCount(int output) const;
- virtual uint32_t format(int output) const;
+ virtual audio_format_t format(int output) const;
virtual size_t frameCount(int output) const;
virtual uint32_t latency(int output) const;
@@ -109,12 +109,12 @@
virtual void registerClient(const sp<IAudioFlingerClient>& client);
- virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount);
+ virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, int channelCount);
virtual unsigned int getInputFramesLost(int ioHandle);
virtual int openOutput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
uint32_t flags);
@@ -129,7 +129,7 @@
virtual int openInput(uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics);
@@ -189,7 +189,7 @@
pid_t pid,
int input,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -315,7 +315,7 @@
TrackBase(const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -343,7 +343,7 @@
virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer) = 0;
virtual void releaseBuffer(AudioBufferProvider::Buffer* buffer);
- uint32_t format() const {
+ audio_format_t format() const {
return mFormat;
}
@@ -376,7 +376,7 @@
// we don't really need a lock for these
int mState;
int mClientTid;
- uint32_t mFormat;
+ audio_format_t mFormat;
uint32_t mFlags;
int mSessionId;
uint8_t mChannelCount;
@@ -410,7 +410,7 @@
int type() const { return mType; }
uint32_t sampleRate() const;
int channelCount() const;
- uint32_t format() const;
+ audio_format_t format() const;
size_t frameCount() const;
void wakeUp() { mWaitWorkCV.broadcast(); }
void exit();
@@ -537,7 +537,7 @@
uint32_t mChannelMask;
uint16_t mChannelCount;
size_t mFrameSize;
- uint32_t mFormat;
+ audio_format_t mFormat;
Condition mParamCond;
Vector<String8> mNewParameters;
status_t mParamStatus;
@@ -575,7 +575,7 @@
const sp<Client>& client,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
@@ -660,7 +660,7 @@
OutputTrack( const wp<ThreadBase>& thread,
DuplicatingThread *sourceThread,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount);
~OutputTrack();
@@ -715,7 +715,7 @@
const sp<AudioFlinger::Client>& client,
audio_stream_type_t streamType,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
const sp<IMemory>& sharedBuffer,
@@ -935,7 +935,7 @@
RecordTrack(const wp<ThreadBase>& thread,
const sp<Client>& client,
uint32_t sampleRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channelMask,
int frameCount,
uint32_t flags,
@@ -979,7 +979,7 @@
sp<AudioFlinger::RecordThread::RecordTrack> createRecordTrack_l(
const sp<AudioFlinger::Client>& client,
uint32_t sampleRate,
- int format,
+ audio_format_t format,
int channelMask,
int frameCount,
uint32_t flags,
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 7a408bc..28b1c89 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -241,7 +241,7 @@
audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_policy_output_flags_t flags)
{
@@ -289,7 +289,7 @@
audio_io_handle_t AudioPolicyService::getInput(int inputSource,
uint32_t samplingRate,
- uint32_t format,
+ audio_format_t format,
uint32_t channels,
audio_in_acoustics_t acoustics,
int audioSession)
@@ -1352,7 +1352,7 @@
static audio_io_handle_t aps_open_output(void *service,
uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t *pLatencyMs,
audio_policy_output_flags_t flags)
@@ -1413,7 +1413,7 @@
static audio_io_handle_t aps_open_input(void *service,
uint32_t *pDevices,
uint32_t *pSamplingRate,
- uint32_t *pFormat,
+ audio_format_t *pFormat,
uint32_t *pChannels,
uint32_t acoustics)
{
diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h
index 3693cef..9811670 100644
--- a/services/audioflinger/AudioPolicyService.h
+++ b/services/audioflinger/AudioPolicyService.h
@@ -63,7 +63,7 @@
virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
virtual audio_io_handle_t getOutput(audio_stream_type_t stream,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = 0,
audio_policy_output_flags_t flags =
AUDIO_POLICY_OUTPUT_FLAG_INDIRECT);
@@ -76,7 +76,7 @@
virtual void releaseOutput(audio_io_handle_t output);
virtual audio_io_handle_t getInput(int inputSource,
uint32_t samplingRate = 0,
- uint32_t format = AUDIO_FORMAT_DEFAULT,
+ audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = 0,
audio_in_acoustics_t acoustics =
(audio_in_acoustics_t)0,