OSDN Git Service

aaudio: remove deprecated aaudio_audio_format_t
authorPhil Burk <philburk@google.com>
Fri, 26 May 2017 21:27:43 +0000 (14:27 -0700)
committerGlenn Kasten <gkasten@google.com>
Tue, 30 May 2017 22:36:21 +0000 (15:36 -0700)
Should be using aaudio_format_t

Bug: 62141619
Test: compile and run CTS test_aaudio.cpp
Change-Id: Ibbba2769dfd8bcd9c108d87c19fe1fad2ba43df1
Signed-off-by: Phil Burk <philburk@google.com>
16 files changed:
media/libaaudio/examples/input_monitor/src/input_monitor.cpp
media/libaaudio/examples/loopback/src/loopback.cpp
media/libaaudio/examples/write_sine/src/write_sine.cpp
media/libaaudio/include/aaudio/AAudio.h
media/libaaudio/src/binding/AAudioStreamConfiguration.cpp
media/libaaudio/src/binding/AAudioStreamConfiguration.h
media/libaaudio/src/client/AudioStreamInternal.h
media/libaaudio/src/core/AAudioAudio.cpp
media/libaaudio/src/core/AudioStream.h
media/libaaudio/src/core/AudioStreamBuilder.h
media/libaaudio/src/legacy/AudioStreamTrack.cpp
media/libaaudio/src/utility/AAudioUtilities.cpp
media/libaaudio/src/utility/AAudioUtilities.h
media/libaaudio/tests/test_open_params.cpp
services/oboeservice/AAudioServiceStreamBase.h
services/oboeservice/AAudioServiceStreamMMAP.cpp

index 5d55eaa..715c5f8 100644 (file)
@@ -39,8 +39,8 @@ int main(int argc, char **argv)
     AAudioSimpleRecorder recorder;
     int actualSamplesPerFrame;
     int actualSampleRate;
-    const aaudio_audio_format_t requestedDataFormat = AAUDIO_FORMAT_PCM_I16;
-    aaudio_audio_format_t actualDataFormat;
+    const aaudio_format_t requestedDataFormat = AAUDIO_FORMAT_PCM_I16;
+    aaudio_format_t actualDataFormat;
 
     const int requestedInputChannelCount = 1; // Can affect whether we get a FAST path.
 
index 1b52652..9f06ee7 100644 (file)
@@ -339,10 +339,10 @@ int main(int argc, const char **argv)
     const int requestedOutputChannelCount = AAUDIO_UNSPECIFIED;
     const int requestedSampleRate = SAMPLE_RATE;
     int actualSampleRate = 0;
-    const aaudio_audio_format_t requestedInputFormat = AAUDIO_FORMAT_PCM_I16;
-    const aaudio_audio_format_t requestedOutputFormat = AAUDIO_FORMAT_PCM_FLOAT;
-    aaudio_audio_format_t actualInputFormat;
-    aaudio_audio_format_t actualOutputFormat;
+    const aaudio_format_t requestedInputFormat = AAUDIO_FORMAT_PCM_I16;
+    const aaudio_format_t requestedOutputFormat = AAUDIO_FORMAT_PCM_FLOAT;
+    aaudio_format_t actualInputFormat;
+    aaudio_format_t actualOutputFormat;
 
     const aaudio_sharing_mode_t requestedSharingMode = AAUDIO_SHARING_MODE_EXCLUSIVE;
     //const aaudio_sharing_mode_t requestedSharingMode = AAUDIO_SHARING_MODE_SHARED;
index 27c6128..58bfa7c 100644 (file)
@@ -43,8 +43,8 @@ int main(int argc, char **argv)
     int actualChannelCount = 0;
     const int requestedSampleRate = SAMPLE_RATE;
     int actualSampleRate = 0;
-    aaudio_audio_format_t requestedDataFormat = REQUESTED_FORMAT;
-    aaudio_audio_format_t actualDataFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t requestedDataFormat = REQUESTED_FORMAT;
+    aaudio_format_t actualDataFormat = AAUDIO_FORMAT_UNSPECIFIED;
     aaudio_sharing_mode_t actualSharingMode = AAUDIO_SHARING_MODE_SHARED;
 
     AAudioStream *aaudioStream = nullptr;
