Package com.amilesend.mediainfo.lib
Interface MediaInfoLibrary
- All Superinterfaces:
com.sun.jna.Library
public interface MediaInfoLibrary
extends com.sun.jna.Library
Defines the JNA interface to access the native libmediainfo library.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sun.jna.Library
com.sun.jna.Library.Handler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Defines the java methods to library method mapping.Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(com.sun.jna.Pointer handle) Closes the file that was opened withopen(Pointer, WString)
.int
countGet
(com.sun.jna.Pointer handle, int streamType, int streamNumber) The count of streams for the given stream type, or count of information parameters for a stream.void
deleteHandle
(com.sun.jna.Pointer handle) Deallocates a pointer reference to the libMediaInfo library.com.sun.jna.WString
get
(com.sun.jna.Pointer handle, int streamType, int streamNumber, com.sun.jna.WString parameter, int infoType, int searchType) Gets information about a media file where the parameter is a string.com.sun.jna.WString
getI
(com.sun.jna.Pointer handle, int streamType, int streamNumber, int parameterIndex, int infoType) Gets information about a media file where the parameter is an integer that represents the parameter index.com.sun.jna.WString
inform
(com.sun.jna.Pointer handle, int reserved) Gets all media details about a file.com.sun.jna.Pointer
Creates a new pointer reference to the libMediaInfo library.static MediaInfoLibrary
Creates a newMediaInfoLibrary
instance.int
open
(com.sun.jna.Pointer handle, com.sun.jna.WString file) Opens a file for parsing media information and tags.int
openBufferContinue
(com.sun.jna.Pointer handle, byte[] buffer, int size) Reads from a memory buffer to parse media information and tags.long
openBufferContinueGotoGet
(com.sun.jna.Pointer handle) Tests if there is request to seek to another position in the stream.int
openBufferFinalize
(com.sun.jna.Pointer handle) Closes the buffer upon read completion.int
openBufferInit
(com.sun.jna.Pointer handle, long length, long offset) Prepares a memory buffer for reading and parsing media information from a stream.com.sun.jna.WString
option
(com.sun.jna.Pointer handle, com.sun.jna.WString option, com.sun.jna.WString value) Configure or gets information about MediaInfo
-
Field Details
-
MEDIA_INFO_LIB_PATH
- See Also:
-
METHOD_TO_FUNCTION_NAME_MAP
Defines the java methods to library method mapping.
-
-
Method Details
-
newInstance
Creates a newMediaInfoLibrary
instance.- Returns:
- the media info library instance
-
newHandle
com.sun.jna.Pointer newHandle()Creates a new pointer reference to the libMediaInfo library.- Returns:
- the pointer reference
-
deleteHandle
void deleteHandle(com.sun.jna.Pointer handle) Deallocates a pointer reference to the libMediaInfo library.- Parameters:
handle
- the pointer reference
-
open
int open(com.sun.jna.Pointer handle, com.sun.jna.WString file) Opens a file for parsing media information and tags.- Parameters:
handle
- the library pointerfile
- the full path to the file to open- Returns:
1
if the file was successfully opened; else,0
-
openBufferInit
int openBufferInit(com.sun.jna.Pointer handle, 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:
1
if the buffer was successfully allocated; else,0
-
openBufferContinue
int openBufferContinue(com.sun.jna.Pointer handle, byte[] buffer, int size) Reads from a memory buffer to parse media information and tags.- Parameters:
handle
- the library pointerbuffer
- 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
long openBufferContinueGotoGet(com.sun.jna.Pointer handle) Tests if there is request to seek to another position in the stream.- Parameters:
handle
- the library pointer- Returns:
-1
if there is no more data to seek to; else, the seek position
-
openBufferFinalize
int openBufferFinalize(com.sun.jna.Pointer handle) Closes the buffer upon read completion.- Parameters:
handle
- the library pointer.- Returns:
0
if the buffer has been read or null; else non-0 value if an error occurred.
-
close
void close(com.sun.jna.Pointer handle) Closes the file that was opened withopen(Pointer, WString)
.- Parameters:
handle
- the library pointer
-
inform
com.sun.jna.WString inform(com.sun.jna.Pointer handle, int reserved) Gets all media details about a file.- Parameters:
handle
- the library pointerreserved
- reserved value. Should be defined as0
- Returns:
- the media information
-
get
com.sun.jna.WString get(com.sun.jna.Pointer handle, int streamType, int streamNumber, com.sun.jna.WString parameter, int infoType, int searchType) Gets information about a media file where the parameter is a string. For a list of available parameters, please refer to General.csv.- Parameters:
handle
- the library pointerstreamType
- the stream typestreamNumber
- the stream numberparameter
- the parameterinfoType
- the information typesearchType
- the search type- Returns:
- the media parameter information
-
getI
com.sun.jna.WString getI(com.sun.jna.Pointer handle, int streamType, int streamNumber, int parameterIndex, int infoType) Gets information about a media file where the parameter is an integer that represents the parameter index.- Parameters:
handle
- the library pointerstreamType
- the stream typestreamNumber
- the stream numberparameterIndex
- the index position for the parameterinfoType
- the information type- Returns:
- the media parameter information
-
countGet
int countGet(com.sun.jna.Pointer handle, int streamType, int streamNumber) The count of streams for the given stream type, or count of information parameters for a stream.- Parameters:
handle
- the library pointerstreamType
- the stream typestreamNumber
- the stream number- Returns:
- the count of streams or parameters
-
option
com.sun.jna.WString option(com.sun.jna.Pointer handle, com.sun.jna.WString option, com.sun.jna.WString value) Configure or gets information about MediaInfo- Parameters:
handle
- the library pointeroption
- the optionvalue
- the value- Returns:
""
means no; else, any other value means yes
-