Package org.schabi.newpipe.extractor
Enum MediaFormat
- java.lang.Object
-
- java.lang.Enum<MediaFormat>
-
- org.schabi.newpipe.extractor.MediaFormat
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MediaFormat>
public enum MediaFormat extends java.lang.Enum<MediaFormat>
Static data about various media formats support by NewPipe, eg mime type, extension
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.List<MediaFormat>
getAllFromMimeType(java.lang.String mimeType)
Get all media formats which have the given mime type.static MediaFormat
getFormatById(int id)
Get the media format by its id.static MediaFormat
getFromMimeType(java.lang.String mimeType)
Return the firstMediaFormat
with the supplied mime type.static MediaFormat
getFromSuffix(java.lang.String suffix)
Get the first media format that has the given suffix/file extension.static java.lang.String
getMimeById(int id)
Return the MIME type of the media format with the supplied idjava.lang.String
getMimeType()
Get the mime typejava.lang.String
getName()
Get the name of the formatstatic java.lang.String
getNameById(int id)
Return the friendly name of the media format with the supplied idjava.lang.String
getSuffix()
Get the filename extensionstatic java.lang.String
getSuffixById(int id)
Return the file extension of the media format with the supplied idstatic MediaFormat
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static MediaFormat[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MPEG_4
public static final MediaFormat MPEG_4
-
v3GPP
public static final MediaFormat v3GPP
-
WEBM
public static final MediaFormat WEBM
-
M4A
public static final MediaFormat M4A
-
WEBMA
public static final MediaFormat WEBMA
-
MP3
public static final MediaFormat MP3
-
MP2
public static final MediaFormat MP2
-
OPUS
public static final MediaFormat OPUS
-
OGG
public static final MediaFormat OGG
-
WEBMA_OPUS
public static final MediaFormat WEBMA_OPUS
-
AIFF
public static final MediaFormat AIFF
-
AIF
public static final MediaFormat AIF
Same asAIFF
, just with the shorter suffix/file extension
-
WAV
public static final MediaFormat WAV
-
FLAC
public static final MediaFormat FLAC
-
ALAC
public static final MediaFormat ALAC
-
VTT
public static final MediaFormat VTT
-
TTML
public static final MediaFormat TTML
-
TRANSCRIPT1
public static final MediaFormat TRANSCRIPT1
-
TRANSCRIPT2
public static final MediaFormat TRANSCRIPT2
-
TRANSCRIPT3
public static final MediaFormat TRANSCRIPT3
-
SRT
public static final MediaFormat SRT
-
-
Method Detail
-
values
public static MediaFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MediaFormat c : MediaFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MediaFormat valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getNameById
@Nonnull public static java.lang.String getNameById(int id)
Return the friendly name of the media format with the supplied id- Parameters:
id
- the id of the media format. Currently an arbitrary, NewPipe-specific number.- Returns:
- the friendly name of the MediaFormat associated with this ids, or an empty String if none match it.
-
getSuffixById
@Nonnull public static java.lang.String getSuffixById(int id)
Return the file extension of the media format with the supplied id- Parameters:
id
- the id of the media format. Currently an arbitrary, NewPipe-specific number.- Returns:
- the file extension of the MediaFormat associated with this ids, or an empty String if none match it.
-
getMimeById
@Nullable public static java.lang.String getMimeById(int id)
Return the MIME type of the media format with the supplied id- Parameters:
id
- the id of the media format. Currently an arbitrary, NewPipe-specific number.- Returns:
- the MIME type of the MediaFormat associated with this ids, or an empty String if none match it.
-
getFromMimeType
@Nullable public static MediaFormat getFromMimeType(java.lang.String mimeType)
Return the firstMediaFormat
with the supplied mime type. There might be more formats which have the same mime type. To retrieve those, usegetAllFromMimeType(String)
.- Returns:
- MediaFormat associated with this mime type, or null if none match it.
-
getAllFromMimeType
@Nonnull public static java.util.List<MediaFormat> getAllFromMimeType(java.lang.String mimeType)
Get all media formats which have the given mime type.- Parameters:
mimeType
- the mime type to search for- Returns:
- a modifiable
List
which contains theMediaFormat
s that have the given mime type.
-
getFormatById
@Nullable public static MediaFormat getFormatById(int id)
Get the media format by its id.- Parameters:
id
- the id- Returns:
- the id of the media format or null.
-
getFromSuffix
@Nullable public static MediaFormat getFromSuffix(java.lang.String suffix)
Get the first media format that has the given suffix/file extension.- Returns:
- the matching
MediaFormat
ornull
if no associated format is found
-
getName
@Nonnull public java.lang.String getName()
Get the name of the format- Returns:
- the name of the format
-
getSuffix
@Nonnull public java.lang.String getSuffix()
Get the filename extension- Returns:
- the filename extension
-
getMimeType
@Nonnull public java.lang.String getMimeType()
Get the mime type- Returns:
- the mime type
-
-