GstBaseSink: GStreamer 1.0 Library Reference Manual

## GstBaseSink GstBaseSink |

## Functions

gboolean | gst_base_sink_query_latency ()
GstClockTime | gst_base_sink_get_latency ()
GstFlowReturn | gst_base_sink_do_preroll ()
GstFlowReturn | gst_base_sink_wait ()
GstFlowReturn | gst_base_sink_wait_preroll ()
GstClockReturn | gst_base_sink_wait_clock ()
void | gst_base_sink_set_sync ()
gboolean | gst_base_sink_get_sync ()
void | gst_base_sink_set_max_lateness ()
gint64 | gst_base_sink_get_max_lateness ()
void | gst_base_sink_set_qos_enabled ()
gboolean | gst_base_sink_is_qos_enabled ()
void | gst_base_sink_set_async_enabled ()
gboolean | gst_base_sink_is_async_enabled ()
void | gst_base_sink_set_ts_offset ()
GstClockTimeDiff | gst_base_sink_get_ts_offset ()
void | gst_base_sink_set_render_delay ()
GstClockTime | gst_base_sink_get_render_delay ()
GstSample * | gst_base_sink_get_last_sample ()
void | gst_base_sink_set_blocksize ()
guint | gst_base_sink_get_blocksize ()
guint64 | gst_base_sink_get_throttle_time ()
void | gst_base_sink_set_throttle_time ()
void | gst_base_sink_set_max_bitrate ()
guint64 | gst_base_sink_get_max_bitrate ()
void | gst_base_sink_set_last_sample_enabled ()
gboolean | gst_base_sink_is_last_sample_enabled ()
#define | GST_BASE_SINK_PAD()
#define | GST_BASE_SINK_GET_PREROLL_COND()
#define | GST_BASE_SINK_GET_PREROLL_LOCK()
#define | GST_BASE_SINK_PREROLL_BROADCAST()
#define | GST_BASE_SINK_PREROLL_LOCK()
#define | GST_BASE_SINK_PREROLL_SIGNAL()
#define | GST_BASE_SINK_PREROLL_TRYLOCK()
#define | GST_BASE_SINK_PREROLL_UNLOCK()
#define | GST_BASE_SINK_PREROLL_WAIT()
#define | GST_BASE_SINK_PREROLL_WAIT_UNTIL()

## Properties

gboolean | async | Read / Write
guint | blocksize | Read / Write
gboolean | enable-last-sample | Read / Write
GstSample * | last-sample | Read
guint64 | max-bitrate | Read / Write
gint64 | max-lateness | Read / Write
gboolean | qos | Read / Write
guint64 | render-delay | Read / Write
gboolean | sync | Read / Write
guint64 | throttle-time | Read / Write
gint64 | ts-offset | Read / Write

## Types and Values

struct | GstBaseSink
struct | GstBaseSinkClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseSink

## Includes

    #include <gst/base/gstbasesink.h>

## Description

## Functions

### gst_base_sink_query_latency ()

    gboolean
    gst_base_sink_query_latency (GstBaseSink *sink,
                                 gboolean *live,
                                 gboolean *upstream_live,
                                 GstClockTime *min_latency,
                                 GstClockTime *max_latency);

### gst_base_sink_get_latency ()

    GstClockTime
    gst_base_sink_get_latency (GstBaseSink *sink);

### gst_base_sink_do_preroll ()

    GstFlowReturn
    gst_base_sink_do_preroll (GstBaseSink *sink,
                              GstMiniObject *obj);

### gst_base_sink_wait ()

    GstFlowReturn
    gst_base_sink_wait (GstBaseSink *sink,
                        GstClockTime time,
                        GstClockTimeDiff *jitter);

### gst_base_sink_wait_preroll ()

    GstFlowReturn
    gst_base_sink_wait_preroll (GstBaseSink *sink);

### gst_base_sink_wait_clock ()

    GstClockReturn
    gst_base_sink_wait_clock (GstBaseSink *sink,
                              GstClockTime time,
                              GstClockTimeDiff *jitter);

### gst_base_sink_set_sync ()

    void
    gst_base_sink_set_sync (GstBaseSink *sink,
                            gboolean sync);

### gst_base_sink_get_sync ()

    gboolean
    gst_base_sink_get_sync (GstBaseSink *sink);

