Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
frameworks_wilhelm
Commits
84bbadf8
Commit
84bbadf8
authored
9 years ago
by
Andy Hung
Committed by
Jean-Michel Trivi
9 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Update OpenSL ES for odd channel counts
Bug: 22629234 Change-Id: I3effb86dc7418997e8b24bf8a11c757878c99693
parent
cfcb54d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
src/android/channels.c
src/android/channels.c
+6
-0
src/data.c
src/data.c
+32
-4
No files found.
src/android/channels.c
View file @
84bbadf8
...
...
@@ -29,10 +29,16 @@ SLuint32 channelCountToMask(unsigned channelCount)
case
2
:
return
SL_SPEAKER_FRONT_LEFT
|
SL_SPEAKER_FRONT_RIGHT
;
// Android-specific
case
3
:
return
SL_SPEAKER_FRONT_LEFT
|
SL_SPEAKER_FRONT_RIGHT
|
SL_SPEAKER_FRONT_CENTER
;
case
4
:
return
SL_ANDROID_SPEAKER_QUAD
;
case
5
:
return
SL_ANDROID_SPEAKER_QUAD
|
SL_SPEAKER_FRONT_CENTER
;
case
6
:
return
SL_ANDROID_SPEAKER_5DOT1
;
case
7
:
return
SL_ANDROID_SPEAKER_5DOT1
|
SL_SPEAKER_BACK_CENTER
;
case
8
:
return
SL_ANDROID_SPEAKER_7DOT1
;
// FIXME FCC_8
...
...
This diff is collapsed.
Click to expand it.
src/data.c
View file @
84bbadf8
...
...
@@ -373,8 +373,11 @@ static SLresult checkDataFormat(const char *name, void *pFormat, DataFormat *pDa
switch
(
pDataFormat
->
mPCM
.
numChannels
)
{
case
1
:
// mono
case
2
:
// stereo
case
3
:
// stereo + front center
case
4
:
// QUAD
case
5
:
// QUAD + front center
case
6
:
// 5.1
case
7
:
// 5.1 + back center
case
8
:
// 7.1
break
;
case
0
:
// unknown
...
...
@@ -460,28 +463,53 @@ static SLresult checkDataFormat(const char *name, void *pFormat, DataFormat *pDa
}
break
;
#ifdef ANDROID
case
SL_SPEAKER_FRONT_LEFT
|
SL_SPEAKER_FRONT_RIGHT
|
SL_SPEAKER_FRONT_CENTER
:
if
(
3
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
case
SL_ANDROID_SPEAKER_QUAD
:
if
(
4
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
case
SL_ANDROID_SPEAKER_QUAD
|
SL_SPEAKER_FRONT_CENTER
:
if
(
5
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
case
SL_ANDROID_SPEAKER_5DOT1
:
if
(
6
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
case
SL_ANDROID_SPEAKER_5DOT1
|
SL_SPEAKER_BACK_CENTER
:
if
(
7
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
case
SL_ANDROID_SPEAKER_7DOT1
:
if
(
8
!=
pDataFormat
->
mPCM
.
numChannels
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
break
;
#endif
case
0
:
case
0
:
{
// According to OpenSL ES 1.0.1 section 9.1.7 SLDataFormat_PCM, "a default
// setting of zero indicates stereo format (i.e. the setting is equivalent to
// SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT)."
//
// ANDROID SPECIFIC BEHAVIOR.
// We fill in the appropriate mask to the number indicated by numChannels.
// The default of front left rather than center for mono may be non-intuitive,
// but the left channel is the first channel for stereo or multichannel content.
pDataFormat
->
mPCM
.
channelMask
=
pDataFormat
->
mPCM
.
numChannels
==
2
?
SL_SPEAKER_FRONT_LEFT
|
SL_SPEAKER_FRONT_RIGHT
:
SL_SPEAKER_FRONT_LEFT
;
break
;
SLuint32
mask
=
channelCountToMask
(
pDataFormat
->
mPCM
.
numChannels
);
if
(
mask
==
UNKNOWN_CHANNELMASK
)
{
result
=
SL_RESULT_PARAMETER_INVALID
;
}
else
{
pDataFormat
->
mPCM
.
channelMask
=
mask
;
}
}
break
;
default:
result
=
SL_RESULT_PARAMETER_INVALID
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment