# GstControlSource

The GstControlSource is a base class for control value sources that could be used to get timestamp-value pairs. A control source essentially is a function over time.

A GstControlSource is used by first getting an instance of a specific control-source, creating a binding for the control-source to the target property of the element and then adding the binding to the element. The binding will convert the data types and value range to fit to the bound property.

For implementing a new GstControlSource one has to implement GstControlSourceGetValue and GstControlSourceGetValueArray functions. These are then used by gst_control_source_get_value and gst_control_source_get_value_array to get values for specific timestamps.

## GstControlSource

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstControlSource

The instance structure of GstControlSource.

### Members

`parent` (GstObject) –

the parent structure

`get_value` (GstControlSourceGetValue) –

Function for returning a value for a given timestamp

`get_value_array` (GstControlSourceGetValueArray) –

Function for returning a values array for a given timestamp

### Class structure

#### GstControlSourceClass

The class structure of GstControlSource.

##### Fields

`parent_class` (GstObjectClass) –

Parent class

### Gst.ControlSourceClass

The class structure of Gst.ControlSource.

##### Attributes

`parent_class` (Gst.ObjectClass) –

Parent class

### Gst.ControlSourceClass

The class structure of Gst.ControlSource.

##### Attributes

`parent_class` (Gst.ObjectClass) –

Parent class

## Gst.ControlSource

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.ControlSource

The instance structure of Gst.ControlSource.

### Members

`parent` (Gst.Object) –

the parent structure

`get_value` (Gst.ControlSourceGetValue) –

Function for returning a value for a given timestamp

`get_value_array` (Gst.ControlSourceGetValueArray) –

Function for returning a values array for a given timestamp

## Gst.ControlSource

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.ControlSource

The instance structure of Gst.ControlSource.

### Members

`parent` (Gst.Object) –

the parent structure

`get_value` (Gst.ControlSourceGetValue) –

Function for returning a value for a given timestamp

`get_value_array` (Gst.ControlSourceGetValueArray) –

Function for returning a values array for a given timestamp

### Methods

#### gst_control_source_get_value

    gboolean
    gst_control_source_get_value (GstControlSource * self,
                                  GstClockTime timestamp,
                                  gdouble * value)

Gets the value for this GstControlSource at a given timestamp.

Parameters:

`self` –

the GstControlSource object

`timestamp` –

the time for which the value should be returned

`value` ( [out]) –

the value

Returns –

FALSE if the value couldn't be returned, TRUE otherwise.

#### Gst.ControlSource.prototype.control_source_get_value

    function Gst.ControlSource.prototype.control_source_get_value(timestamp: Number): {
        // javascript wrapper for 'gst_control_source_get_value'
    }

Gets the value for this Gst.ControlSource at a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource object

`timestamp` (Number) –

the time for which the value should be returned

Returns a tuple made of:

(Number ) –

false if the value couldn't be returned, true otherwise.

`value` (Number ) –

false if the value couldn't be returned, true otherwise.

#### Gst.ControlSource.control_source_get_value

    def Gst.ControlSource.control_source_get_value (self, timestamp):
        #python wrapper for 'gst_control_source_get_value'

Gets the value for this Gst.ControlSource at a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource object

`timestamp` (int) –

the time for which the value should be returned

Returns a tuple made of:

(bool ) –

False if the value couldn't be returned, True otherwise.

`value` (float ) –

False if the value couldn't be returned, True otherwise.

#### gst_control_source_get_value_array

    gboolean
    gst_control_source_get_value_array (GstControlSource * self,
                                        GstClockTime timestamp,
                                        GstClockTime interval,
                                        guint n_values,
                                        gdouble * values)

Gets an array of values for for this GstControlSource. Values that are undefined contain NANs.

Parameters:

`self` –

the GstControlSource object

`timestamp` –

the first timestamp

`interval` –

the time steps

`n_values` –

the number of values to fetch

`values` ( [array length=n_values]) –

array to put control-values in

Returns –

TRUE if the given array could be filled, FALSE otherwise

#### Gst.ControlSource.prototype.control_source_get_value_array

    function Gst.ControlSource.prototype.control_source_get_value_array(timestamp: Number, interval: Number, n_values: Number, values: [ Number ]): {
        // javascript wrapper for 'gst_control_source_get_value_array'
    }

Gets an array of values for for this Gst.ControlSource. Values that are undefined contain NANs.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource object

`timestamp` (Number) –

