Interface VideoFrameProvider


public interface VideoFrameProvider
Base interface for video frame providers.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    Called when this VideoFrameProvider should clean up it's event handlers and etc.
    void
    Notifies this provider of the current codec for the connection.
    boolean
    provideFrame(io.netty.buffer.ByteBuf buf)
    Retrieves a media frame and writes it to the provided ByteBuf.
  • Method Details

    • onCodecChanged

      void onCodecChanged(@NotNull CodecInstance codec)
      Notifies this provider of the current codec for the connection.

      Guarantees:

      • This method is called before the first canProvide() invocation for a provider instance attached to a connection (e.g. when set via setVideoSender).
      • It is called again whenever the codec is changed via setVideoCodec while this provider is attached.
      Implementations should update internal codec-dependent state in this callback. If the provider cannot supply data in the requested format, it must return false from canProvide() until the codec changes to a supported one.
      Parameters:
      codec - the current codec instance for this connection
    • dispose

      void dispose()
      Called when this VideoFrameProvider should clean up it's event handlers and etc.
    • canProvide

      boolean canProvide()
      Returns:
      If true, this provider has media data available and can provide frames. This is used by the frame poller to determine if it should attempt to retrieve frames from this provider. Must return false if the provider cannot supply data for the current codec (see onCodecChanged(moe.kyokobot.koe.codec.CodecInstance)).
    • provideFrame

      boolean provideFrame(io.netty.buffer.ByteBuf buf)
      Retrieves a media frame and writes it to the provided ByteBuf. The buffer is guaranteed to be empty and have enough capacity for the frame. The provider should write the frame data to the buffer and return true if a frame was provided, or return false if no frame is available (e.g. end of stream).
      Parameters:
      buf - The buffer to write the frame data to.
      Returns:
      true if a frame was provided and written to the buffer, false if no frame is available.