GstControlSource: GStreamer 1.0 Core Reference Manual

## GstControlSource GstControlSource — base class for control source sources |

## Functions

gboolean | (*GstControlSourceGetValue) ()
gboolean | (*GstControlSourceGetValueArray) ()
gboolean | gst_control_source_get_value ()
gboolean | gst_control_source_get_value_array ()

## Types and Values

| GstValueArray
struct | GstControlSource
struct | GstControlSourceClass
struct | GstTimedValue

## Object Hierarchy

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

## Includes

    #include <gst/gst.h>

## Description

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.

## Functions

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

### GstControlSourceGetValueArray ()

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

Function for returning an array of values for 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_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.

[method]

#### Parameters

self | the GstControlSource object |
timestamp | the time for which the value should be returned |
value | the value. | [out]

#### Returns

`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.

[method]

#### Parameters

self | the GstControlSource object |
timestamp | the first timestamp |
interval | the time steps |
n_values | the number of values to fetch |
values | array to put control-values in. | [array length=n_values]

#### Returns

`TRUE` if the given array could be filled, `FALSE` otherwise

## Types and Values

### GstValueArray

    typedef struct _GstValueArray GstValueArray;

### struct GstControlSource

    struct GstControlSource {
      GstControlSourceGetValue get_value;             /* Returns the value for a property at a given timestamp */
      GstControlSourceGetValueArray get_value_array;  /* Returns values for a property in a given timespan */
    };

The instance structure of GstControlSource.

#### Members

GstControlSourceGetValue `get_value`; | Function for returning a value for a given timestamp |
GstControlSourceGetValueArray `get_value_array`; | Function for returning a values array for a given timestamp |

### struct GstControlSourceClass

    struct GstControlSourceClass {
      GstObjectClass parent_class;
    };

The class structure of GstControlSource.

#### Members

### struct GstTimedValue

    struct GstTimedValue {
      GstClockTime timestamp;
      gdouble      value;
    };

Structure for saving a timestamp and a value.

#### Members

GstClockTime `timestamp`; | timestamp of the value change |
gdouble `value`; | the corresponding value |