### gst_base_sink_set_max_lateness ()

    void
    gst_base_sink_set_max_lateness (GstBaseSink *sink,
                                    gint64 max_lateness);

### gst_base_sink_get_max_lateness ()

    gint64
    gst_base_sink_get_max_lateness (GstBaseSink *sink);

### gst_base_sink_set_qos_enabled ()

    void
    gst_base_sink_set_qos_enabled (GstBaseSink *sink,
                                   gboolean enabled);

### gst_base_sink_is_qos_enabled ()

    gboolean
    gst_base_sink_is_qos_enabled (GstBaseSink *sink);

### gst_base_sink_set_async_enabled ()

    void
    gst_base_sink_set_async_enabled (GstBaseSink *sink,
                                     gboolean enabled);

### gst_base_sink_is_async_enabled ()

    gboolean
    gst_base_sink_is_async_enabled (GstBaseSink *sink);

### gst_base_sink_set_ts_offset ()

    void
    gst_base_sink_set_ts_offset (GstBaseSink *sink,
                                 GstClockTimeDiff offset);

### gst_base_sink_get_ts_offset ()

    GstClockTimeDiff
    gst_base_sink_get_ts_offset (GstBaseSink *sink);

### gst_base_sink_set_render_delay ()

    void
    gst_base_sink_set_render_delay (GstBaseSink *sink,
                                    GstClockTime delay);

### gst_base_sink_get_render_delay ()

    GstClockTime
    gst_base_sink_get_render_delay (GstBaseSink *sink);

### gst_base_sink_get_last_sample ()

    GstSample *
    gst_base_sink_get_last_sample (GstBaseSink *sink);

### gst_base_sink_set_blocksize ()

    void
    gst_base_sink_set_blocksize (GstBaseSink *sink,
                                 guint blocksize);

### gst_base_sink_get_blocksize ()

    guint
    gst_base_sink_get_blocksize (GstBaseSink *sink);

### gst_base_sink_get_throttle_time ()

    guint64
    gst_base_sink_get_throttle_time (GstBaseSink *sink);

### gst_base_sink_set_throttle_time ()

    void
    gst_base_sink_set_throttle_time (GstBaseSink *sink,
                                     guint64 throttle);

### gst_base_sink_set_max_bitrate ()

    void
    gst_base_sink_set_max_bitrate (GstBaseSink *sink,
                                   guint64 max_bitrate);

### gst_base_sink_get_max_bitrate ()

    guint64
    gst_base_sink_get_max_bitrate (GstBaseSink *sink);

### gst_base_sink_set_last_sample_enabled ()

    void
    gst_base_sink_set_last_sample_enabled (GstBaseSink *sink,
                                           gboolean enabled);

### gst_base_sink_is_last_sample_enabled ()

    gboolean
    gst_base_sink_is_last_sample_enabled (GstBaseSink *sink);

### GST_BASE_SINK_PAD()

    #define GST_BASE_SINK_PAD(obj)          (GST_BASE_SINK_CAST (obj)->sinkpad)

### GST_BASE_SINK_GET_PREROLL_COND()

    #define GST_BASE_SINK_GET_PREROLL_COND(obj)   (&GST_BASE_SINK_CAST(obj)->preroll_cond)

### GST_BASE_SINK_GET_PREROLL_LOCK()

    #define GST_BASE_SINK_GET_PREROLL_LOCK(obj)   (&GST_BASE_SINK_CAST(obj)->preroll_lock)

### GST_BASE_SINK_PREROLL_BROADCAST()

    #define GST_BASE_SINK_PREROLL_BROADCAST(obj)  g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (obj));

### GST_BASE_SINK_PREROLL_LOCK()

    #define GST_BASE_SINK_PREROLL_LOCK(obj)       (g_mutex_lock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))

### GST_BASE_SINK_PREROLL_SIGNAL()

    #define GST_BASE_SINK_PREROLL_SIGNAL(obj)     g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (obj));

### GST_BASE_SINK_PREROLL_TRYLOCK()

    #define GST_BASE_SINK_PREROLL_TRYLOCK(obj)    (g_mutex_trylock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))

### GST_BASE_SINK_PREROLL_UNLOCK()

    #define GST_BASE_SINK_PREROLL_UNLOCK(obj)     (g_mutex_unlock(GST_BASE_SINK_GET_PREROLL_LOCK(obj)))

### GST_BASE_SINK_PREROLL_WAIT()

    #define             GST_BASE_SINK_PREROLL_WAIT(obj)

