From fff6d715a8db0daf08a50634f242c40268de3d49 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Thu, 12 Jan 2012 16:38:12 -0800 Subject: Use audio_stream_type_t consistently At native level it was a mixture of audio_stream_type_t, int, uint32_t, and uint8_t. Java is still int. Also fixed a couple of hard-coded -1 instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0 instead of AUDIO_STREAM_VOICE_CALL. Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83 --- include/media/AudioSystem.h | 20 ++++++++++---------- include/media/AudioTrack.h | 14 +++++++------- include/media/IAudioFlinger.h | 12 ++++++------ include/media/IAudioPolicyService.h | 2 +- include/media/IMediaPlayer.h | 3 ++- include/media/MediaPlayerInterface.h | 2 +- include/media/ToneGenerator.h | 4 ++-- include/media/mediaplayer.h | 4 ++-- 8 files changed, 31 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 6a15f6e..e49d8f5 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -55,19 +55,19 @@ public: static status_t getMasterMute(bool* mute); // set/get stream volume on specified output - static status_t setStreamVolume(int stream, float value, int output); - static status_t getStreamVolume(int stream, float* volume, int output); + static status_t setStreamVolume(audio_stream_type_t stream, float value, int output); + static status_t getStreamVolume(audio_stream_type_t stream, float* volume, int output); // mute/unmute stream - static status_t setStreamMute(int stream, bool mute); - static status_t getStreamMute(int stream, bool* mute); + static status_t setStreamMute(audio_stream_type_t stream, bool mute); + static status_t getStreamMute(audio_stream_type_t stream, bool* mute); // set audio mode in audio hardware (see audio_mode_t) static status_t setMode(int mode); // returns true in *state if tracks are active on the specified stream or has been active // in the past inPastMs milliseconds - static status_t isStreamActive(int stream, bool *state, uint32_t inPastMs = 0); + static status_t isStreamActive(audio_stream_type_t stream, bool *state, uint32_t inPastMs = 0); // set/get audio hardware parameters. The function accepts a list of parameters // key value pairs in the form: key1=value1;key2=value2;... @@ -83,11 +83,11 @@ public: static float linearToLog(int volume); static int logToLinear(float volume); - static status_t getOutputSamplingRate(int* samplingRate, int stream = AUDIO_STREAM_DEFAULT); - static status_t getOutputFrameCount(int* frameCount, int stream = AUDIO_STREAM_DEFAULT); - static status_t getOutputLatency(uint32_t* latency, int stream = AUDIO_STREAM_DEFAULT); + static status_t getOutputSamplingRate(int* samplingRate, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); + static status_t getOutputFrameCount(int* frameCount, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); + static status_t getOutputLatency(uint32_t* latency, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); - static bool routedToA2dpOutput(int streamType); + static bool routedToA2dpOutput(audio_stream_type_t streamType); static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount, size_t* buffSize); @@ -103,7 +103,7 @@ public: // - BAD_VALUE: invalid parameter // NOTE: this feature is not supported on all hardware platforms and it is // necessary to check returned status before using the returned values. - static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = AUDIO_STREAM_DEFAULT); + static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); static unsigned int getInputFramesLost(audio_io_handle_t ioHandle); diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 60b052b..fd83162 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -110,7 +110,7 @@ public: */ static status_t getMinFrameCount(int* frameCount, - int streamType =-1, + audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT, uint32_t sampleRate = 0); /* Constructs an uninitialized AudioTrack. No connection with @@ -142,7 +142,7 @@ public: * sessionId: Specific session ID, or zero to use default. */ - AudioTrack( int streamType, + AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, int channelMask = 0, @@ -162,7 +162,7 @@ public: * EVENT_UNDERRUN event. */ - AudioTrack( int streamType, + AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, int channelMask = 0, @@ -186,7 +186,7 @@ public: * - BAD_VALUE: invalid parameter (channels, format, sampleRate...) * - NO_INIT: audio server or audio hardware not initialized * */ - status_t set(int streamType =-1, + status_t set(audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, int channelMask = 0, @@ -215,7 +215,7 @@ public: /* getters, see constructor */ - int streamType() const; + audio_stream_type_t streamType() const; audio_format_t format() const; int channelCount() const; uint32_t frameCount() const; @@ -433,7 +433,7 @@ private: }; bool processAudioBuffer(const sp& thread); - status_t createTrack_l(int streamType, + status_t createTrack_l(audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, uint32_t channelMask, @@ -458,7 +458,7 @@ private: audio_track_cblk_t* mCblk; audio_format_t mFormat; - uint8_t mStreamType; + audio_stream_type_t mStreamType; uint8_t mChannelCount; uint8_t mMuted; uint8_t mReserved; diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 9e3cb7f..15d3ca9 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -46,7 +46,7 @@ public: */ virtual sp createTrack( pid_t pid, - int streamType, + audio_stream_type_t streamType, uint32_t sampleRate, uint32_t format, uint32_t channelMask, @@ -89,11 +89,11 @@ public: /* set/get stream type state. This will probably be used by * the preference panel, mostly. */ - virtual status_t setStreamVolume(int stream, float value, int output) = 0; - virtual status_t setStreamMute(int stream, bool muted) = 0; + virtual status_t setStreamVolume(audio_stream_type_t stream, float value, int output) = 0; + virtual status_t setStreamMute(audio_stream_type_t stream, bool muted) = 0; - virtual float streamVolume(int stream, int output) const = 0; - virtual bool streamMute(int stream) const = 0; + virtual float streamVolume(audio_stream_type_t stream, int output) const = 0; + virtual bool streamMute(audio_stream_type_t stream) const = 0; // set audio mode virtual status_t setMode(int mode) = 0; @@ -129,7 +129,7 @@ public: uint32_t acoustics) = 0; virtual status_t closeInput(int input) = 0; - virtual status_t setStreamOutput(uint32_t stream, int output) = 0; + virtual status_t setStreamOutput(audio_stream_type_t stream, int output) = 0; virtual status_t setVoiceVolume(float volume) = 0; diff --git a/include/media/IAudioPolicyService.h b/include/media/IAudioPolicyService.h index 9807cbe..1ac0bbf 100644 --- a/include/media/IAudioPolicyService.h +++ b/include/media/IAudioPolicyService.h @@ -85,7 +85,7 @@ public: int id) = 0; virtual status_t unregisterEffect(int id) = 0; virtual status_t setEffectEnabled(int id, bool enabled) = 0; - virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const = 0; + virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const = 0; virtual status_t queryDefaultPreProcessing(int audioSession, effect_descriptor_t *descriptors, uint32_t *count) = 0; diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index e905903..6425886 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace android { @@ -51,7 +52,7 @@ public: virtual status_t getCurrentPosition(int* msec) = 0; virtual status_t getDuration(int* msec) = 0; virtual status_t reset() = 0; - virtual status_t setAudioStreamType(int type) = 0; + virtual status_t setAudioStreamType(audio_stream_type_t type) = 0; virtual status_t setLooping(int loop) = 0; virtual status_t setVolume(float leftVolume, float rightVolume) = 0; virtual status_t setAuxEffectSendLevel(float level) = 0; diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index 1f6bdda..7beb176 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -199,7 +199,7 @@ public: virtual ~MediaPlayerHWInterface() {} virtual bool hardwareOutput() { return true; } virtual status_t setVolume(float leftVolume, float rightVolume) = 0; - virtual status_t setAudioStreamType(int streamType) = 0; + virtual status_t setAudioStreamType(audio_stream_type_t streamType) = 0; }; }; // namespace android diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h index 1ad1f26..7d890bd 100644 --- a/include/media/ToneGenerator.h +++ b/include/media/ToneGenerator.h @@ -151,7 +151,7 @@ public: NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1 }; - ToneGenerator(int streamType, float volume, bool threadCanCallJava = false); + ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false); ~ToneGenerator(); bool startTone(int toneType, int durationMs = -1); @@ -266,7 +266,7 @@ private: Mutex mCbkCondLock; // Mutex associated to mWaitCbkCond Condition mWaitCbkCond; // condition enabling interface to wait for audio callback completion after a change is requested float mVolume; // Volume applied to audio track - int mStreamType; // Audio stream used for output + audio_stream_type_t mStreamType; // Audio stream used for output unsigned int mProcessSize; // Size of audio blocks generated at a time by audioCallback() (in PCM frames). bool initAudioTrack(); diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 2dc055e..00b7dd5 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -185,7 +185,7 @@ public: status_t getCurrentPosition(int *msec); status_t getDuration(int *msec); status_t reset(); - status_t setAudioStreamType(int type); + status_t setAudioStreamType(audio_stream_type_t type); status_t setLooping(int loop); bool isLooping(); status_t setVolume(float leftVolume, float rightVolume); @@ -223,7 +223,7 @@ private: int mSeekPosition; bool mPrepareSync; status_t mPrepareStatus; - int mStreamType; + audio_stream_type_t mStreamType; bool mLoop; float mLeftVolume; float mRightVolume; -- cgit v1.1