Interface AppSrc.NeedDataCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
AppSrc
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface AppSrc.NeedDataCallback extends FunctionPointer

Functional interface declaration of the NeedDataCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(int length)
    Signal that the source needs more data.
    Creates a native function pointer to the upcall(MemorySegment, int) method.
    default void
    upcall(MemorySegment sourceAppSrc, int length)
    The upcall method is called from native code.
  • Method Details

    • run

      void run(int length)

      Signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.

      length is just a hint and when it is set to -1, any number of bytes can be pushed into appsrc.

      You can call push-buffer multiple times until the enough-data signal is fired.

    • upcall

      default void upcall(MemorySegment sourceAppSrc, int length)
      The upcall method is called from native code. The parameters are marshaled and run(int) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, int) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer