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
70658118
authored
May 09, 2023
by
Googler
Committed by
Tofunmi Adigun-Hameed
May 11, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Adding mime type checking to Transformer to identify images.
PiperOrigin-RevId: 530711523
parent
f13f87ab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultAssetLoaderFactory.java
library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
View file @
70658118
...
...
@@ -148,7 +148,11 @@ public final class MimeTypes {
// image/ MIME types
public
static
final
String
IMAGE_PNG
=
BASE_TYPE_IMAGE
+
"/png"
;
public
static
final
String
IMAGE_WEBP
=
BASE_TYPE_IMAGE
+
"/webp"
;
public
static
final
String
IMAGE_JPEG
=
BASE_TYPE_IMAGE
+
"/jpeg"
;
public
static
final
String
IMAGE_HEIC
=
BASE_TYPE_IMAGE
+
"/heic"
;
public
static
final
String
IMAGE_HEIF
=
BASE_TYPE_IMAGE
+
"/heif"
;
/**
* A non-standard codec string for E-AC3-JOC. Use of this constant allows for disambiguation
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultAssetLoaderFactory.java
View file @
70658118
...
...
@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.util.Clock
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.common.collect.ImmutableList
;
import
java.util.Locale
;
import
org.checkerframework.checker.nullness.qual.MonotonicNonNull
;
...
...
@@ -113,6 +114,16 @@ public final class DefaultAssetLoaderFactory implements AssetLoader.Factory {
if
(
localConfiguration
==
null
)
{
return
false
;
}
if
(
localConfiguration
.
mimeType
!=
null
)
{
ImmutableList
<
String
>
supportedMimeTypes
=
ImmutableList
.
of
(
MimeTypes
.
IMAGE_PNG
,
MimeTypes
.
IMAGE_WEBP
,
MimeTypes
.
IMAGE_JPEG
,
MimeTypes
.
IMAGE_HEIC
,
MimeTypes
.
IMAGE_HEIF
);
return
supportedMimeTypes
.
contains
(
localConfiguration
.
mimeType
);
}
ImmutableList
<
String
>
supportedImageTypes
=
ImmutableList
.
of
(
".png"
,
".webp"
,
".jpg"
,
".jpeg"
,
".heic"
,
".heif"
);
String
uriPath
=
checkNotNull
(
localConfiguration
.
uri
.
getPath
());
...
...
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