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
269757cb
authored
Nov 17, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up MP4/FMP4 shouldParse methods.
parent
3cbb1fa1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
33 deletions
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Atom.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Mp4Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Atom.java
View file @
269757cb
...
@@ -100,7 +100,6 @@ import java.util.List;
...
@@ -100,7 +100,6 @@ import java.util.List;
public
static
final
int
TYPE_pasp
=
Util
.
getIntegerCodeForString
(
"pasp"
);
public
static
final
int
TYPE_pasp
=
Util
.
getIntegerCodeForString
(
"pasp"
);
public
static
final
int
TYPE_TTML
=
Util
.
getIntegerCodeForString
(
"TTML"
);
public
static
final
int
TYPE_TTML
=
Util
.
getIntegerCodeForString
(
"TTML"
);
public
static
final
int
TYPE_vmhd
=
Util
.
getIntegerCodeForString
(
"vmhd"
);
public
static
final
int
TYPE_vmhd
=
Util
.
getIntegerCodeForString
(
"vmhd"
);
public
static
final
int
TYPE_smhd
=
Util
.
getIntegerCodeForString
(
"smhd"
);
public
static
final
int
TYPE_mp4v
=
Util
.
getIntegerCodeForString
(
"mp4v"
);
public
static
final
int
TYPE_mp4v
=
Util
.
getIntegerCodeForString
(
"mp4v"
);
public
static
final
int
TYPE_stts
=
Util
.
getIntegerCodeForString
(
"stts"
);
public
static
final
int
TYPE_stts
=
Util
.
getIntegerCodeForString
(
"stts"
);
public
static
final
int
TYPE_stss
=
Util
.
getIntegerCodeForString
(
"stss"
);
public
static
final
int
TYPE_stss
=
Util
.
getIntegerCodeForString
(
"stss"
);
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
View file @
269757cb
...
@@ -226,20 +226,18 @@ public final class FragmentedMp4Extractor implements Extractor {
...
@@ -226,20 +226,18 @@ public final class FragmentedMp4Extractor implements Extractor {
return
true
;
return
true
;
}
}
if
(
shouldParseAtom
(
atomType
))
{
if
(
shouldParseContainerAtom
(
atomType
))
{
if
(
shouldParseContainerAtom
(
atomType
))
{
long
endPosition
=
input
.
getPosition
()
+
atomSize
-
Atom
.
HEADER_SIZE
;
long
endPosition
=
input
.
getPosition
()
+
atomSize
-
Atom
.
HEADER_SIZE
;
containerAtoms
.
add
(
new
ContainerAtom
(
atomType
,
endPosition
));
containerAtoms
.
add
(
new
ContainerAtom
(
atomType
,
endPosition
));
enterReadingAtomHeaderState
();
enterReadingAtomHeaderState
();
}
else
if
(
shouldParseLeafAtom
(
atomType
))
{
}
else
{
// We don't support parsing of leaf atoms that define extended atom sizes, or that have
// We don't support parsing of leaf atoms that define extended atom sizes, or that have
// lengths greater than Integer.MAX_VALUE.
// lengths greater than Integer.MAX_VALUE.
checkState
(
atomHeaderBytesRead
==
Atom
.
HEADER_SIZE
);
checkState
(
atomHeaderBytesRead
==
Atom
.
HEADER_SIZE
);
checkState
(
atomSize
<=
Integer
.
MAX_VALUE
);
checkState
(
atomSize
<=
Integer
.
MAX_VALUE
);
atomData
=
new
ParsableByteArray
((
int
)
atomSize
);
atomData
=
new
ParsableByteArray
((
int
)
atomSize
);
System
.
arraycopy
(
atomHeader
.
data
,
0
,
atomData
.
data
,
0
,
Atom
.
HEADER_SIZE
);
System
.
arraycopy
(
atomHeader
.
data
,
0
,
atomData
.
data
,
0
,
Atom
.
HEADER_SIZE
);
parserState
=
STATE_READING_ATOM_PAYLOAD
;
parserState
=
STATE_READING_ATOM_PAYLOAD
;
}
}
else
{
}
else
{
// We don't support skipping of atoms that have lengths greater than Integer.MAX_VALUE.
// We don't support skipping of atoms that have lengths greater than Integer.MAX_VALUE.
checkState
(
atomSize
<=
Integer
.
MAX_VALUE
);
checkState
(
atomSize
<=
Integer
.
MAX_VALUE
);
...
@@ -795,25 +793,20 @@ public final class FragmentedMp4Extractor implements Extractor {
...
@@ -795,25 +793,20 @@ public final class FragmentedMp4Extractor implements Extractor {
return
1
+
vectorSize
+
subsampleDataLength
;
return
1
+
vectorSize
+
subsampleDataLength
;
}
}
/** Returns whether the extractor should parse an atom with type {@code atom}. */
/** Returns whether the extractor should parse a leaf atom with type {@code atom}. */
private
static
boolean
shouldParseAtom
(
int
atom
)
{
private
static
boolean
shouldParseLeafAtom
(
int
atom
)
{
return
atom
==
Atom
.
TYPE_avc1
||
atom
==
Atom
.
TYPE_avc3
||
atom
==
Atom
.
TYPE_esds
return
atom
==
Atom
.
TYPE_hdlr
||
atom
==
Atom
.
TYPE_mdhd
||
atom
==
Atom
.
TYPE_mvhd
||
atom
==
Atom
.
TYPE_hdlr
||
atom
==
Atom
.
TYPE_mdat
||
atom
==
Atom
.
TYPE_mdhd
||
atom
==
Atom
.
TYPE_sidx
||
atom
==
Atom
.
TYPE_stsd
||
atom
==
Atom
.
TYPE_tfdt
||
atom
==
Atom
.
TYPE_moof
||
atom
==
Atom
.
TYPE_moov
||
atom
==
Atom
.
TYPE_mp4a
||
atom
==
Atom
.
TYPE_tfhd
||
atom
==
Atom
.
TYPE_tkhd
||
atom
==
Atom
.
TYPE_trex
||
atom
==
Atom
.
TYPE_mvhd
||
atom
==
Atom
.
TYPE_sidx
||
atom
==
Atom
.
TYPE_stsd
||
atom
==
Atom
.
TYPE_trun
||
atom
==
Atom
.
TYPE_pssh
||
atom
==
Atom
.
TYPE_saiz
||
atom
==
Atom
.
TYPE_tfdt
||
atom
==
Atom
.
TYPE_tfhd
||
atom
==
Atom
.
TYPE_tkhd
||
atom
==
Atom
.
TYPE_saio
||
atom
==
Atom
.
TYPE_senc
||
atom
==
Atom
.
TYPE_uuid
;
||
atom
==
Atom
.
TYPE_traf
||
atom
==
Atom
.
TYPE_trak
||
atom
==
Atom
.
TYPE_trex
||
atom
==
Atom
.
TYPE_trun
||
atom
==
Atom
.
TYPE_mvex
||
atom
==
Atom
.
TYPE_mdia
||
atom
==
Atom
.
TYPE_minf
||
atom
==
Atom
.
TYPE_stbl
||
atom
==
Atom
.
TYPE_pssh
||
atom
==
Atom
.
TYPE_saiz
||
atom
==
Atom
.
TYPE_saio
||
atom
==
Atom
.
TYPE_uuid
||
atom
==
Atom
.
TYPE_senc
||
atom
==
Atom
.
TYPE_pasp
||
atom
==
Atom
.
TYPE_s263
;
}
}
/** Returns whether the extractor should parse a container atom with type {@code atom}. */
/** Returns whether the extractor should parse a container atom with type {@code atom}. */
private
static
boolean
shouldParseContainerAtom
(
int
atom
)
{
private
static
boolean
shouldParseContainerAtom
(
int
atom
)
{
return
atom
==
Atom
.
TYPE_moov
||
atom
==
Atom
.
TYPE_trak
||
atom
==
Atom
.
TYPE_mdia
return
atom
==
Atom
.
TYPE_moov
||
atom
==
Atom
.
TYPE_trak
||
atom
==
Atom
.
TYPE_mdia
||
atom
==
Atom
.
TYPE_minf
||
atom
==
Atom
.
TYPE_stbl
||
atom
==
Atom
.
TYPE_
avcC
||
atom
==
Atom
.
TYPE_minf
||
atom
==
Atom
.
TYPE_stbl
||
atom
==
Atom
.
TYPE_
moof
||
atom
==
Atom
.
TYPE_
moof
||
atom
==
Atom
.
TYPE_
traf
||
atom
==
Atom
.
TYPE_mvex
;
||
atom
==
Atom
.
TYPE_traf
||
atom
==
Atom
.
TYPE_mvex
;
}
}
}
}
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Mp4Extractor.java
View file @
269757cb
...
@@ -384,12 +384,10 @@ public final class Mp4Extractor implements Extractor, SeekMap {
...
@@ -384,12 +384,10 @@ public final class Mp4Extractor implements Extractor, SeekMap {
/** Returns whether the extractor should parse a leaf atom with type {@code atom}. */
/** Returns whether the extractor should parse a leaf atom with type {@code atom}. */
private
static
boolean
shouldParseLeafAtom
(
int
atom
)
{
private
static
boolean
shouldParseLeafAtom
(
int
atom
)
{
return
atom
==
Atom
.
TYPE_mdhd
||
atom
==
Atom
.
TYPE_mvhd
||
atom
==
Atom
.
TYPE_hdlr
return
atom
==
Atom
.
TYPE_mdhd
||
atom
==
Atom
.
TYPE_mvhd
||
atom
==
Atom
.
TYPE_hdlr
||
atom
==
Atom
.
TYPE_vmhd
||
atom
==
Atom
.
TYPE_smhd
||
atom
==
Atom
.
TYPE_stsd
||
atom
==
Atom
.
TYPE_stsd
||
atom
==
Atom
.
TYPE_stts
||
atom
==
Atom
.
TYPE_stss
||
atom
==
Atom
.
TYPE_avc1
||
atom
==
Atom
.
TYPE_avcC
||
atom
==
Atom
.
TYPE_mp4a
||
atom
==
Atom
.
TYPE_esds
||
atom
==
Atom
.
TYPE_stts
||
atom
==
Atom
.
TYPE_stss
||
atom
==
Atom
.
TYPE_ctts
||
atom
==
Atom
.
TYPE_elst
||
atom
==
Atom
.
TYPE_stsc
||
atom
==
Atom
.
TYPE_ctts
||
atom
==
Atom
.
TYPE_elst
||
atom
==
Atom
.
TYPE_stsc
||
atom
==
Atom
.
TYPE_stsz
||
atom
==
Atom
.
TYPE_stco
||
atom
==
Atom
.
TYPE_co64
||
atom
==
Atom
.
TYPE_stsz
||
atom
==
Atom
.
TYPE_stco
||
atom
==
Atom
.
TYPE_co64
||
atom
==
Atom
.
TYPE_tkhd
||
atom
==
Atom
.
TYPE_s263
;
||
atom
==
Atom
.
TYPE_tkhd
;
}
}
/** Returns whether the extractor should parse a container atom with type {@code atom}. */
/** Returns whether the extractor should parse a container atom with type {@code atom}. */
...
...
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