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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final Map<String,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 Type
    Method
    Description
    void
    close(com.sun.jna.Pointer handle)
    Closes the file that was opened with open(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.
    Creates a new MediaInfoLibrary 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

      static final String MEDIA_INFO_LIB_PATH
      See Also:
    • METHOD_TO_FUNCTION_NAME_MAP

      static final Map<String,String> METHOD_TO_FUNCTION_NAME_MAP
      Defines the java methods to library method mapping.
  • Method Details

    • newInstance

      static MediaInfoLibrary newInstance()
      Creates a new MediaInfoLibrary 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 pointer
      file - 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 buffer
      offset - 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 pointer
      buffer - the buffer reference
      size - 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 - Reserved
      • 16-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 with open(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 pointer
      reserved - reserved value. Should be defined as 0
      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 pointer
      streamType - the stream type
      streamNumber - the stream number
      parameter - the parameter
      infoType - the information type
      searchType - 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 pointer
      streamType - the stream type
      streamNumber - the stream number
      parameterIndex - the index position for the parameter
      infoType - 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 pointer
      streamType - the stream type
      streamNumber - 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 pointer
      option - the option
      value - the value
      Returns:
      "" means no; else, any other value means yes