Interface VideoBackend

All Superinterfaces:
AlgorithmProvider, Backend, ComputeBackend, VideoAlgorithmProvider
All Known Implementing Classes:
JavaCVMediaBackend, MulticoreVideoBackend, NativeJavaCVMediaBackend, NativeVideoBackend, VLCJMediaBackend

public interface VideoBackend extends ComputeBackend, VideoAlgorithmProvider
Universal interface for video backends (playback, frame grabbing, analysis).
Since:
2.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • getType

      default String getType()
      Description copied from interface: Backend
      Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").
      Specified by:
      getType in interface Backend
      Specified by:
      getType in interface ComputeBackend
    • createContext

      default ExecutionContext createContext()
      Description copied from interface: ComputeBackend
      Creates an execution context for running operations.

      The context should be used within a try-with-resources block to ensure proper cleanup of resources.

      Specified by:
      createContext in interface ComputeBackend
      Returns:
      new execution context
    • getAcceleratorType

      default HardwareAccelerator getAcceleratorType()
      Description copied from interface: ComputeBackend
      Returns the type of hardware accelerator used by this backend.
      Specified by:
      getAcceleratorType in interface ComputeBackend
      Returns:
      the accelerator type
    • getName

      default String getName()
      Description copied from interface: Backend
      Returns the display name for UI presentation.
      Specified by:
      getName in interface AlgorithmProvider
      Specified by:
      getName in interface Backend
      Specified by:
      getName in interface VideoAlgorithmProvider
    • load

      void load(String path) throws Exception
      Loads a video resource.
      Parameters:
      path - File path or URL
      Throws:
      Exception
    • play

      void play()
    • pause

      void pause()
    • stop

      void stop()
    • getTime

      double getTime()
    • getDuration

      double getDuration()
    • grabFrame

      <T> T grabFrame()
      Grabs the current frame as an image.
      Type Parameters:
      T - the image type
      Returns:
      the current frame
    • getBackendName

      String getBackendName()
      Returns the friendly name of this backend instance.
    • getId

      default String getId()
      Description copied from interface: Backend
      Returns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").
      Specified by:
      getId in interface Backend
      Specified by:
      getId in interface ComputeBackend
    • getDescription

      default String getDescription()
      Description copied from interface: Backend
      Returns a description of the backend.
      Specified by:
      getDescription in interface Backend
      Specified by:
      getDescription in interface ComputeBackend
    • getPriority

      default int getPriority()
      Description copied from interface: Backend
      Returns the priority for auto-selection (higher = preferred). Used when multiple backends are available.
      Specified by:
      getPriority in interface AlgorithmProvider
      Specified by:
      getPriority in interface Backend
    • isAvailable

      default boolean isAvailable()
      Description copied from interface: Backend
      Checks if this backend is currently available (libraries loaded, etc.).

      Default implementation checks Backend.isExplicitlyDisabled() and returns false if it is.

      Specified by:
      isAvailable in interface AlgorithmProvider
      Specified by:
      isAvailable in interface Backend
    • shutdown

      default void shutdown()
      Description copied from interface: Backend
      Called when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.
      Specified by:
      shutdown in interface AlgorithmProvider
      Specified by:
      shutdown in interface Backend
    • createBackend

      default Object createBackend()
      Description copied from interface: Backend
      Creates and returns the backend instance (or returns self if it is the backend).
      Specified by:
      createBackend in interface Backend
      Specified by:
      createBackend in interface ComputeBackend
      Returns:
      The backend implementation object