Class VideoCodec
Describes a single codec made available by the underlying platform, as returned by
VideoIO#getAvailableEncoders() and VideoIO#getAvailableDecoders(). This lets an
application discover, at runtime, which codecs the device can actually use and pick
the best one for its needs.
Instances are immutable value objects. Capability fields that the platform cannot
report are returned as -1 (integers) or empty arrays.
-
Constructor Summary
ConstructorsConstructorDescriptionVideoCodec(String id, String name, String mimeType, boolean video, boolean encoder, boolean decoder, boolean hardwareAccelerated, int maxWidth, int maxHeight, String[] supportedContainers) Creates a codec descriptor. -
Method Summary
Modifier and TypeMethodDescriptiongetId()The stable identifier of this codec, e.g.intThe maximum height in pixels supported by this codec, or -1 if the platform does not report a limit.intThe maximum width in pixels supported by this codec, or -1 if the platform does not report a limit.The codec mime type when the platform reports one, otherwise null.getName()A human readable name for this codec, suitable for display in a picker.String[]The container formats (e.g.VideoIO#CONTAINER_MP4) this codec can be muxed into.booleanTrue if this codec can be used for decoding.booleanTrue if this codec can be used for encoding.booleanTrue if this codec is backed by dedicated hardware (and therefore typically much faster and more power efficient than a software codec).booleanisVideo()True for a video codec, false for an audio codec.toString()Returns a string representation of the object.
-
Constructor Details
-
VideoCodec
public VideoCodec(String id, String name, String mimeType, boolean video, boolean encoder, boolean decoder, boolean hardwareAccelerated, int maxWidth, int maxHeight, String[] supportedContainers) Creates a codec descriptor. Normally created by platform implementations rather than application code.
Parameters
-
id: the stable identifier of the codec, e.g. one of theVideoIO#CODEC_H264constants -
name: a human readable name for display -
mimeType: the codec mime type when known (may be null) -
video: true for a video codec, false for an audio codec -
encoder: true if this codec can encode -
decoder: true if this codec can decode -
hardwareAccelerated: true if the codec is backed by dedicated hardware -
maxWidth: the maximum supported width in pixels, or -1 if unknown -
maxHeight: the maximum supported height in pixels, or -1 if unknown -
supportedContainers: the container formats this codec can be muxed into (may be empty)
-
-
-
Method Details
-
getId
The stable identifier of this codec, e.g.VideoIO#CODEC_H264. Use this value when configuring aVideoWriterBuilder. -
getName
A human readable name for this codec, suitable for display in a picker. -
getMimeType
The codec mime type when the platform reports one, otherwise null. -
isVideo
public boolean isVideo()True for a video codec, false for an audio codec. -
isEncoder
public boolean isEncoder()True if this codec can be used for encoding. -
isDecoder
public boolean isDecoder()True if this codec can be used for decoding. -
isHardwareAccelerated
public boolean isHardwareAccelerated()True if this codec is backed by dedicated hardware (and therefore typically much faster and more power efficient than a software codec). -
getMaxWidth
public int getMaxWidth()The maximum width in pixels supported by this codec, or -1 if the platform does not report a limit. -
getMaxHeight
public int getMaxHeight()The maximum height in pixels supported by this codec, or -1 if the platform does not report a limit. -
getSupportedContainers
The container formats (e.g.VideoIO#CONTAINER_MP4) this codec can be muxed into. May be empty when unknown. -
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-