OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_MEDIA_FRAMEWORK_LPCM_UTIL_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_LPCM_UTIL_H_ |
| 7 |
| 8 #include "services/media/framework/stream_type.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace media { |
| 12 |
| 13 // Helper class that performs various LPCM processing functions. |
| 14 class LpcmUtil { |
| 15 public: |
| 16 static LpcmUtil* Create(const LpcmStreamType& stream_type); |
| 17 |
| 18 // Fills the buffer with silence. |
| 19 virtual void Silence(void* buffer, uint64_t frame_count) const = 0; |
| 20 |
| 21 // Copies samples. |
| 22 virtual void Copy(void* in, void* out, uint64_t frame_count) const = 0; |
| 23 |
| 24 // Mixes samples. |
| 25 virtual void Mix(void* in, void* out, uint64_t frame_count) const = 0; |
| 26 |
| 27 // Interleaves non-interleaved samples. |
| 28 virtual void Interleave( |
| 29 void* in, |
| 30 uint64_t in_byte_count, |
| 31 void* out, |
| 32 uint64_t frame_count) const = 0; |
| 33 }; |
| 34 |
| 35 // LpcmUtil implementation that processes samples of type T. |
| 36 template<typename T> |
| 37 class LpcmUtilImpl : public LpcmUtil { |
| 38 public: |
| 39 LpcmUtilImpl(const LpcmStreamType& stream_type); |
| 40 |
| 41 ~LpcmUtilImpl(); |
| 42 |
| 43 void Silence(void* buffer, uint64_t frame_count) const override; |
| 44 |
| 45 void Copy(void* in, void* out, uint64_t frame_count) const override; |
| 46 |
| 47 void Mix(void* in, void* out, uint64_t frame_count) const override; |
| 48 |
| 49 void Interleave( |
| 50 void* in, |
| 51 uint64_t in_byte_count, |
| 52 void* out, |
| 53 uint64_t frame_count) const override; |
| 54 |
| 55 private: |
| 56 LpcmStreamType stream_type_; |
| 57 }; |
| 58 |
| 59 } // namespace media |
| 60 } // namespace mojo |
| 61 |
| 62 #endif // SERVICES_MEDIA_FRAMEWORK_LPCM_UTIL_H_ |
OLD | NEW |