Package com.amilesend.mediainfo
Class MediaInfo
- All Implemented Interfaces:
AutoCloseable
The default optional class to access media file attributes without the need to define a customized class that
extends
MediaInfoBase
.
Example usage:
MediaInfoLibrary library = MediaInfoLibrary.newInstance(); MediaInfoAccessor accessor = new MediaInfoAccessor(library); try (MediaInfo myVideo = new MediaInfo(accessor).open("./MyVideo.mkv")) { ListvideoCodecs = MediaInfo.parseList(myVideo.get(StreamType.General, 0, "Video_Codec_List")); int videoWidth = Integer.parseInt(myVideo.get(StreamType.Video, 0, "Width")); // Get and parse additional parameters... }
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget
(StreamType streamType, int streamNumber, int parameterIndex) Get a piece of information about a file (parameter is an integer that represents the parameter index).get
(StreamType streamType, int streamNumber, int parameterIndex, InfoType infoType) Get a piece of information about a file (parameter is an integer that represents the parameter index).get
(StreamType streamType, int streamNumber, String parameter) Get a piece of information about a file (parameter is a string).get
(StreamType streamType, int streamNumber, String parameter, InfoType infoType) Get a piece of information about a file (parameter is a string).get
(StreamType streamType, int streamNumber, String parameter, InfoType infoType, InfoType searchType) Get a piece of information about a file (parameter is a string).Gets information about MediaInfo.int
getStreamCount
(StreamType streamType) Gets the number of streams for the given stream type.int
getStreamOrParameterCount
(StreamType streamType, int streamNumber) Gets the number of streams for the given stream type or the total count of information parameters for a stream.inform()
Get all details about a file.Configures information about MediaInfo.Methods inherited from class com.amilesend.mediainfo.MediaInfoBase
close, open, parseList, parseTime
-
Constructor Details
-
MediaInfo
Creates a newMediaInfo
object.- Parameters:
accessor
- the accessor used to call the underling libMediaInfo library.
-
-
Method Details
-
inform
Get all details about a file.- Returns:
- All details about a file in one string
-
get
Get a piece of information about a file (parameter is a string).- Parameters:
streamType
- the stream typestreamNumber
- the stream numberparameter
- the parameter you are looking for in the stream (e.g., resolution, codec, bitrate, etc.)- Returns:
- the query result, or empty if there is a problem or not found
- See Also:
-
get
Get a piece of information about a file (parameter is a string).- Parameters:
streamType
- the stream typestreamNumber
- the stream numberparameter
- the parameter you are looking for in the stream (e.g., resolution, codec, bitrate, etc.)infoType
- the type of information about the parameter- See Also:
-
get
public String get(StreamType streamType, int streamNumber, String parameter, InfoType infoType, InfoType searchType) Get a piece of information about a file (parameter is a string). For a list of available parameters, please refer to General.csv.- Parameters:
streamType
- the stream typestreamNumber
- the stream numberparameter
- the parameter you are looking for in the stream (e.g., resolution, codec, bitrate, etc.)infoType
- the type of information about the parametersearchType
- describes where to look for the parameter- Returns:
- the queries information; or an empty string if there was a problem
-
get
Get a piece of information about a file (parameter is an integer that represents the parameter index).- Parameters:
streamType
- the stream typestreamNumber
- the stream numberparameterIndex
- the parameter index that you are looking for in the stream- Returns:
- a string about information you search, an empty string if there is a problem
-
get
Get a piece of information about a file (parameter is an integer that represents the parameter index).- Parameters:
streamType
- the stream typestreamNumber
- the stream numberparameterIndex
- the parameter index that you are looking for in the streaminfoType
- the type of information you want about the parameter (the text, the measure, the help...)- Returns:
- the information or an empty string if there is a problem
-
getStreamCount
Gets the number of streams for the given stream type.- Parameters:
streamType
- the stream type- Returns:
- number of streams of the given stream type
-
getStreamOrParameterCount
Gets the number of streams for the given stream type or the total count of information parameters for a stream.- Parameters:
streamType
- the stream typestreamNumber
- the stream number- Returns:
- number of streams of the given stream type
-
getOption
Gets information about MediaInfo.- Parameters:
option
- The name of option- Returns:
- the option value
-
setOption
Configures information about MediaInfo.- Parameters:
option
- The name of optionvalue
- The value of option- Returns:
""
means no; else, any other value means yes
-