# GstAudioClock

GstAudioClock makes it easy for elements to implement a GstClock, they simply need to provide a function that returns the current clock time.

This object is internally used to implement the clock in GstAudioBaseSink.

## GstAudioClock

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstClock
                    ╰──GstSystemClock
                        ╰──GstAudioClock

Opaque GstAudioClock.

### Members

`clock` (GstSystemClock) –
No description available
`func` (GstAudioClockGetTimeFunc) –
No description available
`user_data` (gpointer) –
No description available
`destroy_notify` (GDestroyNotify) –
No description available

### Class structure

#### GstAudioClockClass

##### Fields

`parent_class` (GstSystemClockClass) –
No description available

### GstAudio.AudioClockClass

##### Attributes

`parent_class` (Gst.SystemClockClass) –
No description available

### GstAudio.AudioClockClass

##### Attributes

`parent_class` (Gst.SystemClockClass) –
No description available

## GstAudio.AudioClock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──Gst.SystemClock
                        ╰──GstAudio.AudioClock

Opaque GstAudio.AudioClock.

### Members

`clock` (Gst.SystemClock) –
No description available
`func` (GstAudio.AudioClockGetTimeFunc) –
No description available
`user_data` (Object) –
No description available
`destroy_notify` (GLib.DestroyNotify) –
No description available

## GstAudio.AudioClock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──Gst.SystemClock
                        ╰──GstAudio.AudioClock

Opaque GstAudio.AudioClock.

### Members

`clock` (Gst.SystemClock) –
No description available
`func` (GstAudio.AudioClockGetTimeFunc) –
No description available
`user_data` (object) –
No description available
`destroy_notify` (GLib.DestroyNotify) –
No description available

### Constructors

#### gst_audio_clock_new

    GstClock *
    gst_audio_clock_new (const gchar * name,
                         GstAudioClockGetTimeFunc func,
                         gpointer user_data,
                         GDestroyNotify destroy_notify)

Create a new GstAudioClock instance. Whenever the clock time should be calculated it will call func with user_data. When func returns GST_CLOCK_TIME_NONE, the clock will return the last reported time.

Parameters:

`name` –

the name of the clock

`func` –

a function

`user_data` –

user data

`destroy_notify` –

GDestroyNotify for user_data

Returns ( [transfer: full] ) –

a new GstAudioClock casted to a GstClock.

#### GstAudio.AudioClock.prototype.new

    function GstAudio.AudioClock.prototype.new(name: String, func: GstAudio.AudioClockGetTimeFunc, user_data: Object): {
        // javascript wrapper for 'gst_audio_clock_new'
    }

Create a new GstAudio.AudioClock instance. Whenever the clock time should be calculated it will call func with user_data. When func returns Gst.CLOCK_TIME_NONE, the clock will return the last reported time.

Parameters:

`name` ( String ) –

the name of the clock

`func` ( GstAudio.AudioClockGetTimeFunc ) –

a function

`user_data` ( Object ) –

user data

Returns ( Gst.Clock ) –

a new GstAudio.AudioClock casted to a Gst.Clock.

#### GstAudio.AudioClock.new

    def GstAudio.AudioClock.new (name, func, *user_data):
        #python wrapper for 'gst_audio_clock_new'

Create a new GstAudio.AudioClock instance. Whenever the clock time should be calculated it will call func with user_data. When func returns Gst.CLOCK_TIME_NONE, the clock will return the last reported time.

Parameters:

`name` ( str ) –

the name of the clock

`func` ( GstAudio.AudioClockGetTimeFunc ) –

a function

`user_data` ( variadic ) –

user data

Returns ( Gst.Clock ) –

a new GstAudio.AudioClock casted to a Gst.Clock.

### Methods

#### gst_audio_clock_adjust

    GstClockTime
    gst_audio_clock_adjust (GstAudioClock * clock,
                            GstClockTime time)

Adjust time with the internal offset of the audio clock.

Parameters:

`clock` –

a GstAudioClock

`time` –

a GstClockTime

Returns –

time adjusted with the internal offset.

#### GstAudio.AudioClock.prototype.adjust

    function GstAudio.AudioClock.prototype.adjust(time: Number): {
        // javascript wrapper for 'gst_audio_clock_adjust'
    }

Adjust time with the internal offset of the audio clock.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

`time` ( Number ) –

a Number

Returns ( Number ) –

time adjusted with the internal offset.

#### GstAudio.AudioClock.adjust

    def GstAudio.AudioClock.adjust (self, time):
        #python wrapper for 'gst_audio_clock_adjust'

Adjust time with the internal offset of the audio clock.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

`time` ( int ) –

a int

Returns ( int ) –

time adjusted with the internal offset.

#### gst_audio_clock_get_time

    GstClockTime
    gst_audio_clock_get_time (GstAudioClock * clock)

Report the time as returned by the GstAudioClockGetTimeFunc without applying any offsets.

Parameters:

`clock` –

a GstAudioClock

Returns –

the time as reported by the time function of the audio clock

#### GstAudio.AudioClock.prototype.get_time

    function GstAudio.AudioClock.prototype.get_time(): {
        // javascript wrapper for 'gst_audio_clock_get_time'
    }

