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
29d978fd
authored
Jan 09, 2022
by
OxygenCobalt
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cleanup VorbisUtil
Slightly cleanup VorbisUtil.
parent
90b30568
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/VorbisUtil.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/VorbisUtil.java
View file @
29d978fd
...
@@ -302,8 +302,9 @@ public final class VorbisUtil {
...
@@ -302,8 +302,9 @@ public final class VorbisUtil {
Log
.
w
(
TAG
,
"Failed to parse Vorbis comment: "
+
vorbisComment
);
Log
.
w
(
TAG
,
"Failed to parse Vorbis comment: "
+
vorbisComment
);
}
else
{
}
else
{
if
(
keyAndValue
[
0
].
equals
(
"METADATA_BLOCK_PICTURE"
))
{
if
(
keyAndValue
[
0
].
equals
(
"METADATA_BLOCK_PICTURE"
))
{
// This tag is a special cover art tag. Decode it from Base64 and make it a
// This tag is a special cover art tag, outlined by
// PictureFrame.
// https://wiki.xiph.org/index.php/VorbisComment#Cover_art.
// Decode it from Base64 and transform it into a PictureFrame.
try
{
try
{
byte
[]
decoded
=
Base64
.
decode
(
keyAndValue
[
1
],
Base64
.
DEFAULT
);
byte
[]
decoded
=
Base64
.
decode
(
keyAndValue
[
1
],
Base64
.
DEFAULT
);
metadataEntries
.
add
(
buildPictureFrame
(
new
ParsableByteArray
(
decoded
)));
metadataEntries
.
add
(
buildPictureFrame
(
new
ParsableByteArray
(
decoded
)));
...
@@ -324,22 +325,22 @@ public final class VorbisUtil {
...
@@ -324,22 +325,22 @@ public final class VorbisUtil {
/**
/**
* Transforms a picture metadata block into a picture frame.
* Transforms a picture metadata block into a picture frame.
*
*
* @param
input
The bytes of the picture.
* @param
scratch
The bytes of the picture.
* @return A picture frame from the
input
data.
* @return A picture frame from the
scratch
data.
*/
*/
static
PictureFrame
buildPictureFrame
(
ParsableByteArray
input
)
{
static
PictureFrame
buildPictureFrame
(
ParsableByteArray
scratch
)
{
int
pictureType
=
input
.
readInt
();
int
pictureType
=
scratch
.
readInt
();
int
mimeTypeLength
=
input
.
readInt
();
int
mimeTypeLength
=
scratch
.
readInt
();
String
mimeType
=
input
.
readString
(
mimeTypeLength
,
Charsets
.
US_ASCII
);
String
mimeType
=
scratch
.
readString
(
mimeTypeLength
,
Charsets
.
US_ASCII
);
int
descriptionLength
=
input
.
readInt
();
int
descriptionLength
=
scratch
.
readInt
();
String
description
=
input
.
readString
(
descriptionLength
);
String
description
=
scratch
.
readString
(
descriptionLength
);
int
width
=
input
.
readInt
();
int
width
=
scratch
.
readInt
();
int
height
=
input
.
readInt
();
int
height
=
scratch
.
readInt
();
int
depth
=
input
.
readInt
();
int
depth
=
scratch
.
readInt
();
int
colors
=
input
.
readInt
();
int
colors
=
scratch
.
readInt
();
int
pictureDataLength
=
input
.
readInt
();
int
pictureDataLength
=
scratch
.
readInt
();
byte
[]
pictureData
=
new
byte
[
pictureDataLength
];
byte
[]
pictureData
=
new
byte
[
pictureDataLength
];
input
.
readBytes
(
pictureData
,
0
,
pictureDataLength
);
scratch
.
readBytes
(
pictureData
,
0
,
pictureDataLength
);
return
new
PictureFrame
(
return
new
PictureFrame
(
pictureType
,
mimeType
,
description
,
width
,
height
,
depth
,
colors
,
pictureData
);
pictureType
,
mimeType
,
description
,
width
,
height
,
depth
,
colors
,
pictureData
);
...
...
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