RecordTracks.h revision b220884bf3129253cc5bc8d030bc475411ea4911
181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent/* 281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** 381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** Copyright 2012, The Android Open Source Project 481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** 581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** Licensed under the Apache License, Version 2.0 (the "License"); 681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** you may not use this file except in compliance with the License. 781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** You may obtain a copy of the License at 881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** 981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** http://www.apache.org/licenses/LICENSE-2.0 1081784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** 1181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** Unless required by applicable law or agreed to in writing, software 1281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** distributed under the License is distributed on an "AS IS" BASIS, 1381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** See the License for the specific language governing permissions and 1581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent** limitations under the License. 1681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent*/ 1781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 1881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#ifndef INCLUDING_FROM_AUDIOFLINGER_H 1981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent #error This header file should only be included from AudioFlinger.h 2081784c37c61b09289654b979567a42bf73cd2b12Eric Laurent#endif 2181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 2281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent// record track 2381784c37c61b09289654b979567a42bf73cd2b12Eric Laurentclass RecordTrack : public TrackBase { 2481784c37c61b09289654b979567a42bf73cd2b12Eric Laurentpublic: 2581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent RecordTrack(RecordThread *thread, 2681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent const sp<Client>& client, 2781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent uint32_t sampleRate, 2881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent audio_format_t format, 2981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent audio_channel_mask_t channelMask, 3081784c37c61b09289654b979567a42bf73cd2b12Eric Laurent size_t frameCount, 31462fd2fa9eef642b0574aa7409de0bde3fec8d43Marco Nelissen int sessionId, 32462fd2fa9eef642b0574aa7409de0bde3fec8d43Marco Nelissen int uid); 3381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent virtual ~RecordTrack(); 3481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 3581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent virtual status_t start(AudioSystem::sync_event_t event, int triggerSession); 3681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent virtual void stop(); 3781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 3881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent void destroy(); 3981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 409a54bc27876acd5d8be5b1fc3dc46701fe76fbb3Eric Laurent void invalidate(); 4181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent // clear the buffer overflow flag 4281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent void clearOverflow() { mOverflow = false; } 4381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent // set the buffer overflow flag and return previous value 4481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent bool setOverflow() { bool tmp = mOverflow; mOverflow = true; 4581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent return tmp; } 4681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 4781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent static void appendDumpHeader(String8& result); 48b220884bf3129253cc5bc8d030bc475411ea4911Marco Nelissen void dump(char* buffer, size_t size, bool active); 4981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 5081784c37c61b09289654b979567a42bf73cd2b12Eric Laurentprivate: 5181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent friend class AudioFlinger; // for mState 5281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 5381784c37c61b09289654b979567a42bf73cd2b12Eric Laurent RecordTrack(const RecordTrack&); 5481784c37c61b09289654b979567a42bf73cd2b12Eric Laurent RecordTrack& operator = (const RecordTrack&); 5581784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 5681784c37c61b09289654b979567a42bf73cd2b12Eric Laurent // AudioBufferProvider interface 5781784c37c61b09289654b979567a42bf73cd2b12Eric Laurent virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer, 5881784c37c61b09289654b979567a42bf73cd2b12Eric Laurent int64_t pts = kInvalidPTS); 5981784c37c61b09289654b979567a42bf73cd2b12Eric Laurent // releaseBuffer() not overridden 6081784c37c61b09289654b979567a42bf73cd2b12Eric Laurent 6181784c37c61b09289654b979567a42bf73cd2b12Eric Laurent bool mOverflow; // overflow on most recent attempt to fill client buffer 6281784c37c61b09289654b979567a42bf73cd2b12Eric Laurent}; 63