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
6f41585e
authored
Jan 22, 2022
by
Dustin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
AvcAviTrack cleanup
parent
5ebaafde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AvcAviTrack.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AvcAviTrack.java
View file @
6f41585e
...
@@ -71,7 +71,6 @@ public class AvcAviTrack extends AviTrack{
...
@@ -71,7 +71,6 @@ public class AvcAviTrack extends AviTrack{
maxPicCount
=
1
<<
(
spsData
.
picOrderCntLsbLength
);
maxPicCount
=
1
<<
(
spsData
.
picOrderCntLsbLength
);
posHalf
=
maxPicCount
/
2
;
//Not sure why pics are 2x
posHalf
=
maxPicCount
/
2
;
//Not sure why pics are 2x
negHalf
=
-
posHalf
;
negHalf
=
-
posHalf
;
//Not sure if this works after the fact
if
(
spsData
.
pixelWidthHeightRatio
!=
pixelWidthHeightRatio
)
{
if
(
spsData
.
pixelWidthHeightRatio
!=
pixelWidthHeightRatio
)
{
formatBuilder
.
setPixelWidthHeightRatio
(
spsData
.
pixelWidthHeightRatio
);
formatBuilder
.
setPixelWidthHeightRatio
(
spsData
.
pixelWidthHeightRatio
);
trackOutput
.
format
(
formatBuilder
.
build
());
trackOutput
.
format
(
formatBuilder
.
build
());
...
@@ -106,7 +105,7 @@ public class AvcAviTrack extends AviTrack{
...
@@ -106,7 +105,7 @@ public class AvcAviTrack extends AviTrack{
int
getPicOrderCountLsb
(
byte
[]
peek
)
{
int
getPicOrderCountLsb
(
byte
[]
peek
)
{
if
(
peek
[
3
]
!=
1
)
{
if
(
peek
[
3
]
!=
1
)
{
return
0
;
return
-
1
;
}
}
final
ParsableNalUnitBitArray
in
=
new
ParsableNalUnitBitArray
(
peek
,
5
,
peek
.
length
);
final
ParsableNalUnitBitArray
in
=
new
ParsableNalUnitBitArray
(
peek
,
5
,
peek
.
length
);
//slide_header()
//slide_header()
...
@@ -126,10 +125,10 @@ public class AvcAviTrack extends AviTrack{
...
@@ -126,10 +125,10 @@ public class AvcAviTrack extends AviTrack{
//We skip IDR in the switch
//We skip IDR in the switch
if
(
spsData
.
picOrderCountType
==
0
)
{
if
(
spsData
.
picOrderCountType
==
0
)
{
int
picOrderCountLsb
=
in
.
readBits
(
spsData
.
picOrderCntLsbLength
);
int
picOrderCountLsb
=
in
.
readBits
(
spsData
.
picOrderCntLsbLength
);
Log
.
d
(
"Test"
,
"FrameNum: "
+
frame
+
" cnt="
+
picOrderCountLsb
);
//
Log.d("Test", "FrameNum: " + frame + " cnt=" + picOrderCountLsb);
return
picOrderCountLsb
;
return
picOrderCountLsb
;
}
}
return
0
;
return
-
1
;
}
}
@Override
@Override
...
@@ -144,6 +143,10 @@ public class AvcAviTrack extends AviTrack{
...
@@ -144,6 +143,10 @@ public class AvcAviTrack extends AviTrack{
case
3
:
case
3
:
case
4
:
{
case
4
:
{
final
int
picCount
=
getPicOrderCountLsb
(
peek
);
final
int
picCount
=
getPicOrderCountLsb
(
peek
);
if
(
picCount
<
0
)
{
Log
.
d
(
AviExtractor
.
TAG
,
"Error getting PicOrder"
);
seekFrame
(
frame
);
}
int
delta
=
picCount
-
lastPicCount
;
int
delta
=
picCount
-
lastPicCount
;
if
(
delta
<
negHalf
)
{
if
(
delta
<
negHalf
)
{
delta
+=
maxPicCount
;
delta
+=
maxPicCount
;
...
@@ -167,18 +170,4 @@ public class AvcAviTrack extends AviTrack{
...
@@ -167,18 +170,4 @@ public class AvcAviTrack extends AviTrack{
}
}
return
super
.
newChunk
(
tag
,
size
,
input
);
return
super
.
newChunk
(
tag
,
size
,
input
);
}
}
public
static
String
toString
(
byte
[]
buffer
,
int
i
,
final
int
len
)
{
final
StringBuilder
sb
=
new
StringBuilder
((
len
-
i
)
*
3
);
while
(
i
<
len
)
{
String
hex
=
Integer
.
toHexString
(
buffer
[
i
]
&
0xff
);
if
(
hex
.
length
()
==
1
)
{
sb
.
append
(
'0'
);
}
sb
.
append
(
hex
);
sb
.
append
(
' '
);
i
++;
}
return
sb
.
toString
();
}
}
}
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