GstBaseSrc: GStreamer 1.0 Library Reference Manual

## GstBaseSrc GstBaseSrc |

## Functions

GstFlowReturn | gst_base_src_wait_playing ()
GstFlowReturn | gst_base_src_start_wait ()
void | gst_base_src_start_complete ()
gboolean | gst_base_src_is_live ()
void | gst_base_src_set_live ()
void | gst_base_src_set_format ()
gboolean | gst_base_src_query_latency ()
guint | gst_base_src_get_blocksize ()
void | gst_base_src_set_blocksize ()
gboolean | gst_base_src_get_do_timestamp ()
void | gst_base_src_set_do_timestamp ()
void | gst_base_src_set_dynamic_size ()
void | gst_base_src_set_automatic_eos ()
gboolean | gst_base_src_new_seamless_segment ()
gboolean | gst_base_src_set_caps ()
void | gst_base_src_get_allocator ()
GstBufferPool * | gst_base_src_get_buffer_pool ()
gboolean | gst_base_src_is_async ()
void | gst_base_src_set_async ()
#define | GST_BASE_SRC_PAD()
#define | GST_BASE_SRC_IS_STARTED()
#define | GST_BASE_SRC_IS_STARTING()

## Properties

guint | blocksize | Read / Write
gboolean | do-timestamp | Read / Write
gint | num-buffers | Read / Write
gboolean | typefind | Read / Write

## Types and Values

struct | GstBaseSrc
struct | GstBaseSrcClass
enum | GstBaseSrcFlags

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GstObject
                ╰── GstElement
                    ╰── GstBaseSrc
                        ╰── GstPushSrc

## Includes

    #include <gst/base/gstbasesrc.h>

## Description

## Functions

### gst_base_src_wait_playing ()

    GstFlowReturn
    gst_base_src_wait_playing (GstBaseSrc *src);

### gst_base_src_start_wait ()

    GstFlowReturn
    gst_base_src_start_wait (GstBaseSrc *basesrc);

### gst_base_src_start_complete ()

    void
    gst_base_src_start_complete (GstBaseSrc *basesrc,
                                 GstFlowReturn ret);

### gst_base_src_is_live ()

    gboolean
    gst_base_src_is_live (GstBaseSrc *src);

### gst_base_src_set_live ()

    void
    gst_base_src_set_live (GstBaseSrc *src,
                           gboolean live);

### gst_base_src_set_format ()

    void
    gst_base_src_set_format (GstBaseSrc *src,
                             GstFormat format);

### gst_base_src_query_latency ()

    gboolean
    gst_base_src_query_latency (GstBaseSrc *src,
                                gboolean *live,
                                GstClockTime *min_latency,
                                GstClockTime *max_latency);

### gst_base_src_get_blocksize ()

    guint
    gst_base_src_get_blocksize (GstBaseSrc *src);

### gst_base_src_set_blocksize ()

    void
    gst_base_src_set_blocksize (GstBaseSrc *src,
                                guint blocksize);

### gst_base_src_get_do_timestamp ()

    gboolean
    gst_base_src_get_do_timestamp (GstBaseSrc *src);

### gst_base_src_set_do_timestamp ()

    void
    gst_base_src_set_do_timestamp (GstBaseSrc *src,
                                   gboolean timestamp);

### gst_base_src_set_dynamic_size ()

    void
    gst_base_src_set_dynamic_size (GstBaseSrc *src,
                                   gboolean dynamic);

### gst_base_src_set_automatic_eos ()

    void
    gst_base_src_set_automatic_eos (GstBaseSrc *src,
                                    gboolean automatic_eos);

### gst_base_src_new_seamless_segment ()

    gboolean
    gst_base_src_new_seamless_segment (GstBaseSrc *src,
                                       gint64 start,
                                       gint64 stop,
                                       gint64 time);

### gst_base_src_set_caps ()

    gboolean
    gst_base_src_set_caps (GstBaseSrc *src,
                           GstCaps *caps);

### gst_base_src_get_allocator ()

    void
    gst_base_src_get_allocator (GstBaseSrc *src,
                                GstAllocator **allocator,
                                GstAllocationParams *params);

### gst_base_src_get_buffer_pool ()

    GstBufferPool *
    gst_base_src_get_buffer_pool (GstBaseSrc *src);

### gst_base_src_is_async ()

    gboolean
    gst_base_src_is_async (GstBaseSrc *src);

