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

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

Issue 12662038: Revert 187936 "Pass more detailed audio hardware configuration i..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1440/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
« no previous file with comments | « media/base/channel_layout.cc ('k') | media/base/channel_mixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
18 17
19 // ChannelMixer is for converting audio between channel layouts. The conversion 18 // ChannelMixer is for converting audio between channel layouts. The conversion
20 // matrix is built upon construction and used during each Transform() call. The 19 // matrix is built upon construction and used during each Transform() call. The
21 // algorithm works by generating a conversion matrix mapping each output channel 20 // algorithm works by generating a conversion matrix mapping each output channel
22 // to list of input channels. The transform renders all of the output channels, 21 // to list of input channels. The transform renders all of the output channels,
23 // with each output channel rendered according to a weighted sum of the relevant 22 // with each output channel rendered according to a weighted sum of the relevant
24 // input channels as defined in the matrix. 23 // input channels as defined in the matrix.
25 class MEDIA_EXPORT ChannelMixer { 24 class MEDIA_EXPORT ChannelMixer {
26 public: 25 public:
27 ChannelMixer(ChannelLayout input_layout, ChannelLayout output_layout); 26 ChannelMixer(ChannelLayout input, ChannelLayout output);
28 ChannelMixer(const AudioParameters& input, const AudioParameters& output);
29 ~ChannelMixer(); 27 ~ChannelMixer();
30 28
31 void Initialize(ChannelLayout input_layout, int input_channels,
32 ChannelLayout output_layout, int output_channels);
33
34 // Transforms all channels from |input| into |output| channels. 29 // Transforms all channels from |input| into |output| channels.
35 void Transform(const AudioBus* input, AudioBus* output); 30 void Transform(const AudioBus* input, AudioBus* output);
36 31
37 private: 32 private:
38 // Constructor helper methods for managing unaccounted input channels. 33 // Constructor helper methods for managing unaccounted input channels.
39 void AccountFor(Channels ch); 34 void AccountFor(Channels ch);
40 bool IsUnaccounted(Channels ch); 35 bool IsUnaccounted(Channels ch);
41 36
42 // Helper methods for checking if |ch| exists in either |input_layout_| or 37 // Helper methods for checking if |ch| exists in either |input_layout_| or
43 // |output_layout_| respectively. 38 // |output_layout_| respectively.
(...skipping 20 matching lines...) Expand all
64 // Optimization case for when we can simply remap the input channels to output 59 // Optimization case for when we can simply remap the input channels to output
65 // channels and don't need to do a multiply-accumulate loop over |matrix_|. 60 // channels and don't need to do a multiply-accumulate loop over |matrix_|.
66 bool remapping_; 61 bool remapping_;
67 62
68 DISALLOW_COPY_AND_ASSIGN(ChannelMixer); 63 DISALLOW_COPY_AND_ASSIGN(ChannelMixer);
69 }; 64 };
70 65
71 } // namespace media 66 } // namespace media
72 67
73 #endif // MEDIA_BASE_CHANNEL_MIXER_H_ 68 #endif // MEDIA_BASE_CHANNEL_MIXER_H_
OLDNEW
« no previous file with comments | « media/base/channel_layout.cc ('k') | media/base/channel_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698