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
89d10451
authored
Feb 01, 2022
by
Dustin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Move list types to the same class. Expose readHeaderList for external use.
parent
e67d4719
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
14 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java
View file @
89d10451
...
@@ -106,8 +106,6 @@ public class AviExtractor implements Extractor {
...
@@ -106,8 +106,6 @@ public class AviExtractor implements Extractor {
static
final
int
RIFF
=
'R'
|
(
'I'
<<
8
)
|
(
'F'
<<
16
)
|
(
'F'
<<
24
);
static
final
int
RIFF
=
'R'
|
(
'I'
<<
8
)
|
(
'F'
<<
16
)
|
(
'F'
<<
24
);
static
final
int
AVI_
=
'A'
|
(
'V'
<<
8
)
|
(
'I'
<<
16
)
|
(
' '
<<
24
);
static
final
int
AVI_
=
'A'
|
(
'V'
<<
8
)
|
(
'I'
<<
16
)
|
(
' '
<<
24
);
//Stream List
static
final
int
STRL
=
's'
|
(
't'
<<
8
)
|
(
'r'
<<
16
)
|
(
'l'
<<
24
);
//movie data box
//movie data box
static
final
int
MOVI
=
'm'
|
(
'o'
<<
8
)
|
(
'v'
<<
16
)
|
(
'i'
<<
24
);
static
final
int
MOVI
=
'm'
|
(
'o'
<<
8
)
|
(
'v'
<<
16
)
|
(
'i'
<<
24
);
//Index
//Index
...
@@ -191,7 +189,7 @@ public class AviExtractor implements Extractor {
...
@@ -191,7 +189,7 @@ public class AviExtractor implements Extractor {
}
}
@Nullable
@Nullable
static
ListBox
readHeaderList
(
ExtractorInput
input
)
throws
IOException
{
public
static
ListBox
readHeaderList
(
ExtractorInput
input
)
throws
IOException
{
final
ByteBuffer
byteBuffer
=
getAviBuffer
(
input
,
20
);
final
ByteBuffer
byteBuffer
=
getAviBuffer
(
input
,
20
);
if
(
byteBuffer
==
null
)
{
if
(
byteBuffer
==
null
)
{
return
null
;
return
null
;
...
@@ -313,7 +311,7 @@ public class AviExtractor implements Extractor {
...
@@ -313,7 +311,7 @@ public class AviExtractor implements Extractor {
int
streamId
=
0
;
int
streamId
=
0
;
for
(
Box
box
:
headerList
.
getChildren
())
{
for
(
Box
box
:
headerList
.
getChildren
())
{
if
(
box
instanceof
ListBox
&&
((
ListBox
)
box
).
getListType
()
==
STRL
)
{
if
(
box
instanceof
ListBox
&&
((
ListBox
)
box
).
getListType
()
==
ListBox
.
TYPE_
STRL
)
{
final
ListBox
streamList
=
(
ListBox
)
box
;
final
ListBox
streamList
=
(
ListBox
)
box
;
aviTracks
[
streamId
]
=
parseStream
(
streamList
,
streamId
);
aviTracks
[
streamId
]
=
parseStream
(
streamList
,
streamId
);
streamId
++;
streamId
++;
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java
View file @
89d10451
...
@@ -15,6 +15,8 @@ public class ListBox extends Box {
...
@@ -15,6 +15,8 @@ public class ListBox extends Box {
public
static
final
int
LIST
=
'L'
|
(
'I'
<<
8
)
|
(
'S'
<<
16
)
|
(
'T'
<<
24
);
public
static
final
int
LIST
=
'L'
|
(
'I'
<<
8
)
|
(
'S'
<<
16
)
|
(
'T'
<<
24
);
//Header List
//Header List
public
static
final
int
TYPE_HDRL
=
'h'
|
(
'd'
<<
8
)
|
(
'r'
<<
16
)
|
(
'l'
<<
24
);
public
static
final
int
TYPE_HDRL
=
'h'
|
(
'd'
<<
8
)
|
(
'r'
<<
16
)
|
(
'l'
<<
24
);
//Stream List
public
static
final
int
TYPE_STRL
=
's'
|
(
't'
<<
8
)
|
(
'r'
<<
16
)
|
(
'l'
<<
24
);
private
final
int
listType
;
private
final
int
listType
;
...
@@ -47,9 +49,6 @@ public class ListBox extends Box {
...
@@ -47,9 +49,6 @@ public class ListBox extends Box {
/**
/**
* Assume the input is pointing to the list type
* Assume the input is pointing to the list type
* @param boxFactory
* @param input
* @return
* @throws IOException
* @throws IOException
*/
*/
public
static
ListBox
newInstance
(
final
int
listSize
,
BoxFactory
boxFactory
,
public
static
ListBox
newInstance
(
final
int
listSize
,
BoxFactory
boxFactory
,
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java
View file @
89d10451
...
@@ -46,7 +46,7 @@ public class AviExtractorRoboTest {
...
@@ -46,7 +46,7 @@ public class AviExtractorRoboTest {
final
AviExtractor
aviExtractor
=
new
AviExtractor
();
final
AviExtractor
aviExtractor
=
new
AviExtractor
();
final
FakeExtractorOutput
fakeExtractorOutput
=
new
FakeExtractorOutput
();
final
FakeExtractorOutput
fakeExtractorOutput
=
new
FakeExtractorOutput
();
aviExtractor
.
init
(
fakeExtractorOutput
);
aviExtractor
.
init
(
fakeExtractorOutput
);
final
ListBox
streamList
=
new
ListBox
(
128
,
AviExtractor
.
STRL
,
Collections
.
EMPTY_LIST
);
final
ListBox
streamList
=
new
ListBox
(
128
,
ListBox
.
TYPE_
STRL
,
Collections
.
EMPTY_LIST
);
Assert
.
assertNull
(
aviExtractor
.
parseStream
(
streamList
,
0
));
Assert
.
assertNull
(
aviExtractor
.
parseStream
(
streamList
,
0
));
}
}
...
@@ -55,7 +55,7 @@ public class AviExtractorRoboTest {
...
@@ -55,7 +55,7 @@ public class AviExtractorRoboTest {
final
AviExtractor
aviExtractor
=
new
AviExtractor
();
final
AviExtractor
aviExtractor
=
new
AviExtractor
();
final
FakeExtractorOutput
fakeExtractorOutput
=
new
FakeExtractorOutput
();
final
FakeExtractorOutput
fakeExtractorOutput
=
new
FakeExtractorOutput
();
aviExtractor
.
init
(
fakeExtractorOutput
);
aviExtractor
.
init
(
fakeExtractorOutput
);
final
ListBox
streamList
=
new
ListBox
(
128
,
AviExtractor
.
STRL
,
final
ListBox
streamList
=
new
ListBox
(
128
,
ListBox
.
TYPE_
STRL
,
Collections
.
singletonList
(
DataHelper
.
getVidsStreamHeader
()));
Collections
.
singletonList
(
DataHelper
.
getVidsStreamHeader
()));
Assert
.
assertNull
(
aviExtractor
.
parseStream
(
streamList
,
0
));
Assert
.
assertNull
(
aviExtractor
.
parseStream
(
streamList
,
0
));
}
}
...
@@ -73,7 +73,7 @@ public class AviExtractorRoboTest {
...
@@ -73,7 +73,7 @@ public class AviExtractorRoboTest {
byteBuffer
.
put
(
aviHeader
);
byteBuffer
.
put
(
aviHeader
);
byteBuffer
.
putInt
(
ListBox
.
LIST
);
byteBuffer
.
putInt
(
ListBox
.
LIST
);
byteBuffer
.
putInt
(
byteBuffer
.
remaining
()
-
4
);
byteBuffer
.
putInt
(
byteBuffer
.
remaining
()
-
4
);
byteBuffer
.
putInt
(
AviExtractor
.
STRL
);
byteBuffer
.
putInt
(
ListBox
.
TYPE_
STRL
);
final
StreamHeaderBox
streamHeaderBox
=
DataHelper
.
getVidsStreamHeader
();
final
StreamHeaderBox
streamHeaderBox
=
DataHelper
.
getVidsStreamHeader
();
byteBuffer
.
putInt
(
StreamHeaderBox
.
STRH
);
byteBuffer
.
putInt
(
StreamHeaderBox
.
STRH
);
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java
View file @
89d10451
...
@@ -319,7 +319,7 @@ public class AviExtractorTest {
...
@@ -319,7 +319,7 @@ public class AviExtractorTest {
@Test
@Test
public
void
readHeaderList_givenNoHeaderList
()
throws
IOException
{
public
void
readHeaderList_givenNoHeaderList
()
throws
IOException
{
final
ByteBuffer
byteBuffer
=
DataHelper
.
getRiffHeader
(
88
,
0x44
);
final
ByteBuffer
byteBuffer
=
DataHelper
.
getRiffHeader
(
88
,
0x44
);
byteBuffer
.
putInt
(
0x14
,
AviExtractor
.
STRL
);
//Overwrite header list with stream list
byteBuffer
.
putInt
(
0x14
,
ListBox
.
TYPE_
STRL
);
//Overwrite header list with stream list
final
FakeExtractorInput
input
=
new
FakeExtractorInput
.
Builder
().
final
FakeExtractorInput
input
=
new
FakeExtractorInput
.
Builder
().
setData
(
byteBuffer
.
array
()).
build
();
setData
(
byteBuffer
.
array
()).
build
();
Assert
.
assertNull
(
AviExtractor
.
readHeaderList
(
input
));
Assert
.
assertNull
(
AviExtractor
.
readHeaderList
(
input
));
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java
View file @
89d10451
...
@@ -62,7 +62,7 @@ public class DataHelper {
...
@@ -62,7 +62,7 @@ public class DataHelper {
list
.
add
(
streamHeaderBox
);
list
.
add
(
streamHeaderBox
);
list
.
add
(
streamFormatBox
);
list
.
add
(
streamFormatBox
);
return
new
ListBox
((
int
)(
streamHeaderBox
.
getSize
()
+
streamFormatBox
.
getSize
()),
return
new
ListBox
((
int
)(
streamHeaderBox
.
getSize
()
+
streamFormatBox
.
getSize
()),
AviExtractor
.
STRL
,
list
);
ListBox
.
TYPE_
STRL
,
list
);
}
}
public
static
ListBox
getAacStreamList
()
throws
IOException
{
public
static
ListBox
getAacStreamList
()
throws
IOException
{
...
@@ -72,7 +72,7 @@ public class DataHelper {
...
@@ -72,7 +72,7 @@ public class DataHelper {
list
.
add
(
streamHeaderBox
);
list
.
add
(
streamHeaderBox
);
list
.
add
(
streamFormatBox
);
list
.
add
(
streamFormatBox
);
return
new
ListBox
((
int
)(
streamHeaderBox
.
getSize
()
+
streamFormatBox
.
getSize
()),
return
new
ListBox
((
int
)(
streamHeaderBox
.
getSize
()
+
streamFormatBox
.
getSize
()),
AviExtractor
.
STRL
,
list
);
ListBox
.
TYPE_
STRL
,
list
);
}
}
public
static
StreamNameBox
getStreamNameBox
(
final
String
name
)
{
public
static
StreamNameBox
getStreamNameBox
(
final
String
name
)
{
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java
View file @
89d10451
...
@@ -10,7 +10,7 @@ public class StreamNameBoxTest {
...
@@ -10,7 +10,7 @@ public class StreamNameBoxTest {
@Test
@Test
public
void
createStreamName_givenList
()
throws
IOException
{
public
void
createStreamName_givenList
()
throws
IOException
{
final
String
name
=
"Test"
;
final
String
name
=
"Test"
;
final
ListBuilder
listBuilder
=
new
ListBuilder
(
AviExtractor
.
STRL
);
final
ListBuilder
listBuilder
=
new
ListBuilder
(
ListBox
.
TYPE_
STRL
);
listBuilder
.
addBox
(
DataHelper
.
getStreamNameBox
(
name
));
listBuilder
.
addBox
(
DataHelper
.
getStreamNameBox
(
name
));
final
ByteBuffer
listBuffer
=
listBuilder
.
build
();
final
ByteBuffer
listBuffer
=
listBuilder
.
build
();
final
FakeExtractorInput
fakeExtractorInput
=
new
FakeExtractorInput
.
Builder
().
setData
(
listBuffer
.
array
()).
build
();
final
FakeExtractorInput
fakeExtractorInput
=
new
FakeExtractorInput
.
Builder
().
setData
(
listBuffer
.
array
()).
build
();
...
...
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