# GstBaseSrc

This is a generic base class for source elements. The following types of sources are supported:

- random access sources like files
- seekable sources
- live sources

The source can be configured to operate in any GstFormat with the gst_base_src_set_format method. The currently set format determines the format of the internal GstSegment and any GST_EVENT_SEGMENT events. The default format for GstBaseSrc is GST_FORMAT_BYTES.

GstBaseSrc always supports push mode scheduling. If the following conditions are met, it also supports pull mode scheduling:

- The format is set to GST_FORMAT_BYTES (default).
- is_seekable returns TRUE.

If all the conditions are met for operating in pull mode, GstBaseSrc is automatically seekable in push mode as well. The following conditions must be met to make the element seekable in push mode when the format is not GST_FORMAT_BYTES:

- is_seekable returns TRUE.
- query can convert all supported seek formats to the internal format as set with gst_base_src_set_format.
- do_seek is implemented, performs the seek and returns TRUE.

When the element does not meet the requirements to operate in pull mode, the offset and length in the create method should be ignored. It is recommended to subclass GstPushSrc instead, in this situation. If the element can operate in pull mode but only with specific offsets and lengths, it is allowed to generate an error when the wrong values are passed to the create function.

GstBaseSrc has support for live sources. Live sources are sources that when paused discard data, such as audio or video capture devices. A typical live source also produces data at a fixed rate and thus provides a clock to publish this rate. Use gst_base_src_set_live to activate the live source mode.

A live source does not produce data in the PAUSED state. This means that the create method will not be called in PAUSED but only in PLAYING. To signal the pipeline that the element will not produce data, the return value from the READY to PAUSED state will be GST_STATE_CHANGE_NO_PREROLL.

A typical live source will timestamp the buffers it creates with the current running time of the pipeline. This is one reason why a live source can only produce data in the PLAYING state, when the clock is actually distributed and running.

Live sources that synchronize and block on the clock (an audio source, for example) can use gst_base_src_wait_playing when the create function was interrupted by a state change to PAUSED.

The get_times method can be used to implement pseudo-live sources. It only makes sense to implement the get_times function if the source is a live source. The get_times function should return timestamps starting from 0, as if it were a non-live source. The base class will make sure that the timestamps are transformed into the current running_time. The base source will then wait for the calculated running_time before pushing out the buffer.

For live sources, the base class will by default report a latency of 0. For pseudo live sources, the base class will by default measure the difference between the first buffer timestamp and the start time of get_times and will report this value as the latency. Subclasses should override the query function when this behaviour is not acceptable.

There is only support in GstBaseSrc for exactly one source pad, which should be named "src". A source implementation (subclass of GstBaseSrc) should install a pad template in its class_init function, like so:

     static void
     my_element_class_init (GstMyElementClass *klass)
     {
       GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
       // srctemplate should be a #GstStaticPadTemplate with direction
       // %GST_PAD_SRC and name "src"
       gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);

       gst_element_class_set_static_metadata (gstelement_class,
          "Source name",
          "Source",
          "My Source element",
          "The author <my.sink@my.email>");
     }

## Controlled shutdown of live sources in applications

Applications that record from a live source may want to stop recording in a controlled way, so that the recording is stopped, but the data already in the pipeline is processed to the end (remember that many live sources would go on recording forever otherwise). For that to happen the application needs to make the source stop recording and send an EOS event down the pipeline. The application would then wait for an EOS message posted on the pipeline's bus to know when all data has been processed and the pipeline can safely be stopped.

An application may send an EOS event to a source element to make it perform the EOS logic (send EOS event downstream or post a GST_MESSAGE_SEGMENT_DONE on the bus). This can typically be done with the gst_element_send_event function on the element or its parent bin.

After the EOS has been sent to the element, the application should wait for an EOS message to be posted on the pipeline's bus. Once this EOS message is received, it may safely shut down the entire pipeline.

## GstBaseSrc

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

The opaque GstBaseSrc data structure.

### Members

`element` (GstElement) –
No description available
`srcpad` (GstPad *) –
No description available
`live_lock` (GMutex) –
No description available
`live_cond` (GCond) –
No description available
`is_live` (gboolean) –
No description available
`live_running` (gboolean) –
No description available
`blocksize` (guint) –
No description available
`can_activate_push` (gboolean) –
No description available
`random_access` (gboolean) –
No description available
`clock_id` (GstClockID) –
No description available
`segment` (GstSegment) –
No description available
`need_newsegment` (gboolean) –
No description available
`num_buffers` (gint) –
No description available
`num_buffers_left` (gint) –
No description available
`typefind` (gboolean) –
No description available
`running` (gboolean) –
No description available
`pending_seek` (GstEvent *) –
No description available
`priv` (GstBaseSrcPrivate*) –
No description available

### Class structure

#### GstBaseSrcClass

Subclasses can override any of the available virtual methods or not, as needed. At the minimum, the create method should be overridden to produce buffers.

##### Fields

`parent_class` (GstElementClass) –

Element parent class

### GstBase.BaseSrcClass

Subclasses can override any of the available virtual methods or not, as needed. At the minimum, the create method should be overridden to produce buffers.

##### Attributes

`parent_class` (Gst.ElementClass) –

Element parent class

### GstBase.BaseSrcClass

Subclasses can override any of the available virtual methods or not, as needed. At the minimum, the create method should be overridden to produce buffers.

##### Attributes

`parent_class` (Gst.ElementClass) –

Element parent class

## GstBase.BaseSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBase.BaseSrc
                        ╰──GstBase.PushSrc

The opaque GstBase.BaseSrc data structure.

### Members

`element` (Gst.Element) –
No description available
`srcpad` (Gst.Pad) –
No description available
`live_lock` (GLib.Mutex) –
No description available
`live_cond` (GLib.Cond) –
No description available
`is_live` (Number) –
No description available
`live_running` (Number) –
No description available
`blocksize` (Number) –
No description available
`can_activate_push` (Number) –
No description available
`random_access` (Number) –
No description available
`clock_id` (Object) –
No description available
`segment` (Gst.Segment) –
No description available
`need_newsegment` (Number) –
No description available
`num_buffers` (Number) –
No description available
`num_buffers_left` (Number) –
No description available
`typefind` (Number) –
No description available
`running` (Number) –
No description available
`pending_seek` (Gst.Event) –
No description available
`priv` (GstBase.BaseSrcPrivate) –
No description available

## GstBase.BaseSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──GstBase.BaseSrc
                        ╰──GstBase.PushSrc

The opaque GstBase.BaseSrc data structure.

### Members

