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
520e6caa
authored
Sep 08, 2016
by
Santiago Seifert
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed style things from pull request
parent
e2722dee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
46 deletions
library/src/main/java/com/google/android/exoplayer2/extractor/ts/Ac3Reader.java
library/src/main/java/com/google/android/exoplayer2/extractor/ts/AdtsReader.java
library/src/main/java/com/google/android/exoplayer2/extractor/ts/DtsReader.java
library/src/main/java/com/google/android/exoplayer2/extractor/ts/MpegAudioReader.java
library/src/main/java/com/google/android/exoplayer2/extractor/ts/TsExtractor.java
library/src/main/java/com/google/android/exoplayer2/extractor/ts/Ac3Reader.java
View file @
520e6caa
...
@@ -33,10 +33,9 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
...
@@ -33,10 +33,9 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
private
static
final
int
HEADER_SIZE
=
8
;
private
static
final
int
HEADER_SIZE
=
8
;
private
String
language
;
private
final
ParsableBitArray
headerScratchBits
;
private
final
ParsableBitArray
headerScratchBits
;
private
final
ParsableByteArray
headerScratchBytes
;
private
final
ParsableByteArray
headerScratchBytes
;
private
final
String
language
;
private
int
state
;
private
int
state
;
private
int
bytesRead
;
private
int
bytesRead
;
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/ts/AdtsReader.java
View file @
520e6caa
...
@@ -42,8 +42,6 @@ import java.util.Collections;
...
@@ -42,8 +42,6 @@ import java.util.Collections;
private
static
final
int
HEADER_SIZE
=
5
;
private
static
final
int
HEADER_SIZE
=
5
;
private
static
final
int
CRC_SIZE
=
2
;
private
static
final
int
CRC_SIZE
=
2
;
private
String
language
;
// Match states used while looking for the next sample
// Match states used while looking for the next sample
private
static
final
int
MATCH_STATE_VALUE_SHIFT
=
8
;
private
static
final
int
MATCH_STATE_VALUE_SHIFT
=
8
;
private
static
final
int
MATCH_STATE_START
=
1
<<
MATCH_STATE_VALUE_SHIFT
;
private
static
final
int
MATCH_STATE_START
=
1
<<
MATCH_STATE_VALUE_SHIFT
;
...
@@ -58,6 +56,7 @@ import java.util.Collections;
...
@@ -58,6 +56,7 @@ import java.util.Collections;
private
final
ParsableBitArray
adtsScratch
;
private
final
ParsableBitArray
adtsScratch
;
private
final
ParsableByteArray
id3HeaderBuffer
;
private
final
ParsableByteArray
id3HeaderBuffer
;
private
final
TrackOutput
id3Output
;
private
final
TrackOutput
id3Output
;
private
final
String
language
;
private
int
state
;
private
int
state
;
private
int
bytesRead
;
private
int
bytesRead
;
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/ts/DtsReader.java
View file @
520e6caa
...
@@ -34,9 +34,8 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
...
@@ -34,9 +34,8 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
private
static
final
int
SYNC_VALUE
=
0x7FFE8001
;
private
static
final
int
SYNC_VALUE
=
0x7FFE8001
;
private
static
final
int
SYNC_VALUE_SIZE
=
4
;
private
static
final
int
SYNC_VALUE_SIZE
=
4
;
private
String
language
;
private
final
ParsableByteArray
headerScratchBytes
;
private
final
ParsableByteArray
headerScratchBytes
;
private
final
String
language
;
private
int
state
;
private
int
state
;
private
int
bytesRead
;
private
int
bytesRead
;
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/ts/MpegAudioReader.java
View file @
520e6caa
...
@@ -32,10 +32,9 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
...
@@ -32,10 +32,9 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
private
static
final
int
HEADER_SIZE
=
4
;
private
static
final
int
HEADER_SIZE
=
4
;
private
String
language
;
private
final
ParsableByteArray
headerScratch
;
private
final
ParsableByteArray
headerScratch
;
private
final
MpegAudioHeader
header
;
private
final
MpegAudioHeader
header
;
private
final
String
language
;
private
int
state
;
private
int
state
;
private
int
frameBytesRead
;
private
int
frameBytesRead
;
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/ts/TsExtractor.java
View file @
520e6caa
...
@@ -327,6 +327,12 @@ public final class TsExtractor implements Extractor {
...
@@ -327,6 +327,12 @@ public final class TsExtractor implements Extractor {
*/
*/
private
class
PmtReader
extends
TsPayloadReader
{
private
class
PmtReader
extends
TsPayloadReader
{
private
static
final
int
TS_PMT_DESC_REGISTRATION
=
0x05
;
private
static
final
int
TS_PMT_DESC_ISO639_LANG
=
0x0A
;
private
static
final
int
TS_PMT_DESC_AC3
=
0x6A
;
private
static
final
int
TS_PMT_DESC_EAC3
=
0x7A
;
private
static
final
int
TS_PMT_DESC_DTS
=
0x7B
;
private
final
ParsableBitArray
pmtScratch
;
private
final
ParsableBitArray
pmtScratch
;
private
final
ParsableByteArray
sectionData
;
private
final
ParsableByteArray
sectionData
;
...
@@ -334,30 +340,18 @@ public final class TsExtractor implements Extractor {
...
@@ -334,30 +340,18 @@ public final class TsExtractor implements Extractor {
private
int
sectionBytesRead
;
private
int
sectionBytesRead
;
private
int
crc
;
private
int
crc
;
private
static
final
int
TS_PMT_DESC_REGISTRATION
=
0x05
;
private
final
class
EsInfo
{
private
static
final
int
TS_PMT_DESC_ISO639_LANG
=
0x0A
;
private
static
final
int
TS_PMT_DESC_VBI_DATA
=
0x45
;
final
int
streamType
;
private
static
final
int
TS_PMT_DESC_VBI_TELETEXT
=
0x46
;
final
int
audioType
;
private
static
final
int
TS_PMT_DESC_TELETEXT
=
0x56
;
final
String
language
;
private
static
final
int
TS_PMT_DESC_SUBTITLING
=
0x59
;
private
static
final
int
TS_PMT_DESC_AC3
=
0x6A
;
public
EsInfo
(
int
streamType
,
int
audioType
,
String
language
)
{
private
static
final
int
TS_PMT_DESC_EAC3
=
0x7A
;
this
.
streamType
=
streamType
;
private
static
final
int
TS_PMT_DESC_DTS
=
0x7B
;
this
.
audioType
=
audioType
;
private
static
final
int
TS_PMT_DESC_AAC
=
0x7C
;
this
.
language
=
language
;
class
EsInfo
{
int
streamType
;
String
streamLanguage
;
int
audioType
;
public
EsInfo
()
{
// REGISTRATION
streamType
=
-
1
;
// ISO639LANG
streamLanguage
=
null
;
audioType
=
-
1
;
}
}
}
}
public
PmtReader
()
{
public
PmtReader
()
{
...
@@ -442,22 +436,22 @@ public final class TsExtractor implements Extractor {
...
@@ -442,22 +436,22 @@ public final class TsExtractor implements Extractor {
ElementaryStreamReader
pesPayloadReader
;
ElementaryStreamReader
pesPayloadReader
;
switch
(
streamType
)
{
switch
(
streamType
)
{
case
TS_STREAM_TYPE_MPA:
case
TS_STREAM_TYPE_MPA:
pesPayloadReader
=
new
MpegAudioReader
(
output
.
track
(
trackId
),
esInfo
.
streamL
anguage
);
pesPayloadReader
=
new
MpegAudioReader
(
output
.
track
(
trackId
),
esInfo
.
l
anguage
);
break
;
break
;
case
TS_STREAM_TYPE_MPA_LSF:
case
TS_STREAM_TYPE_MPA_LSF:
pesPayloadReader
=
new
MpegAudioReader
(
output
.
track
(
trackId
),
esInfo
.
streamL
anguage
);
pesPayloadReader
=
new
MpegAudioReader
(
output
.
track
(
trackId
),
esInfo
.
l
anguage
);
break
;
break
;
case
TS_STREAM_TYPE_AAC:
case
TS_STREAM_TYPE_AAC:
pesPayloadReader
=
(
workaroundFlags
&
WORKAROUND_IGNORE_AAC_STREAM
)
!=
0
?
null
pesPayloadReader
=
(
workaroundFlags
&
WORKAROUND_IGNORE_AAC_STREAM
)
!=
0
?
null
:
new
AdtsReader
(
output
.
track
(
trackId
),
new
DummyTrackOutput
(),
esInfo
.
streamL
anguage
);
:
new
AdtsReader
(
output
.
track
(
trackId
),
new
DummyTrackOutput
(),
esInfo
.
l
anguage
);
break
;
break
;
case
TS_STREAM_TYPE_AC3:
case
TS_STREAM_TYPE_AC3:
case
TS_STREAM_TYPE_E_AC3:
case
TS_STREAM_TYPE_E_AC3:
pesPayloadReader
=
new
Ac3Reader
(
output
.
track
(
trackId
),
esInfo
.
streamL
anguage
);
pesPayloadReader
=
new
Ac3Reader
(
output
.
track
(
trackId
),
esInfo
.
l
anguage
);
break
;
break
;
case
TS_STREAM_TYPE_DTS:
case
TS_STREAM_TYPE_DTS:
case
TS_STREAM_TYPE_HDMV_DTS:
case
TS_STREAM_TYPE_HDMV_DTS:
pesPayloadReader
=
new
DtsReader
(
output
.
track
(
trackId
),
esInfo
.
streamL
anguage
);
pesPayloadReader
=
new
DtsReader
(
output
.
track
(
trackId
),
esInfo
.
l
anguage
);
break
;
break
;
case
TS_STREAM_TYPE_H262:
case
TS_STREAM_TYPE_H262:
pesPayloadReader
=
new
H262Reader
(
output
.
track
(
trackId
));
pesPayloadReader
=
new
H262Reader
(
output
.
track
(
trackId
));
...
@@ -505,36 +499,38 @@ public final class TsExtractor implements Extractor {
...
@@ -505,36 +499,38 @@ public final class TsExtractor implements Extractor {
* descriptors are present.
* descriptors are present.
*/
*/
private
EsInfo
readEsInfo
(
ParsableByteArray
data
,
int
length
)
{
private
EsInfo
readEsInfo
(
ParsableByteArray
data
,
int
length
)
{
EsInfo
esInfo
=
new
EsInfo
();
int
descriptorsEndPosition
=
data
.
getPosition
()
+
length
;
int
descriptorsEndPosition
=
data
.
getPosition
()
+
length
;
int
streamType
=
-
1
;
int
audioType
=
-
1
;
String
language
=
null
;
while
(
data
.
getPosition
()
<
descriptorsEndPosition
)
{
while
(
data
.
getPosition
()
<
descriptorsEndPosition
)
{
int
descriptorTag
=
data
.
readUnsignedByte
();
int
descriptorTag
=
data
.
readUnsignedByte
();
int
descriptorLength
=
data
.
readUnsignedByte
();
int
descriptorLength
=
data
.
readUnsignedByte
();
if
(
descriptorTag
==
TS_PMT_DESC_REGISTRATION
)
{
// registration_descriptor
if
(
descriptorTag
==
TS_PMT_DESC_REGISTRATION
)
{
// registration_descriptor
long
formatIdentifier
=
data
.
readUnsignedInt
();
long
formatIdentifier
=
data
.
readUnsignedInt
();
if
(
formatIdentifier
==
AC3_FORMAT_IDENTIFIER
)
{
if
(
formatIdentifier
==
AC3_FORMAT_IDENTIFIER
)
{
esInfo
.
streamType
=
TS_STREAM_TYPE_AC3
;
streamType
=
TS_STREAM_TYPE_AC3
;
}
else
if
(
formatIdentifier
==
E_AC3_FORMAT_IDENTIFIER
)
{
}
else
if
(
formatIdentifier
==
E_AC3_FORMAT_IDENTIFIER
)
{
esInfo
.
streamType
=
TS_STREAM_TYPE_E_AC3
;
streamType
=
TS_STREAM_TYPE_E_AC3
;
}
else
if
(
formatIdentifier
==
HEVC_FORMAT_IDENTIFIER
)
{
}
else
if
(
formatIdentifier
==
HEVC_FORMAT_IDENTIFIER
)
{
esInfo
.
streamType
=
TS_STREAM_TYPE_H265
;
streamType
=
TS_STREAM_TYPE_H265
;
}
}
break
;
break
;
}
else
if
(
descriptorTag
==
TS_PMT_DESC_AC3
)
{
// AC-3_descriptor in DVB (ETSI EN 300 468)
}
else
if
(
descriptorTag
==
TS_PMT_DESC_AC3
)
{
// AC-3_descriptor in DVB (ETSI EN 300 468)
esInfo
.
streamType
=
TS_STREAM_TYPE_AC3
;
streamType
=
TS_STREAM_TYPE_AC3
;
}
else
if
(
descriptorTag
==
TS_PMT_DESC_EAC3
)
{
// enhanced_AC-3_descriptor
}
else
if
(
descriptorTag
==
TS_PMT_DESC_EAC3
)
{
// enhanced_AC-3_descriptor
esInfo
.
streamType
=
TS_STREAM_TYPE_E_AC3
;
streamType
=
TS_STREAM_TYPE_E_AC3
;
}
else
if
(
descriptorTag
==
TS_PMT_DESC_DTS
)
{
// DTS_descriptor
}
else
if
(
descriptorTag
==
TS_PMT_DESC_DTS
)
{
// DTS_descriptor
esInfo
.
streamType
=
TS_STREAM_TYPE_DTS
;
streamType
=
TS_STREAM_TYPE_DTS
;
}
else
if
(
descriptorTag
==
TS_PMT_DESC_ISO639_LANG
)
{
}
else
if
(
descriptorTag
==
TS_PMT_DESC_ISO639_LANG
)
{
esInfo
.
streamL
anguage
=
new
String
(
data
.
data
,
data
.
getPosition
(),
3
).
trim
();
l
anguage
=
new
String
(
data
.
data
,
data
.
getPosition
(),
3
).
trim
();
esInfo
.
audioType
=
data
.
data
[
data
.
getPosition
()
+
3
];
audioType
=
data
.
data
[
data
.
getPosition
()
+
3
];
}
}
data
.
skipBytes
(
descriptorLength
);
data
.
skipBytes
(
descriptorLength
);
}
}
data
.
setPosition
(
descriptorsEndPosition
);
data
.
setPosition
(
descriptorsEndPosition
);
return
esInfo
;
return
new
EsInfo
(
streamType
,
audioType
,
language
)
;
}
}
}
}
...
...
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