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); | |
johngro
2016/01/25 18:55:43
virtual ~LpcmUtil() { }
dalesat
2016/01/25 23:29:37
Done.
| |
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, | |
johngro
2016/01/25 18:55:43
const void* for the in param, here and below
dalesat
2016/01/25 23:29:37
Done for all inputs.
| |
30 uint64_t in_byte_count, | |
johngro
2016/01/25 18:55:43
in_byte_count seems redundant here. Don't we know
dalesat
2016/01/25 23:29:37
The layout of non-interleaved samples we get from
johngro
2016/01/27 22:35:22
k, This is an important detail/assertion; perhaps
dalesat
2016/01/28 18:49:15
Done.
| |
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 { | |
johngro
2016/01/25 18:55:43
In theory, you can bury the Impl class definition
dalesat
2016/01/25 23:29:37
Done.
| |
38 public: | |
39 LpcmUtilImpl(const LpcmStreamType& stream_type); | |
johngro
2016/01/25 18:55:43
probably want to make this private and make the in
dalesat
2016/01/25 23:29:37
Done.
| |
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 |