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
7aeeb8dd
authored
Dec 11, 2020
by
krocard
Committed by
Ian Baker
Dec 14, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Minor refactor in Matroska extractor
#exofixit PiperOrigin-RevId: 346975740
parent
297c2bf9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
View file @
7aeeb8dd
...
@@ -720,11 +720,13 @@ public class MatroskaExtractor implements Extractor {
...
@@ -720,11 +720,13 @@ public class MatroskaExtractor implements Extractor {
break
;
break
;
case
ID_CUES:
case
ID_CUES:
if
(!
sentSeekMap
)
{
if
(!
sentSeekMap
)
{
extractorOutput
.
seekMap
(
buildSeekMap
());
extractorOutput
.
seekMap
(
buildSeekMap
(
cueTimesUs
,
cueClusterPositions
));
sentSeekMap
=
true
;
sentSeekMap
=
true
;
}
else
{
}
else
{
// We have already built the cues. Ignore.
// We have already built the cues. Ignore.
}
}
this
.
cueTimesUs
=
null
;
this
.
cueClusterPositions
=
null
;
break
;
break
;
case
ID_BLOCK_GROUP:
case
ID_BLOCK_GROUP:
if
(
blockState
!=
BLOCK_STATE_DATA
)
{
if
(
blockState
!=
BLOCK_STATE_DATA
)
{
...
@@ -769,10 +771,7 @@ public class MatroskaExtractor implements Extractor {
...
@@ -769,10 +771,7 @@ public class MatroskaExtractor implements Extractor {
}
}
break
;
break
;
case
ID_TRACK_ENTRY:
case
ID_TRACK_ENTRY:
if
(
currentTrack
==
null
)
{
Track
currentTrack
=
checkStateNotNull
(
this
.
currentTrack
);
throw
new
ParserException
(
"TrackEntry ends without matching start"
);
}
else
{
Track
currentTrack
=
this
.
currentTrack
;
if
(
currentTrack
.
codecId
==
null
)
{
if
(
currentTrack
.
codecId
==
null
)
{
throw
new
ParserException
(
"CodecId is missing in TrackEntry element"
);
throw
new
ParserException
(
"CodecId is missing in TrackEntry element"
);
}
else
{
}
else
{
...
@@ -781,8 +780,7 @@ public class MatroskaExtractor implements Extractor {
...
@@ -781,8 +780,7 @@ public class MatroskaExtractor implements Extractor {
tracks
.
put
(
currentTrack
.
number
,
currentTrack
);
tracks
.
put
(
currentTrack
.
number
,
currentTrack
);
}
}
}
}
}
this
.
currentTrack
=
null
;
currentTrack
=
null
;
break
;
break
;
case
ID_TRACKS:
case
ID_TRACKS:
if
(
tracks
.
size
()
==
0
)
{
if
(
tracks
.
size
()
==
0
)
{
...
@@ -1735,15 +1733,12 @@ public class MatroskaExtractor implements Extractor {
...
@@ -1735,15 +1733,12 @@ public class MatroskaExtractor implements Extractor {
* @return The built {@link SeekMap}. The returned {@link SeekMap} may be unseekable if cues
* @return The built {@link SeekMap}. The returned {@link SeekMap} may be unseekable if cues
* information was missing or incomplete.
* information was missing or incomplete.
*/
*/
private
SeekMap
buildSeekMap
()
{
private
SeekMap
buildSeekMap
(
LongArray
cueTimesUs
=
this
.
cueTimesUs
;
@Nullable
LongArray
cueTimesUs
,
@Nullable
LongArray
cueClusterPositions
)
{
LongArray
cueClusterPositions
=
this
.
cueClusterPositions
;
if
(
segmentContentPosition
==
C
.
POSITION_UNSET
||
durationUs
==
C
.
TIME_UNSET
if
(
segmentContentPosition
==
C
.
POSITION_UNSET
||
durationUs
==
C
.
TIME_UNSET
||
cueTimesUs
==
null
||
cueTimesUs
.
size
()
==
0
||
cueTimesUs
==
null
||
cueTimesUs
.
size
()
==
0
||
cueClusterPositions
==
null
||
cueClusterPositions
.
size
()
!=
cueTimesUs
.
size
())
{
||
cueClusterPositions
==
null
||
cueClusterPositions
.
size
()
!=
cueTimesUs
.
size
())
{
// Cues information is missing or incomplete.
// Cues information is missing or incomplete.
this
.
cueTimesUs
=
null
;
this
.
cueClusterPositions
=
null
;
return
new
SeekMap
.
Unseekable
(
durationUs
);
return
new
SeekMap
.
Unseekable
(
durationUs
);
}
}
int
cuePointsSize
=
cueTimesUs
.
size
();
int
cuePointsSize
=
cueTimesUs
.
size
();
...
@@ -1772,8 +1767,6 @@ public class MatroskaExtractor implements Extractor {
...
@@ -1772,8 +1767,6 @@ public class MatroskaExtractor implements Extractor {
timesUs
=
Arrays
.
copyOf
(
timesUs
,
timesUs
.
length
-
1
);
timesUs
=
Arrays
.
copyOf
(
timesUs
,
timesUs
.
length
-
1
);
}
}
this
.
cueTimesUs
=
null
;
this
.
cueClusterPositions
=
null
;
return
new
ChunkIndex
(
sizes
,
offsets
,
durationsUs
,
timesUs
);
return
new
ChunkIndex
(
sizes
,
offsets
,
durationsUs
,
timesUs
);
}
}
...
@@ -2231,10 +2224,11 @@ public class MatroskaExtractor implements Extractor {
...
@@ -2231,10 +2224,11 @@ public class MatroskaExtractor implements Extractor {
break
;
break
;
case
CODEC_ID_ASS:
case
CODEC_ID_ASS:
mimeType
=
MimeTypes
.
TEXT_SSA
;
mimeType
=
MimeTypes
.
TEXT_SSA
;
initializationData
=
ImmutableList
.
of
(
SSA_DIALOGUE_FORMAT
,
getCodecPrivate
(
codecId
));
break
;
break
;
case
CODEC_ID_VOBSUB:
case
CODEC_ID_VOBSUB:
mimeType
=
MimeTypes
.
APPLICATION_VOBSUB
;
mimeType
=
MimeTypes
.
APPLICATION_VOBSUB
;
initializationData
=
Collections
.
singletonList
(
getCodecPrivate
(
codecId
));
initializationData
=
ImmutableList
.
of
(
getCodecPrivate
(
codecId
));
break
;
break
;
case
CODEC_ID_PGS:
case
CODEC_ID_PGS:
mimeType
=
MimeTypes
.
APPLICATION_PGS
;
mimeType
=
MimeTypes
.
APPLICATION_PGS
;
...
@@ -2317,12 +2311,9 @@ public class MatroskaExtractor implements Extractor {
...
@@ -2317,12 +2311,9 @@ public class MatroskaExtractor implements Extractor {
.
setProjectionData
(
projectionData
)
.
setProjectionData
(
projectionData
)
.
setStereoMode
(
stereoMode
)
.
setStereoMode
(
stereoMode
)
.
setColorInfo
(
colorInfo
);
.
setColorInfo
(
colorInfo
);
}
else
if
(
MimeTypes
.
APPLICATION_SUBRIP
.
equals
(
mimeType
))
{
}
else
if
(
MimeTypes
.
APPLICATION_SUBRIP
.
equals
(
mimeType
)
type
=
C
.
TRACK_TYPE_TEXT
;
||
MimeTypes
.
TEXT_SSA
.
equals
(
mimeType
)
}
else
if
(
MimeTypes
.
TEXT_SSA
.
equals
(
mimeType
))
{
||
MimeTypes
.
APPLICATION_VOBSUB
.
equals
(
mimeType
)
type
=
C
.
TRACK_TYPE_TEXT
;
initializationData
=
ImmutableList
.
of
(
SSA_DIALOGUE_FORMAT
,
getCodecPrivate
(
codecId
));
}
else
if
(
MimeTypes
.
APPLICATION_VOBSUB
.
equals
(
mimeType
)
||
MimeTypes
.
APPLICATION_PGS
.
equals
(
mimeType
)
||
MimeTypes
.
APPLICATION_PGS
.
equals
(
mimeType
)
||
MimeTypes
.
APPLICATION_DVBSUBS
.
equals
(
mimeType
))
{
||
MimeTypes
.
APPLICATION_DVBSUBS
.
equals
(
mimeType
))
{
type
=
C
.
TRACK_TYPE_TEXT
;
type
=
C
.
TRACK_TYPE_TEXT
;
...
...
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