`element` (Gst.Element) –
No description available
`srcpad` (Gst.Pad) –
No description available
`live_lock` (GLib.Mutex) –
No description available
`live_cond` (GLib.Cond) –
No description available
`is_live` (bool) –
No description available
`live_running` (bool) –
No description available
`blocksize` (int) –
No description available
`can_activate_push` (bool) –
No description available
`random_access` (bool) –
No description available
`clock_id` (object) –
No description available
`segment` (Gst.Segment) –
No description available
`need_newsegment` (bool) –
No description available
`num_buffers` (int) –
No description available
`num_buffers_left` (int) –
No description available
`typefind` (bool) –
No description available
`running` (bool) –
No description available
`pending_seek` (Gst.Event) –
No description available
`priv` (GstBase.BaseSrcPrivate) –
No description available

### Methods

#### gst_base_src_get_allocator

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

Lets GstBaseSrc sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after usage.

Parameters:

`src` –

a GstBaseSrc

`allocator` ( [out][optional][nullable][transfer: full]) –

the GstAllocator used

`params` ( [out][optional]) –

the GstAllocationParams of allocator

#### GstBase.BaseSrc.prototype.get_allocator

    function GstBase.BaseSrc.prototype.get_allocator(): {
        // javascript wrapper for 'gst_base_src_get_allocator'
    }

Lets GstBase.BaseSrc sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after usage.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

#### GstBase.BaseSrc.get_allocator

    def GstBase.BaseSrc.get_allocator (self):
        #python wrapper for 'gst_base_src_get_allocator'

Lets GstBase.BaseSrc sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after usage.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

#### gst_base_src_get_blocksize

    guint
    gst_base_src_get_blocksize (GstBaseSrc * src)

Get the number of bytes that src will push out with each buffer.

Parameters:

`src` –

the source

Returns –

the number of bytes pushed with each buffer.

#### GstBase.BaseSrc.prototype.get_blocksize

    function GstBase.BaseSrc.prototype.get_blocksize(): {
        // javascript wrapper for 'gst_base_src_get_blocksize'
    }

Get the number of bytes that src will push out with each buffer.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns (Number) –

the number of bytes pushed with each buffer.

#### GstBase.BaseSrc.get_blocksize

    def GstBase.BaseSrc.get_blocksize (self):
        #python wrapper for 'gst_base_src_get_blocksize'

Get the number of bytes that src will push out with each buffer.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns (int) –

the number of bytes pushed with each buffer.

#### gst_base_src_get_buffer_pool

    GstBufferPool *
    gst_base_src_get_buffer_pool (GstBaseSrc * src)

Parameters:

`src` –

a GstBaseSrc

Returns ( [nullable][transfer: full]) –

the instance of the GstBufferPool used by the src; unref it after usage.

#### GstBase.BaseSrc.prototype.get_buffer_pool

    function GstBase.BaseSrc.prototype.get_buffer_pool(): {
        // javascript wrapper for 'gst_base_src_get_buffer_pool'
    }

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

Returns (Gst.BufferPool) –

the instance of the Gst.BufferPool used by the src; unref it after usage.

#### GstBase.BaseSrc.get_buffer_pool

    def GstBase.BaseSrc.get_buffer_pool (self):
        #python wrapper for 'gst_base_src_get_buffer_pool'

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

Returns (Gst.BufferPool) –

the instance of the Gst.BufferPool used by the src; unref it after usage.

#### gst_base_src_get_do_timestamp

    gboolean
    gst_base_src_get_do_timestamp (GstBaseSrc * src)

Query if src timestamps outgoing buffers based on the current running_time.

Parameters:

`src` –

the source

Returns –

TRUE if the base class will automatically timestamp outgoing buffers.

#### GstBase.BaseSrc.prototype.get_do_timestamp

    function GstBase.BaseSrc.prototype.get_do_timestamp(): {
        // javascript wrapper for 'gst_base_src_get_do_timestamp'
    }

Query if src timestamps outgoing buffers based on the current running_time.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns (Number) –

true if the base class will automatically timestamp outgoing buffers.

#### GstBase.BaseSrc.get_do_timestamp

    def GstBase.BaseSrc.get_do_timestamp (self):
        #python wrapper for 'gst_base_src_get_do_timestamp'

Query if src timestamps outgoing buffers based on the current running_time.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns (bool) –

True if the base class will automatically timestamp outgoing buffers.

#### gst_base_src_is_async

    gboolean
    gst_base_src_is_async (GstBaseSrc * src)

Get the current async behaviour of src. See also gst_base_src_set_async.

Parameters:

`src` –

base source instance

Returns –

TRUE if src is operating in async mode.

#### GstBase.BaseSrc.prototype.is_async

    function GstBase.BaseSrc.prototype.is_async(): {
        // javascript wrapper for 'gst_base_src_is_async'
    }

Get the current async behaviour of src. See also GstBase.BaseSrc.prototype.set_async.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (Number) –

true if src is operating in async mode.

#### GstBase.BaseSrc.is_async

    def GstBase.BaseSrc.is_async (self):
        #python wrapper for 'gst_base_src_is_async'

Get the current async behaviour of src. See also GstBase.BaseSrc.set_async.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (bool) –

True if src is operating in async mode.

#### gst_base_src_is_live

    gboolean
    gst_base_src_is_live (GstBaseSrc * src)

Check if an element is in live mode.

Parameters:

`src` –

base source instance

Returns –

TRUE if element is in live mode.

#### GstBase.BaseSrc.prototype.is_live

    function GstBase.BaseSrc.prototype.is_live(): {
        // javascript wrapper for 'gst_base_src_is_live'
    }

Check if an element is in live mode.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (Number) –

true if element is in live mode.

#### GstBase.BaseSrc.is_live

    def GstBase.BaseSrc.is_live (self):
        #python wrapper for 'gst_base_src_is_live'

Check if an element is in live mode.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (bool) –

True if element is in live mode.

#### gst_base_src_negotiate

    gboolean
    gst_base_src_negotiate (GstBaseSrc * src)

Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if negotiate fails.

Do not call this in the fill vmethod. Call this in create or in alloc, before any buffer is allocated.

Parameters:

`src` –

base source instance

Returns –

TRUE if the negotiation succeeded, else FALSE.

Since : 1.18

#### GstBase.BaseSrc.prototype.negotiate

    function GstBase.BaseSrc.prototype.negotiate(): {
        // javascript wrapper for 'gst_base_src_negotiate'
    }

Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if vfunc_negotiate fails.

Do not call this in the vfunc_fill vmethod. Call this in vfunc_create or in vfunc_alloc, before any buffer is allocated.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (Number) –

true if the negotiation succeeded, else false.

Since : 1.18

#### GstBase.BaseSrc.negotiate

    def GstBase.BaseSrc.negotiate (self):
        #python wrapper for 'gst_base_src_negotiate'

Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if do_negotiate fails.

Do not call this in the do_fill vmethod. Call this in do_create or in do_alloc, before any buffer is allocated.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

Returns (bool) –

True if the negotiation succeeded, else False.

Since : 1.18

#### gst_base_src_new_seamless_segment

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

Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the create function, as the stream-lock needs to be held.

The format for the new segment will be the current format of the source, as configured with gst_base_src_set_format

Parameters:

`src` –

The source

`start` –

The new start value for the segment

`stop` –

Stop value for the new segment

`time` –

The new time value for the start of the new segment

Returns –

TRUE if preparation of the seamless segment succeeded.

deprecated : 1.18: Use gst_base_src_new_segment()

#### GstBase.BaseSrc.prototype.new_seamless_segment

    function GstBase.BaseSrc.prototype.new_seamless_segment(start: Number, stop: Number, time: Number): {
        // javascript wrapper for 'gst_base_src_new_seamless_segment'
    }

Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the vfunc_create function, as the stream-lock needs to be held.

The format for the new segment will be the current format of the source, as configured with GstBase.BaseSrc.prototype.set_format

Parameters:

`src` (GstBase.BaseSrc) –

The source

`start` (Number) –

The new start value for the segment

`stop` (Number) –

Stop value for the new segment

`time` (Number) –

The new time value for the start of the new segment

Returns (Number) –

true if preparation of the seamless segment succeeded.

deprecated : 1.18: Use gst_base_src_new_segment()

#### GstBase.BaseSrc.new_seamless_segment

    def GstBase.BaseSrc.new_seamless_segment (self, start, stop, time):
        #python wrapper for 'gst_base_src_new_seamless_segment'

Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the do_create function, as the stream-lock needs to be held.

The format for the new segment will be the current format of the source, as configured with GstBase.BaseSrc.set_format

Parameters:

`src` (GstBase.BaseSrc) –

The source

`start` (int) –

The new start value for the segment

`stop` (int) –

Stop value for the new segment

`time` (int) –

The new time value for the start of the new segment

Returns (bool) –

True if preparation of the seamless segment succeeded.

deprecated : 1.18: Use gst_base_src_new_segment()

#### gst_base_src_new_segment

    gboolean
    gst_base_src_new_segment (GstBaseSrc * src,
                              const GstSegment * segment)

Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the create function, as the stream-lock needs to be held.

The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format.

The format of src must not be GST_FORMAT_UNDEFINED and the format should be configured via gst_base_src_set_format before calling this method.

Parameters:

`src` –

a GstBaseSrc

`segment` –

a pointer to a GstSegment

Returns –

TRUE if preparation of new segment succeeded.

Since : 1.18

#### GstBase.BaseSrc.prototype.new_segment

    function GstBase.BaseSrc.prototype.new_segment(segment: Gst.Segment): {
        // javascript wrapper for 'gst_base_src_new_segment'
    }

Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the vfunc_create function, as the stream-lock needs to be held.

The format for the segment must be identical with the current format of the source, as configured with GstBase.BaseSrc.prototype.set_format.

The format of src must not be Gst.Format.UNDEFINED and the format should be configured via GstBase.BaseSrc.prototype.set_format before calling this method.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`segment` (Gst.Segment) –

a pointer to a Gst.Segment

Returns (Number) –

true if preparation of new segment succeeded.

Since : 1.18

#### GstBase.BaseSrc.new_segment

    def GstBase.BaseSrc.new_segment (self, segment):
        #python wrapper for 'gst_base_src_new_segment'

Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the do_create function, as the stream-lock needs to be held.

The format for the segment must be identical with the current format of the source, as configured with GstBase.BaseSrc.set_format.

The format of src must not be Gst.Format.UNDEFINED and the format should be configured via GstBase.BaseSrc.set_format before calling this method.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`segment` (Gst.Segment) –

a pointer to a Gst.Segment

Returns (bool) –

True if preparation of new segment succeeded.

Since : 1.18

#### gst_base_src_push_segment

    gboolean
    gst_base_src_push_segment (GstBaseSrc * src,
                               const GstSegment * segment)

Send a new segment downstream. This function must only be called by derived sub-classes, and only from the create function, as the stream-lock needs to be held. This method also requires that an out caps has been configured, so gst_base_src_set_caps needs to have been called before.

The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format.

The format of src must not be GST_FORMAT_UNDEFINED and the format should be configured via gst_base_src_set_format before calling this method.

This is a variant of gst_base_src_new_segment sending the segment right away, which can be useful to ensure events ordering.

Parameters:

`src` –

a GstBaseSrc

`segment` –

a pointer to a GstSegment

Returns –

TRUE if sending of new segment succeeded.

Since : 1.24

#### GstBase.BaseSrc.prototype.push_segment

    function GstBase.BaseSrc.prototype.push_segment(segment: Gst.Segment): {
        // javascript wrapper for 'gst_base_src_push_segment'
    }

Send a new segment downstream. This function must only be called by derived sub-classes, and only from the vfunc_create function, as the stream-lock needs to be held. This method also requires that an out caps has been configured, so GstBase.BaseSrc.prototype.set_caps needs to have been called before.

The format for the segment must be identical with the current format of the source, as configured with GstBase.BaseSrc.prototype.set_format.

The format of src must not be Gst.Format.UNDEFINED and the format should be configured via GstBase.BaseSrc.prototype.set_format before calling this method.

This is a variant of GstBase.BaseSrc.prototype.new_segment sending the segment right away, which can be useful to ensure events ordering.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`segment` (Gst.Segment) –

a pointer to a Gst.Segment

Returns (Number) –

true if sending of new segment succeeded.

Since : 1.24

#### GstBase.BaseSrc.push_segment

    def GstBase.BaseSrc.push_segment (self, segment):
        #python wrapper for 'gst_base_src_push_segment'

Send a new segment downstream. This function must only be called by derived sub-classes, and only from the do_create function, as the stream-lock needs to be held. This method also requires that an out caps has been configured, so GstBase.BaseSrc.set_caps needs to have been called before.

The format for the segment must be identical with the current format of the source, as configured with GstBase.BaseSrc.set_format.

The format of src must not be Gst.Format.UNDEFINED and the format should be configured via GstBase.BaseSrc.set_format before calling this method.

This is a variant of GstBase.BaseSrc.new_segment sending the segment right away, which can be useful to ensure events ordering.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`segment` (Gst.Segment) –

a pointer to a Gst.Segment

Returns (bool) –

True if sending of new segment succeeded.

Since : 1.24

#### gst_base_src_query_latency

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

Query the source for the latency parameters. live will be TRUE when src is configured as a live source. min_latency and max_latency will be set to the difference between the running time and the timestamp of the first buffer.

This function is mostly used by subclasses.

Parameters:

`src` –

the source

`live` ( [out][allow-none]) –

if the source is live

`min_latency` ( [out][allow-none]) –

the min latency of the source

`max_latency` ( [out][allow-none]) –

the max latency of the source

Returns –

TRUE if the query succeeded.

#### GstBase.BaseSrc.prototype.query_latency

    function GstBase.BaseSrc.prototype.query_latency(): {
        // javascript wrapper for 'gst_base_src_query_latency'
    }

Query the source for the latency parameters. live will be true when src is configured as a live source. min_latency and max_latency will be set to the difference between the running time and the timestamp of the first buffer.