Report the time as returned by the GstAudio.AudioClockGetTimeFunc without applying any offsets.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

Returns ( Number ) –

the time as reported by the time function of the audio clock

#### GstAudio.AudioClock.get_time

    def GstAudio.AudioClock.get_time (self):
        #python wrapper for 'gst_audio_clock_get_time'

Report the time as returned by the GstAudio.AudioClockGetTimeFunc without applying any offsets.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

Returns ( int ) –

the time as reported by the time function of the audio clock

#### gst_audio_clock_invalidate

    gst_audio_clock_invalidate (GstAudioClock * clock)

Invalidate the clock function. Call this function when the provided GstAudioClockGetTimeFunc cannot be called anymore, for example, when the user_data becomes invalid.

After calling this function, clock will return the last returned time for the rest of its lifetime.

Parameters:

`clock` –

a GstAudioClock

#### GstAudio.AudioClock.prototype.invalidate

    function GstAudio.AudioClock.prototype.invalidate(): {
        // javascript wrapper for 'gst_audio_clock_invalidate'
    }

Invalidate the clock function. Call this function when the provided GstAudio.AudioClockGetTimeFunc cannot be called anymore, for example, when the user_data becomes invalid.

After calling this function, clock will return the last returned time for the rest of its lifetime.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

#### GstAudio.AudioClock.invalidate

    def GstAudio.AudioClock.invalidate (self):
        #python wrapper for 'gst_audio_clock_invalidate'

Invalidate the clock function. Call this function when the provided GstAudio.AudioClockGetTimeFunc cannot be called anymore, for example, when the user_data becomes invalid.

After calling this function, clock will return the last returned time for the rest of its lifetime.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

#### gst_audio_clock_reset

    gst_audio_clock_reset (GstAudioClock * clock,
                           GstClockTime time)

Inform clock that future calls to GstAudioClockGetTimeFunc will return values starting from time. The clock will update an internal offset to make sure that future calls to internal_time will return an increasing result as required by the GstClock object.

Parameters:

`clock` –

a GstAudioClock

`time` –

a GstClockTime

#### GstAudio.AudioClock.prototype.reset

    function GstAudio.AudioClock.prototype.reset(time: Number): {
        // javascript wrapper for 'gst_audio_clock_reset'
    }

Inform clock that future calls to GstAudio.AudioClockGetTimeFunc will return values starting from time. The clock will update an internal offset to make sure that future calls to internal_time will return an increasing result as required by the Gst.Clock object.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

`time` ( Number ) –

a Number

#### GstAudio.AudioClock.reset

    def GstAudio.AudioClock.reset (self, time):
        #python wrapper for 'gst_audio_clock_reset'

Inform clock that future calls to GstAudio.AudioClockGetTimeFunc will return values starting from time. The clock will update an internal offset to make sure that future calls to internal_time will return an increasing result as required by the Gst.Clock object.

Parameters:

`clock` ( GstAudio.AudioClock ) –

a GstAudio.AudioClock

`time` ( int ) –

a int

## Function Macros

### GST_AUDIO_CLOCK_CAST

    #define GST_AUDIO_CLOCK_CAST(obj) \
      ((GstAudioClock*)(obj))

## Constants

### GST_TYPE_AUDIO_CLOCK

    #define GST_TYPE_AUDIO_CLOCK \
      (gst_audio_clock_get_type())

## Callbacks

### GstAudioClockGetTimeFunc

    GstClockTime
    (*GstAudioClockGetTimeFunc) (GstClock * clock,
                                 gpointer user_data)

This function will be called whenever the current clock time needs to be calculated. If this function returns GST_CLOCK_TIME_NONE, the last reported time will be returned by the clock.

Parameters:

`clock` –

the GstAudioClock

`user_data` –

user data

Returns –

the current time or GST_CLOCK_TIME_NONE if the previous time should be used.

### GstAudio.AudioClockGetTimeFunc

    function GstAudio.AudioClockGetTimeFunc(clock: Gst.Clock, user_data: Object): {
        // javascript wrapper for 'GstAudioClockGetTimeFunc'
    }

This function will be called whenever the current clock time needs to be calculated. If this function returns Gst.CLOCK_TIME_NONE, the last reported time will be returned by the clock.

Parameters:

`clock` ( Gst.Clock ) –

the GstAudio.AudioClock

`user_data` ( Object ) –

user data

Returns ( Number ) –

the current time or Gst.CLOCK_TIME_NONE if the previous time should be used.

### GstAudio.AudioClockGetTimeFunc

    def GstAudio.AudioClockGetTimeFunc (clock, *user_data):
        #python wrapper for 'GstAudioClockGetTimeFunc'

This function will be called whenever the current clock time needs to be calculated. If this function returns Gst.CLOCK_TIME_NONE, the last reported time will be returned by the clock.

Parameters:

`clock` ( Gst.Clock ) –

the GstAudio.AudioClock

`user_data` ( variadic ) –

user data

Returns ( int ) –

the current time or Gst.CLOCK_TIME_NONE if the previous time should be used.

The results of the search are