### GST_BASE_SINK_PREROLL_WAIT_UNTIL()

    #define             GST_BASE_SINK_PREROLL_WAIT_UNTIL(obj, end_time)

## Types and Values

### struct GstBaseSink

    struct GstBaseSink;

### struct GstBaseSinkClass

    struct GstBaseSinkClass {
      GstElementClass parent_class;

      /* get caps from subclass */
      GstCaps*      (*get_caps)     (GstBaseSink *sink, GstCaps *filter);
      /* notify subclass of new caps */
      gboolean      (*set_caps)     (GstBaseSink *sink, GstCaps *caps);

      /* fixate sink caps during pull-mode negotiation */
      GstCaps *     (*fixate)       (GstBaseSink *sink, GstCaps *caps);
      /* start or stop a pulling thread */
      gboolean      (*activate_pull)(GstBaseSink *sink, gboolean active);

      /* get the start and end times for syncing on this buffer */
      void          (*get_times)    (GstBaseSink *sink, GstBuffer *buffer,
                                     GstClockTime *start, GstClockTime *end);

      /* propose allocation parameters for upstream */
      gboolean      (*propose_allocation)   (GstBaseSink *sink, GstQuery *query);

      /* start and stop processing, ideal for opening/closing the resource */
      gboolean      (*start)        (GstBaseSink *sink);
      gboolean      (*stop)         (GstBaseSink *sink);

      /* unlock any pending access to the resource. subclasses should unlock
       * any function ASAP. */
      gboolean      (*unlock)       (GstBaseSink *sink);
      /* Clear a previously indicated unlock request not that unlocking is
       * complete. Sub-classes should clear any command queue or indicator they
       * set during unlock */
      gboolean      (*unlock_stop)  (GstBaseSink *sink);

      /* notify subclass of query */
      gboolean      (*query)        (GstBaseSink *sink, GstQuery *query);

      /* notify subclass of event */
      gboolean      (*event)        (GstBaseSink *sink, GstEvent *event);
      /* wait for eos or gap, subclasses should chain up to parent first */
      GstFlowReturn (*wait_event)   (GstBaseSink *sink, GstEvent *event);

      /* notify subclass of buffer or list before doing sync */
      GstFlowReturn (*prepare)      (GstBaseSink *sink, GstBuffer *buffer);
      GstFlowReturn (*prepare_list) (GstBaseSink *sink, GstBufferList *buffer_list);

      /* notify subclass of preroll buffer or real buffer */
      GstFlowReturn (*preroll)      (GstBaseSink *sink, GstBuffer *buffer);
      GstFlowReturn (*render)       (GstBaseSink *sink, GstBuffer *buffer);
      /* Render a BufferList */
      GstFlowReturn (*render_list)  (GstBaseSink *sink, GstBufferList *buffer_list);
    };

## Property Details

### The `“async”` property

      “async”                    gboolean

Go asynchronously to PAUSED.

Flags: Read / Write

Default value: TRUE

### The `“blocksize”` property

      “blocksize”                guint

Size in bytes to pull per buffer (0 = default).

Flags: Read / Write

Default value: 4096

### The `“enable-last-sample”` property

      “enable-last-sample”       gboolean

Enable the last-sample property.

Flags: Read / Write

Default value: TRUE

### The `“last-sample”` property

      “last-sample”              GstSample *

The last sample received in the sink.

Flags: Read

### The `“max-bitrate”` property

      “max-bitrate”              guint64

The maximum bits per second to render (0 = disabled).

Flags: Read / Write

Default value: 0

### The `“max-lateness”` property

      “max-lateness”             gint64

Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited).

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“qos”` property

      “qos”                      gboolean

Generate Quality-of-Service events upstream.

Flags: Read / Write

Default value: FALSE

### The `“render-delay”` property

      “render-delay”             guint64

Additional render delay of the sink in nanoseconds.

Flags: Read / Write

Default value: 0

### The `“sync”` property

      “sync”                     gboolean

Sync on the clock.

Flags: Read / Write

Default value: TRUE

### The `“throttle-time”` property

      “throttle-time”            guint64

The time to keep between rendered buffers (0 = disabled).

Flags: Read / Write

Default value: 0

### The `“ts-offset”` property

      “ts-offset”                gint64

Timestamp offset in nanoseconds.

Flags: Read / Write

Default value: 0