This function is mostly used by subclasses.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns a tuple made of:

(Number ) –

true if the query succeeded.

`live` (Number ) –

true if the query succeeded.

`min_latency` (Number ) –

true if the query succeeded.

`max_latency` (Number ) –

true if the query succeeded.

#### GstBase.BaseSrc.query_latency

    def GstBase.BaseSrc.query_latency (self):
        #python wrapper for 'gst_base_src_query_latency'

Query the source for the latency parameters. live will be True when src is configured as a live source. min_latency and max_latency will be set to the difference between the running time and the timestamp of the first buffer.

This function is mostly used by subclasses.

Parameters:

`src` (GstBase.BaseSrc) –

the source

Returns a tuple made of:

(bool ) –

True if the query succeeded.

`live` (bool ) –

True if the query succeeded.

`min_latency` (int ) –

True if the query succeeded.

`max_latency` (int ) –

True if the query succeeded.

#### gst_base_src_set_async

    gst_base_src_set_async (GstBaseSrc * src,
                            gboolean async)

Configure async behaviour in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.

Parameters:

`src` –

base source instance

`async` –

new async mode

#### GstBase.BaseSrc.prototype.set_async

    function GstBase.BaseSrc.prototype.set_async(async: Number): {
        // javascript wrapper for 'gst_base_src_set_async'
    }

Configure async behaviour in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`async` (Number) –

new async mode

#### GstBase.BaseSrc.set_async

    def GstBase.BaseSrc.set_async (self, async):
        #python wrapper for 'gst_base_src_set_async'

Configure async behaviour in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`async` (bool) –

new async mode

#### gst_base_src_set_automatic_eos

    gst_base_src_set_automatic_eos (GstBaseSrc * src,
                                    gboolean automatic_eos)

If automatic_eos is TRUE, src will automatically go EOS if a buffer after the total size is returned. By default this is TRUE but sources that can't return an authoritative size and only know that they're EOS when trying to read more should set this to FALSE.

When src operates in GST_FORMAT_TIME, GstBaseSrc will send an EOS when a buffer outside of the currently configured segment is pushed if automatic_eos is TRUE. Since 1.16, if automatic_eos is FALSE an EOS will be pushed only when the create implementation returns GST_FLOW_EOS.

Parameters:

`src` –

base source instance

`automatic_eos` –

automatic eos

Since : 1.4

#### GstBase.BaseSrc.prototype.set_automatic_eos

    function GstBase.BaseSrc.prototype.set_automatic_eos(automatic_eos: Number): {
        // javascript wrapper for 'gst_base_src_set_automatic_eos'
    }

If automatic_eos is true, src will automatically go EOS if a buffer after the total size is returned. By default this is true but sources that can't return an authoritative size and only know that they're EOS when trying to read more should set this to false.

When src operates in Gst.Format.TIME, GstBase.BaseSrc will send an EOS when a buffer outside of the currently configured segment is pushed if automatic_eos is true. Since 1.16, if automatic_eos is false an EOS will be pushed only when the vfunc_create implementation returns Gst.FlowReturn.EOS.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`automatic_eos` (Number) –

automatic eos

Since : 1.4

#### GstBase.BaseSrc.set_automatic_eos

    def GstBase.BaseSrc.set_automatic_eos (self, automatic_eos):
        #python wrapper for 'gst_base_src_set_automatic_eos'

If automatic_eos is True, src will automatically go EOS if a buffer after the total size is returned. By default this is True but sources that can't return an authoritative size and only know that they're EOS when trying to read more should set this to False.

When src operates in Gst.Format.TIME, GstBase.BaseSrc will send an EOS when a buffer outside of the currently configured segment is pushed if automatic_eos is True. Since 1.16, if automatic_eos is False an EOS will be pushed only when the do_create implementation returns Gst.FlowReturn.EOS.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`automatic_eos` (bool) –

automatic eos

Since : 1.4

#### gst_base_src_set_blocksize

    gst_base_src_set_blocksize (GstBaseSrc * src,
                                guint blocksize)

Set the number of bytes that src will push out with each buffer. When blocksize is set to -1, a default length will be used.

Parameters:

`src` –

the source

`blocksize` –

the new blocksize in bytes

#### GstBase.BaseSrc.prototype.set_blocksize

    function GstBase.BaseSrc.prototype.set_blocksize(blocksize: Number): {
        // javascript wrapper for 'gst_base_src_set_blocksize'
    }

Set the number of bytes that src will push out with each buffer. When blocksize is set to -1, a default length will be used.

Parameters:

`src` (GstBase.BaseSrc) –

the source

`blocksize` (Number) –

the new blocksize in bytes

#### GstBase.BaseSrc.set_blocksize

    def GstBase.BaseSrc.set_blocksize (self, blocksize):
        #python wrapper for 'gst_base_src_set_blocksize'

Set the number of bytes that src will push out with each buffer. When blocksize is set to -1, a default length will be used.

Parameters:

`src` (GstBase.BaseSrc) –

the source

`blocksize` (int) –

the new blocksize in bytes

#### gst_base_src_set_caps

    gboolean
    gst_base_src_set_caps (GstBaseSrc * src,
                           GstCaps * caps)

Set new caps on the basesrc source pad.

Parameters:

`src` –

a GstBaseSrc

`caps` ( [transfer: none]) –

a GstCaps

Returns –

TRUE if the caps could be set

#### GstBase.BaseSrc.prototype.set_caps

    function GstBase.BaseSrc.prototype.set_caps(caps: Gst.Caps): {
        // javascript wrapper for 'gst_base_src_set_caps'
    }

Set new caps on the basesrc source pad.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`caps` (Gst.Caps) –

a Gst.Caps

Returns (Number) –

true if the caps could be set

#### GstBase.BaseSrc.set_caps

    def GstBase.BaseSrc.set_caps (self, caps):
        #python wrapper for 'gst_base_src_set_caps'

Set new caps on the basesrc source pad.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`caps` (Gst.Caps) –

a Gst.Caps

Returns (bool) –

True if the caps could be set

#### gst_base_src_set_do_timestamp

    gst_base_src_set_do_timestamp (GstBaseSrc * src,
                                   gboolean timestamp)

Configure src to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.

Parameters:

`src` –

the source

`timestamp` –

enable or disable timestamping

#### GstBase.BaseSrc.prototype.set_do_timestamp

    function GstBase.BaseSrc.prototype.set_do_timestamp(timestamp: Number): {
        // javascript wrapper for 'gst_base_src_set_do_timestamp'
    }

Configure src to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.

Parameters:

`src` (GstBase.BaseSrc) –

the source

`timestamp` (Number) –

enable or disable timestamping

#### GstBase.BaseSrc.set_do_timestamp

    def GstBase.BaseSrc.set_do_timestamp (self, timestamp):
        #python wrapper for 'gst_base_src_set_do_timestamp'

