Class MediaInfoAccessor
java.lang.Object
com.amilesend.mediainfo.lib.MediaInfoAccessor
- All Implemented Interfaces:
AutoCloseable
The object used by java applications to interact with the libMediaInfo library.
-
Constructor Summary
ConstructorsConstructorDescriptionMediaInfoAccessor(@NonNull MediaInfoLibrary mediaInfoLibrary) Creates a newMediaInfoobject. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the library instance.voidCloses a file handle that was previously opened.voiddispose()Disposes of the library instance reference.get(@NonNull StreamType streamType, int streamNumber, int parameterIndex, @NonNull InfoType infoType) Get a piece of information about a file (parameter is an integer that represents the parameter index).get(@NonNull StreamType streamType, int streamNumber, String parameter, @NonNull InfoType infoType, @NonNull InfoType searchType) Get a piece of information about a file (parameter is a string).get(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, 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).Gets information about MediaInfo.intgetStreamCount(@NonNull StreamType streamType) Gets the number of streams for the given stream type.intgetStreamOrParameterCount(@NonNull 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.booleanOpens a file to parse.intopenBufferContinue(@NonNull byte[] buffer, int size) Reads from a memory buffer to parse media information and tags.longTests if there is request to seek to another position in the stream.intCloses the buffer upon read completion.booleanopenBufferInit(long length, long offset) Prepares a memory buffer for reading and parsing media information from a stream.Configures information about MediaInfo.
-
Constructor Details
-
MediaInfoAccessor
Creates a newMediaInfoobject.- Parameters:
mediaInfoLibrary- the library instance- See Also:
-
-
Method Details
-
close
-
dispose
public void dispose()Disposes of the library instance reference. -
open
Opens a file to parse.- Parameters:
fileName- the full path and filename to open- Returns:
trueif file was opened; else,false
-
openBufferInit
public boolean openBufferInit(long length, long offset) Prepares a memory buffer for reading and parsing media information from a stream.- Parameters:
length- the length of the bufferoffset- the byte offset to start reading from- Returns:
trueif the buffer was successfully initialized; else,false
-
openBufferContinue
public int openBufferContinue(@NonNull byte[] buffer, int size) Reads from a memory buffer to parse media information and tags.- Parameters:
buffer- the buffer referencesize- the amount of data to read- Returns:
- a bitfield with the following bits:
0- Accepted (format is known)1- Filled (data collected)2- Buffer updated (further data required)3- Buffer finalized (no further data required)4-15- Reserved16-31- User defined
-
openBufferContinueGotoGet
public long openBufferContinueGotoGet()Tests if there is request to seek to another position in the stream.- Returns:
-1if there is no more data to seek to; else, the seek position
-
openBufferFinalize
public int openBufferFinalize()Closes the buffer upon read completion.- Returns:
0if the buffer has been read or null; else non-0 value if an error occurred.
-
closeHandle
public void closeHandle()Closes a file handle that was previously opened. -
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(@NonNull StreamType streamType, int streamNumber, String parameter, @NonNull InfoType infoType, @NonNull 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
public String get(@NonNull StreamType streamType, int streamNumber, int parameterIndex, @NonNull InfoType infoType) 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
-
setOption
-