Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f604ee59
authored
Feb 15, 2022
by
Dustin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Changed constants to literals.
parent
ac96a2be
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
11 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AudioFormat.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AudioFormatTest.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AudioFormat.java
View file @
f604ee59
...
@@ -23,18 +23,13 @@ import java.nio.ByteBuffer;
...
@@ -23,18 +23,13 @@ import java.nio.ByteBuffer;
* Wrapper for the WAVEFORMATEX structure
* Wrapper for the WAVEFORMATEX structure
*/
*/
public
class
AudioFormat
{
public
class
AudioFormat
{
public
static
final
short
WAVE_FORMAT_PCM
=
1
;
static
final
short
WAVE_FORMAT_AAC
=
0xff
;
private
static
final
short
WAVE_FORMAT_MPEGLAYER3
=
0x55
;
private
static
final
short
WAVE_FORMAT_DVM
=
0x2000
;
//AC3
private
static
final
short
WAVE_FORMAT_DTS2
=
0x2001
;
//DTS
private
static
final
SparseArray
<
String
>
FORMAT_MAP
=
new
SparseArray
<>();
private
static
final
SparseArray
<
String
>
FORMAT_MAP
=
new
SparseArray
<>();
static
{
static
{
FORMAT_MAP
.
put
(
WAVE_FORMAT_PCM
,
MimeTypes
.
AUDIO_RAW
);
FORMAT_MAP
.
put
(
0x1
,
MimeTypes
.
AUDIO_RAW
);
// WAVE_FORMAT_PCM
FORMAT_MAP
.
put
(
WAVE_FORMAT_MPEGLAYER3
,
MimeTypes
.
AUDIO_MPEG
);
FORMAT_MAP
.
put
(
0x55
,
MimeTypes
.
AUDIO_MPEG
);
// WAVE_FORMAT_MPEGLAYER3
FORMAT_MAP
.
put
(
WAVE_FORMAT_AAC
,
MimeTypes
.
AUDIO_AAC
);
FORMAT_MAP
.
put
(
0xff
,
MimeTypes
.
AUDIO_AAC
);
// WAVE_FORMAT_AAC
FORMAT_MAP
.
put
(
WAVE_FORMAT_DVM
,
MimeTypes
.
AUDIO_AC3
);
FORMAT_MAP
.
put
(
0x2000
,
MimeTypes
.
AUDIO_AC3
);
// WAVE_FORMAT_DVM - AC3
FORMAT_MAP
.
put
(
WAVE_FORMAT_DTS2
,
MimeTypes
.
AUDIO_DTS
);
FORMAT_MAP
.
put
(
0x2001
,
MimeTypes
.
AUDIO_DTS
);
// WAVE_FORMAT_DTS2
}
}
private
final
ByteBuffer
byteBuffer
;
private
final
ByteBuffer
byteBuffer
;
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AudioFormatTest.java
View file @
f604ee59
...
@@ -32,7 +32,7 @@ public class AudioFormatTest {
...
@@ -32,7 +32,7 @@ public class AudioFormatTest {
final
AudioFormat
audioFormat
=
streamFormatBox
.
getAudioFormat
();
final
AudioFormat
audioFormat
=
streamFormatBox
.
getAudioFormat
();
Assert
.
assertEquals
(
MimeTypes
.
AUDIO_AAC
,
audioFormat
.
getMimeType
());
Assert
.
assertEquals
(
MimeTypes
.
AUDIO_AAC
,
audioFormat
.
getMimeType
());
Assert
.
assertEquals
(
2
,
audioFormat
.
getChannels
());
Assert
.
assertEquals
(
2
,
audioFormat
.
getChannels
());
Assert
.
assertEquals
(
AudioFormat
.
WAVE_FORMAT_AAC
,
audioFormat
.
getFormatTag
());
Assert
.
assertEquals
(
0xff
,
audioFormat
.
getFormatTag
());
// AAC
Assert
.
assertEquals
(
48000
,
audioFormat
.
getSamplesPerSecond
());
Assert
.
assertEquals
(
48000
,
audioFormat
.
getSamplesPerSecond
());
Assert
.
assertEquals
(
0
,
audioFormat
.
getBitsPerSample
());
//Not meaningful for AAC
Assert
.
assertEquals
(
0
,
audioFormat
.
getBitsPerSample
());
//Not meaningful for AAC
Assert
.
assertArrayEquals
(
CODEC_PRIVATE
,
audioFormat
.
getCodecData
());
Assert
.
assertArrayEquals
(
CODEC_PRIVATE
,
audioFormat
.
getCodecData
());
...
...
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