From e53b9ead781c36e96d6b6f012ddffc93a3d80f0d Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Mon, 12 Mar 2012 16:29:55 -0700 Subject: Whitespace and indentation Fix indentation to be multiple of 4. Make it easier to search: sp< not sp < to "switch (...)" instead of "switch(...)" (also "if" and "while") Remove redundant blank line at start or EOF. Remove whitespace at end of line. Remove extra blank lines where they don't add value. Use git diff -b or -w to verify. Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e --- media/libmedia/AudioEffect.cpp | 3 +- media/libmedia/AudioRecord.cpp | 17 +++++------ media/libmedia/AudioSystem.cpp | 9 +++--- media/libmedia/AudioTrack.cpp | 26 ++++++++-------- media/libmedia/IAudioFlinger.cpp | 18 +++++------ media/libmedia/IAudioFlingerClient.cpp | 2 +- media/libmedia/IAudioPolicyService.cpp | 2 +- media/libmedia/IAudioRecord.cpp | 29 +++++++++--------- media/libmedia/IAudioTrack.cpp | 30 +++++++++--------- media/libmedia/IEffect.cpp | 11 +++---- media/libmedia/IEffectClient.cpp | 3 +- media/libmedia/IMediaDeathNotifier.cpp | 8 ++--- media/libmedia/IMediaPlayer.cpp | 2 +- media/libmedia/IMediaPlayerClient.cpp | 2 +- media/libmedia/IMediaPlayerService.cpp | 2 +- media/libmedia/IMediaRecorder.cpp | 2 +- media/libmedia/IMediaRecorderClient.cpp | 2 +- media/libmedia/JetPlayer.cpp | 51 +++++++++++++++---------------- media/libmedia/MediaProfiles.cpp | 4 +-- media/libmedia/MediaScanner.cpp | 6 ++-- media/libmedia/MediaScannerClient.cpp | 1 - media/libmedia/Metadata.cpp | 2 +- media/libmedia/ToneGenerator.cpp | 11 +++---- media/libmedia/Visualizer.cpp | 3 +- media/libmedia/mediametadataretriever.cpp | 2 +- media/libmedia/mediaplayer.cpp | 14 ++++----- media/libmedia/mediarecorder.cpp | 34 ++++++++++----------- 27 files changed, 143 insertions(+), 153 deletions(-) (limited to 'media') diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 6808aa2..34451ca 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -174,7 +174,7 @@ AudioEffect::~AudioEffect() mIEffect->disconnect(); mIEffect->asBinder()->unlinkToDeath(mIEffectClient); } - IPCThreadState::self()->flushCommands(); + IPCThreadState::self()->flushCommands(); } mIEffect.clear(); mIEffectClient.clear(); @@ -480,4 +480,3 @@ status_t AudioEffect::guidToString(const effect_uuid_t *guid, char *str, size_t }; // namespace android - diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 22c3a18..05ade75 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -293,13 +293,13 @@ status_t AudioRecord::start() return WOULD_BLOCK; } } - } + } AutoMutex lock(mLock); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk - sp audioRecord = mAudioRecord; - sp iMem = mCblkMemory; + sp audioRecord = mAudioRecord; + sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; if (mActive == 0) { mActive = 1; @@ -638,8 +638,8 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) mLock.lock(); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk - sp audioRecord = mAudioRecord; - sp iMem = mCblkMemory; + sp audioRecord = mAudioRecord; + sp iMem = mCblkMemory; mLock.unlock(); do { @@ -684,8 +684,8 @@ bool AudioRecord::processAudioBuffer(const sp& thread) mLock.lock(); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk - sp audioRecord = mAudioRecord; - sp iMem = mCblkMemory; + sp audioRecord = mAudioRecord; + sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; mLock.unlock(); @@ -806,7 +806,7 @@ status_t AudioRecord::restoreRecord_l(audio_track_cblk_t*& cblk) } } ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x", - result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); + result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); if (result == NO_ERROR) { // from now on we switch to the newly created cblk @@ -843,4 +843,3 @@ status_t AudioRecord::ClientRecordThread::readyToRun() // ------------------------------------------------------------------------- }; // namespace android - diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index a1cbf0f..33c7d03 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -59,14 +59,14 @@ const sp& AudioSystem::get_audio_flinger() break; ALOGW("AudioFlinger not published, waiting..."); usleep(500000); // 0.5 s - } while(true); + } while (true); if (gAudioFlingerClient == NULL) { gAudioFlingerClient = new AudioFlingerClient(); } else { if (gAudioErrorCallback) { gAudioErrorCallback(NO_ERROR); } - } + } binder->linkToDeath(gAudioFlingerClient); gAudioFlinger = interface_cast(binder); gAudioFlinger->registerClient(gAudioFlingerClient); @@ -482,7 +482,7 @@ void AudioSystem::setErrorCallback(audio_error_callback cb) { } bool AudioSystem::routedToA2dpOutput(audio_stream_type_t streamType) { - switch(streamType) { + switch (streamType) { case AUDIO_STREAM_MUSIC: case AUDIO_STREAM_VOICE_CALL: case AUDIO_STREAM_BLUETOOTH_SCO: @@ -512,7 +512,7 @@ const sp& AudioSystem::get_audio_policy_service() break; ALOGW("AudioPolicyService not published, waiting..."); usleep(500000); // 0.5 s - } while(true); + } while (true); if (gAudioPolicyServiceClient == NULL) { gAudioPolicyServiceClient = new AudioPolicyServiceClient(); } @@ -768,4 +768,3 @@ void AudioSystem::AudioPolicyServiceClient::binderDied(const wp& who) { } }; // namespace android - diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 34563ca..048be1d 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -72,7 +72,7 @@ status_t AudioTrack::getMinFrameCount( if (minBufCount < 2) minBufCount = 2; *frameCount = (sampleRate == 0) ? afFrameCount * minBufCount : - afFrameCount * minBufCount * sampleRate / afSampleRate; + afFrameCount * minBufCount * sampleRate / afSampleRate; return NO_ERROR; } @@ -352,13 +352,13 @@ void AudioTrack::start() return; } } - } + } AutoMutex lock(mLock); // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk - sp audioTrack = mAudioTrack; - sp iMem = mCblkMemory; + sp audioTrack = mAudioTrack; + sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; if (!mActive) { @@ -743,8 +743,8 @@ status_t AudioTrack::createTrack_l( status_t status; const sp& audioFlinger = AudioSystem::get_audio_flinger(); if (audioFlinger == 0) { - ALOGE("Could not get audioflinger"); - return NO_INIT; + ALOGE("Could not get audioflinger"); + return NO_INIT; } int afSampleRate; @@ -830,7 +830,7 @@ status_t AudioTrack::createTrack_l( mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); } else { mCblk->buffers = sharedBuffer->pointer(); - // Force buffer full condition as data is already present in shared memory + // Force buffer full condition as data is already present in shared memory mCblk->stepUser(mCblk->frameCount); } @@ -991,8 +991,8 @@ ssize_t AudioTrack::write(const void* buffer, size_t userSize) // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk mLock.lock(); - sp audioTrack = mAudioTrack; - sp iMem = mCblkMemory; + sp audioTrack = mAudioTrack; + sp iMem = mCblkMemory; mLock.unlock(); ssize_t written = 0; @@ -1095,8 +1095,8 @@ bool AudioTrack::processAudioBuffer(const sp& thread) mLock.lock(); // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk - sp audioTrack = mAudioTrack; - sp iMem = mCblkMemory; + sp audioTrack = mAudioTrack; + sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; bool active = mActive; mLock.unlock(); @@ -1224,7 +1224,7 @@ status_t AudioTrack::restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart) if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) { ALOGW("dead IAudioTrack, creating a new one from %s TID %d", - fromStart ? "start()" : "obtainBuffer()", gettid()); + fromStart ? "start()" : "obtainBuffer()", gettid()); // signal old cblk condition so that other threads waiting for available buffers stop // waiting now @@ -1310,7 +1310,7 @@ status_t AudioTrack::restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart) } } ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x", - result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); + result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); if (result == NO_ERROR) { // from now on we switch to the newly created cblk diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 47c261d..07b12e4 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -622,11 +622,11 @@ public: sp effect; if (pDesc == NULL) { - return effect; - if (status) { - *status = BAD_VALUE; - } - } + return effect; + if (status) { + *status = BAD_VALUE; + } + } data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); @@ -679,7 +679,7 @@ IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); status_t BnAudioFlinger::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case CREATE_TRACK: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); @@ -745,7 +745,7 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; - case SET_MASTER_VOLUME: { + case SET_MASTER_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( setMasterVolume(data.readFloat()) ); return NO_ERROR; @@ -815,14 +815,14 @@ status_t BnAudioFlinger::onTransact( String8 keyValuePairs(data.readString8()); reply->writeInt32(setParameters(ioHandle, keyValuePairs)); return NO_ERROR; - } break; + } break; case GET_PARAMETERS: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); String8 keys(data.readString8()); reply->writeString8(getParameters(ioHandle, keys)); return NO_ERROR; - } break; + } break; case REGISTER_CLIENT: { CHECK_INTERFACE(IAudioFlinger, data, reply); diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp index 1db39a3..4178b29 100644 --- a/media/libmedia/IAudioFlingerClient.cpp +++ b/media/libmedia/IAudioFlingerClient.cpp @@ -68,7 +68,7 @@ IMPLEMENT_META_INTERFACE(AudioFlingerClient, "android.media.IAudioFlingerClient" status_t BnAudioFlingerClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case IO_CONFIG_CHANGED: { CHECK_INTERFACE(IAudioFlingerClient, data, reply); int event = data.readInt32(); diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp index da7c124..5040bd9 100644 --- a/media/libmedia/IAudioPolicyService.cpp +++ b/media/libmedia/IAudioPolicyService.cpp @@ -365,7 +365,7 @@ IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService" status_t BnAudioPolicyService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case SET_DEVICE_CONNECTION_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_devices_t device = diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp index 6b473c9..377b9a8 100644 --- a/media/libmedia/IAudioRecord.cpp +++ b/media/libmedia/IAudioRecord.cpp @@ -2,16 +2,16 @@ ** ** Copyright 2007, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -41,7 +41,7 @@ public: : BpInterface(impl) { } - + virtual status_t start(pid_t tid) { Parcel data, reply; @@ -55,14 +55,14 @@ public: } return status; } - + virtual void stop() { Parcel data, reply; data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); } - + virtual sp getCblk() const { Parcel data, reply; @@ -73,7 +73,7 @@ public: cblk = interface_cast(reply.readStrongBinder()); } return cblk; - } + } }; IMPLEMENT_META_INTERFACE(AudioRecord, "android.media.IAudioRecord"); @@ -83,8 +83,8 @@ IMPLEMENT_META_INTERFACE(AudioRecord, "android.media.IAudioRecord"); status_t BnAudioRecord::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { - case GET_CBLK: { + switch (code) { + case GET_CBLK: { CHECK_INTERFACE(IAudioRecord, data, reply); reply->writeStrongBinder(getCblk()->asBinder()); return NO_ERROR; @@ -105,4 +105,3 @@ status_t BnAudioRecord::onTransact( } }; // namespace android - diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp index 28ebbbf..09f31a7 100644 --- a/media/libmedia/IAudioTrack.cpp +++ b/media/libmedia/IAudioTrack.cpp @@ -2,16 +2,16 @@ ** ** Copyright 2007, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -48,7 +48,7 @@ public: : BpInterface(impl) { } - + virtual sp getCblk() const { Parcel data, reply; @@ -74,14 +74,14 @@ public: } return status; } - + virtual void stop() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); } - + virtual void flush() { Parcel data, reply; @@ -96,14 +96,14 @@ public: data.writeInt32(e); remote()->transact(MUTE, data, &reply); } - + virtual void pause() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); remote()->transact(PAUSE, data, &reply); } - + virtual status_t attachAuxEffect(int effectId) { Parcel data, reply; @@ -172,8 +172,8 @@ IMPLEMENT_META_INTERFACE(AudioTrack, "android.media.IAudioTrack"); status_t BnAudioTrack::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { - case GET_CBLK: { + switch (code) { + case GET_CBLK: { CHECK_INTERFACE(IAudioTrack, data, reply); reply->writeStrongBinder(getCblk()->asBinder()); return NO_ERROR; diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp index 5d40cc8..a303a8f 100644 --- a/media/libmedia/IEffect.cpp +++ b/media/libmedia/IEffect.cpp @@ -129,7 +129,7 @@ IMPLEMENT_META_INTERFACE(Effect, "android.media.IEffect"); status_t BnEffect::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case ENABLE: { ALOGV("ENABLE"); CHECK_INTERFACE(IEffect, data, reply); @@ -186,10 +186,10 @@ status_t BnEffect::onTransact( } break; case GET_CBLK: { - CHECK_INTERFACE(IEffect, data, reply); - reply->writeStrongBinder(getCblk()->asBinder()); - return NO_ERROR; - } break; + CHECK_INTERFACE(IEffect, data, reply); + reply->writeStrongBinder(getCblk()->asBinder()); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); @@ -199,4 +199,3 @@ status_t BnEffect::onTransact( // ---------------------------------------------------------------------------- }; // namespace android - diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp index 4693b45..aef4371 100644 --- a/media/libmedia/IEffectClient.cpp +++ b/media/libmedia/IEffectClient.cpp @@ -94,7 +94,7 @@ IMPLEMENT_META_INTERFACE(EffectClient, "android.media.IEffectClient"); status_t BnEffectClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case CONTROL_STATUS_CHANGED: { ALOGV("CONTROL_STATUS_CHANGED"); CHECK_INTERFACE(IEffectClient, data, reply); @@ -142,4 +142,3 @@ status_t BnEffectClient::onTransact( // ---------------------------------------------------------------------------- }; // namespace android - diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp index aeb35a5..9199db6 100644 --- a/media/libmedia/IMediaDeathNotifier.cpp +++ b/media/libmedia/IMediaDeathNotifier.cpp @@ -43,10 +43,10 @@ IMediaDeathNotifier::getMediaPlayerService() binder = sm->getService(String16("media.player")); if (binder != 0) { break; - } - ALOGW("Media player service not published, waiting..."); - usleep(500000); // 0.5 s - } while(true); + } + ALOGW("Media player service not published, waiting..."); + usleep(500000); // 0.5 s + } while (true); if (sDeathNotifier == NULL) { sDeathNotifier = new DeathNotifier(); diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp index c47fa41..f586b02 100644 --- a/media/libmedia/IMediaPlayer.cpp +++ b/media/libmedia/IMediaPlayer.cpp @@ -319,7 +319,7 @@ IMPLEMENT_META_INTERFACE(MediaPlayer, "android.media.IMediaPlayer"); status_t BnMediaPlayer::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case DISCONNECT: { CHECK_INTERFACE(IMediaPlayer, data, reply); disconnect(); diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp index 1f135c4..a670c96 100644 --- a/media/libmedia/IMediaPlayerClient.cpp +++ b/media/libmedia/IMediaPlayerClient.cpp @@ -56,7 +56,7 @@ IMPLEMENT_META_INTERFACE(MediaPlayerClient, "android.media.IMediaPlayerClient"); status_t BnMediaPlayerClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case NOTIFY: { CHECK_INTERFACE(IMediaPlayerClient, data, reply); int msg = data.readInt32(); diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp index f5b5cbd..f5fccef 100644 --- a/media/libmedia/IMediaPlayerService.cpp +++ b/media/libmedia/IMediaPlayerService.cpp @@ -132,7 +132,7 @@ IMPLEMENT_META_INTERFACE(MediaPlayerService, "android.media.IMediaPlayerService" status_t BnMediaPlayerService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case CREATE: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp index 2f4e31a..a710fd7 100644 --- a/media/libmedia/IMediaRecorder.cpp +++ b/media/libmedia/IMediaRecorder.cpp @@ -289,7 +289,7 @@ IMPLEMENT_META_INTERFACE(MediaRecorder, "android.media.IMediaRecorder"); status_t BnMediaRecorder::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case RELEASE: { ALOGV("RELEASE"); CHECK_INTERFACE(IMediaRecorder, data, reply); diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp index ff235c9..e7907e3 100644 --- a/media/libmedia/IMediaRecorderClient.cpp +++ b/media/libmedia/IMediaRecorderClient.cpp @@ -53,7 +53,7 @@ IMPLEMENT_META_INTERFACE(MediaRecorderClient, "android.media.IMediaRecorderClien status_t BnMediaRecorderClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { + switch (code) { case NOTIFY: { CHECK_INTERFACE(IMediaRecorderClient, data, reply); int msg = data.readInt32(); diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp index a85956c..312a493 100644 --- a/media/libmedia/JetPlayer.cpp +++ b/media/libmedia/JetPlayer.cpp @@ -74,14 +74,14 @@ int JetPlayer::init() // init the EAS library result = EAS_Init(&mEasData); - if( result != EAS_SUCCESS) { + if (result != EAS_SUCCESS) { ALOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting."); mState = EAS_STATE_ERROR; return result; } // init the JET library with the default app event controller range result = JET_Init(mEasData, NULL, sizeof(S_JET_CONFIG)); - if( result != EAS_SUCCESS) { + if (result != EAS_SUCCESS) { ALOGE("JetPlayer::init(): Error initializing JET library, aborting."); mState = EAS_STATE_ERROR; return result; @@ -151,7 +151,7 @@ int JetPlayer::release() mAudioBuffer = NULL; } mEasData = NULL; - + return EAS_SUCCESS; } @@ -166,7 +166,7 @@ int JetPlayer::render() { ALOGV("JetPlayer::render(): entering"); // allocate render buffer - mAudioBuffer = + mAudioBuffer = new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS]; // signal main thread that we started @@ -177,8 +177,8 @@ int JetPlayer::render() { mCondition.signal(); } - while (1) { - + while (1) { + mMutex.lock(); // [[[[[[[[ LOCK --------------------------------------- if (mEasData == NULL) { @@ -186,20 +186,20 @@ int JetPlayer::render() { ALOGV("JetPlayer::render(): NULL EAS data, exiting render."); goto threadExit; } - + // nothing to render, wait for client thread to wake us up while (!mRender) { ALOGV("JetPlayer::render(): signal wait"); - if (audioStarted) { - mAudioTrack->pause(); + if (audioStarted) { + mAudioTrack->pause(); // we have to restart the playback once we start rendering again audioStarted = false; } mCondition.wait(mMutex); ALOGV("JetPlayer::render(): signal rx'd"); } - + // render midi data into the input buffer int num_output = 0; EAS_PCM* p = mAudioBuffer; @@ -210,8 +210,8 @@ int JetPlayer::render() { } p += count * pLibConfig->numChannels; num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM); - - // send events that were generated (if any) to the event callback + + // send events that were generated (if any) to the event callback fireEventsFromJetQueue(); } @@ -265,9 +265,9 @@ threadExit: // precondition: mMutex locked void JetPlayer::fireUpdateOnStatusChange() { - if( (mJetStatus.currentUserID != mPreviousJetStatus.currentUserID) + if ( (mJetStatus.currentUserID != mPreviousJetStatus.currentUserID) ||(mJetStatus.segmentRepeatCount != mPreviousJetStatus.segmentRepeatCount) ) { - if(mEventCallback) { + if (mEventCallback) { mEventCallback( JetPlayer::JET_USERID_UPDATE, mJetStatus.currentUserID, @@ -278,8 +278,8 @@ void JetPlayer::fireUpdateOnStatusChange() mPreviousJetStatus.segmentRepeatCount = mJetStatus.segmentRepeatCount; } - if(mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) { - if(mEventCallback) { + if (mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) { + if (mEventCallback) { mEventCallback( JetPlayer::JET_NUMQUEUEDSEGMENT_UPDATE, mJetStatus.numQueuedSegments, @@ -289,8 +289,8 @@ void JetPlayer::fireUpdateOnStatusChange() mPreviousJetStatus.numQueuedSegments = mJetStatus.numQueuedSegments; } - if(mJetStatus.paused != mPreviousJetStatus.paused) { - if(mEventCallback) { + if (mJetStatus.paused != mPreviousJetStatus.paused) { + if (mEventCallback) { mEventCallback(JetPlayer::JET_PAUSE_UPDATE, mJetStatus.paused, -1, @@ -307,7 +307,7 @@ void JetPlayer::fireUpdateOnStatusChange() // precondition: mMutex locked void JetPlayer::fireEventsFromJetQueue() { - if(!mEventCallback) { + if (!mEventCallback) { // no callback, just empty the event queue while (JET_GetEvent(mEasData, NULL, NULL)) { } return; @@ -341,7 +341,7 @@ int JetPlayer::loadFromFile(const char* path) mEasJetFileLoc->offset = 0; EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc); - if(result != EAS_SUCCESS) + if (result != EAS_SUCCESS) mState = EAS_STATE_ERROR; else mState = EAS_STATE_OPEN; @@ -353,7 +353,7 @@ int JetPlayer::loadFromFile(const char* path) int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length) { ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length); - + Mutex::Autolock lock(mMutex); mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE)); @@ -361,9 +361,9 @@ int JetPlayer::loadFromFD(const int fd, const long long offset, const long long mEasJetFileLoc->offset = offset; mEasJetFileLoc->length = length; mEasJetFileLoc->path = NULL; - + EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc); - if(result != EAS_SUCCESS) + if (result != EAS_SUCCESS) mState = EAS_STATE_ERROR; else mState = EAS_STATE_OPEN; @@ -392,7 +392,7 @@ int JetPlayer::play() JET_Status(mEasData, &mJetStatus); this->dumpJetStatus(&mJetStatus); - + fireUpdateOnStatusChange(); // wake up render thread @@ -468,7 +468,7 @@ void JetPlayer::dump() void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus) { - if(pJetStatus!=NULL) + if (pJetStatus!=NULL) ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d", pJetStatus->currentUserID, pJetStatus->segmentRepeatCount, pJetStatus->numQueuedSegments, pJetStatus->paused); @@ -478,4 +478,3 @@ void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus) } // end namespace android - diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index 93ddca8..a7536b3 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -1099,12 +1099,12 @@ int MediaProfiles::getCamcorderProfileParamByName(const char *name, camcorder_quality quality) const { ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d", - name, cameraId, quality); + name, cameraId, quality); int index = getCamcorderProfileIndex(cameraId, quality); if (index == -1) { ALOGE("The given camcorder profile camera %d quality %d is not found", - cameraId, quality); + cameraId, quality); return -1; } diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp index 73d4519..28b5aa7 100644 --- a/media/libmedia/MediaScanner.cpp +++ b/media/libmedia/MediaScanner.cpp @@ -54,7 +54,7 @@ const char *MediaScanner::locale() const { void MediaScanner::loadSkipList() { mSkipList = (char *)malloc(PROPERTY_VALUE_MAX * sizeof(char)); if (mSkipList) { - property_get("testing.mediascanner.skiplist", mSkipList, ""); + property_get("testing.mediascanner.skiplist", mSkipList, ""); } if (!mSkipList || (strlen(mSkipList) == 0)) { free(mSkipList); @@ -135,8 +135,8 @@ MediaScanResult MediaScanner::doProcessDirectory( struct dirent* entry; if (shouldSkipDirectory(path)) { - ALOGD("Skipping: %s", path); - return MEDIA_SCAN_RESULT_OK; + ALOGD("Skipping: %s", path); + return MEDIA_SCAN_RESULT_OK; } // Treat all files as non-media in directories that contain a ".nomedia" file diff --git a/media/libmedia/MediaScannerClient.cpp b/media/libmedia/MediaScannerClient.cpp index cdfd477..e1e3348 100644 --- a/media/libmedia/MediaScannerClient.cpp +++ b/media/libmedia/MediaScannerClient.cpp @@ -228,4 +228,3 @@ void MediaScannerClient::endFile() } } // namespace android - diff --git a/media/libmedia/Metadata.cpp b/media/libmedia/Metadata.cpp index 546a9b0..ef8a9ed 100644 --- a/media/libmedia/Metadata.cpp +++ b/media/libmedia/Metadata.cpp @@ -57,7 +57,7 @@ namespace media { Metadata::Metadata(Parcel *p) :mData(p), - mBegin(p->dataPosition()) { } + mBegin(p->dataPosition()) { } Metadata::~Metadata() { } diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 9c3170c..717d316 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -268,8 +268,8 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI { segments: { { duration: 0, waveFreq: { 0 }, 0, 0} }, - repeatCnt: 0, - repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 + repeatCnt: 0, + repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 { segments: { { duration: 32, waveFreq: { 2091, 0 }, 0, 0 }, { duration: 64, waveFreq: { 2556, 0 }, 4, 0 }, { duration: 20, waveFreq: { 2091, 0 }, 0, 0 }, @@ -1015,7 +1015,7 @@ bool ToneGenerator::initAudioTrack() { mpAudioTrack = NULL; } - // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size + // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size mpAudioTrack = new AudioTrack(); ALOGV("Create Track: %p", mpAudioTrack); @@ -1284,9 +1284,9 @@ audioCallback_EndLoop: ALOGV("Cbk starting track"); lpToneGen->mState = TONE_PLAYING; lSignal = true; - break; + break; case TONE_PLAYING: - break; + break; default: // Force loop exit lNumSmp = 0; @@ -1578,4 +1578,3 @@ void ToneGenerator::WaveGenerator::getSamples(short *outBuffer, } } // end namespace android - diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp index 70f8c0c..bcd6ae4 100644 --- a/media/libmedia/Visualizer.cpp +++ b/media/libmedia/Visualizer.cpp @@ -66,7 +66,7 @@ status_t Visualizer::setEnabled(bool enabled) } } t->mLock.lock(); - } + } status_t status = AudioEffect::setEnabled(enabled); @@ -320,4 +320,3 @@ void Visualizer::CaptureThread::onFirstRef() } }; // namespace android - diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp index 8d53357..b0241aa 100644 --- a/media/libmedia/mediametadataretriever.cpp +++ b/media/libmedia/mediametadataretriever.cpp @@ -45,7 +45,7 @@ const sp& MediaMetadataRetriever::getService() } ALOGW("MediaPlayerService not published, waiting..."); usleep(500000); // 0.5 s - } while(true); + } while (true); if (sDeathNotifier == NULL) { sDeathNotifier = new DeathNotifier(); } diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index 4ff1862..7ea9490 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -195,8 +195,8 @@ status_t MediaPlayer::invoke(const Parcel& request, Parcel *reply) (mCurrentState != MEDIA_PLAYER_STATE_ERROR) && ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE); if ((mPlayer != NULL) && hasBeenInitialized) { - ALOGV("invoke %d", request.dataSize()); - return mPlayer->invoke(request, reply); + ALOGV("invoke %d", request.dataSize()); + return mPlayer->invoke(request, reply); } ALOGE("invoke failed: wrong state %X", mCurrentState); return INVALID_OPERATION; @@ -556,9 +556,9 @@ status_t MediaPlayer::setAudioSessionId(int sessionId) return BAD_VALUE; } if (sessionId != mAudioSessionId) { - AudioSystem::releaseAudioSessionId(mAudioSessionId); - AudioSystem::acquireAudioSessionId(sessionId); - mAudioSessionId = sessionId; + AudioSystem::releaseAudioSessionId(mAudioSessionId); + AudioSystem::acquireAudioSessionId(sessionId); + mAudioSessionId = sessionId; } return NO_ERROR; } @@ -610,7 +610,7 @@ status_t MediaPlayer::getParameter(int key, Parcel *reply) ALOGV("MediaPlayer::getParameter(%d)", key); Mutex::Autolock _l(mLock); if (mPlayer != NULL) { - return mPlayer->getParameter(key, reply); + return mPlayer->getParameter(key, reply); } ALOGV("getParameter: no active player"); return INVALID_OPERATION; @@ -658,7 +658,7 @@ void MediaPlayer::notify(int msg, int ext1, int ext2, const Parcel *obj) // and seekTo within the same process. // FIXME: Remember, this is a hack, it's not even a hack that is applied // consistently for all use-cases, this needs to be revisited. - if (mLockThreadId != getThreadId()) { + if (mLockThreadId != getThreadId()) { mLock.lock(); locked = true; } diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp index cc73014..9541015 100644 --- a/media/libmedia/mediarecorder.cpp +++ b/media/libmedia/mediarecorder.cpp @@ -31,7 +31,7 @@ namespace android { status_t MediaRecorder::setCamera(const sp& camera, const sp& proxy) { ALOGV("setCamera(%p,%p)", camera.get(), proxy.get()); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -52,7 +52,7 @@ status_t MediaRecorder::setCamera(const sp& camera, const sp& surface) { ALOGV("setPreviewSurface(%p)", surface.get()); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -77,7 +77,7 @@ status_t MediaRecorder::setPreviewSurface(const sp& surface) status_t MediaRecorder::init() { ALOGV("init"); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -107,7 +107,7 @@ status_t MediaRecorder::init() status_t MediaRecorder::setVideoSource(int vs) { ALOGV("setVideoSource(%d)", vs); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -142,7 +142,7 @@ status_t MediaRecorder::setVideoSource(int vs) status_t MediaRecorder::setAudioSource(int as) { ALOGV("setAudioSource(%d)", as); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -175,7 +175,7 @@ status_t MediaRecorder::setAudioSource(int as) status_t MediaRecorder::setOutputFormat(int of) { ALOGV("setOutputFormat(%d)", of); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -201,7 +201,7 @@ status_t MediaRecorder::setOutputFormat(int of) status_t MediaRecorder::setVideoEncoder(int ve) { ALOGV("setVideoEncoder(%d)", ve); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -231,7 +231,7 @@ status_t MediaRecorder::setVideoEncoder(int ve) status_t MediaRecorder::setAudioEncoder(int ae) { ALOGV("setAudioEncoder(%d)", ae); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -261,7 +261,7 @@ status_t MediaRecorder::setAudioEncoder(int ae) status_t MediaRecorder::setOutputFile(const char* path) { ALOGV("setOutputFile(%s)", path); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -287,7 +287,7 @@ status_t MediaRecorder::setOutputFile(const char* path) status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length) { ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -324,7 +324,7 @@ status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length) status_t MediaRecorder::setVideoSize(int width, int height) { ALOGV("setVideoSize(%d, %d)", width, height); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -367,7 +367,7 @@ sp MediaRecorder:: status_t MediaRecorder::setVideoFrameRate(int frames_per_second) { ALOGV("setVideoFrameRate(%d)", frames_per_second); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -391,7 +391,7 @@ status_t MediaRecorder::setVideoFrameRate(int frames_per_second) status_t MediaRecorder::setParameters(const String8& params) { ALOGV("setParameters(%s)", params.string()); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -419,7 +419,7 @@ status_t MediaRecorder::setParameters(const String8& params) { status_t MediaRecorder::prepare() { ALOGV("prepare"); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -458,7 +458,7 @@ status_t MediaRecorder::prepare() status_t MediaRecorder::getMaxAmplitude(int* max) { ALOGV("getMaxAmplitude"); - if(mMediaRecorder == NULL) { + if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } @@ -536,7 +536,7 @@ status_t MediaRecorder::reset() doCleanUp(); status_t ret = UNKNOWN_ERROR; - switch(mCurrentState) { + switch (mCurrentState) { case MEDIA_RECORDER_IDLE: ret = OK; break; @@ -547,7 +547,7 @@ status_t MediaRecorder::reset() case MEDIA_RECORDER_ERROR: { ret = doReset(); if (OK != ret) { - return ret; // No need to continue + return ret; // No need to continue } } // Intentional fall through case MEDIA_RECORDER_INITIALIZED: -- cgit v1.1