Eric Laurent | 6acd1d4 | 2017-01-04 14:23:29 -0800 | [diff] [blame^] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2017, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef INCLUDING_FROM_AUDIOFLINGER_H |
| 19 | #error This header file should only be included from AudioFlinger.h |
| 20 | #endif |
| 21 | |
| 22 | // playback track |
| 23 | class MmapTrack : public TrackBase { |
| 24 | public: |
| 25 | MmapTrack(ThreadBase *thread, |
| 26 | uint32_t sampleRate, |
| 27 | audio_format_t format, |
| 28 | audio_channel_mask_t channelMask, |
| 29 | audio_session_t sessionId, |
| 30 | uid_t uid, |
| 31 | audio_port_handle_t portId = AUDIO_PORT_HANDLE_NONE); |
| 32 | virtual ~MmapTrack(); |
| 33 | |
| 34 | // TrackBase virtual |
| 35 | virtual status_t initCheck() const; |
| 36 | virtual status_t start(AudioSystem::sync_event_t event, |
| 37 | audio_session_t triggerSession); |
| 38 | virtual void stop(); |
| 39 | virtual bool isFastTrack() const { return false; } |
| 40 | |
| 41 | static void appendDumpHeader(String8& result); |
| 42 | void dump(char* buffer, size_t size); |
| 43 | |
| 44 | protected: |
| 45 | friend class MmapThread; |
| 46 | |
| 47 | MmapTrack(const MmapTrack&); |
| 48 | MmapTrack& operator = (const MmapTrack&); |
| 49 | |
| 50 | // AudioBufferProvider interface |
| 51 | virtual status_t getNextBuffer(AudioBufferProvider::Buffer* buffer); |
| 52 | // releaseBuffer() not overridden |
| 53 | |
| 54 | // ExtendedAudioBufferProvider interface |
| 55 | virtual size_t framesReady() const; |
| 56 | virtual int64_t framesReleased() const; |
| 57 | virtual void onTimestamp(const ExtendedTimestamp ×tamp); |
| 58 | |
| 59 | }; // end of Track |
| 60 | |