GstAudio.AudioStreamAlign¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstAudio.AudioStreamAlign¶
GstAudio.AudioStreamAlign
provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible.See
GstAudio.AudioStreamAlign.new
() for a description of its parameters andGstAudio.AudioStreamAlign.process
() for the details of the processing.New in version 1.14.
- classmethod new(rate, alignment_threshold, discont_wait)[source]¶
- Parameters:
- Returns:
a new
GstAudio.AudioStreamAlign
. free withGstAudio.AudioStreamAlign.free
().- Return type:
Allocate a new
GstAudio.AudioStreamAlign
with the given configuration. All processing happens according to sample rate rate, untilGstAudio.AudioStreamAlign.set_rate
() is called with a new rate. A negative rate can be used for reverse playback.alignment_threshold gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, discont_wait nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with
GstAudio.AudioStreamAlign.set_alignment_threshold
() andGstAudio.AudioStreamAlign.set_discont_wait
().New in version 1.14.
- copy()[source]¶
- Returns:
a new
GstAudio.AudioStreamAlign
. free withGstAudio.AudioStreamAlign.free
.- Return type:
Copy a
GstAudio.AudioStreamAlign
structure.New in version 1.14.
- free()[source]¶
Free a
GstAudio.AudioStreamAlign
structure previously allocated withGstAudio.AudioStreamAlign.new
() orGstAudio.AudioStreamAlign.copy
().New in version 1.14.
- get_alignment_threshold()[source]¶
- Returns:
The currently configured alignment threshold
- Return type:
Gets the currently configured alignment threshold.
New in version 1.14.
- get_discont_wait()[source]¶
- Returns:
The currently configured discont wait
- Return type:
Gets the currently configured discont wait.
New in version 1.14.
- get_rate()[source]¶
- Returns:
The currently configured sample rate
- Return type:
Gets the currently configured sample rate.
New in version 1.14.
- get_samples_since_discont()[source]¶
- Returns:
The number of samples processed since the last discontinuity.
- Return type:
Returns the number of samples that were processed since the last discontinuity was detected.
New in version 1.14.
- get_timestamp_at_discont()[source]¶
- Returns:
The last timestamp at when a discontinuity was detected
- Return type:
Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.
New in version 1.14.
- mark_discont()[source]¶
Marks the next buffer as discontinuous and resets timestamp tracking.
New in version 1.14.
- process(discont, timestamp, n_samples)[source]¶
- Parameters:
- Returns:
True
if a discontinuity was detected,False
otherwise.- out_timestamp:
output timestamp of the data
- out_duration:
output duration of the data
- out_sample_position:
output sample position of the start of the data
- Return type:
(
bool
, out_timestamp:int
, out_duration:int
, out_sample_position:int
)
Processes data with timestamp and n_samples, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations.
A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait.
Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one.
New in version 1.14.
- set_alignment_threshold(alignment_threshold)[source]¶
- Parameters:
alignment_threshold (
int
) – a new alignment threshold
Sets alignment_treshold as new alignment threshold for the following processing.
New in version 1.14.