index 4e36e84..4b8da79 100644 (file)
@@ -58,12 +58,6 @@ enum {
 };
 typedef int32_t aaudio_format_t;
 
-/**
- * @deprecated use aaudio_format_t instead
- * TODO remove when tests and examples are updated
- */
-typedef int32_t aaudio_audio_format_t;
-
 enum {
     AAUDIO_OK,
     AAUDIO_ERROR_BASE = -900, // TODO review
@@ -263,7 +257,7 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil
  * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16.
  */
 AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder,
-                                                   aaudio_audio_format_t format);
+                                                   aaudio_format_t format);
 
 /**
  * Request a mode for sharing the device.
@@ -754,7 +748,7 @@ AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream);
  * @param stream reference provided by AAudioStreamBuilder_openStream()
  * @return actual data format
  */
-AAUDIO_API aaudio_audio_format_t AAudioStream_getFormat(AAudioStream* stream);
+AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream);
 
 /**
  * Provide actual sharing mode.
index 09eaa42..44edb1d 100644 (file)
@@ -55,19 +55,16 @@ error:
 }
 
 status_t AAudioStreamConfiguration::readFromParcel(const Parcel* parcel) {
-    int32_t temp;
     status_t status = parcel->readInt32(&mDeviceId);
     if (status != NO_ERROR) goto error;
     status = parcel->readInt32(&mSampleRate);
     if (status != NO_ERROR) goto error;
     status = parcel->readInt32(&mSamplesPerFrame);
     if (status != NO_ERROR) goto error;
-    status = parcel->readInt32(&temp);
+    status = parcel->readInt32(&mSharingMode);
     if (status != NO_ERROR) goto error;
-    mSharingMode = (aaudio_sharing_mode_t) temp;
-    status = parcel->readInt32(&temp);
+    status = parcel->readInt32(&mAudioFormat);
     if (status != NO_ERROR) goto error;
-    mAudioFormat = (aaudio_audio_format_t) temp;
     status = parcel->readInt32(&mBufferCapacity);
     if (status != NO_ERROR) goto error;
     return NO_ERROR;
index b1e4a7d..acb6744 100644 (file)
@@ -58,11 +58,11 @@ public:
         mSamplesPerFrame = samplesPerFrame;
     }
 
-    aaudio_audio_format_t getAudioFormat() const {
+    aaudio_format_t getAudioFormat() const {
         return mAudioFormat;
     }
 
-    void setAudioFormat(aaudio_audio_format_t audioFormat) {
+    void setAudioFormat(aaudio_format_t audioFormat) {
         mAudioFormat = audioFormat;
     }
 
@@ -95,7 +95,7 @@ private:
     int32_t               mSampleRate      = AAUDIO_UNSPECIFIED;
     int32_t               mSamplesPerFrame = AAUDIO_UNSPECIFIED;
     aaudio_sharing_mode_t mSharingMode     = AAUDIO_SHARING_MODE_SHARED;
-    aaudio_audio_format_t mAudioFormat     = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t       mAudioFormat     = AAUDIO_FORMAT_UNSPECIFIED;
     int32_t               mBufferCapacity  = AAUDIO_UNSPECIFIED;
 };
 
index fe4431c..a11f309 100644 (file)
@@ -124,7 +124,7 @@ protected:
     // Calculate timeout for an operation involving framesPerOperation.
     int64_t calculateReasonableTimeout(int32_t framesPerOperation);
 
-    aaudio_audio_format_t    mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t          mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED;
 
     IsochronousClockModel    mClockModel;      // timing model for chasing the HAL
 
index c644ee5..30b6d2b 100644 (file)
@@ -157,7 +157,7 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder,
 }
 
 AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder,
-                                                   aaudio_audio_format_t format)
+                                                   aaudio_format_t format)
 {
     AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder);
     streamBuilder->setFormat(format);
@@ -359,7 +359,7 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream)
     return audioStream->getState();
 }
 
-AAUDIO_API aaudio_audio_format_t AAudioStream_getFormat(AAudioStream* stream)
+AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream)
 {
     AudioStream *audioStream = convertAAudioStreamToAudioStream(stream);
     return audioStream->getFormat();
index 377f24a..39c9f9c 100644 (file)
@@ -142,7 +142,7 @@ public:
         return mSampleRate;
     }
 
-    aaudio_audio_format_t getFormat()  const {
+    aaudio_format_t getFormat()  const {
         return mFormat;
     }
 
@@ -264,7 +264,7 @@ protected:
     /**
      * This should not be called after the open() call.
      */
