public static final class MediaCodecInfo.VideoCapabilities extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
areSizeAndRateSupported(int width,
int height,
double frameRate)
Returns whether a given video size (
width and
height ) and frameRate combination is supported. |
static MediaCodecInfo.VideoCapabilities |
create(MediaFormat info,
MediaCodecInfo.CodecCapabilities parent) |
static int |
equivalentVP9Level(MediaFormat info) |
Range<Double> |
getAchievableFrameRatesFor(int width,
int height)
Returns the range of achievable video frame rates for a video size.
|
Range<Rational> |
getAspectRatioRange(boolean blocks) |
Range<Integer> |
getBitrateRange()
Returns the range of supported bitrates in bits/second.
|
Range<Integer> |
getBlockCountRange() |
Size |
getBlockSize() |
Range<Long> |
getBlocksPerSecondRange() |
int |
getHeightAlignment()
Returns the alignment requirement for video height (in pixels).
|
int |
getSmallerDimensionUpperLimit()
Return the upper limit on the smaller dimension of width or height.
|
Range<Integer> |
getSupportedFrameRates()
Returns the range of supported frame rates.
|
Range<Double> |
getSupportedFrameRatesFor(int width,
int height)
Returns the range of supported video frame rates for a video size.
|
Range<Integer> |
getSupportedHeights()
Returns the range of supported video heights.
|
Range<Integer> |
getSupportedHeightsFor(int width)
Returns the range of supported video heights for a video width
|
Range<Integer> |
getSupportedWidths()
Returns the range of supported video widths.
|
Range<Integer> |
getSupportedWidthsFor(int height)
Returns the range of supported video widths for a video height.
|
int |
getWidthAlignment()
Returns the alignment requirement for video width (in pixels).
|
void |
init(MediaFormat info,
MediaCodecInfo.CodecCapabilities parent) |
boolean |
isSizeSupported(int width,
int height)
Returns whether a given video size (
width and
height ) is supported. |
boolean |
supportsFormat(MediaFormat format) |
public Range<Integer> getBitrateRange()
public Range<Integer> getSupportedWidths()
public Range<Integer> getSupportedHeights()
public int getWidthAlignment()
public int getHeightAlignment()
public int getSmallerDimensionUpperLimit()
Math.min(getSupportedWidths().getUpper(),
getSupportedHeights().getUpper())
.public Range<Integer> getSupportedFrameRates()
This is not a performance indicator. Rather, it expresses the limits specified in the coding standard, based on the complexities of encoding material for later playback at a certain frame rate, or the decoding of such material in non-realtime.
public Range<Integer> getSupportedWidthsFor(int height)
height
- the height of the videopublic Range<Integer> getSupportedHeightsFor(int width)
width
- the width of the videopublic Range<Double> getSupportedFrameRatesFor(int width, int height)
This is not a performance indicator. Rather, it expresses the limits specified in the coding standard, based on the complexities of encoding material of a given size for later playback at a certain frame rate, or the decoding of such material in non-realtime.
width
- the width of the videoheight
- the height of the videopublic Range<Double> getAchievableFrameRatesFor(int width, int height)
null
, if the codec did not publish any measurement
data.
This is a performance estimate provided by the device manufacturer based on statistical sampling of full-speed decoding and encoding measurements in various configurations of common video sizes supported by the codec. As such it should only be used to compare individual codecs on the device. The value is not suitable for comparing different devices or even different android releases for the same device.
On Build.VERSION_CODES.M
release the returned range
corresponds to the fastest frame rates achieved in the tested configurations. As
such, it should not be used to gauge guaranteed or even average codec performance
on the device.
On Build.VERSION_CODES.N
release the returned range
corresponds closer to sustained performance in tested configurations.
One can expect to achieve sustained performance higher than the lower limit more than
50% of the time, and higher than half of the lower limit at least 90% of the time
in tested configurations.
Conversely, one can expect performance lower than twice the upper limit at least
90% of the time.
Tested configurations use a single active codec. For use cases where multiple codecs are active, applications can expect lower and in most cases significantly lower performance.
The returned range value is interpolated from the nearest frame size(s) tested. Codec performance is severely impacted by other activity on the device as well as environmental factors (such as battery level, temperature or power source), and can vary significantly even in a steady environment.
Use this method in cases where only codec performance matters, e.g. to evaluate if
a codec has any chance of meeting a performance target. Codecs are listed
in MediaCodecList
in the preferred order as defined by the device
manufacturer. As such, applications should use the first suitable codec in the
list to achieve the best balance between power use and performance.
width
- the width of the videoheight
- the height of the videoIllegalArgumentException
- if the video size is not supported.public boolean areSizeAndRateSupported(int width, int height, double frameRate)
width
and
height
) and frameRate
combination is supported.public boolean isSizeSupported(int width, int height)
width
and
height
) is supported.public boolean supportsFormat(MediaFormat format)
ClassCastException
public static MediaCodecInfo.VideoCapabilities create(MediaFormat info, MediaCodecInfo.CodecCapabilities parent)
public void init(MediaFormat info, MediaCodecInfo.CodecCapabilities parent)
public Size getBlockSize()
public static int equivalentVP9Level(MediaFormat info)