Class AppSink.Builder<B extends AppSink.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
AppSink

public static class AppSink.Builder<B extends AppSink.Builder<B>> extends BaseSink.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public AppSink build()
      Finish building the AppSink object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to AppSink.
      Overrides:
      build in class BaseSink.Builder<B extends AppSink.Builder<B>>
      Returns:
      a new instance of AppSink with the properties that were set in the Builder object.
    • setBufferList

      public B setBufferList(boolean bufferList)
    • setCaps

      public B setCaps(Caps caps)
    • setDrop

      public B setDrop(boolean drop)
    • setEmitSignals

      public B setEmitSignals(boolean emitSignals)
    • setMaxBuffers

      public B setMaxBuffers(int maxBuffers)
      Maximum amount of buffers in the queue (0 = unlimited).
      Parameters:
      maxBuffers - the value for the max-buffers property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMaxBytes

      public B setMaxBytes(long maxBytes)
      Maximum amount of bytes in the queue (0 = unlimited)
      Parameters:
      maxBytes - the value for the max-bytes property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.24
    • setMaxTime

      public B setMaxTime(long maxTime)
      Maximum total duration of data in the queue (0 = unlimited)
      Parameters:
      maxTime - the value for the max-time property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.24
    • setWaitOnEos

      public B setWaitOnEos(boolean waitOnEos)

      Wait for all buffers to be processed after receiving an EOS.

      In cases where it is uncertain if an appsink will have a consumer for its buffers when it receives an EOS, set to false to ensure that the appsink will not hang.

      Parameters:
      waitOnEos - the value for the wait-on-eos property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.8
    • onEos

      public B onEos(AppSink.EosCallback handler)
      Signal that the end-of-stream has been reached. This signal is emitted from the streaming thread.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onNewPreroll

      public B onNewPreroll(AppSink.NewPrerollCallback handler)

      Signal that a new preroll sample is available.

      This signal is emitted from the streaming thread and only when the "emit-signals" property is true.

      The new preroll sample can be retrieved with the "pull-preroll" action signal or gst_app_sink_pull_preroll() either from this signal callback or from any other thread.

      Note that this signal is only emitted when the "emit-signals" property is set to true, which it is not by default for performance reasons.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onNewSample

      public B onNewSample(AppSink.NewSampleCallback handler)

      Signal that a new sample is available.

      This signal is emitted from the streaming thread and only when the "emit-signals" property is true.

      The new sample can be retrieved with the "pull-sample" action signal or gst_app_sink_pull_sample() either from this signal callback or from any other thread.

      Note that this signal is only emitted when the "emit-signals" property is set to true, which it is not by default for performance reasons.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onNewSerializedEvent

      public B onNewSerializedEvent(AppSink.NewSerializedEventCallback handler)

      Signal that a new downstream serialized event is available.

      This signal is emitted from the streaming thread and only when the "emit-signals" property is true.

      The new event can be retrieved with the "try-pull-object" action signal or gst_app_sink_pull_object() either from this signal callback or from any other thread.

      EOS will not be notified using this signal, use GstAppSink::eos instead. EOS cannot be pulled either, use gst_app_sink_is_eos() to check for it.

      Note that this signal is only emitted when the "emit-signals" property is set to true, which it is not by default for performance reasons.

      The callback should return true if the event has been handled, which will skip basesink handling of the event, false otherwise.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.20
      See Also:
    • onProposeAllocation

      public B onProposeAllocation(AppSink.ProposeAllocationCallback handler)

      Signal that a new propose_allocation query is available.

      This signal is emitted from the streaming thread and only when the "emit-signals" property is true.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.24
      See Also:
    • onPullPreroll

      public B onPullPreroll(AppSink.PullPrerollCallback handler)

      Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.

      This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.

      Calling this function will clear the internal reference to the preroll buffer.

      Note that the preroll sample will also be returned as the first sample when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.

      If an EOS event was received before any buffers, this function returns null. Use gst_app_sink_is_eos () to check for the EOS condition.

      This function blocks until a preroll sample or EOS is received or the appsink element is set to the READY/NULL state.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPullSample

      public B onPullSample(AppSink.PullSampleCallback handler)

      This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state.

      This function will only return samples when the appsink is in the PLAYING state. All rendered samples will be put in a queue so that the application can pull samples at its own rate.

      Note that when the application does not pull samples fast enough, the queued samples could consume a lot of memory, especially when dealing with raw video frames. It's possible to control the behaviour of the queue with the "drop" and "max-buffers" / "max-bytes" / "max-time" set of properties.

      If an EOS event was received before any buffers, this function returns null. Use gst_app_sink_is_eos () to check for the EOS condition.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onTryPullPreroll

      public B onTryPullPreroll(AppSink.TryPullPrerollCallback handler)

      Get the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.

      This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give the sample right after the seek position.

      Calling this function will clear the internal reference to the preroll buffer.

      Note that the preroll sample will also be returned as the first sample when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.

      If an EOS event was received before any buffers or the timeout expires, this function returns null. Use gst_app_sink_is_eos () to check for the EOS condition.

      This function blocks until a preroll sample or EOS is received, the appsink element is set to the READY/NULL state, or the timeout expires.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.10
      See Also:
    • onTryPullSample

      public B onTryPullSample(AppSink.TryPullSampleCallback handler)

      This function blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state or the timeout expires.

      This function will only return samples when the appsink is in the PLAYING state. All rendered samples will be put in a queue so that the application can pull samples at its own rate.

      Note that when the application does not pull samples fast enough, the queued samples could consume a lot of memory, especially when dealing with raw video frames. It's possible to control the behaviour of the queue with the "drop" and "max-buffers" / "max-bytes" / "max-time" set of properties.

      If an EOS event was received before any buffers or the timeout expires, this function returns null. Use gst_app_sink_is_eos () to check for the EOS condition.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.10
      See Also: