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
19629513
authored
Jun 11, 2021
by
samrobinson
Committed by
Oliver Woodman
Jun 15, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Populate MediaMetadata artwork from PictureFrame.
PiperOrigin-RevId: 378889901
parent
aeeef654
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
library/common/src/main/java/com/google/android/exoplayer2/metadata/flac/PictureFrame.java
library/common/src/test/java/com/google/android/exoplayer2/metadata/flac/PictureFrameTest.java
library/common/src/main/java/com/google/android/exoplayer2/metadata/flac/PictureFrame.java
View file @
19629513
...
...
@@ -20,6 +20,7 @@ import static com.google.android.exoplayer2.util.Util.castNonNull;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
java.util.Arrays
;
...
...
@@ -74,6 +75,11 @@ public final class PictureFrame implements Metadata.Entry {
}
@Override
public
void
populateMediaMetadata
(
MediaMetadata
.
Builder
builder
)
{
builder
.
setArtworkData
(
pictureData
);
}
@Override
public
String
toString
()
{
return
"Picture: mimeType="
+
mimeType
+
", description="
+
description
;
}
...
...
library/common/src/test/java/com/google/android/exoplayer2/metadata/flac/PictureFrameTest.java
View file @
19629513
...
...
@@ -19,6 +19,9 @@ import static com.google.common.truth.Truth.assertThat;
import
android.os.Parcel
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -39,4 +42,25 @@ public final class PictureFrameTest {
parcel
.
recycle
();
}
@Test
public
void
populateMediaMetadata_setsMediaMetadataValue
()
{
byte
[]
pictureData
=
new
byte
[]
{-
12
,
52
,
33
,
85
,
34
,
22
,
1
,
-
55
};
Metadata
.
Entry
entry
=
new
PictureFrame
(
/* pictureType= */
0x03
,
/* mimeType= */
MimeTypes
.
IMAGE_JPEG
,
/* description= */
"an image"
,
/* width= */
4
,
/* height= */
2
,
/* depth= */
1
,
/* colors= */
1
,
pictureData
);
MediaMetadata
.
Builder
builder
=
MediaMetadata
.
EMPTY
.
buildUpon
();
entry
.
populateMediaMetadata
(
builder
);
MediaMetadata
mediaMetadata
=
builder
.
build
();
assertThat
(
mediaMetadata
.
artworkData
).
isEqualTo
(
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