Configure src to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.

Parameters:

`src` (GstBase.BaseSrc) –

the source

`timestamp` (bool) –

enable or disable timestamping

#### gst_base_src_set_dynamic_size

    gst_base_src_set_dynamic_size (GstBaseSrc * src,
                                   gboolean dynamic)

If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.

Parameters:

`src` –

base source instance

`dynamic` –

new dynamic size mode

#### GstBase.BaseSrc.prototype.set_dynamic_size

    function GstBase.BaseSrc.prototype.set_dynamic_size(dynamic: Number): {
        // javascript wrapper for 'gst_base_src_set_dynamic_size'
    }

If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`dynamic` (Number) –

new dynamic size mode

#### GstBase.BaseSrc.set_dynamic_size

    def GstBase.BaseSrc.set_dynamic_size (self, dynamic):
        #python wrapper for 'gst_base_src_set_dynamic_size'

If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`dynamic` (bool) –

new dynamic size mode

#### gst_base_src_set_format

    gst_base_src_set_format (GstBaseSrc * src,
                             GstFormat format)

Sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.

If a format of GST_FORMAT_BYTES is set, the element will be able to operate in pull mode if the is_seekable returns TRUE.

This function must only be called in states < GST_STATE_PAUSED.

Parameters:

`src` –

base source instance

`format` –

the format to use

#### GstBase.BaseSrc.prototype.set_format

    function GstBase.BaseSrc.prototype.set_format(format: Gst.Format): {
        // javascript wrapper for 'gst_base_src_set_format'
    }

Sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.

If a format of GST_FORMAT_BYTES is set, the element will be able to operate in pull mode if the vfunc_is_seekable returns true.

This function must only be called in states < Gst.State.PAUSED.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`format` (Gst.Format) –

the format to use

#### GstBase.BaseSrc.set_format

    def GstBase.BaseSrc.set_format (self, format):
        #python wrapper for 'gst_base_src_set_format'

Sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.

If a format of GST_FORMAT_BYTES is set, the element will be able to operate in pull mode if the do_is_seekable returns True.

This function must only be called in states < Gst.State.PAUSED.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`format` (Gst.Format) –

the format to use

#### gst_base_src_set_live

    gst_base_src_set_live (GstBaseSrc * src,
                           gboolean live)

If the element listens to a live source, live should be set to TRUE.

A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be GST_STATE_CHANGE_NO_PREROLL.

Parameters:

`src` –

base source instance

`live` –

new live-mode

#### GstBase.BaseSrc.prototype.set_live

    function GstBase.BaseSrc.prototype.set_live(live: Number): {
        // javascript wrapper for 'gst_base_src_set_live'
    }

If the element listens to a live source, live should be set to true.

A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be GST_STATE_CHANGE_NO_PREROLL.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`live` (Number) –

new live-mode

#### GstBase.BaseSrc.set_live

    def GstBase.BaseSrc.set_live (self, live):
        #python wrapper for 'gst_base_src_set_live'

If the element listens to a live source, live should be set to True.

A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be GST_STATE_CHANGE_NO_PREROLL.

Parameters:

`src` (GstBase.BaseSrc) –

base source instance

`live` (bool) –

new live-mode

#### gst_base_src_start_complete

    gst_base_src_start_complete (GstBaseSrc * basesrc,
                                 GstFlowReturn ret)

Complete an asynchronous start operation. When the subclass overrides the start method, it should call gst_base_src_start_complete when the start operation completes either from the same thread or from an asynchronous helper thread.

Parameters:

`basesrc` –

base source instance

`ret` –

a GstFlowReturn

#### GstBase.BaseSrc.prototype.start_complete

    function GstBase.BaseSrc.prototype.start_complete(ret: Gst.FlowReturn): {
        // javascript wrapper for 'gst_base_src_start_complete'
    }

Complete an asynchronous start operation. When the subclass overrides the start method, it should call GstBase.BaseSrc.prototype.start_complete when the start operation completes either from the same thread or from an asynchronous helper thread.

Parameters:

`basesrc` (GstBase.BaseSrc) –

base source instance

`ret` (Gst.FlowReturn) –

a Gst.FlowReturn

#### GstBase.BaseSrc.start_complete

    def GstBase.BaseSrc.start_complete (self, ret):
        #python wrapper for 'gst_base_src_start_complete'

Complete an asynchronous start operation. When the subclass overrides the start method, it should call GstBase.BaseSrc.start_complete when the start operation completes either from the same thread or from an asynchronous helper thread.

Parameters:

`basesrc` (GstBase.BaseSrc) –

base source instance

`ret` (Gst.FlowReturn) –

a Gst.FlowReturn

#### gst_base_src_start_wait

    GstFlowReturn
    gst_base_src_start_wait (GstBaseSrc * basesrc)

Wait until the start operation completes.

Parameters:

`basesrc` –

base source instance

Returns –

a GstFlowReturn.

#### GstBase.BaseSrc.prototype.start_wait

    function GstBase.BaseSrc.prototype.start_wait(): {
        // javascript wrapper for 'gst_base_src_start_wait'
    }

Wait until the start operation completes.

Parameters:

`basesrc` (GstBase.BaseSrc) –

base source instance

Returns (Gst.FlowReturn) –

a Gst.FlowReturn.

#### GstBase.BaseSrc.start_wait

    def GstBase.BaseSrc.start_wait (self):
        #python wrapper for 'gst_base_src_start_wait'

Wait until the start operation completes.

Parameters:

`basesrc` (GstBase.BaseSrc) –

base source instance

Returns (Gst.FlowReturn) –

a Gst.FlowReturn.

#### gst_base_src_submit_buffer_list

    gst_base_src_submit_buffer_list (GstBaseSrc * src,
                                     GstBufferList * buffer_list)

Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a GstBufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).

Subclasses that use this function from their create function must return GST_FLOW_OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behaviour is undefined.

Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.

Parameters:

`src` –

a GstBaseSrc

`buffer_list` ( [transfer: full]) –

a GstBufferList

Since : 1.14

#### GstBase.BaseSrc.prototype.submit_buffer_list

    function GstBase.BaseSrc.prototype.submit_buffer_list(buffer_list: Gst.BufferList): {
        // javascript wrapper for 'gst_base_src_submit_buffer_list'
    }

Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a Gst.BufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).

Subclasses that use this function from their create function must return Gst.FlowReturn.OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behaviour is undefined.

Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`buffer_list` (Gst.BufferList) –

a Gst.BufferList

Since : 1.14

#### GstBase.BaseSrc.submit_buffer_list

    def GstBase.BaseSrc.submit_buffer_list (self, buffer_list):
        #python wrapper for 'gst_base_src_submit_buffer_list'

Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a Gst.BufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).

Subclasses that use this function from their create function must return Gst.FlowReturn.OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behaviour is undefined.

Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.

Parameters:

`src` (GstBase.BaseSrc) –

a GstBase.BaseSrc