the first timestamp

`interval` (Number) –

the time steps

`n_values` (Number) –

the number of values to fetch

`values` ([ Number ]) –

array to put control-values in

Returns (Number) –

true if the given array could be filled, false otherwise

#### Gst.ControlSource.control_source_get_value_array

    def Gst.ControlSource.control_source_get_value_array (self, timestamp, interval, n_values, values):
        #python wrapper for 'gst_control_source_get_value_array'

Gets an array of values for for this Gst.ControlSource. Values that are undefined contain NANs.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource object

`timestamp` (int) –

the first timestamp

`interval` (int) –

the time steps

`n_values` (int) –

the number of values to fetch

`values` ([ float ]) –

array to put control-values in

Returns (bool) –

True if the given array could be filled, False otherwise

## GstTimedValue

Structure for storing a timestamp and a value.

### Members

`timestamp` (GstClockTime) –

timestamp of the value change

`value` (gdouble) –

the corresponding value

## Gst.TimedValue

Structure for storing a timestamp and a value.

### Members

`timestamp` (Number) –

timestamp of the value change

`value` (Number) –

the corresponding value

## Gst.TimedValue

Structure for storing a timestamp and a value.

### Members

`timestamp` (int) –

timestamp of the value change

`value` (float) –

the corresponding value

## Constants

### GST_TYPE_CONTROL_SOURCE

    #define GST_TYPE_CONTROL_SOURCE \
      (gst_control_source_get_type())

## Callbacks

### GstControlSourceGetValue

    gboolean
    (*GstControlSourceGetValue) (GstControlSource * self,
                                 GstClockTime timestamp,
                                 gdouble * value)

Function for returning a value for a given timestamp.

Parameters:

`self` –

the GstControlSource instance

`timestamp` –

timestamp for which a value should be calculated

`value` –

a value which will be set to the result.

Returns –

TRUE if the value was successfully calculated.

### Gst.ControlSourceGetValue

    function Gst.ControlSourceGetValue(self: Gst.ControlSource, timestamp: Number, value: Number): {
        // javascript wrapper for 'GstControlSourceGetValue'
    }

Function for returning a value for a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource instance

`timestamp` (Number) –

timestamp for which a value should be calculated

`value` (Number) –

a value which will be set to the result.

Returns (Number) –

true if the value was successfully calculated.

### Gst.ControlSourceGetValue

    def Gst.ControlSourceGetValue (self, timestamp, value):
        #python wrapper for 'GstControlSourceGetValue'

Function for returning a value for a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource instance

`timestamp` (int) –

timestamp for which a value should be calculated

`value` (float) –

a value which will be set to the result.

Returns (bool) –

True if the value was successfully calculated.

### GstControlSourceGetValueArray

    gboolean
    (*GstControlSourceGetValueArray) (GstControlSource * self,
                                      GstClockTime timestamp,
                                      GstClockTime interval,
                                      guint n_values,
                                      gdouble * values)

Function for returning an array of values starting at a given timestamp.

Parameters:

`self` –

the GstControlSource instance

`timestamp` –

timestamp for which a value should be calculated

`interval` –

the time spacing between subsequent values

`n_values` –

the number of values

`values` –

array to put control-values in

Returns –

TRUE if the values were successfully calculated.

### Gst.ControlSourceGetValueArray

    function Gst.ControlSourceGetValueArray(self: Gst.ControlSource, timestamp: Number, interval: Number, n_values: Number, values: Number): {
        // javascript wrapper for 'GstControlSourceGetValueArray'
    }

Function for returning an array of values starting at a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource instance

`timestamp` (Number) –

timestamp for which a value should be calculated

`interval` (Number) –

the time spacing between subsequent values

`n_values` (Number) –

the number of values

`values` (Number) –

array to put control-values in

Returns (Number) –

true if the values were successfully calculated.

### Gst.ControlSourceGetValueArray

    def Gst.ControlSourceGetValueArray (self, timestamp, interval, n_values, values):
        #python wrapper for 'GstControlSourceGetValueArray'

Function for returning an array of values starting at a given timestamp.

Parameters:

`self` (Gst.ControlSource) –

the Gst.ControlSource instance

`timestamp` (int) –

timestamp for which a value should be calculated

`interval` (int) –

the time spacing between subsequent values

`n_values` (int) –

the number of values

`values` (float) –

array to put control-values in

Returns (bool) –

True if the values were successfully calculated.

The results of the search are