OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
6 #define CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chromecast_export.h" | 10 #include "chromecast_export.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Returns |false| if the processor cannot support |sample_rate| | 38 // Returns |false| if the processor cannot support |sample_rate| |
39 // Returning false will result in crashing cast_shell. | 39 // Returning false will result in crashing cast_shell. |
40 virtual bool SetSampleRate(int sample_rate) = 0; | 40 virtual bool SetSampleRate(int sample_rate) = 0; |
41 | 41 |
42 // Processes audio frames from |data|, overwriting contents. | 42 // Processes audio frames from |data|, overwriting contents. |
43 // |data| will always be 32-bit planar float. | 43 // |data| will always be 32-bit planar float. |
44 // |frames| is the number of audio frames in data and is | 44 // |frames| is the number of audio frames in data and is |
45 // always non-zero and less than or equal to 20ms of audio. | 45 // always non-zero and less than or equal to 20ms of audio. |
46 // AudioPostProcessor must always provide |frames| frames of data back | 46 // AudioPostProcessor must always provide |frames| frames of data back |
47 // (may output 0’s) | 47 // (may output 0’s) |
48 // |volume| is the attenuation level (multiplier) of the stream. | 48 // |volume| is the Cast Volume applied to the stream (normalized to 0-1) |
49 // |volume| is between 0 and 1 inclusive. | |
50 // AudioPostProcessor should assume that it has already been applied. | 49 // AudioPostProcessor should assume that it has already been applied. |
51 // TODO(bshaya): Change |volume| to Cast System Volume. | |
52 // Returns the current rendering delay of the filter in frames, | 50 // Returns the current rendering delay of the filter in frames, |
53 // or negative if an error occurred during processing. | 51 // or negative if an error occurred during processing. |
54 // If an error occurred during processing, |data| should be unchanged. | 52 // If an error occurred during processing, |data| should be unchanged. |
55 virtual int ProcessFrames(const std::vector<float*>& data, | 53 virtual int ProcessFrames(const std::vector<float*>& data, |
56 int frames, | 54 int frames, |
57 float volume) = 0; | 55 float volume) = 0; |
58 | 56 |
59 // Returns the number of frames of silence it will take for the | 57 // Returns the number of frames of silence it will take for the |
60 // processor to come to rest. | 58 // processor to come to rest. |
61 // This may be the actual number of frames stored, | 59 // This may be the actual number of frames stored, |
62 // or may be calculated from internal resonators or similar. | 60 // or may be calculated from internal resonators or similar. |
63 // When inputs are paused, at least this |GetRingingTimeInFrames()| of | 61 // When inputs are paused, at least this |GetRingingTimeInFrames()| of |
64 // silence will be passed through the processor. | 62 // silence will be passed through the processor. |
65 // This is not expected to be real-time; | 63 // This is not expected to be real-time; |
66 // It should only change when SetSampleRate is called. | 64 // It should only change when SetSampleRate is called. |
67 virtual int GetRingingTimeInFrames() = 0; | 65 virtual int GetRingingTimeInFrames() = 0; |
68 | 66 |
69 virtual ~AudioPostProcessor() = default; | 67 virtual ~AudioPostProcessor() = default; |
70 }; | 68 }; |
71 | 69 |
72 } // namespace media | 70 } // namespace media |
73 } // namespace chromecast | 71 } // namespace chromecast |
74 | 72 |
75 #endif // CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ | 73 #endif // CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR_SHLIB_H_ |
OLD | NEW |