`buffer_list` (Gst.BufferList) –

a Gst.BufferList

Since : 1.14

#### gst_base_src_wait_playing

    GstFlowReturn
    gst_base_src_wait_playing (GstBaseSrc * src)

If the create method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to produce the remaining data.

This function will block until a state change to PLAYING happens (in which case this function returns GST_FLOW_OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns GST_FLOW_FLUSHING).

Parameters:

`src` –

the src

Returns –

GST_FLOW_OK if src is PLAYING and processing can continue. Any other return value should be returned from the create vmethod.

#### GstBase.BaseSrc.prototype.wait_playing

    function GstBase.BaseSrc.prototype.wait_playing(): {
        // javascript wrapper for 'gst_base_src_wait_playing'
    }

If the vfunc_create method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to produce the remaining data.

This function will block until a state change to PLAYING happens (in which case this function returns Gst.FlowReturn.OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns Gst.FlowReturn.FLUSHING).

Parameters:

`src` (GstBase.BaseSrc) –

the src

Returns (Gst.FlowReturn) –

Gst.FlowReturn.OK if src is PLAYING and processing can continue. Any other return value should be returned from the create vmethod.

#### GstBase.BaseSrc.wait_playing

    def GstBase.BaseSrc.wait_playing (self):
        #python wrapper for 'gst_base_src_wait_playing'

If the do_create method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to produce the remaining data.

This function will block until a state change to PLAYING happens (in which case this function returns Gst.FlowReturn.OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns Gst.FlowReturn.FLUSHING).

Parameters:

`src` (GstBase.BaseSrc) –

the src

Returns (Gst.FlowReturn) –

Gst.FlowReturn.OK if src is PLAYING and processing can continue. Any other return value should be returned from the create vmethod.

### Properties

#### automatic-eos

    “automatic-eos” gboolean

See gst_base_src_set_automatic_eos

Flags : Read / Write

Since : 1.24

#### automatic-eos

    “automatic-eos” Number

See GstBase.BaseSrc.prototype.set_automatic_eos

Flags : Read / Write

Since : 1.24

#### automatic_eos

    “self.props.automatic_eos” bool

See GstBase.BaseSrc.set_automatic_eos

Flags : Read / Write

Since : 1.24

#### blocksize

    “blocksize” guint

Flags : Read / Write

#### blocksize

    “blocksize” Number

Flags : Read / Write

#### blocksize

    “self.props.blocksize” int

Flags : Read / Write

#### do-timestamp

    “do-timestamp” gboolean

Flags : Read / Write

#### do-timestamp

    “do-timestamp” Number

Flags : Read / Write

#### do_timestamp

    “self.props.do_timestamp” bool

Flags : Read / Write

#### num-buffers

    “num-buffers” gint

Flags : Read / Write

#### num-buffers

    “num-buffers” Number

Flags : Read / Write

#### num_buffers

    “self.props.num_buffers” int

Flags : Read / Write

#### typefind

    “typefind” gboolean

Flags : Read / Write

#### typefind

    “typefind” Number

Flags : Read / Write

#### typefind

    “self.props.typefind” bool

Flags : Read / Write

### Virtual Methods

#### alloc

    GstFlowReturn
    alloc (GstBaseSrc * src,
           guint64 offset,
           guint size,
           GstBuffer ** buf)

Ask the subclass to allocate a buffer with for offset and size. The default implementation will create a new buffer from the negotiated allocator.

Parameters:

`src` –
No description available
`offset` –
No description available
`size` –
No description available
`buf` –
No description available
Returns –
No description available

#### vfunc_alloc

    function vfunc_alloc(src: GstBase.BaseSrc, offset: Number, size: Number): {
        // javascript implementation of the 'alloc' virtual method
    }

Ask the subclass to allocate a buffer with for offset and size. The default implementation will create a new buffer from the negotiated allocator.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (Number) –
No description available
`size` (Number) –
No description available

Returns a tuple made of:

(Gst.FlowReturn ) –
No description available
`buf` (Gst.Buffer ) –
No description available

#### do_alloc

    def do_alloc (src, offset, size):
        #python implementation of the 'alloc' virtual method

Ask the subclass to allocate a buffer with for offset and size. The default implementation will create a new buffer from the negotiated allocator.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (int) –
No description available
`size` (int) –
No description available

Returns a tuple made of:

(Gst.FlowReturn ) –
No description available
`buf` (Gst.Buffer ) –
No description available

#### create

    GstFlowReturn
    create (GstBaseSrc * src,
            guint64 offset,
            guint size,
            GstBuffer ** buf)

Ask the subclass to create a buffer with offset and size. When the subclass returns GST_FLOW_OK, it MUST return a buffer of the requested size unless fewer bytes are available because an EOS condition is near. No buffer should be returned when the return value is different from GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the end of stream is reached. The default implementation will call alloc and then call fill.

Parameters:

`src` –
No description available
`offset` –
No description available
`size` –
No description available
`buf` –
No description available
Returns –
No description available

#### vfunc_create

    function vfunc_create(src: GstBase.BaseSrc, offset: Number, size: Number, buf: Gst.Buffer): {
        // javascript implementation of the 'create' virtual method
    }

Ask the subclass to create a buffer with offset and size. When the subclass returns GST_FLOW_OK, it MUST return a buffer of the requested size unless fewer bytes are available because an EOS condition is near. No buffer should be returned when the return value is different from GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the end of stream is reached. The default implementation will call vfunc_alloc and then call vfunc_fill.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (Number) –
No description available
`size` (Number) –
No description available
`buf` (Gst.Buffer) –
No description available

Returns a tuple made of:

(Gst.FlowReturn ) –
No description available
`buf` (Gst.Buffer ) –
No description available

#### do_create

    def do_create (src, offset, size, buf):
        #python implementation of the 'create' virtual method

Ask the subclass to create a buffer with offset and size. When the subclass returns GST_FLOW_OK, it MUST return a buffer of the requested size unless fewer bytes are available because an EOS condition is near. No buffer should be returned when the return value is different from GST_FLOW_OK. A return value of GST_FLOW_EOS signifies that the end of stream is reached. The default implementation will call do_alloc and then call do_fill.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (int) –
No description available
`size` (int) –
No description available
`buf` (Gst.Buffer) –
No description available

Returns a tuple made of:

(Gst.FlowReturn ) –
No description available
`buf` (Gst.Buffer ) –
No description available

#### decide_allocation

    gboolean
    decide_allocation (GstBaseSrc * src,
                       GstQuery * query)

configure the allocation query

Parameters:

`src` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_decide_allocation

    function vfunc_decide_allocation(src: GstBase.BaseSrc, query: Gst.Query): {
        // javascript implementation of the 'decide_allocation' virtual method
    }

configure the allocation query

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_decide_allocation

    def do_decide_allocation (src, query):
        #python implementation of the 'decide_allocation' virtual method