-    void setFormat(aaudio_audio_format_t format) {
+    void setFormat(aaudio_format_t format) {
         mFormat = format;
     }
 
@@ -299,7 +299,7 @@ private:
     int32_t                mDeviceId = AAUDIO_UNSPECIFIED;
     aaudio_sharing_mode_t  mSharingMode = AAUDIO_SHARING_MODE_SHARED;
     bool                   mSharingModeMatchRequired = false; // must match sharing mode requested
-    aaudio_audio_format_t  mFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t        mFormat = AAUDIO_FORMAT_UNSPECIFIED;
     aaudio_stream_state_t  mState = AAUDIO_STREAM_STATE_UNINITIALIZED;
 
     aaudio_performance_mode_t mPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
index 569ca63..476f909 100644 (file)
@@ -64,11 +64,11 @@ public:
         return this;
     }
 
-    aaudio_audio_format_t getFormat() const {
+    aaudio_format_t getFormat() const {
         return mFormat;
     }
 
-    AudioStreamBuilder *setFormat(aaudio_audio_format_t format) {
+    AudioStreamBuilder *setFormat(aaudio_format_t format) {
         mFormat = format;
         return this;
     }
@@ -171,7 +171,7 @@ private:
     int32_t                    mDeviceId = AAUDIO_DEVICE_UNSPECIFIED;
     aaudio_sharing_mode_t      mSharingMode = AAUDIO_SHARING_MODE_SHARED;
     bool                       mSharingModeMatchRequired = false; // must match sharing mode requested
-    aaudio_audio_format_t      mFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t            mFormat = AAUDIO_FORMAT_UNSPECIFIED;
     aaudio_direction_t         mDirection = AAUDIO_DIRECTION_OUTPUT;
     int32_t                    mBufferCapacity = AAUDIO_UNSPECIFIED;
     aaudio_performance_mode_t  mPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
index 1e3119c..a0c1d45 100644 (file)
@@ -145,7 +145,7 @@ aaudio_result_t AudioStreamTrack::open(const AudioStreamBuilder& builder)
 
     // Get the actual values from the AudioTrack.
     setSamplesPerFrame(mAudioTrack->channelCount());
-    aaudio_audio_format_t aaudioFormat =
+    aaudio_format_t aaudioFormat =
             AAudioConvert_androidToAAudioDataFormat(mAudioTrack->format());
     setFormat(aaudioFormat);
 
index 38ad59f..2cf9612 100644 (file)
@@ -33,7 +33,7 @@ using namespace android;
 #define MAX_HEADROOM (1.41253754f)
 #define MIN_HEADROOM (0 - MAX_HEADROOM)
 
-int32_t AAudioConvert_formatToSizeInBytes(aaudio_audio_format_t format) {
+int32_t AAudioConvert_formatToSizeInBytes(aaudio_format_t format) {
     int32_t size = AAUDIO_ERROR_ILLEGAL_ARGUMENT;
     switch (format) {
         case AAUDIO_FORMAT_PCM_I16:
@@ -275,7 +275,7 @@ aaudio_result_t AAudioConvert_androidToAAudioResult(status_t status) {
     return result;
 }
 
-audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_audio_format_t aaudioFormat) {
+audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_format_t aaudioFormat) {
     audio_format_t androidFormat;
     switch (aaudioFormat) {
     case AAUDIO_FORMAT_PCM_I16:
@@ -292,8 +292,8 @@ audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_audio_format_t aau
     return androidFormat;
 }
 
-aaudio_audio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t androidFormat) {
-    aaudio_audio_format_t aaudioFormat = AAUDIO_FORMAT_INVALID;
+aaudio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t androidFormat) {
+    aaudio_format_t aaudioFormat = AAUDIO_FORMAT_INVALID;
     switch (androidFormat) {
     case AUDIO_FORMAT_PCM_16_BIT:
         aaudioFormat = AAUDIO_FORMAT_PCM_I16;
index 7c383c7..f895293 100644 (file)
@@ -161,14 +161,14 @@ int32_t AAudioConvert_framesToBytes(int32_t numFrames,
                                             int32_t bytesPerFrame,
                                             int32_t *sizeInBytes);
 
-audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_audio_format_t aaudio_format);
+audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_format_t aaudio_format);
 
-aaudio_audio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t format);
+aaudio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t format);
 
 /**
  * @return the size of a sample of the given format in bytes or AAUDIO_ERROR_ILLEGAL_ARGUMENT
  */
-int32_t AAudioConvert_formatToSizeInBytes(aaudio_audio_format_t format);
+int32_t AAudioConvert_formatToSizeInBytes(aaudio_format_t format);
 
 
 // Note that this code may be replaced by Settings or by some other system configuration tool.
index 5125653..01b8799 100644 (file)
@@ -57,7 +57,7 @@ aaudio_data_callback_result_t MyDataCallbackProc(
 static void testOpenOptions(aaudio_direction_t direction,
                             int32_t channelCount,
                             int32_t sampleRate,
-                            aaudio_audio_format_t format) {
+                            aaudio_format_t format) {
 
     aaudio_result_t result = AAUDIO_OK;
 
@@ -66,7 +66,7 @@ static void testOpenOptions(aaudio_direction_t direction,
 
     int32_t actualChannelCount = 0;
     int32_t actualSampleRate = 0;
-    aaudio_audio_format_t actualDataFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t actualDataFormat = AAUDIO_FORMAT_UNSPECIFIED;
     aaudio_sharing_mode_t actualSharingMode = AAUDIO_SHARING_MODE_SHARED;
     aaudio_direction_t actualDirection;
 
@@ -134,7 +134,8 @@ finish:
 //void foo() { // for tricking the Android Studio formatter
 TEST(test_open_params, aaudio_open_all) {
     aaudio_direction_t directions[] = {AAUDIO_DIRECTION_OUTPUT, AAUDIO_DIRECTION_INPUT};
-    aaudio_audio_format_t formats[] = {AAUDIO_FORMAT_UNSPECIFIED, AAUDIO_FORMAT_PCM_I16, AAUDIO_FORMAT_PCM_FLOAT};
+    aaudio_format_t formats[] = {AAUDIO_FORMAT_UNSPECIFIED,
+                                 AAUDIO_FORMAT_PCM_I16, AAUDIO_FORMAT_PCM_FLOAT};
     int32_t rates[] = {AAUDIO_UNSPECIFIED, 22050, 32000, 44100, 48000, 88200, 96000, 37913, 59132};
 
     // Make printf print immediately so that debug info is not stuck
index 9318c2e..ee52c39 100644 (file)
@@ -133,7 +133,7 @@ protected:
     // This is used by one thread to tell another thread to exit. So it must be atomic.
     std::atomic<bool>   mThreadEnabled;
 
-    aaudio_audio_format_t mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED;
+    aaudio_format_t    mAudioFormat = AAUDIO_FORMAT_UNSPECIFIED;
     int32_t            mFramesPerBurst = 0;
     int32_t            mSamplesPerFrame = AAUDIO_UNSPECIFIED;
     int32_t            mSampleRate = AAUDIO_UNSPECIFIED;
index 14b3379..97b9937 100644 (file)
@@ -93,7 +93,7 @@ aaudio_result_t AAudioServiceStreamMMAP::open(const aaudio::AAudioStreamRequest
     aaudio_direction_t direction = request.getDirection();
 
     // Fill in config
-    aaudio_audio_format_t aaudioFormat = configurationInput.getAudioFormat();
+    aaudio_format_t aaudioFormat = configurationInput.getAudioFormat();
     if (aaudioFormat == AAUDIO_UNSPECIFIED || aaudioFormat == AAUDIO_FORMAT_PCM_FLOAT) {
         aaudioFormat = AAUDIO_FORMAT_PCM_I16;
     }