Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: media/base/channel_mixer.h

Issue 12387006: Pass more detailed audio hardware configuration information to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 MEDIA_BASE_CHANNEL_MIXER_H_ 5 #ifndef MEDIA_BASE_CHANNEL_MIXER_H_
6 #define MEDIA_BASE_CHANNEL_MIXER_H_ 6 #define MEDIA_BASE_CHANNEL_MIXER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "media/base/channel_layout.h" 11 #include "media/base/channel_layout.h"
12 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class AudioBus; 16 class AudioBus;
17 class AudioParameters;
17 18
18 // ChannelMixer is for converting audio between channel layouts. The conversion 19 // ChannelMixer is for converting audio between channel layouts. The conversion
19 // matrix is built upon construction and used during each Transform() call. The 20 // matrix is built upon construction and used during each Transform() call. The
20 // algorithm works by generating a conversion matrix mapping each output channel 21 // algorithm works by generating a conversion matrix mapping each output channel
21 // to list of input channels. The transform renders all of the output channels, 22 // to list of input channels. The transform renders all of the output channels,
22 // with each output channel rendered according to a weighted sum of the relevant 23 // with each output channel rendered according to a weighted sum of the relevant
23 // input channels as defined in the matrix. 24 // input channels as defined in the matrix.
24 class MEDIA_EXPORT ChannelMixer { 25 class MEDIA_EXPORT ChannelMixer {
25 public: 26 public:
26 ChannelMixer(ChannelLayout input, ChannelLayout output); 27 ChannelMixer(ChannelLayout input_layout, ChannelLayout output_layout);
28 ChannelMixer(const AudioParameters& input, const AudioParameters& output);
27 ~ChannelMixer(); 29 ~ChannelMixer();
28 30
31 void Initialize(ChannelLayout input_layout, int input_channels,
32 ChannelLayout output_layout, int output_channels);
33
29 // Transforms all channels from |input| into |output| channels. 34 // Transforms all channels from |input| into |output| channels.
30 void Transform(const AudioBus* input, AudioBus* output); 35 void Transform(const AudioBus* input, AudioBus* output);
31 36
32 private: 37 private:
33 // Constructor helper methods for managing unaccounted input channels. 38 // Constructor helper methods for managing unaccounted input channels.
34 void AccountFor(Channels ch); 39 void AccountFor(Channels ch);
35 bool IsUnaccounted(Channels ch); 40 bool IsUnaccounted(Channels ch);
36 41
37 // Helper methods for checking if |ch| exists in either |input_layout_| or 42 // Helper methods for checking if |ch| exists in either |input_layout_| or
38 // |output_layout_| respectively. 43 // |output_layout_| respectively.
(...skipping 20 matching lines...) Expand all
59 // Optimization case for when we can simply remap the input channels to output 64 // Optimization case for when we can simply remap the input channels to output
60 // channels and don't need to do a multiply-accumulate loop over |matrix_|. 65 // channels and don't need to do a multiply-accumulate loop over |matrix_|.
61 bool remapping_; 66 bool remapping_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(ChannelMixer); 68 DISALLOW_COPY_AND_ASSIGN(ChannelMixer);
64 }; 69 };
65 70
66 } // namespace media 71 } // namespace media
67 72
68 #endif // MEDIA_BASE_CHANNEL_MIXER_H_ 73 #endif // MEDIA_BASE_CHANNEL_MIXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698