configure the allocation query

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### do_seek

    gboolean
    do_seek (GstBaseSrc * src,
             GstSegment * segment)

Perform seeking on the resource to the indicated segment.

Parameters:

`src` –
No description available
`segment` –
No description available
Returns –
No description available

#### vfunc_do_seek

    function vfunc_do_seek(src: GstBase.BaseSrc, segment: Gst.Segment): {
        // javascript implementation of the 'do_seek' virtual method
    }

Perform seeking on the resource to the indicated segment.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`segment` (Gst.Segment) –
No description available
Returns (Number) –
No description available

#### do_do_seek

    def do_do_seek (src, segment):
        #python implementation of the 'do_seek' virtual method

Perform seeking on the resource to the indicated segment.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`segment` (Gst.Segment) –
No description available
Returns (bool) –
No description available

#### event

    gboolean
    event (GstBaseSrc * src,
           GstEvent * event)

Override this to implement custom event handling.

Parameters:

`src` –
No description available
`event` –
No description available
Returns –
No description available

#### vfunc_event

    function vfunc_event(src: GstBase.BaseSrc, event: Gst.Event): {
        // javascript implementation of the 'event' virtual method
    }

Override this to implement custom event handling.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`event` (Gst.Event) –
No description available
Returns (Number) –
No description available

#### do_event

    def do_event (src, event):
        #python implementation of the 'event' virtual method

Override this to implement custom event handling.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`event` (Gst.Event) –
No description available
Returns (bool) –
No description available

#### fill

    GstFlowReturn
    fill (GstBaseSrc * src,
          guint64 offset,
          guint size,
          GstBuffer * buf)

Ask the subclass to fill the buffer with data for offset and size. The passed buffer is guaranteed to hold the requested amount of bytes.

Parameters:

`src` –
No description available
`offset` –
No description available
`size` –
No description available
`buf` –
No description available
Returns –
No description available

#### vfunc_fill

    function vfunc_fill(src: GstBase.BaseSrc, offset: Number, size: Number, buf: Gst.Buffer): {
        // javascript implementation of the 'fill' virtual method
    }

Ask the subclass to fill the buffer with data for offset and size. The passed buffer is guaranteed to hold the requested amount of bytes.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (Number) –
No description available
`size` (Number) –
No description available
`buf` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### do_fill

    def do_fill (src, offset, size, buf):
        #python implementation of the 'fill' virtual method

Ask the subclass to fill the buffer with data for offset and size. The passed buffer is guaranteed to hold the requested amount of bytes.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`offset` (int) –
No description available
`size` (int) –
No description available
`buf` (Gst.Buffer) –
No description available
Returns (Gst.FlowReturn) –
No description available

#### fixate

    GstCaps *
    fixate (GstBaseSrc * src,
            GstCaps * caps)

Called during negotiation if caps need fixating. Implement instead of setting a fixate function on the source pad.

Parameters:

`src` –
No description available
`caps` –
No description available
Returns –
No description available

#### vfunc_fixate

    function vfunc_fixate(src: GstBase.BaseSrc, caps: Gst.Caps): {
        // javascript implementation of the 'fixate' virtual method
    }

Called during negotiation if caps need fixating. Implement instead of setting a fixate function on the source pad.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`caps` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### do_fixate

    def do_fixate (src, caps):
        #python implementation of the 'fixate' virtual method

Called during negotiation if caps need fixating. Implement instead of setting a fixate function on the source pad.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`caps` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### get_caps

    GstCaps *
    get_caps (GstBaseSrc * src,
              GstCaps * filter)

Called to get the caps to report

Parameters:

`src` –
No description available
`filter` –
No description available
Returns –
No description available

#### vfunc_get_caps

    function vfunc_get_caps(src: GstBase.BaseSrc, filter: Gst.Caps): {
        // javascript implementation of the 'get_caps' virtual method
    }

Called to get the caps to report

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`filter` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### do_get_caps

    def do_get_caps (src, filter):
        #python implementation of the 'get_caps' virtual method

Called to get the caps to report

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`filter` (Gst.Caps) –
No description available
Returns (Gst.Caps) –
No description available

#### get_size

    gboolean
    get_size (GstBaseSrc * src,
              guint64 * size)

Return the total size of the resource, in the format set by gst_base_src_set_format.

Parameters:

`src` –
No description available
`size` –
No description available
Returns –
No description available

#### vfunc_get_size

    function vfunc_get_size(src: GstBase.BaseSrc): {
        // javascript implementation of the 'get_size' virtual method
    }

Return the total size of the resource, in the format set by GstBase.BaseSrc.prototype.set_format.

Parameters:

`src` (GstBase.BaseSrc) –
No description available

Returns a tuple made of:

(Number ) –
No description available
`size` (Number ) –
No description available

#### do_get_size

    def do_get_size (src):
        #python implementation of the 'get_size' virtual method

Return the total size of the resource, in the format set by GstBase.BaseSrc.set_format.

Parameters:

`src` (GstBase.BaseSrc) –
No description available

Returns a tuple made of:

(bool ) –
No description available
`size` (int ) –
No description available

#### get_times

    get_times (GstBaseSrc * src,
               GstBuffer * buffer,
               GstClockTime * start,
               GstClockTime * end)

Given a buffer, return the start and stop time when it should be pushed out. The base class will sync on the clock using these times.

Parameters:

`src` –
No description available
`buffer` –
No description available
`start` –
No description available
`end` –
No description available

#### vfunc_get_times

    function vfunc_get_times(src: GstBase.BaseSrc, buffer: Gst.Buffer): {
        // javascript implementation of the 'get_times' virtual method
    }

Given a buffer, return the start and stop time when it should be pushed out. The base class will sync on the clock using these times.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`buffer` (Gst.Buffer) –
No description available

#### do_get_times

    def do_get_times (src, buffer):
        #python implementation of the 'get_times' virtual method

Given a buffer, return the start and stop time when it should be pushed out. The base class will sync on the clock using these times.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`buffer` (Gst.Buffer) –
No description available

#### is_seekable

    gboolean
    is_seekable (GstBaseSrc * src)

Check if the source can seek

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_is_seekable

    function vfunc_is_seekable(src: GstBase.BaseSrc): {
        // javascript implementation of the 'is_seekable' virtual method
    }

Check if the source can seek

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_is_seekable

    def do_is_seekable (src):
        #python implementation of the 'is_seekable' virtual method

Check if the source can seek

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

#### negotiate

    gboolean
    negotiate (GstBaseSrc * src)

Negotiated the caps with the peer.

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_negotiate

    function vfunc_negotiate(src: GstBase.BaseSrc): {
        // javascript implementation of the 'negotiate' virtual method
    }

Negotiated the caps with the peer.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_negotiate

    def do_negotiate (src):
        #python implementation of the 'negotiate' virtual method

Negotiated the caps with the peer.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

#### prepare_seek_segment

    gboolean
    prepare_seek_segment (GstBaseSrc * src,
                          GstEvent * seek,
                          GstSegment * segment)

Prepare the GstSegment that will be passed to the do_seek vmethod for executing a seek request. Sub-classes should override this if they support seeking in formats other than the configured native format. By default, it tries to convert the seek arguments to the configured native format and prepare a segment in that format.

Parameters:

`src` –
No description available
`seek` –
No description available
`segment` –
No description available
Returns –
No description available

#### vfunc_prepare_seek_segment

    function vfunc_prepare_seek_segment(src: GstBase.BaseSrc, seek: Gst.Event, segment: Gst.Segment): {
        // javascript implementation of the 'prepare_seek_segment' virtual method
    }

Prepare the Gst.Segment that will be passed to the vfunc_do_seek vmethod for executing a seek request. Sub-classes should override this if they support seeking in formats other than the configured native format. By default, it tries to convert the seek arguments to the configured native format and prepare a segment in that format.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`seek` (Gst.Event) –
No description available
`segment` (Gst.Segment) –
No description available
Returns (Number) –
No description available

#### do_prepare_seek_segment

    def do_prepare_seek_segment (src, seek, segment):
        #python implementation of the 'prepare_seek_segment' virtual method

Prepare the Gst.Segment that will be passed to the do_do_seek vmethod for executing a seek request. Sub-classes should override this if they support seeking in formats other than the configured native format. By default, it tries to convert the seek arguments to the configured native format and prepare a segment in that format.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`seek` (Gst.Event) –
No description available
`segment` (Gst.Segment) –
No description available
Returns (bool) –
No description available

#### query

    gboolean
    query (GstBaseSrc * src,
           GstQuery * query)

Handle a requested query.

Parameters:

`src` –
No description available
`query` –
No description available
Returns –
No description available

#### vfunc_query

    function vfunc_query(src: GstBase.BaseSrc, query: Gst.Query): {
        // javascript implementation of the 'query' virtual method
    }

Handle a requested query.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`query` (Gst.Query) –
No description available
Returns (Number) –
No description available

#### do_query

    def do_query (src, query):
        #python implementation of the 'query' virtual method

Handle a requested query.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`query` (Gst.Query) –
No description available
Returns (bool) –
No description available

#### set_caps

    gboolean
    set_caps (GstBaseSrc * src,
              GstCaps * caps)

Notify subclass of changed output caps

Parameters:

`src` –
No description available
`caps` –
No description available
Returns –
No description available

#### vfunc_set_caps

    function vfunc_set_caps(src: GstBase.BaseSrc, caps: Gst.Caps): {
        // javascript implementation of the 'set_caps' virtual method
    }

Notify subclass of changed output caps

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`caps` (Gst.Caps) –
No description available
Returns (Number) –
No description available

#### do_set_caps

    def do_set_caps (src, caps):
        #python implementation of the 'set_caps' virtual method

Notify subclass of changed output caps

Parameters:

`src` (GstBase.BaseSrc) –
No description available
`caps` (Gst.Caps) –
No description available
Returns (bool) –
No description available

#### start

    gboolean
    start (GstBaseSrc * src)

Start processing. Subclasses should open resources and prepare to produce data. Implementation should call gst_base_src_start_complete when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_start

    function vfunc_start(src: GstBase.BaseSrc): {
        // javascript implementation of the 'start' virtual method
    }

Start processing. Subclasses should open resources and prepare to produce data. Implementation should call GstBase.BaseSrc.prototype.start_complete when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_start

    def do_start (src):
        #python implementation of the 'start' virtual method

Start processing. Subclasses should open resources and prepare to produce data. Implementation should call GstBase.BaseSrc.start_complete when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

#### stop

    gboolean
    stop (GstBaseSrc * src)

Stop processing. Subclasses should use this to close resources.

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_stop

    function vfunc_stop(src: GstBase.BaseSrc): {
        // javascript implementation of the 'stop' virtual method
    }

Stop processing. Subclasses should use this to close resources.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_stop

    def do_stop (src):
        #python implementation of the 'stop' virtual method

Stop processing. Subclasses should use this to close resources.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

#### unlock

    gboolean
    unlock (GstBaseSrc * src)

Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any `create()` function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any future create function call should also return GST_FLOW_FLUSHING until the unlock_stop function has been called.

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_unlock

    function vfunc_unlock(src: GstBase.BaseSrc): {
        // javascript implementation of the 'unlock' virtual method
    }

Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any `create()` function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any future vfunc_create function call should also return GST_FLOW_FLUSHING until the vfunc_unlock_stop function has been called.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_unlock

    def do_unlock (src):
        #python implementation of the 'unlock' virtual method

Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any `create()` function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any future do_create function call should also return GST_FLOW_FLUSHING until the do_unlock_stop function has been called.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

#### unlock_stop

    gboolean
    unlock_stop (GstBaseSrc * src)

Clear the previous unlock request. Subclasses should clear any state they set during unlock, such as clearing command queues.

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_unlock_stop

    function vfunc_unlock_stop(src: GstBase.BaseSrc): {
        // javascript implementation of the 'unlock_stop' virtual method
    }

Clear the previous unlock request. Subclasses should clear any state they set during vfunc_unlock, such as clearing command queues.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (Number) –
No description available

#### do_unlock_stop

    def do_unlock_stop (src):
        #python implementation of the 'unlock_stop' virtual method

Clear the previous unlock request. Subclasses should clear any state they set during do_unlock, such as clearing command queues.

Parameters:

`src` (GstBase.BaseSrc) –
No description available
Returns (bool) –
No description available

## Function Macros

### GST_BASE_SRC_CAST

    #define GST_BASE_SRC_CAST(obj)          ((GstBaseSrc *)(obj))

### 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)

### GST_BASE_SRC_PAD

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

Gives the pointer to the GstPad object of the element.

Parameters:

`obj` –

base source instance

## Enumerations

### GstBaseSrcFlags

The GstElement flags that a basesrc element may have.

##### Members

`GST_BASE_SRC_FLAG_STARTING` (16384) –

has source is starting

`GST_BASE_SRC_FLAG_STARTED` (32768) –

has source been started

`GST_BASE_SRC_FLAG_LAST` (1048576) –

offset to define more flags

### GstBase.BaseSrcFlags

The Gst.Element flags that a basesrc element may have.

##### Members

`GstBase.BaseSrcFlags.STARTING` (16384) –

has source is starting

`GstBase.BaseSrcFlags.STARTED` (32768) –

has source been started

`GstBase.BaseSrcFlags.LAST` (1048576) –

offset to define more flags

### GstBase.BaseSrcFlags

The Gst.Element flags that a basesrc element may have.

##### Members

`GstBase.BaseSrcFlags.STARTING` (16384) –

has source is starting

`GstBase.BaseSrcFlags.STARTED` (32768) –

has source been started

`GstBase.BaseSrcFlags.LAST` (1048576) –

offset to define more flags

The results of the search are