FastCaptureState.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2014 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef ANDROID_AUDIO_FAST_CAPTURE_STATE_H
  17. #define ANDROID_AUDIO_FAST_CAPTURE_STATE_H
  18. #include <media/nbaio/NBAIO.h>
  19. #include <media/AudioBufferProvider.h>
  20. #include "FastThreadState.h"
  21. #include <private/media/AudioTrackShared.h>
  22. namespace android {
  23. // Represent a single state of the fast capture
  24. struct FastCaptureState : FastThreadState {
  25. FastCaptureState();
  26. /*virtual*/ ~FastCaptureState();
  27. // all pointer fields use raw pointers; objects are owned and ref-counted by RecordThread
  28. NBAIO_Source* mInputSource; // HAL input device, must already be negotiated
  29. // FIXME by renaming, could pull up these fields to FastThreadState
  30. int mInputSourceGen; // increment when mInputSource is assigned
  31. NBAIO_Sink* mPipeSink; // after reading from input source, write to this pipe sink
  32. int mPipeSinkGen; // increment when mPipeSink is assigned
  33. size_t mFrameCount; // number of frames per fast capture buffer
  34. audio_track_cblk_t* mCblk; // control block for the single fast client, or NULL
  35. audio_format_t mFastPatchRecordFormat = AUDIO_FORMAT_INVALID;
  36. AudioBufferProvider* mFastPatchRecordBufferProvider = nullptr; // a reference to a patch
  37. // record in fast mode
  38. // Extends FastThreadState::Command
  39. static const Command
  40. // The following commands also process configuration changes, and can be "or"ed:
  41. READ = 0x8, // read from input source
  42. WRITE = 0x10, // write to pipe sink
  43. READ_WRITE = 0x18; // read from input source and write to pipe sink
  44. // never returns NULL; asserts if command is invalid
  45. static const char *commandToString(Command command);
  46. }; // struct FastCaptureState
  47. } // namespace android
  48. #endif // ANDROID_AUDIO_FAST_CAPTURE_STATE_H