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
81a290f1
authored
Aug 14, 2019
by
sofijajvc
Committed by
Andrew Lewis
Aug 15, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add internal method for format support
PiperOrigin-RevId: 263312721
parent
b77b9f5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
14 deletions
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/video/SimpleDecoderVideoRenderer.java
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/LibvpxVideoRenderer.java
View file @
81a290f1
...
@@ -204,15 +204,20 @@ public class LibvpxVideoRenderer extends SimpleDecoderVideoRenderer {
...
@@ -204,15 +204,20 @@ public class LibvpxVideoRenderer extends SimpleDecoderVideoRenderer {
}
}
@Override
@Override
public
int
supportsFormat
(
Format
format
)
{
protected
int
supportsFormatInternal
(
@Nullable
DrmSessionManager
<
ExoMediaCrypto
>
drmSessionManager
,
Format
format
)
{
if
(!
VpxLibrary
.
isAvailable
()
||
!
MimeTypes
.
VIDEO_VP9
.
equalsIgnoreCase
(
format
.
sampleMimeType
))
{
if
(!
VpxLibrary
.
isAvailable
()
||
!
MimeTypes
.
VIDEO_VP9
.
equalsIgnoreCase
(
format
.
sampleMimeType
))
{
return
FORMAT_UNSUPPORTED_TYPE
;
return
FORMAT_UNSUPPORTED_TYPE
;
}
}
if
(
format
.
drmInitData
==
null
boolean
drmIsSupported
=
||
VpxLibrary
.
matchesExpectedExoMediaCryptoType
(
format
.
exoMediaCryptoType
))
{
format
.
drmInitData
==
null
return
FORMAT_HANDLED
|
ADAPTIVE_SEAMLESS
;
||
VpxLibrary
.
matchesExpectedExoMediaCryptoType
(
format
.
exoMediaCryptoType
)
||
(
format
.
exoMediaCryptoType
==
null
&&
supportsFormatDrm
(
drmSessionManager
,
format
.
drmInitData
));
if
(!
drmIsSupported
)
{
return
FORMAT_UNSUPPORTED_DRM
;
}
}
return
super
.
supportsFormat
(
format
)
;
return
FORMAT_HANDLED
|
ADAPTIVE_SEAMLESS
;
}
}
@Override
@Override
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/SimpleDecoderVideoRenderer.java
View file @
81a290f1
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.C;
...
@@ -27,6 +27,7 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.FormatHolder
;
import
com.google.android.exoplayer2.FormatHolder
;
import
com.google.android.exoplayer2.RendererCapabilities
;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.decoder.DecoderCounters
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.decoder.DecoderInputBuffer
;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
...
@@ -155,15 +156,8 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
...
@@ -155,15 +156,8 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
// BaseRenderer implementation.
// BaseRenderer implementation.
@Override
@Override
public
int
supportsFormat
(
Format
format
)
{
public
final
int
supportsFormat
(
Format
format
)
{
boolean
drmIsSupported
=
return
supportsFormatInternal
(
drmSessionManager
,
format
);
format
.
drmInitData
==
null
||
(
format
.
exoMediaCryptoType
==
null
&&
supportsFormatDrm
(
drmSessionManager
,
format
.
drmInitData
));
if
(!
drmIsSupported
)
{
return
FORMAT_UNSUPPORTED_DRM
;
}
return
FORMAT_HANDLED
|
ADAPTIVE_SEAMLESS
;
}
}
@Override
@Override
...
@@ -527,6 +521,17 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
...
@@ -527,6 +521,17 @@ public abstract class SimpleDecoderVideoRenderer extends BaseRenderer {
}
}
/**
/**
* Returns the extent to which the subclass supports a given format.
*
* @param drmSessionManager The renderer's {@link DrmSessionManager}.
* @param format The format, which has a video {@link Format#sampleMimeType}.
* @return The extent to which the subclass supports the format itself.
* @see RendererCapabilities#supportsFormat(Format)
*/
protected
abstract
int
supportsFormatInternal
(
@Nullable
DrmSessionManager
<
ExoMediaCrypto
>
drmSessionManager
,
Format
format
);
/**
* Creates a decoder for the given format.
* Creates a decoder for the given format.
*
*
* @param format The format for which a decoder is required.
* @param format The format for which a decoder is required.
...
...
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