public final class VideoFormatSelectorUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int[] |
selectVideoFormats(List<? extends FormatWrapper> formatWrappers,
String[] allowedContainerMimeTypes,
boolean filterHdFormats,
boolean orientationMayChange,
boolean secureDecoder,
int viewportWidth,
int viewportHeight)
Chooses a suitable subset from a number of video formats.
|
static int[] |
selectVideoFormatsForDefaultDisplay(Context context,
List<? extends FormatWrapper> formatWrappers,
String[] allowedContainerMimeTypes,
boolean filterHdFormats)
Chooses a suitable subset from a number of video formats, to be rendered on the device's
default display.
|
public static int[] selectVideoFormatsForDefaultDisplay(Context context, List<? extends FormatWrapper> formatWrappers, String[] allowedContainerMimeTypes, boolean filterHdFormats) throws MediaCodecUtil.DecoderQueryException
context
- A context.formatWrappers
- Wrapped formats from which to select.allowedContainerMimeTypes
- An array of allowed container mime types. Null allows all
mime types.filterHdFormats
- True to filter HD formats. False otherwise.MediaCodecUtil.DecoderQueryException
- Thrown if there was an error querying decoders.public static int[] selectVideoFormats(List<? extends FormatWrapper> formatWrappers, String[] allowedContainerMimeTypes, boolean filterHdFormats, boolean orientationMayChange, boolean secureDecoder, int viewportWidth, int viewportHeight) throws MediaCodecUtil.DecoderQueryException
A format is filtered (i.e. not selected) if:
allowedContainerMimeTypes
is non-null and the format does not have one of the
permitted mime types.
filterHdFormats
is true and the format is HD.
formatWrappers
- Wrapped formats from which to select.allowedContainerMimeTypes
- An array of allowed container mime types. Null allows all
mime types.filterHdFormats
- True to filter HD formats. False otherwise.orientationMayChange
- True if the video's orientation may change with respect to the
viewport during playback.secureDecoder
- True if secure decoder is required.viewportWidth
- The width in pixels of the viewport within which the video will be
displayed. If the viewport size may change, this should be set to the maximum possible
width. -1 if selection should not be constrained by a viewport.viewportHeight
- The height in pixels of the viewport within which the video will be
displayed. If the viewport size may change, this should be set to the maximum possible
height. -1 if selection should not be constrained by a viewport.MediaCodecUtil.DecoderQueryException