### gst_base_src_set_async ()

    void
    gst_base_src_set_async (GstBaseSrc *src,
                            gboolean async);

### GST_BASE_SRC_PAD()

    #define GST_BASE_SRC_PAD(obj)                 (GST_BASE_SRC_CAST (obj)->srcpad)

### GST_BASE_SRC_IS_STARTED()

    #define GST_BASE_SRC_IS_STARTED(obj)  GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTED)

### GST_BASE_SRC_IS_STARTING()

    #define GST_BASE_SRC_IS_STARTING(obj) GST_OBJECT_FLAG_IS_SET ((obj), GST_BASE_SRC_FLAG_STARTING)

## Types and Values

### struct GstBaseSrc

    struct GstBaseSrc;

### struct GstBaseSrcClass

    struct GstBaseSrcClass {
      GstElementClass parent_class;

      /* virtual methods for subclasses */

      /* get caps from subclass */
      GstCaps*      (*get_caps)     (GstBaseSrc *src, GstCaps *filter);
      /* decide on caps */
      gboolean      (*negotiate)    (GstBaseSrc *src);
      /* called if, in negotiation, caps need fixating */
      GstCaps *     (*fixate)       (GstBaseSrc *src, GstCaps *caps);
      /* notify the subclass of new caps */
      gboolean      (*set_caps)     (GstBaseSrc *src, GstCaps *caps);

      /* setup allocation query */
      gboolean      (*decide_allocation)   (GstBaseSrc *src, GstQuery *query);

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

      /* given a buffer, return start and stop time when it should be pushed
       * out. The base class will sync on the clock using these times. */
      void          (*get_times)    (GstBaseSrc *src, GstBuffer *buffer,
                                     GstClockTime *start, GstClockTime *end);

      /* get the total size of the resource in the format set by
       * gst_base_src_set_format() */
      gboolean      (*get_size)     (GstBaseSrc *src, guint64 *size);

      /* check if the resource is seekable */
      gboolean      (*is_seekable)  (GstBaseSrc *src);

      /* Prepare the segment on which to perform do_seek(), converting to the
       * current basesrc format. */
      gboolean      (*prepare_seek_segment) (GstBaseSrc *src, GstEvent *seek,
                                             GstSegment *segment);
      /* notify subclasses of a seek */
      gboolean      (*do_seek)      (GstBaseSrc *src, GstSegment *segment);

      /* unlock any pending access to the resource. subclasses should unlock
       * any function ASAP. */
      gboolean      (*unlock)       (GstBaseSrc *src);
      /* Clear any pending unlock request, as we succeeded in unlocking */
      gboolean      (*unlock_stop)  (GstBaseSrc *src);

      /* notify subclasses of a query */
      gboolean      (*query)        (GstBaseSrc *src, GstQuery *query);

      /* notify subclasses of an event */
      gboolean      (*event)        (GstBaseSrc *src, GstEvent *event);

      /* ask the subclass to create a buffer with offset and size, the default
       * implementation will call alloc and fill. */
      GstFlowReturn (*create)       (GstBaseSrc *src, guint64 offset, guint size,
                                     GstBuffer **buf);
      /* ask the subclass to allocate an output buffer. The default implementation
       * will use the negotiated allocator. */
      GstFlowReturn (*alloc)        (GstBaseSrc *src, guint64 offset, guint size,
                                     GstBuffer **buf);
      /* ask the subclass to fill the buffer with data from offset and size */
      GstFlowReturn (*fill)         (GstBaseSrc *src, guint64 offset, guint size,
                                     GstBuffer *buf);
    };

### enum GstBaseSrcFlags

#### Members

GST_BASE_SRC_FLAG_STARTING |  |
GST_BASE_SRC_FLAG_STARTED |  |
GST_BASE_SRC_FLAG_LAST |  |

## Property Details

### The `“blocksize”` property

      “blocksize”                guint

Size in bytes to read per buffer (-1 = default).

Flags: Read / Write

Default value: 4096

### The `“do-timestamp”` property

      “do-timestamp”             gboolean

Apply current stream time to buffers.

Flags: Read / Write

Default value: FALSE

### The `“num-buffers”` property

      “num-buffers”              gint

Number of buffers to output before sending EOS (-1 = unlimited).

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“typefind”` property

      “typefind”                 gboolean

Run typefind before negotiating.

Flags: Read / Write

Default value: FALSE