public final class VideoCodec
- Object
- 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.
Constructors
Methods
public String getId() | The stable identifier of this codec, e.g. VideoIO#CODEC_H264. |
public String getName() | A human readable name for this codec, suitable for display in a picker. |
public String getMimeType() | The codec mime type when the platform reports one, otherwise null. |
public boolean isVideo() | True for a video codec, false for an audio codec. |
public boolean isEncoder() | True if this codec can be used for encoding. |
public boolean isDecoder() | True if this codec can be used for decoding. |
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). |
public int getMaxWidth() | The maximum width in pixels supported by this codec, or -1 if the platform does not report a limit. |
public int getMaxHeight() | The maximum height in pixels supported by this codec, or -1 if the platform does not report a limit. |
public String[] getSupportedContainers() | The container formats (e.g. VideoIO#CONTAINER_MP4) this codec can be muxed into. |
public String toString() | Returns a string representation of the object. |
Inherited methods
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
idString- the stable identifier of the codec, e.g. one of the
VideoIO#CODEC_H264constants nameString- a human readable name for display
mimeTypeString- the codec mime type when known (may be null)
videoboolean- true for a video codec, false for an audio codec
encoderboolean- true if this codec can encode
decoderboolean- true if this codec can decode
hardwareAcceleratedboolean- true if the codec is backed by dedicated hardware
maxWidthint- the maximum supported width in pixels, or -1 if unknown
maxHeightint- the maximum supported height in pixels, or -1 if unknown
supportedContainersString[]- the container formats this codec can be muxed into (may be empty)
Method details
getId
public String getId()The stable identifier of this codec, e.g.
VideoIO#CODEC_H264. Use this value
when configuring a VideoWriterBuilder.getName
public String getName()A human readable name for this codec, suitable for display in a picker.
getMimeType
public String 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
public String[] getSupportedContainers()The container formats (e.g.
VideoIO#CONTAINER_MP4) this codec can be muxed
into. May be empty when unknown.toString
public String toString()Returns 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())