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

Side by Side Diff: media/audio/android/opensles_util.cc

Issue 1921963004: Add support for multichannel playback to OpenSLES output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whoops, add file. Created 4 years, 7 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
« no previous file with comments | « media/audio/android/opensles_util.h ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "media/audio/android/opensles_util.h"
6
7 namespace media {
8
9 #define SL_ANDROID_SPEAKER_QUAD \
10 (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_BACK_LEFT | \
11 SL_SPEAKER_BACK_RIGHT)
12 #define SL_ANDROID_SPEAKER_5DOT1 \
13 (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER | \
14 SL_SPEAKER_LOW_FREQUENCY | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT)
15 #define SL_ANDROID_SPEAKER_7DOT1 \
16 (SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT)
17
18 // Ported from:
19 // https://android.googlesource.com/platform/frameworks/wilhelm/+/refs/heads/mas ter/src/android/channels.h
20 // https://android.googlesource.com/platform/frameworks/wilhelm/+/refs/heads/mas ter/src/android/channels.c
21 SLuint32 ChannelCountToSLESChannelMask(int channel_count) {
henrika (OOO until Aug 14) 2016/04/28 07:52:54 I understand that you want to avoid the existing D
DaleCurtis 2016/04/28 17:27:26 AndroidTV devices and those hooked up via HDMI sho
henrika (OOO until Aug 14) 2016/04/29 07:46:31 Thanks. Just hope it works then ;-)
22 if (channel_count > 2) {
23 LOG(WARNING) << "Guessing channel layout for " << channel_count
24 << " channels; speaker order may be incorrect.";
25 }
26
27 switch (channel_count) {
28 case 1:
29 return SL_SPEAKER_FRONT_LEFT;
30 case 2:
31 return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
32 case 3:
33 return SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
34 SL_SPEAKER_FRONT_CENTER;
35 case 4:
36 return SL_ANDROID_SPEAKER_QUAD;
37 case 5:
38 return SL_ANDROID_SPEAKER_QUAD | SL_SPEAKER_FRONT_CENTER;
39 case 6:
40 return SL_ANDROID_SPEAKER_5DOT1;
41 case 7:
42 return SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_BACK_CENTER;
43 case 8:
44 return SL_ANDROID_SPEAKER_7DOT1;
45 }
46
47 return 0;
48 }
49
50 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/android/opensles_util.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698