Interface AudioBaseSinkCustomSlavingCallback

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

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface AudioBaseSinkCustomSlavingCallback extends FunctionPointer

Functional interface declaration of the AudioBaseSinkCustomSlavingCallback callback.

See Also:
  • Method Details

    • run

      void run(AudioBaseSink sink, ClockTime etime, ClockTime itime, MemorySegment requestedSkew, AudioBaseSinkDiscontReason discontReason)

      This function is set with gst_audio_base_sink_set_custom_slaving_callback() and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving/synchronization schemes.

      The external clock is the sink's element clock, the internal one is the internal audio clock. The internal audio clock's calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime < etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens.

      requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0.

      The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens.

      Parameters:
      sink - a GstAudioBaseSink
      etime - external clock time
      itime - internal clock time
      requestedSkew - skew amount requested by the callback
      discontReason - reason for discontinuity (if any)
      Since:
      1.6
    • upcall

      default void upcall(MemorySegment sink, long etime, long itime, MemorySegment requestedSkew, int discontReason, MemorySegment userData)
      The upcall method is called from native code. The parameters are marshaled and run(AudioBaseSink, ClockTime, ClockTime, MemorySegment, AudioBaseSinkDiscontReason) is executed.
    • toCallback

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