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
bb6b0e1a
authored
Aug 07, 2019
by
ibaker
Committed by
Oliver Woodman
Sep 02, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Expose a method on EventMessageDecoder that returns EventMessage directly
PiperOrigin-RevId: 262121134
parent
acdb19e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
library/core/src/main/java/com/google/android/exoplayer2/metadata/emsg/EventMessageDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/metadata/emsg/EventMessageDecoder.java
View file @
bb6b0e1a
...
...
@@ -37,7 +37,10 @@ public final class EventMessageDecoder implements MetadataDecoder {
ByteBuffer
buffer
=
inputBuffer
.
data
;
byte
[]
data
=
buffer
.
array
();
int
size
=
buffer
.
limit
();
ParsableByteArray
emsgData
=
new
ParsableByteArray
(
data
,
size
);
return
new
Metadata
(
decode
(
new
ParsableByteArray
(
data
,
size
)));
}
public
EventMessage
decode
(
ParsableByteArray
emsgData
)
{
String
schemeIdUri
=
Assertions
.
checkNotNull
(
emsgData
.
readNullTerminatedString
());
String
value
=
Assertions
.
checkNotNull
(
emsgData
.
readNullTerminatedString
());
long
timescale
=
emsgData
.
readUnsignedInt
();
...
...
@@ -50,8 +53,9 @@ public final class EventMessageDecoder implements MetadataDecoder {
long
durationMs
=
Util
.
scaleLargeTimestamp
(
emsgData
.
readUnsignedInt
(),
C
.
MILLIS_PER_SECOND
,
timescale
);
long
id
=
emsgData
.
readUnsignedInt
();
byte
[]
messageData
=
Arrays
.
copyOfRange
(
data
,
emsgData
.
getPosition
(),
size
);
return
new
Metadata
(
new
EventMessage
(
schemeIdUri
,
value
,
durationMs
,
id
,
messageData
));
byte
[]
messageData
=
Arrays
.
copyOfRange
(
emsgData
.
data
,
emsgData
.
getPosition
(),
emsgData
.
limit
());
return
new
EventMessage
(
schemeIdUri
,
value
,
durationMs
,
id
,
messageData
);
}
}
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