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
7fb5b865
authored
Jun 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
git://github.com/tresvecesseis/ExoPlayer
into dev
parents
faff8578
dd3a4a91
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
3 deletions
library/src/main/java/com/google/android/exoplayer/extractor/ts/MpaReader.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
library/src/main/java/com/google/android/exoplayer/util/CodecSpecificDataUtil.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/MpaReader.java
0 → 100644
View file @
7fb5b865
This diff is collapsed.
Click to expand it.
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
View file @
7fb5b865
...
...
@@ -42,6 +42,8 @@ public final class TsExtractor implements Extractor, SeekMap {
private
static
final
int
TS_SYNC_BYTE
=
0x47
;
// First byte of each TS packet.
private
static
final
int
TS_PAT_PID
=
0
;
private
static
final
int
TS_STREAM_TYPE_MPA
=
0x03
;
private
static
final
int
TS_STREAM_TYPE_MPA_LSF
=
0x04
;
private
static
final
int
TS_STREAM_TYPE_AAC
=
0x0F
;
private
static
final
int
TS_STREAM_TYPE_ATSC_AC3
=
0x81
;
private
static
final
int
TS_STREAM_TYPE_ATSC_E_AC3
=
0x87
;
...
...
@@ -351,6 +353,12 @@ public final class TsExtractor implements Extractor, SeekMap {
// TODO: Detect and read DVB AC-3 streams with Ac3Reader.
ElementaryStreamReader
pesPayloadReader
=
null
;
switch
(
streamType
)
{
case
TS_STREAM_TYPE_MPA:
pesPayloadReader
=
new
MpaReader
(
output
.
track
(
TS_STREAM_TYPE_MPA
));
break
;
case
TS_STREAM_TYPE_MPA_LSF:
pesPayloadReader
=
new
MpaReader
(
output
.
track
(
TS_STREAM_TYPE_MPA_LSF
));
break
;
case
TS_STREAM_TYPE_AAC:
pesPayloadReader
=
new
AdtsReader
(
output
.
track
(
TS_STREAM_TYPE_AAC
));
break
;
...
...
library/src/main/java/com/google/android/exoplayer/util/CodecSpecificDataUtil.java
View file @
7fb5b865
...
...
@@ -42,6 +42,22 @@ public final class CodecSpecificDataUtil {
private
CodecSpecificDataUtil
()
{}
/**
* Gets the sample rate index.
*
* @param sampleRate The sample rate in Hz.
* @return The sample rate index.
*/
public
static
int
getSampleRateIndex
(
int
sampleRate
)
{
int
sampleRateIndex
=
0
;
for
(;
sampleRateIndex
<
AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE
.
length
;
sampleRateIndex
++)
{
if
(
AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE
[
sampleRateIndex
]
==
sampleRate
)
{
return
sampleRateIndex
;
}
}
return
-
1
;
}
/**
* Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
*
* @param audioSpecificConfig The AudioSpecificConfig to parse.
...
...
@@ -49,14 +65,25 @@ public final class CodecSpecificDataUtil {
*/
public
static
Pair
<
Integer
,
Integer
>
parseAacAudioSpecificConfig
(
byte
[]
audioSpecificConfig
)
{
int
audioObjectType
=
(
audioSpecificConfig
[
0
]
>>
3
)
&
0x1F
;
if
(
audioObjectType
<
31
)
{
int
byteOffset
=
audioObjectType
==
5
||
audioObjectType
==
29
?
1
:
0
;
int
frequencyIndex
=
(
audioSpecificConfig
[
byteOffset
]
&
0x7
)
<<
1
|
((
audioSpecificConfig
[
byteOffset
+
1
]
>>
7
)
&
0x1
);
int
frequencyIndex
=
(
audioSpecificConfig
[
byteOffset
]
&
0x7
)
<<
1
|
((
audioSpecificConfig
[
byteOffset
+
1
]
>>
7
)
&
0x1
);
Assertions
.
checkState
(
frequencyIndex
<
13
);
int
sampleRate
=
AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE
[
frequencyIndex
];
int
channelCount
=
AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE
[
(
audioSpecificConfig
[
byteOffset
+
1
]
>>
3
)
&
0xF
];
return
Pair
.
create
(
sampleRate
,
channelCount
);
}
else
{
int
frequencyIndex
=
(
audioSpecificConfig
[
1
]
&
0x1E
)
>>
1
;
Assertions
.
checkState
(
frequencyIndex
<
13
);
int
sampleRate
=
AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE
[
frequencyIndex
];
int
channelCount
=
(
audioSpecificConfig
[
byteOffset
+
1
]
>>
3
)
&
0xF
;
int
channelCount
=
AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE
[
(
audioSpecificConfig
[
1
]
&
0x01
)
<<
3
|
((
audioSpecificConfig
[
2
]
>>
5
)
&
0x07
)];
return
Pair
.
create
(
sampleRate
,
channelCount
);
}
}
/**
* Builds a simple AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
...
...
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