Class BaseNativeDiscoveryStrategy

java.lang.Object
uk.co.caprica.vlcj.factory.discovery.strategy.BaseNativeDiscoveryStrategy
All Implemented Interfaces:
NativeDiscoveryStrategy
Direct Known Subclasses:
DirectoryProviderDiscoveryStrategy

public abstract class BaseNativeDiscoveryStrategy extends Object implements NativeDiscoveryStrategy
Base implementation of a native discovery strategy that searches a list of directories for a list of files.
  • Constructor Details

    • BaseNativeDiscoveryStrategy

      public BaseNativeDiscoveryStrategy(String[] filenamePatterns, String[] pluginPathFormats)
      Create a new native discovery strategy.
      Parameters:
      filenamePatterns - filename patterns to search for, as regular expressions
      pluginPathFormats - directory name templates used to find the VLC plugin directory, printf style.
  • Method Details

    • discover

      public final String discover()
      Description copied from interface: NativeDiscoveryStrategy
      Attempt to discover the location of the libvlc native shared libraries.
      Specified by:
      discover in interface NativeDiscoveryStrategy
      Returns:
      path containing the shared libraries, or null if this strategy did not find them
    • onFound

      public boolean onFound(String path)
      Description copied from interface: NativeDiscoveryStrategy
      Invoked when native shared libraries found.

      This serves two purposes: the first is to enable the strategy implementation to carry out bespoke work if needed; te second is to indicate whether or not the discovered path should be added to the JNA native library search path.

      Specified by:
      onFound in interface NativeDiscoveryStrategy
      Parameters:
      path - directory containing the shared libraries
      Returns:
      true if the path should be added to the JNA native search path; false if not
    • onSetPluginPath

      public final boolean onSetPluginPath(String path)
      Description copied from interface: NativeDiscoveryStrategy
      Invoked after discovery has completed and found the native shared libraries.

      This method will not be invoked if there is already a VLC_PLUGIN_PATH environment variable set.

      Specified by:
      onSetPluginPath in interface NativeDiscoveryStrategy
      Parameters:
      path - directory containing the shared libraries
      Returns:
      true if the plugin path was set successfully; false on error