GstBaseSink

GstBaseSink —

Synopsis


#include <gst/base/gstbasesink.h>


            GstBaseSink;
            GstBaseSinkClass;
#define     GST_BASE_SINK_PAD               (obj)
void        gst_base_sink_set_sync          (GstBaseSink *sink,
                                             gboolean sync);
gboolean    gst_base_sink_get_sync          (GstBaseSink *sink);
void        gst_base_sink_set_max_lateness  (GstBaseSink *sink,
                                             gint64 max_lateness);
gint64      gst_base_sink_get_max_lateness  (GstBaseSink *sink);


Object Hierarchy


  GObject
   +----GstObject
         +----GstElement
               +----GstBaseSink

Description

Details

GstBaseSink

typedef struct _GstBaseSink GstBaseSink;

The opaque GstBaseSink data structure.


GstBaseSinkClass

typedef struct {
  GstElementClass parent_class;

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

  /* allocate a new buffer with given caps */
  GstFlowReturn (*buffer_alloc) (GstBaseSink *sink, guint64 offset, guint size,
		                 GstCaps *caps, GstBuffer **buf);

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

  /* 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);

  /* notify subclass of event, preroll buffer or real buffer */
  gboolean      (*event)        (GstBaseSink *sink, GstEvent *event);
  GstFlowReturn (*preroll)      (GstBaseSink *sink, GstBuffer *buffer);
  GstFlowReturn (*render)       (GstBaseSink *sink, GstBuffer *buffer);

  /* ABI additions */

  /* when an ASYNC state change to PLAYING happens */ /* with LOCK */
  GstStateChangeReturn (*async_play)   (GstBaseSink *sink);
} GstBaseSinkClass;

Subclasses can override any of the available virtual methods or not, as needed. At the minimum, the render method should be overridden to output/present buffers

GstElementClass parent_class; Element parent class
get_caps () Called to get sink pad caps from the subclass
set_caps () Notify subclass of changed caps
buffer_alloc () Subclasses can override to perform custom buffer allocations
get_times () Called to get the start and end times for synchronising the passed buffer to the clock
start () Start processing. Ideal for opening resources in the subclass
stop () Stop processing. Subclasses should use this to close resources.
unlock () Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP
event () Override this to handle events arriving on the sink pad
preroll () Called to present the preroll buffer if desired
render () Called when a buffer should be presented or output, at the correct moment if the GstBaseSink has been set to sync to the clock.
async_play () Subclasses should override this when they need to perform special processing when changing to the PLAYING state asynchronously. Called with the OBJECT_LOCK held.

GST_BASE_SINK_PAD()

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

Gives the pointer to the GstPad object of the element.

obj : base sink instance

gst_base_sink_set_sync ()

void        gst_base_sink_set_sync          (GstBaseSink *sink,
                                             gboolean sync);

Configures sink to synchronize on the clock or not. When sync is FALSE, incomming samples will be played as fast as possible. If sync is TRUE, the timestamps of the incomming buffers will be used to schedule the exact render time of its contents.

sink : the sink
sync : the new sync value.

Since 0.10.4


gst_base_sink_get_sync ()

gboolean    gst_base_sink_get_sync          (GstBaseSink *sink);

Checks if sink is currently configured to synchronize against the clock.

sink : the sink
Returns : TRUE if the sink is configured to synchronize against the clock.

Since 0.10.4


gst_base_sink_set_max_lateness ()

void        gst_base_sink_set_max_lateness  (GstBaseSink *sink,
                                             gint64 max_lateness);

Sets the new max lateness value to max_lateness. This value is used to decide if a buffer should be dropped or not based on the buffer timestamp and the current clock time. A value of -1 means an unlimited time.

sink : the sink
max_lateness : the new max lateness value.

Since 0.10.4


gst_base_sink_get_max_lateness ()

gint64      gst_base_sink_get_max_lateness  (GstBaseSink *sink);

Gets the max lateness value. See gst_base_sink_set_max_lateness for more details.

sink : the sink
Returns : The maximum time in nanoseconds that a buffer can be late before it is dropped and not rendered. A value of -1 means an unlimited time.

Since 0.10.4