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
daa58359
authored
Oct 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Timestamp HEVC samples based on the first NALU's timestamp.
Issue: #893
parent
c0a81e11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
library/src/main/java/com/google/android/exoplayer/extractor/ts/H265Reader.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/H265Reader.java
View file @
daa58359
...
@@ -120,7 +120,7 @@ import java.util.Collections;
...
@@ -120,7 +120,7 @@ import java.util.Collections;
// Indicate the start of the next NAL unit.
// Indicate the start of the next NAL unit.
int
nalUnitType
=
NalUnitUtil
.
getH265NalUnitType
(
dataArray
,
nalUnitOffset
);
int
nalUnitType
=
NalUnitUtil
.
getH265NalUnitType
(
dataArray
,
nalUnitOffset
);
startNalUnit
(
absolutePosition
,
bytesWrittenPastPosition
,
nalUnitType
);
startNalUnit
(
absolutePosition
,
bytesWrittenPastPosition
,
nalUnitType
,
pesTimeUs
);
// Continue scanning the data.
// Continue scanning the data.
offset
=
nalUnitOffset
+
3
;
offset
=
nalUnitOffset
+
3
;
}
else
{
}
else
{
...
@@ -136,7 +136,7 @@ import java.util.Collections;
...
@@ -136,7 +136,7 @@ import java.util.Collections;
// Do nothing.
// Do nothing.
}
}
private
void
startNalUnit
(
long
position
,
int
offset
,
int
nalUnitType
)
{
private
void
startNalUnit
(
long
position
,
int
offset
,
int
nalUnitType
,
long
pesTimeUs
)
{
if
(!
hasOutputFormat
)
{
if
(!
hasOutputFormat
)
{
vps
.
startNalUnit
(
nalUnitType
);
vps
.
startNalUnit
(
nalUnitType
);
sps
.
startNalUnit
(
nalUnitType
);
sps
.
startNalUnit
(
nalUnitType
);
...
@@ -144,7 +144,7 @@ import java.util.Collections;
...
@@ -144,7 +144,7 @@ import java.util.Collections;
}
}
prefixSei
.
startNalUnit
(
nalUnitType
);
prefixSei
.
startNalUnit
(
nalUnitType
);
suffixSei
.
startNalUnit
(
nalUnitType
);
suffixSei
.
startNalUnit
(
nalUnitType
);
sampleReader
.
startNalUnit
(
position
,
offset
,
nalUnitType
);
sampleReader
.
startNalUnit
(
position
,
offset
,
nalUnitType
,
pesTimeUs
);
}
}
private
void
nalUnitData
(
byte
[]
dataArray
,
int
offset
,
int
limit
)
{
private
void
nalUnitData
(
byte
[]
dataArray
,
int
offset
,
int
limit
)
{
...
@@ -161,7 +161,7 @@ import java.util.Collections;
...
@@ -161,7 +161,7 @@ import java.util.Collections;
private
void
nalUnitEnd
(
long
position
,
int
offset
,
int
discardPadding
,
long
pesTimeUs
)
{
private
void
nalUnitEnd
(
long
position
,
int
offset
,
int
discardPadding
,
long
pesTimeUs
)
{
if
(
hasOutputFormat
)
{
if
(
hasOutputFormat
)
{
sampleReader
.
endNalUnit
(
position
,
offset
,
pesTimeUs
);
sampleReader
.
endNalUnit
(
position
,
offset
);
}
else
{
}
else
{
vps
.
endNalUnit
(
discardPadding
);
vps
.
endNalUnit
(
discardPadding
);
sps
.
endNalUnit
(
discardPadding
);
sps
.
endNalUnit
(
discardPadding
);
...
@@ -377,6 +377,7 @@ import java.util.Collections;
...
@@ -377,6 +377,7 @@ import java.util.Collections;
private
long
nalUnitStartPosition
;
private
long
nalUnitStartPosition
;
private
boolean
nalUnitHasKeyframeData
;
private
boolean
nalUnitHasKeyframeData
;
private
int
nalUnitBytesRead
;
private
int
nalUnitBytesRead
;
private
long
nalUnitTimeUs
;
private
boolean
lookingForFirstSliceFlag
;
private
boolean
lookingForFirstSliceFlag
;
private
boolean
firstSliceFlag
;
private
boolean
firstSliceFlag
;
...
@@ -396,8 +397,9 @@ import java.util.Collections;
...
@@ -396,8 +397,9 @@ import java.util.Collections;
readingSample
=
false
;
readingSample
=
false
;
}
}
public
void
startNalUnit
(
long
position
,
int
offset
,
int
nalUnitType
)
{
public
void
startNalUnit
(
long
position
,
int
offset
,
int
nalUnitType
,
long
pesTimeUs
)
{
firstSliceFlag
=
false
;
firstSliceFlag
=
false
;
nalUnitTimeUs
=
pesTimeUs
;
nalUnitBytesRead
=
0
;
nalUnitBytesRead
=
0
;
nalUnitStartPosition
=
position
;
nalUnitStartPosition
=
position
;
// Flush the previous sample when reading a non-VCL NAL unit.
// Flush the previous sample when reading a non-VCL NAL unit.
...
@@ -422,7 +424,7 @@ import java.util.Collections;
...
@@ -422,7 +424,7 @@ import java.util.Collections;
}
}
}
}
public
void
endNalUnit
(
long
position
,
int
offset
,
long
timeUs
)
{
public
void
endNalUnit
(
long
position
,
int
offset
)
{
if
(
firstSliceFlag
)
{
if
(
firstSliceFlag
)
{
// If the NAL unit ending is the start of a new sample, output the previous one.
// If the NAL unit ending is the start of a new sample, output the previous one.
if
(
readingSample
)
{
if
(
readingSample
)
{
...
@@ -430,7 +432,7 @@ import java.util.Collections;
...
@@ -430,7 +432,7 @@ import java.util.Collections;
outputSample
(
offset
+
nalUnitLength
);
outputSample
(
offset
+
nalUnitLength
);
}
}
samplePosition
=
nalUnitStartPosition
;
samplePosition
=
nalUnitStartPosition
;
sampleTimeUs
=
t
imeUs
;
sampleTimeUs
=
nalUnitT
imeUs
;
readingSample
=
true
;
readingSample
=
true
;
sampleIsKeyframe
=
nalUnitHasKeyframeData
;
sampleIsKeyframe
=
nalUnitHasKeyframeData
;
}
}
...
...
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