Class FrameOutput

java.lang.Object
com.banuba.sdk.player.VerifyCloseable
com.banuba.sdk.output.FrameOutput
All Implemented Interfaces:
IOrientable, IOutput, Closeable, AutoCloseable

public class FrameOutput extends VerifyCloseable implements IOutput, IOrientable
Representing a Frame as an Array of Pixels
  • Constructor Details

    • FrameOutput

      public FrameOutput(@NonNull FrameOutput.IFramePixelBufferProvider callback)
      Create a new instance of the FrameOutput with default SimpleDirectBufferAllocator and SYNC read mode
      Parameters:
      callback - the processed frame is sent here
      See Also:
    • FrameOutput

      public FrameOutput(@NonNull FrameOutput.IFramePixelBufferProvider callback, @NonNull FrameOutput.ReadBufferMode readMode)
      Create a new instance of the FrameOutput with default SimpleDirectBufferAllocator
      Parameters:
      callback - the processed frame is sent here
      readMode - pixels reading mode
      See Also:
    • FrameOutput

      public FrameOutput(@NonNull FrameOutput.IFramePixelBufferProvider callback, IDirectBufferAllocator allocator)
      Create a new instance of the FrameOutput with memory allocator and SYNC read mode The memory allocator helps avoid excessive memory usage, as well as increases performance and reduces the number of GarbageCollector hits.
      Parameters:
      callback - the processed frame is sent here
      allocator - allocator for the images
    • FrameOutput

      public FrameOutput(@NonNull FrameOutput.IFramePixelBufferProvider callback, IDirectBufferAllocator allocator, @NonNull FrameOutput.ReadBufferMode readMode)
      Create a new instance of the FrameOutput with memory allocator. The memory allocator helps avoid excessive memory usage, as well as increases performance and reduces the number of GarbageCollector hits.
      Parameters:
      callback - the processed frame is sent here
      allocator - allocator for the images
      readMode - pixels reading mode
  • Method Details

    • setFormat

      public void setFormat(FramePixelBufferFormat format)
      Apply output frame format. The nearest output frame will have this format.
      Parameters:
      format - desired output format of image
      See Also:
    • setOrientation

      public void setOrientation(Orientation orientation, boolean mirroring)
      Apply output frame orientation. The nearest output frame will have this orientation.
      Specified by:
      setOrientation in interface IOrientable
      Parameters:
      orientation - rotation of output frame
      mirroring - require mirroring
    • present

      public void present(IRenderTargetPresentable renderTarget)
      Presenting the processed frame to the surface
      Specified by:
      present in interface IOutput
      Parameters:
      renderTarget - provided by the Player
    • close

      public void close()
      Closes the resource and frees memory
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class VerifyCloseable