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
fea2140d
authored
Apr 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add ability to query size/rate support in MediaCodecUtil.
parent
38efb1fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
View file @
fea2140d
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer
;
package
com
.
google
.
android
.
exoplayer
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.Util
;
import
com.google.android.exoplayer.util.Util
;
...
@@ -180,6 +181,33 @@ public class MediaCodecUtil {
...
@@ -180,6 +181,33 @@ public class MediaCodecUtil {
}
}
/**
/**
* Tests whether the device advertises it can decode video of a given type at a specified
* width, height, and frame rate.
* <p>
* Must not be called if the device SDK version is less than 21.
*
* @param mimeType The mime type.
* @param secure Whether the decoder is required to support secure decryption. Always pass false
* unless secure decryption really is required.
* @param width Width in pixels.
* @param height Height in pixels.
* @param frameRate Frame rate in frames per second.
* @return Whether the decoder advertises support of the given size and frame rate.
*/
@TargetApi
(
21
)
public
static
boolean
isSizeAndRateSupportedV21
(
String
mimeType
,
boolean
secure
,
int
width
,
int
height
,
double
frameRate
)
throws
DecoderQueryException
{
Assertions
.
checkState
(
Util
.
SDK_INT
>=
21
);
Pair
<
String
,
CodecCapabilities
>
info
=
getMediaCodecInfo
(
mimeType
,
secure
);
if
(
info
==
null
)
{
return
false
;
}
MediaCodecInfo
.
VideoCapabilities
videoCapabilities
=
info
.
second
.
getVideoCapabilities
();
return
videoCapabilities
!=
null
&&
videoCapabilities
.
areSizeAndRateSupported
(
width
,
height
,
frameRate
);
}
/**
* @param profile An AVC profile constant from {@link CodecProfileLevel}.
* @param profile An AVC profile constant from {@link CodecProfileLevel}.
* @param level An AVC profile level from {@link CodecProfileLevel}.
* @param level An AVC profile level from {@link CodecProfileLevel}.
* @return Whether the specified profile is supported at the specified level.
* @return Whether the specified profile is supported at the specified level.
...
...
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