gstaudio

package
v0.0.0-...-ccbbe8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AUDIO_CHANNELS_RANGE = "(int) [ 1, max ]"

AUDIO_CHANNELS_RANGE: maximum range of allowed channels, for use in template caps strings.

View Source
const AUDIO_CONVERTER_OPT_DITHER_METHOD = "GstAudioConverter.dither-method"

AUDIO_CONVERTER_OPT_DITHER_METHOD The dither method to use when changing bit depth. Default is T_AUDIO_DITHER_NONE.

View Source
const AUDIO_CONVERTER_OPT_MIX_MATRIX = "GstAudioConverter.mix-matrix"

AUDIO_CONVERTER_OPT_MIX_MATRIX The channel mapping matrix.

The matrix coefficients must be between -1 and 1: the number of rows is equal to the number of output channels and the number of columns is equal to the number of input channels.

Example matrix generation code

To generate the matrix using code:

GValue v = G_VALUE_INIT;
GValue v2 = G_VALUE_INIT;
GValue v3 = G_VALUE_INIT;

g_value_init (&v2, GST_TYPE_ARRAY);
g_value_init (&v3, G_TYPE_DOUBLE);
g_value_set_double (&v3, 1);
gst_value_array_append_value (&v2, &v3);
g_value_unset (&v3);
[ Repeat for as many double as your input channels - unset and reinit v3 ]
g_value_init (&v, GST_TYPE_ARRAY);
gst_value_array_append_value (&v, &v2);
g_value_unset (&v2);
[ Repeat for as many v2's as your output channels - unset and reinit v2]
g_object_set_property (G_OBJECT (audiomixmatrix), "matrix", &v);
g_value_unset (&v);.
View Source
const AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD = "GstAudioConverter.noise-shaping-method"

AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD The noise shaping method to use to mask noise from quantization errors. Default is T_AUDIO_NOISE_SHAPING_NONE.

View Source
const AUDIO_CONVERTER_OPT_QUANTIZATION = "GstAudioConverter.quantization"

AUDIO_CONVERTER_OPT_QUANTIZATION The quantization amount. Components will be quantized to multiples of this value. Default is 1.

View Source
const AUDIO_CONVERTER_OPT_RESAMPLER_METHOD = "GstAudioConverter.resampler-method"

AUDIO_CONVERTER_OPT_RESAMPLER_METHOD The resampler method to use when changing sample rates. Default is T_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL.

View Source
const AUDIO_DECODER_MAX_ERRORS = 10

AUDIO_DECODER_MAX_ERRORS: default maximum number of errors tolerated before signaling error.

View Source
const AUDIO_DECODER_SINK_NAME = "sink"

AUDIO_DECODER_SINK_NAME: name of the templates for the sink pad.

View Source
const AUDIO_DECODER_SRC_NAME = "src"

AUDIO_DECODER_SRC_NAME: name of the templates for the source pad.

View Source
const AUDIO_DEF_CHANNELS = 2

AUDIO_DEF_CHANNELS: standard number of channels used in consumer audio.

View Source
const AUDIO_DEF_FORMAT = "S16LE"

AUDIO_DEF_FORMAT: standard format used in consumer audio.

View Source
const AUDIO_DEF_RATE = 44100

AUDIO_DEF_RATE: standard sampling rate used in consumer audio.

View Source
const AUDIO_ENCODER_SINK_NAME = "sink"

AUDIO_ENCODER_SINK_NAME: name of the templates for the sink pad.

View Source
const AUDIO_ENCODER_SRC_NAME = "src"

AUDIO_ENCODER_SRC_NAME: name of the templates for the source pad.

View Source
const AUDIO_FORMATS_ALL = "" /* 218-byte string literal not displayed */

AUDIO_FORMATS_ALL: list of all audio formats, for use in template caps strings.

Formats are sorted by decreasing "quality", using these criteria by priority: - depth - width - Float > Signed > Unsigned - native endianness preferred.

View Source
const AUDIO_RATE_RANGE = "(int) [ 1, max ]"

AUDIO_RATE_RANGE: maximum range of allowed sample rates, for use in template caps strings.

View Source
const AUDIO_RESAMPLER_OPT_CUBIC_B = "GstAudioResampler.cubic-b"

AUDIO_RESAMPLER_OPT_CUBIC_B: g_TYPE_DOUBLE, B parameter of the cubic filter. Values between 0.0 and 2.0 are accepted. 1.0 is the default.

Below are some values of popular filters: B C Hermite 0.0 0.0 Spline 1.0 0.0 Catmull-Rom 0.0 1/2.

View Source
const AUDIO_RESAMPLER_OPT_CUBIC_C = "GstAudioResampler.cubic-c"

AUDIO_RESAMPLER_OPT_CUBIC_C: g_TYPE_DOUBLE, C parameter of the cubic filter. Values between 0.0 and 2.0 are accepted. 0.0 is the default.

See T_AUDIO_RESAMPLER_OPT_CUBIC_B for some more common values.

View Source
const AUDIO_RESAMPLER_OPT_CUTOFF = "GstAudioResampler.cutoff"

AUDIO_RESAMPLER_OPT_CUTOFF: g_TYPE_DOUBLE, Cutoff parameter for the filter. 0.940 is the default.

View Source
const AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION = "GstAudioResampler.filter-interpolation"

AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION: GST_TYPE_AUDIO_RESAMPLER_INTERPOLATION: how the filter coefficients should be interpolated. GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC is default.

View Source
const AUDIO_RESAMPLER_OPT_FILTER_MODE = "GstAudioResampler.filter-mode"

AUDIO_RESAMPLER_OPT_FILTER_MODE: GST_TYPE_AUDIO_RESAMPLER_FILTER_MODE: how the filter tables should be constructed. GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is the default.

View Source
const AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD = "GstAudioResampler.filter-mode-threshold"

AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD: g_TYPE_UINT: the amount of memory to use for full filter tables before switching to interpolated filter tables. 1048576 is the default.

View Source
const AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE = "GstAudioResampler.filter-oversample"

AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE: g_TYPE_UINT, oversampling to use when interpolating filters 8 is the default.

View Source
const AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR = "GstAudioResampler.max-phase-error"

AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR: g_TYPE_DOUBLE: The maximum allowed phase error when switching sample rates. 0.1 is the default.

View Source
const AUDIO_RESAMPLER_OPT_N_TAPS = "GstAudioResampler.n-taps"

AUDIO_RESAMPLER_OPT_N_TAPS: g_TYPE_INT: the number of taps to use for the filter. 0 is the default and selects the taps automatically.

View Source
const AUDIO_RESAMPLER_OPT_STOP_ATTENUATION = "GstAudioResampler.stop-attenutation"

AUDIO_RESAMPLER_OPT_STOP_ATTENUATION: g_TYPE_DOUBLE, stopband attenuation in decibels. The attenuation after the stopband for the kaiser window. 85 dB is the default.

View Source
const AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH = "GstAudioResampler.transition-bandwidth"

AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH: g_TYPE_DOUBLE, transition bandwidth. The width of the transition band for the kaiser window. 0.087 is the default.

View Source
const AUDIO_RESAMPLER_QUALITY_DEFAULT = 4
View Source
const AUDIO_RESAMPLER_QUALITY_MAX = 10
View Source
const AUDIO_RESAMPLER_QUALITY_MIN = 0
View Source
const META_TAG_AUDIO_CHANNELS_STR = "channels"

META_TAG_AUDIO_CHANNELS_STR: this metadata stays relevant as long as channels are unchanged.

View Source
const META_TAG_AUDIO_RATE_STR = "rate"

META_TAG_AUDIO_RATE_STR: this metadata stays relevant as long as sample rate is unchanged.

View Source
const META_TAG_AUDIO_STR = "audio"

META_TAG_AUDIO_STR: this metadata is relevant for audio streams.

Variables

View Source
var (
	GTypeAudioFormat      = coreglib.Type(C.gst_audio_format_get_type())
	GTypeAudioLayout      = coreglib.Type(C.gst_audio_layout_get_type())
	GTypeAudioFormatFlags = coreglib.Type(C.gst_audio_format_flags_get_type())
	GTypeAudioPackFlags   = coreglib.Type(C.gst_audio_pack_flags_get_type())
)

GType values.

View Source
var (
	GTypeAudioFlags = coreglib.Type(C.gst_audio_flags_get_type())
	GTypeAudioInfo  = coreglib.Type(C.gst_audio_info_get_type())
)

GType values.

View Source
var (
	GTypeAudioDitherMethod       = coreglib.Type(C.gst_audio_dither_method_get_type())
	GTypeAudioNoiseShapingMethod = coreglib.Type(C.gst_audio_noise_shaping_method_get_type())
	GTypeAudioQuantizeFlags      = coreglib.Type(C.gst_audio_quantize_flags_get_type())
)

GType values.

View Source
var (
	GTypeAudioResamplerFilterInterpolation = coreglib.Type(C.gst_audio_resampler_filter_interpolation_get_type())
	GTypeAudioResamplerFilterMode          = coreglib.Type(C.gst_audio_resampler_filter_mode_get_type())
	GTypeAudioResamplerMethod              = coreglib.Type(C.gst_audio_resampler_method_get_type())
	GTypeAudioResamplerFlags               = coreglib.Type(C.gst_audio_resampler_flags_get_type())
)

GType values.

View Source
var (
	GTypeAudioAggregator           = coreglib.Type(C.gst_audio_aggregator_get_type())
	GTypeAudioAggregatorConvertPad = coreglib.Type(C.gst_audio_aggregator_convert_pad_get_type())
	GTypeAudioAggregatorPad        = coreglib.Type(C.gst_audio_aggregator_pad_get_type())
)

GType values.

View Source
var (
	GTypeAudioBaseSinkSlaveMethod = coreglib.Type(C.gst_audio_base_sink_slave_method_get_type())
	GTypeAudioBaseSink            = coreglib.Type(C.gst_audio_base_sink_get_type())
)

GType values.

View Source
var (
	GTypeAudioBaseSrcSlaveMethod = coreglib.Type(C.gst_audio_base_src_slave_method_get_type())
	GTypeAudioBaseSrc            = coreglib.Type(C.gst_audio_base_src_get_type())
)

GType values.

View Source
var (
	GTypeAudioCdSrcMode = coreglib.Type(C.gst_audio_cd_src_mode_get_type())
	GTypeAudioCdSrc     = coreglib.Type(C.gst_audio_cd_src_get_type())
)

GType values.

View Source
var (
	GTypeAudioRingBufferFormatType = coreglib.Type(C.gst_audio_ring_buffer_format_type_get_type())
	GTypeAudioRingBufferState      = coreglib.Type(C.gst_audio_ring_buffer_state_get_type())
	GTypeAudioRingBuffer           = coreglib.Type(C.gst_audio_ring_buffer_get_type())
)

GType values.

View Source
var (
	GTypeAudioBaseSinkDiscontReason = coreglib.Type(C.gst_audio_base_sink_discont_reason_get_type())
)

GType values.

View Source
var (
	GTypeAudioChannelMixerFlags = coreglib.Type(C.gst_audio_channel_mixer_flags_get_type())
)

GType values.

View Source
var (
	GTypeAudioChannelPosition = coreglib.Type(C.gst_audio_channel_position_get_type())
)

GType values.

View Source
var (
	GTypeAudioClock = coreglib.Type(C.gst_audio_clock_get_type())
)

GType values.

View Source
var (
	GTypeAudioConverter = coreglib.Type(C.gst_audio_converter_get_type())
)

GType values.

View Source
var (
	GTypeAudioConverterFlags = coreglib.Type(C.gst_audio_converter_flags_get_type())
)

GType values.

View Source
var (
	GTypeAudioDecoder = coreglib.Type(C.gst_audio_decoder_get_type())
)

GType values.

View Source
var (
	GTypeAudioEncoder = coreglib.Type(C.gst_audio_encoder_get_type())
)

GType values.

View Source
var (
	GTypeAudioFilter = coreglib.Type(C.gst_audio_filter_get_type())
)

GType values.

View Source
var (
	GTypeAudioSink = coreglib.Type(C.gst_audio_sink_get_type())
)

GType values.

View Source
var (
	GTypeAudioSrc = coreglib.Type(C.gst_audio_src_get_type())
)

GType values.

View Source
var (
	GTypeAudioStreamAlign = coreglib.Type(C.gst_audio_stream_align_get_type())
)

GType values.

View Source
var (
	GTypeStreamVolume = coreglib.Type(C.gst_stream_volume_get_type())
)

GType values.

Functions

func AudioBufferClip

func AudioBufferClip(buffer *gst.Buffer, segment *gst.Segment, rate, bpf int) *gst.Buffer

AudioBufferClip: clip the buffer to the given GstSegment.

After calling this function the caller does not own a reference to buffer anymore.

The function takes the following parameters:

  • buffer to clip.
  • segment: segment in GST_FORMAT_TIME or GST_FORMAT_DEFAULT to which the buffer should be clipped.
  • rate: sample rate.
  • bpf: size of one audio frame in bytes. This is the size of one sample * number of channels.

The function returns the following values:

  • ret: NULL if the buffer is completely outside the configured segment, otherwise the clipped buffer is returned.

    If the buffer has no timestamp, it is assumed to be inside the segment and is not clipped.

func AudioBufferReorderChannels

func AudioBufferReorderChannels(buffer *gst.Buffer, format AudioFormat, from, to []AudioChannelPosition) bool

AudioBufferReorderChannels reorders buffer from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order. buffer must be writable.

The function takes the following parameters:

  • buffer to reorder.
  • format: GstAudioFormat of the buffer.
  • from: channel positions in the buffer.
  • to: channel positions to convert to.

The function returns the following values:

  • ok: TRUE if the reordering was possible.

func AudioBufferTruncate

func AudioBufferTruncate(buffer *gst.Buffer, bpf int, trim, samples uint) *gst.Buffer

AudioBufferTruncate: truncate the buffer to finally have samples number of samples, removing the necessary amount of samples from the end and trim number of samples from the beginning.

This function does not know the audio rate, therefore the caller is responsible for re-setting the correct timestamp and duration to the buffer. However, timestamp will be preserved if trim == 0, and duration will also be preserved if there is no trimming to be done. Offset and offset end will be preserved / updated.

After calling this function the caller does not own a reference to buffer anymore.

The function takes the following parameters:

  • buffer to truncate.
  • bpf: size of one audio frame in bytes. This is the size of one sample * number of channels.
  • trim: number of samples to remove from the beginning of the buffer.
  • samples: final number of samples that should exist in this buffer or -1 to use all the remaining samples if you are only removing samples from the beginning.

The function returns the following values:

  • ret: truncated buffer or NULL if the arguments were invalid.

func AudioChannelGetFallbackMask

func AudioChannelGetFallbackMask(channels int) uint64

AudioChannelGetFallbackMask: get the fallback channel-mask for the given number of channels.

This function returns a reasonable fallback channel-mask and should be called as a last resort when the specific channel map is unknown.

The function takes the following parameters:

  • channels: number of channels.

The function returns the following values:

  • guint64: fallback channel-mask for channels or 0 when there is no mask and mono.

func AudioChannelPositionsFromMask

func AudioChannelPositionsFromMask(channelMask uint64, position []AudioChannelPosition) bool

AudioChannelPositionsFromMask: convert the channels present in channel_mask to a position array (which should have at least channels entries ensured by caller). If channel_mask is set to 0, it is considered as 'not present' for purpose of conversion. A partially valid channel_mask with less bits set than the number of channels is considered valid.

The function takes the following parameters:

  • channelMask: input channel_mask.
  • position: the GstAudioChannelPosition<!-- -->s.

The function returns the following values:

  • ok: TRUE if channel and channel mask are valid and could be converted.

func AudioChannelPositionsToMask

func AudioChannelPositionsToMask(position []AudioChannelPosition, forceOrder bool) (uint64, bool)

AudioChannelPositionsToMask: convert the position array of channels channels to a bitmask.

If force_order is TRUE it additionally checks if the channels are in the order required by GStreamer.

The function takes the following parameters:

  • position: GstAudioChannelPositions.
  • forceOrder: only consider the GStreamer channel order.

The function returns the following values:

  • channelMask: output channel mask.
  • ok: TRUE if the channel positions are valid and could be converted.

func AudioChannelPositionsToString

func AudioChannelPositionsToString(position []AudioChannelPosition) string

AudioChannelPositionsToString converts position to a human-readable string representation for debugging purposes.

The function takes the following parameters:

  • position: GstAudioChannelPositions to convert.

The function returns the following values:

  • utf8: newly allocated string representing position.

func AudioChannelPositionsToValidOrder

func AudioChannelPositionsToValidOrder(position []AudioChannelPosition) bool

AudioChannelPositionsToValidOrder reorders the channel positions in position from any order to the GStreamer channel order.

The function takes the following parameters:

  • position: channel positions to reorder to.

The function returns the following values:

  • ok: TRUE if the channel positions are valid and reordering was successful.

func AudioCheckValidChannelPositions

func AudioCheckValidChannelPositions(position []AudioChannelPosition, forceOrder bool) bool

AudioCheckValidChannelPositions checks if position contains valid channel positions for channels channels. If force_order is TRUE it additionally checks if the channels are in the order required by GStreamer.

The function takes the following parameters:

  • position: GstAudioChannelPositions to check.
  • forceOrder: only consider the GStreamer channel order.

The function returns the following values:

  • ok: TRUE if the channel positions are valid.

func AudioClippingMetaApiGetType

func AudioClippingMetaApiGetType() coreglib.Type

The function returns the following values:

func AudioClippingMetaGetInfo

func AudioClippingMetaGetInfo() *gst.MetaInfo

The function returns the following values:

func AudioDownmixMetaApiGetType

func AudioDownmixMetaApiGetType() coreglib.Type

The function returns the following values:

func AudioDownmixMetaGetInfo

func AudioDownmixMetaGetInfo() *gst.MetaInfo

The function returns the following values:

func AudioFormatFillSilence deprecated

func AudioFormatFillSilence(info *AudioFormatInfo, dest []byte)

AudioFormatFillSilence: fill length bytes in dest with silence samples for info.

Deprecated: Use gst_audio_format_info_fill_silence() instead.

The function takes the following parameters:

  • info: AudioFormatInfo.
  • dest: destination to fill.

func AudioFormatInfoGetType

func AudioFormatInfoGetType() coreglib.Type

The function returns the following values:

func AudioFormatToString

func AudioFormatToString(format AudioFormat) string

The function takes the following parameters:

The function returns the following values:

func AudioGetChannelReorderMap

func AudioGetChannelReorderMap(from, to []AudioChannelPosition, reorderMap []int) bool

AudioGetChannelReorderMap returns a reorder map for from to to that can be used in custom channel reordering code, e.g. to convert from or to the GStreamer channel order. from and to must contain the same number of positions and the same positions, only in a different order.

The resulting reorder_map can be used for reordering by assigning channel i of the input to channel reorder_map[i] of the output.

The function takes the following parameters:

  • from: channel positions to reorder from.
  • to: channel positions to reorder to.
  • reorderMap: pointer to the reorder map.

The function returns the following values:

  • ok: TRUE if the channel positions are valid and reordering is possible.

func AudioIec61937FrameSize

func AudioIec61937FrameSize(spec *AudioRingBufferSpec) uint

AudioIec61937FrameSize: calculated the size of the buffer expected by gst_audio_iec61937_payload() for payloading type from spec.

The function takes the following parameters:

  • spec: ringbufer spec.

The function returns the following values:

  • guint: size or 0 if the given type is not supported or cannot be payloaded.

func AudioIec61937Payload

func AudioIec61937Payload(src, dst []byte, spec *AudioRingBufferSpec, endianness int) bool

AudioIec61937Payload payloads src in the form specified by IEC 61937 for the type from spec and stores the result in dst. src must contain exactly one frame of data and the frame is not checked for errors.

The function takes the following parameters:

  • src: buffer containing the data to payload.
  • dst: destination buffer to store the payloaded contents in. Should not overlap with src.
  • spec: ringbufer spec for src.
  • endianness: expected byte order of the payloaded data.

The function returns the following values:

  • ok: transfer-full: TRUE if the payloading was successful, FALSE otherwise.

func AudioLevelMetaApiGetType

func AudioLevelMetaApiGetType() coreglib.Type

AudioLevelMetaApiGetType: return the #GType associated with AudioLevelMeta.

The function returns the following values:

  • gType: #GType.

func AudioLevelMetaGetInfo

func AudioLevelMetaGetInfo() *gst.MetaInfo

AudioLevelMetaGetInfo: return the MetaInfo associated with AudioLevelMeta.

The function returns the following values:

  • metaInfo: MetaInfo.

func AudioMakeRawCaps

func AudioMakeRawCaps(formats []AudioFormat, layout AudioLayout) *gst.Caps

AudioMakeRawCaps: return a generic raw audio caps for formats defined in formats. If formats is NULL returns a caps for all the supported raw audio formats, see gst_audio_formats_raw().

The function takes the following parameters:

  • formats (optional): array of raw AudioFormat, or NULL.
  • layout of audio samples.

The function returns the following values:

  • caps: audio GstCaps.

func AudioMetaApiGetType

func AudioMetaApiGetType() coreglib.Type

The function returns the following values:

func AudioMetaGetInfo

func AudioMetaGetInfo() *gst.MetaInfo

The function returns the following values:

func AudioReorderChannels

func AudioReorderChannels(data []byte, format AudioFormat, from, to []AudioChannelPosition) bool

AudioReorderChannels reorders data from the channel positions from to the channel positions to. from and to must contain the same number of positions and the same positions, only in a different order.

Note: this function assumes the audio data is in interleaved layout.

The function takes the following parameters:

  • data: pointer to the memory.
  • format: GstAudioFormat of the buffer.
  • from: channel positions in the buffer.
  • to: channel positions to convert to.

The function returns the following values:

  • ok: TRUE if the reordering was possible.

func AudioRingBufferDebugSpecBuff

func AudioRingBufferDebugSpecBuff(spec *AudioRingBufferSpec)

AudioRingBufferDebugSpecBuff: print debug info about the buffer sized in spec to the debug log.

The function takes the following parameters:

  • spec to debug.

func AudioRingBufferDebugSpecCaps

func AudioRingBufferDebugSpecCaps(spec *AudioRingBufferSpec)

AudioRingBufferDebugSpecCaps: print debug info about the parsed caps in spec to the debug log.

The function takes the following parameters:

  • spec to debug.

func AudioRingBufferParseCaps

func AudioRingBufferParseCaps(spec *AudioRingBufferSpec, caps *gst.Caps) bool

AudioRingBufferParseCaps: parse caps into spec.

The function takes the following parameters:

  • spec: spec.
  • caps: Caps.

The function returns the following values:

  • ok: TRUE if the caps could be parsed.

func StreamVolumeConvertVolume

func StreamVolumeConvertVolume(from, to StreamVolumeFormat, val float64) float64

The function takes the following parameters:

  • from to convert from.
  • to to convert to.
  • val: volume in from format that should be converted.

The function returns the following values:

  • gdouble: converted volume.

Types

type AudioAggregator

type AudioAggregator struct {
	gstbase.Aggregator
	// contains filtered or unexported fields
}

AudioAggregator subclasses must use (a subclass of) AudioAggregatorPad for both their source and sink pads, gst_element_class_add_static_pad_template_with_gtype() is a convenient helper.

AudioAggregator can perform conversion on the data arriving on its sink pads, based on the format expected downstream: in order to enable that behaviour, the GType of the sink pads must either be a (subclass of) AudioAggregatorConvertPad to use the default AudioConverter implementation, or a subclass of AudioAggregatorPad implementing AudioAggregatorPadClass.convert_buffer.

To allow for the output caps to change, the mechanism is the same as above, with the GType of the source pad.

See AudioMixer for an example.

When conversion is enabled, AudioAggregator will accept any type of raw audio caps and perform conversion on the data arriving on its sink pads, with whatever downstream expects as the target format.

In case downstream caps are not fully fixated, it will use the first configured sink pad to finish fixating its source pad caps.

A notable exception for now is the sample rate, sink pads must have the same sample rate as either the downstream requirement, or the first configured pad, or a combination of both (when downstream specifies a range or a set of acceptable rates).

The Aggregator::samples-selected signal is provided with some additional information about the output buffer:

- "offset" G_TYPE_UINT64 Offset in samples since segment start for the position that is next to be filled in the output buffer.

- "frames" G_TYPE_UINT Number of frames per output buffer.

In addition the gst_aggregator_peek_next_sample() function returns additional information in the info Structure of the returned sample:

- "output-offset" G_TYPE_UINT64 Sample offset in output segment relative to the output segment's start where the current position of this input buffer would be placed

- "position" G_TYPE_UINT current position in the input buffer in samples

- "size" G_TYPE_UINT size of the input buffer in samples.

func BaseAudioAggregator

func BaseAudioAggregator(obj AudioAggregatorrer) *AudioAggregator

BaseAudioAggregator returns the underlying base object.

func (*AudioAggregator) SetSinkCaps

func (aagg *AudioAggregator) SetSinkCaps(pad *AudioAggregatorPad, caps *gst.Caps)

The function takes the following parameters:

  • pad
  • caps

type AudioAggregatorClass

type AudioAggregatorClass struct {
	// contains filtered or unexported fields
}

AudioAggregatorClass: instance of this type is always passed by reference.

func (*AudioAggregatorClass) ParentClass

func (a *AudioAggregatorClass) ParentClass() *gstbase.AggregatorClass

type AudioAggregatorConvertPad

type AudioAggregatorConvertPad struct {
	AudioAggregatorPad
	// contains filtered or unexported fields
}

AudioAggregatorConvertPad: implementation of GstPad that can be used with AudioAggregator.

See AudioAggregator for more details.

type AudioAggregatorConvertPadClass

type AudioAggregatorConvertPadClass struct {
	// contains filtered or unexported fields
}

AudioAggregatorConvertPadClass: instance of this type is always passed by reference.

func (*AudioAggregatorConvertPadClass) ParentClass

type AudioAggregatorConvertPadOverrides

type AudioAggregatorConvertPadOverrides struct {
}

AudioAggregatorConvertPadOverrides contains methods that are overridable.

type AudioAggregatorOverrides

type AudioAggregatorOverrides struct {
	// The function takes the following parameters:
	//
	//    - pad
	//    - inbuf
	//    - inOffset
	//    - outbuf
	//    - outOffset
	//    - numFrames
	//
	// The function returns the following values:
	//
	AggregateOneBuffer func(pad *AudioAggregatorPad, inbuf *gst.Buffer, inOffset uint, outbuf *gst.Buffer, outOffset, numFrames uint) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	CreateOutputBuffer func(numFrames uint) *gst.Buffer
}

AudioAggregatorOverrides contains methods that are overridable.

type AudioAggregatorPad

type AudioAggregatorPad struct {
	gstbase.AggregatorPad
	// contains filtered or unexported fields
}

AudioAggregatorPad: default implementation of GstPad used with AudioAggregator.

type AudioAggregatorPadClass

type AudioAggregatorPadClass struct {
	// contains filtered or unexported fields
}

AudioAggregatorPadClass: instance of this type is always passed by reference.

func (*AudioAggregatorPadClass) ParentClass

type AudioAggregatorPadOverrides

type AudioAggregatorPadOverrides struct {
	// The function takes the following parameters:
	//
	//    - inInfo
	//    - outInfo
	//    - buffer
	//
	// The function returns the following values:
	//
	ConvertBuffer        func(inInfo, outInfo *AudioInfo, buffer *gst.Buffer) *gst.Buffer
	UpdateConversionInfo func()
}

AudioAggregatorPadOverrides contains methods that are overridable.

type AudioAggregatorrer

type AudioAggregatorrer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AudioAggregatorrer describes types inherited from class AudioAggregator.

To get the original type, the caller must assert this to an interface or another type.

type AudioBaseSink

type AudioBaseSink struct {
	gstbase.BaseSink
	// contains filtered or unexported fields
}

AudioBaseSink: this is the base class for audio sinks. Subclasses need to implement the ::create_ringbuffer vmethod. This base class will then take care of writing samples to the ringbuffer, synchronisation, clipping and flushing.

func (*AudioBaseSink) AlignmentThreshold

func (sink *AudioBaseSink) AlignmentThreshold() gst.ClockTime

AlignmentThreshold: get the current alignment threshold, in nanoseconds, used by sink.

The function returns the following values:

  • clockTime: current alignment threshold used by sink.

func (*AudioBaseSink) CreateRingbuffer

func (sink *AudioBaseSink) CreateRingbuffer() AudioRingBufferer

CreateRingbuffer: create and return the AudioRingBuffer for sink. This function will call the ::create_ringbuffer vmethod and will set sink as the parent of the returned buffer (see gst_object_set_parent()).

The function returns the following values:

  • audioRingBuffer: new ringbuffer of sink.

func (*AudioBaseSink) DiscontWait

func (sink *AudioBaseSink) DiscontWait() gst.ClockTime

DiscontWait: get the current discont wait, in nanoseconds, used by sink.

The function returns the following values:

  • clockTime: current discont wait used by sink.

func (*AudioBaseSink) DriftTolerance

func (sink *AudioBaseSink) DriftTolerance() int64

DriftTolerance: get the current drift tolerance, in microseconds, used by sink.

The function returns the following values:

  • gint64: current drift tolerance used by sink.

func (*AudioBaseSink) ProvideClock

func (sink *AudioBaseSink) ProvideClock() bool

ProvideClock queries whether sink will provide a clock or not. See also gst_audio_base_sink_set_provide_clock.

The function returns the following values:

  • ok: TRUE if sink will provide a clock.

func (*AudioBaseSink) ReportDeviceFailure

func (sink *AudioBaseSink) ReportDeviceFailure()

ReportDeviceFailure informs this base class that the audio output device has failed for some reason, causing a discontinuity (for example, because the device recovered from the error, but lost all contents of its ring buffer). This function is typically called by derived classes, and is useful for the custom slave method.

func (*AudioBaseSink) SetAlignmentThreshold

func (sink *AudioBaseSink) SetAlignmentThreshold(alignmentThreshold gst.ClockTime)

SetAlignmentThreshold controls the sink's alignment threshold.

The function takes the following parameters:

  • alignmentThreshold: new alignment threshold in nanoseconds.

func (*AudioBaseSink) SetCustomSlavingCallback

func (sink *AudioBaseSink) SetCustomSlavingCallback(callback AudioBaseSinkCustomSlavingCallback)

SetCustomSlavingCallback sets the custom slaving callback. This callback will be invoked if the slave-method property is set to GST_AUDIO_BASE_SINK_SLAVE_CUSTOM and the audio sink receives and plays samples.

Setting the callback to NULL causes the sink to behave as if the GST_AUDIO_BASE_SINK_SLAVE_NONE method were used.

The function takes the following parameters:

  • callback: AudioBaseSinkCustomSlavingCallback.

func (*AudioBaseSink) SetDiscontWait

func (sink *AudioBaseSink) SetDiscontWait(discontWait gst.ClockTime)

SetDiscontWait controls how long the sink will wait before creating a discontinuity.

The function takes the following parameters:

  • discontWait: new discont wait in nanoseconds.

func (*AudioBaseSink) SetDriftTolerance

func (sink *AudioBaseSink) SetDriftTolerance(driftTolerance int64)

SetDriftTolerance controls the sink's drift tolerance.

The function takes the following parameters:

  • driftTolerance: new drift tolerance in microseconds.

func (*AudioBaseSink) SetProvideClock

func (sink *AudioBaseSink) SetProvideClock(provide bool)

SetProvideClock controls whether sink will provide a clock or not. If provide is TRUE, gst_element_provide_clock() will return a clock that reflects the datarate of sink. If provide is FALSE, gst_element_provide_clock() will return NULL.

The function takes the following parameters:

  • provide: new state.

func (*AudioBaseSink) SetSlaveMethod

func (sink *AudioBaseSink) SetSlaveMethod(method AudioBaseSinkSlaveMethod)

SetSlaveMethod controls how clock slaving will be performed in sink.

The function takes the following parameters:

  • method: new slave method.

func (*AudioBaseSink) SlaveMethod

func (sink *AudioBaseSink) SlaveMethod() AudioBaseSinkSlaveMethod

SlaveMethod: get the current slave method used by sink.

The function returns the following values:

  • audioBaseSinkSlaveMethod: current slave method used by sink.

type AudioBaseSinkClass

type AudioBaseSinkClass struct {
	// contains filtered or unexported fields
}

AudioBaseSinkClass class. Override the vmethod to implement functionality.

An instance of this type is always passed by reference.

func (*AudioBaseSinkClass) ParentClass

func (a *AudioBaseSinkClass) ParentClass() *gstbase.BaseSinkClass

ParentClass: parent class.

type AudioBaseSinkCustomSlavingCallback

type AudioBaseSinkCustomSlavingCallback func(sink *AudioBaseSink, etime, itime gst.ClockTime, requestedSkew *gst.ClockTimeDiff, discontReason AudioBaseSinkDiscontReason)

AudioBaseSinkCustomSlavingCallback: this function is set with gst_audio_base_sink_set_custom_slaving_callback() and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving/synchronization schemes.

The external clock is the sink's element clock, the internal one is the internal audio clock. The internal audio clock's calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime < etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens.

requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0.

The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens.

type AudioBaseSinkDiscontReason

type AudioBaseSinkDiscontReason C.gint

AudioBaseSinkDiscontReason: different possible reasons for discontinuities. This enum is useful for the custom slave method.

const (
	// AudioBaseSinkDiscontReasonNoDiscont: no discontinuity occurred.
	AudioBaseSinkDiscontReasonNoDiscont AudioBaseSinkDiscontReason = iota
	// AudioBaseSinkDiscontReasonNewCaps: new caps are set, causing
	// renegotiotion.
	AudioBaseSinkDiscontReasonNewCaps
	// AudioBaseSinkDiscontReasonFlush samples have been flushed.
	AudioBaseSinkDiscontReasonFlush
	// AudioBaseSinkDiscontReasonSyncLatency: sink was synchronized to the
	// estimated latency (occurs during initialization).
	AudioBaseSinkDiscontReasonSyncLatency
	// AudioBaseSinkDiscontReasonAlignment: aligning buffers failed because the
	// timestamps are too discontinuous.
	AudioBaseSinkDiscontReasonAlignment
	// AudioBaseSinkDiscontReasonDeviceFailure: audio output device experienced
	// and recovered from an error but introduced latency in the process (see
	// also gst_audio_base_sink_report_device_failure()).
	AudioBaseSinkDiscontReasonDeviceFailure
)

func (AudioBaseSinkDiscontReason) String

String returns the name in string for AudioBaseSinkDiscontReason.

type AudioBaseSinkOverrides

type AudioBaseSinkOverrides struct {
	// CreateRingbuffer: create and return the AudioRingBuffer for sink. This
	// function will call the ::create_ringbuffer vmethod and will set sink as
	// the parent of the returned buffer (see gst_object_set_parent()).
	//
	// The function returns the following values:
	//
	//    - audioRingBuffer: new ringbuffer of sink.
	//
	CreateRingbuffer func() AudioRingBufferer
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Payload func(buffer *gst.Buffer) *gst.Buffer
}

AudioBaseSinkOverrides contains methods that are overridable.

type AudioBaseSinkSlaveMethod

type AudioBaseSinkSlaveMethod C.gint

AudioBaseSinkSlaveMethod: different possible clock slaving algorithms used when the internal audio clock is not selected as the pipeline master clock.

const (
	// AudioBaseSinkSlaveResample: resample to match the master clock.
	AudioBaseSinkSlaveResample AudioBaseSinkSlaveMethod = iota
	// AudioBaseSinkSlaveSkew: adjust playout pointer when master clock drifts
	// too much.
	AudioBaseSinkSlaveSkew
	// AudioBaseSinkSlaveNone: no adjustment is done.
	AudioBaseSinkSlaveNone
	// AudioBaseSinkSlaveCustom: use custom clock slaving algorithm (Since:
	// 1.6).
	AudioBaseSinkSlaveCustom
)

func (AudioBaseSinkSlaveMethod) String

func (a AudioBaseSinkSlaveMethod) String() string

String returns the name in string for AudioBaseSinkSlaveMethod.

type AudioBaseSrc

type AudioBaseSrc struct {
	gstbase.PushSrc
	// contains filtered or unexported fields
}

AudioBaseSrc: this is the base class for audio sources. Subclasses need to implement the ::create_ringbuffer vmethod. This base class will then take care of reading samples from the ringbuffer, synchronisation and flushing.

func (*AudioBaseSrc) CreateRingbuffer

func (src *AudioBaseSrc) CreateRingbuffer() AudioRingBufferer

CreateRingbuffer: create and return the AudioRingBuffer for src. This function will call the ::create_ringbuffer vmethod and will set src as the parent of the returned buffer (see gst_object_set_parent()).

The function returns the following values:

  • audioRingBuffer: new ringbuffer of src.

func (*AudioBaseSrc) ProvideClock

func (src *AudioBaseSrc) ProvideClock() bool

ProvideClock queries whether src will provide a clock or not. See also gst_audio_base_src_set_provide_clock.

The function returns the following values:

  • ok: TRUE if src will provide a clock.

func (*AudioBaseSrc) SetProvideClock

func (src *AudioBaseSrc) SetProvideClock(provide bool)

SetProvideClock controls whether src will provide a clock or not. If provide is TRUE, gst_element_provide_clock() will return a clock that reflects the datarate of src. If provide is FALSE, gst_element_provide_clock() will return NULL.

The function takes the following parameters:

  • provide: new state.

func (*AudioBaseSrc) SetSlaveMethod

func (src *AudioBaseSrc) SetSlaveMethod(method AudioBaseSrcSlaveMethod)

SetSlaveMethod controls how clock slaving will be performed in src.

The function takes the following parameters:

  • method: new slave method.

func (*AudioBaseSrc) SlaveMethod

func (src *AudioBaseSrc) SlaveMethod() AudioBaseSrcSlaveMethod

SlaveMethod: get the current slave method used by src.

The function returns the following values:

  • audioBaseSrcSlaveMethod: current slave method used by src.

type AudioBaseSrcClass

type AudioBaseSrcClass struct {
	// contains filtered or unexported fields
}

AudioBaseSrcClass class. Override the vmethod to implement functionality.

An instance of this type is always passed by reference.

func (*AudioBaseSrcClass) ParentClass

func (a *AudioBaseSrcClass) ParentClass() *gstbase.PushSrcClass

ParentClass: parent class.

type AudioBaseSrcOverrides

type AudioBaseSrcOverrides struct {
	// CreateRingbuffer: create and return the AudioRingBuffer for src. This
	// function will call the ::create_ringbuffer vmethod and will set src as
	// the parent of the returned buffer (see gst_object_set_parent()).
	//
	// The function returns the following values:
	//
	//    - audioRingBuffer: new ringbuffer of src.
	//
	CreateRingbuffer func() AudioRingBufferer
}

AudioBaseSrcOverrides contains methods that are overridable.

type AudioBaseSrcSlaveMethod

type AudioBaseSrcSlaveMethod C.gint

AudioBaseSrcSlaveMethod: different possible clock slaving algorithms when the internal audio clock was not selected as the pipeline clock.

const (
	// AudioBaseSrcSlaveResample: resample to match the master clock.
	AudioBaseSrcSlaveResample AudioBaseSrcSlaveMethod = iota
	// AudioBaseSrcSlaveReTimestamp: retimestamp output buffers with master
	// clock time.
	AudioBaseSrcSlaveReTimestamp
	// AudioBaseSrcSlaveSkew: adjust capture pointer when master clock drifts
	// too much.
	AudioBaseSrcSlaveSkew
	// AudioBaseSrcSlaveNone: no adjustment is done.
	AudioBaseSrcSlaveNone
)

func (AudioBaseSrcSlaveMethod) String

func (a AudioBaseSrcSlaveMethod) String() string

String returns the name in string for AudioBaseSrcSlaveMethod.

type AudioBuffer

type AudioBuffer struct {
	// contains filtered or unexported fields
}

AudioBuffer: structure containing the result of an audio buffer map operation, which is executed with gst_audio_buffer_map(). For non-interleaved (planar) buffers, the beginning of each channel in the buffer has its own pointer in the planes array. For interleaved buffers, the planes array only contains one item, which is the pointer to the beginning of the buffer, and n_planes equals 1.

The different channels in planes are always in the GStreamer channel order.

An instance of this type is always passed by reference.

func AudioBufferMap

func AudioBufferMap(info *AudioInfo, gstbuffer *gst.Buffer, flags gst.MapFlags) (*AudioBuffer, bool)

AudioBufferMap maps an audio gstbuffer so that it can be read or written and stores the result of the map operation in buffer.

This is especially useful when the gstbuffer is in non-interleaved (planar) layout, in which case this function will use the information in the gstbuffer's attached AudioMeta in order to map each channel in a separate "plane" in AudioBuffer. If a AudioMeta is not attached on the gstbuffer, then it must be in interleaved layout.

If a AudioMeta is attached, then the AudioInfo on the meta is checked against info. Normally, they should be equal, but in case they are not, a g_critical will be printed and the AudioInfo from the meta will be used.

In non-interleaved buffers, it is possible to have each channel on a separate Memory. In this case, each memory will be mapped separately to avoid copying their contents in a larger memory area. Do note though that it is not supported to have a single channel spanning over two or more different Memory objects. Although the map operation will likely succeed in this case, it will be highly sub-optimal and it is recommended to merge all the memories in the buffer before calling this function.

Note: The actual Buffer is not ref'ed, but it is required to stay valid as long as it's mapped.

The function takes the following parameters:

  • info: audio properties of the buffer.
  • gstbuffer to be mapped.
  • flags access mode for the memory.

The function returns the following values:

  • buffer: pointer to a AudioBuffer.
  • ok: TRUE if the map operation succeeded or FALSE on failure.

func (*AudioBuffer) Buffer

func (a *AudioBuffer) Buffer() *gst.Buffer

Buffer: mapped buffer.

func (*AudioBuffer) Info

func (a *AudioBuffer) Info() *AudioInfo

Info describing the audio properties of this buffer.

func (*AudioBuffer) NPlanes

func (a *AudioBuffer) NPlanes() int

NPlanes: number of planes available.

func (*AudioBuffer) NSamples

func (a *AudioBuffer) NSamples() uint

NSamples: size of the buffer in samples.

func (*AudioBuffer) Planes

func (a *AudioBuffer) Planes() *unsafe.Pointer

Planes: array of n_planes pointers pointing to the start of each plane in the mapped buffer.

func (*AudioBuffer) SetNPlanes

func (a *AudioBuffer) SetNPlanes(nPlanes int)

NPlanes: number of planes available.

func (*AudioBuffer) SetNSamples

func (a *AudioBuffer) SetNSamples(nSamples uint)

NSamples: size of the buffer in samples.

func (*AudioBuffer) Unmap

func (buffer *AudioBuffer) Unmap()

Unmap unmaps an audio buffer that was previously mapped with gst_audio_buffer_map().

type AudioCdSrc

type AudioCdSrc struct {
	gstbase.PushSrc

	gst.URIHandler
	// contains filtered or unexported fields
}

AudioCdSrc provides a base class for CD digital audio (CDDA) sources, which handles things like seeking, querying, discid calculation, tags, and buffer timestamping.

Using GstAudioCdSrc-based elements in applications

GstAudioCdSrc registers two Format<!-- -->s of its own, namely the "track" format and the "sector" format. Applications will usually only find the "track" format interesting. You can retrieve that Format for use in seek events or queries with gst_format_get_by_nick("track").

In order to query the number of tracks, for example, an application would set the CDDA source element to READY or PAUSED state and then query the the number of tracks via gst_element_query_duration() using the track format acquired above. Applications can query the currently playing track in the same way.

Alternatively, applications may retrieve the currently playing track and the total number of tracks from the taglist that will posted on the bus whenever the CD is opened or the currently playing track changes. The taglist will contain GST_TAG_TRACK_NUMBER and GST_TAG_TRACK_COUNT tags.

Applications playing back CD audio using playbin and cdda://n URIs should issue a seek command in track format to change between tracks, rather than setting a new cdda://n+1 URI on playbin (as setting a new URI on playbin involves closing and re-opening the CD device, which is much much slower).

Tags and meta-information

CDDA sources will automatically emit a number of tags, details about which can be found in the libgsttag documentation. Those tags are: T_TAG_CDDA_CDDB_DISCID, T_TAG_CDDA_CDDB_DISCID_FULL, T_TAG_CDDA_MUSICBRAINZ_DISCID, T_TAG_CDDA_MUSICBRAINZ_DISCID_FULL, among others.

Tracks and Table of Contents (TOC)

Applications will be informed of the available tracks via a TOC message on the pipeline's Bus. The Toc will contain a TocEntry for each track, with information about each track. The duration for each track can be retrieved via the T_TAG_DURATION tag from each entry's tag list, or calculated via gst_toc_entry_get_start_stop_times(). The track entries in the TOC will be sorted by track number.

func (*AudioCdSrc) AddTrack

func (src *AudioCdSrc) AddTrack(track *AudioCdSrcTrack) bool

AddTrack: CDDA sources use this function from their start vfunc to announce the available data and audio tracks to the base source class. The caller should allocate track on the stack, the base source will do a shallow copy of the structure (and take ownership of the taglist if there is one).

The function takes the following parameters:

  • track address of AudioCdSrcTrack to add.

The function returns the following values:

  • ok: FALSE on error, otherwise TRUE.

type AudioCdSrcClass

type AudioCdSrcClass struct {
	// contains filtered or unexported fields
}

AudioCdSrcClass: audio CD source base class.

An instance of this type is always passed by reference.

func (*AudioCdSrcClass) PushsrcClass

func (a *AudioCdSrcClass) PushsrcClass() *gstbase.PushSrcClass

PushsrcClass: parent class.

type AudioCdSrcMode

type AudioCdSrcMode C.gint

AudioCdSrcMode: mode in which the CD audio source operates. Influences timestamping, EOS handling and seeking.

const (
	// AudioCdSrcModeNormal: each single track is a stream.
	AudioCdSrcModeNormal AudioCdSrcMode = iota
	// AudioCdSrcModeContinuous: entire disc is a single stream.
	AudioCdSrcModeContinuous
)

func (AudioCdSrcMode) String

func (a AudioCdSrcMode) String() string

String returns the name in string for AudioCdSrcMode.

type AudioCdSrcOverrides

type AudioCdSrcOverrides struct {
	Close func()
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Open func(device string) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	ReadSector func(sector int) *gst.Buffer
}

AudioCdSrcOverrides contains methods that are overridable.

type AudioCdSrcTrack

type AudioCdSrcTrack struct {
	// contains filtered or unexported fields
}

AudioCdSrcTrack: CD track abstraction to communicate TOC entries to the base class.

This structure is only for use by sub-classed in connection with gst_audio_cd_src_add_track().

Applications will be informed of the available tracks via a TOC message on the pipeline's Bus instead.

An instance of this type is always passed by reference.

func (*AudioCdSrcTrack) End

func (a *AudioCdSrcTrack) End() uint

End: last sector of this track (LBA).

func (*AudioCdSrcTrack) IsAudio

func (a *AudioCdSrcTrack) IsAudio() bool

IsAudio: whether this is an audio track.

func (*AudioCdSrcTrack) Num

func (a *AudioCdSrcTrack) Num() uint

Num: track number in TOC (usually starts from 1, but not always).

func (*AudioCdSrcTrack) SetEnd

func (a *AudioCdSrcTrack) SetEnd(end uint)

End: last sector of this track (LBA).

func (*AudioCdSrcTrack) SetIsAudio

func (a *AudioCdSrcTrack) SetIsAudio(isAudio bool)

IsAudio: whether this is an audio track.

func (*AudioCdSrcTrack) SetNum

func (a *AudioCdSrcTrack) SetNum(num uint)

Num: track number in TOC (usually starts from 1, but not always).

func (*AudioCdSrcTrack) SetStart

func (a *AudioCdSrcTrack) SetStart(start uint)

Start: first sector of this track (LBA).

func (*AudioCdSrcTrack) Start

func (a *AudioCdSrcTrack) Start() uint

Start: first sector of this track (LBA).

type AudioChannelMixerFlags

type AudioChannelMixerFlags C.guint

AudioChannelMixerFlags flags passed to gst_audio_channel_mixer_new().

const (
	// AudioChannelMixerFlagsNone: no flag.
	AudioChannelMixerFlagsNone AudioChannelMixerFlags = 0b0
	// AudioChannelMixerFlagsNonInterleavedIn: input channels are not
	// interleaved.
	AudioChannelMixerFlagsNonInterleavedIn AudioChannelMixerFlags = 0b1
	// AudioChannelMixerFlagsNonInterleavedOut: output channels are not
	// interleaved.
	AudioChannelMixerFlagsNonInterleavedOut AudioChannelMixerFlags = 0b10
	// AudioChannelMixerFlagsUnpositionedIn: input channels are explicitly
	// unpositioned.
	AudioChannelMixerFlagsUnpositionedIn AudioChannelMixerFlags = 0b100
	// AudioChannelMixerFlagsUnpositionedOut: output channels are explicitly
	// unpositioned.
	AudioChannelMixerFlagsUnpositionedOut AudioChannelMixerFlags = 0b1000
)

func (AudioChannelMixerFlags) Has

Has returns true if a contains other.

func (AudioChannelMixerFlags) String

func (a AudioChannelMixerFlags) String() string

String returns the names in string for AudioChannelMixerFlags.

type AudioChannelPosition

type AudioChannelPosition C.gint

AudioChannelPosition: audio channel positions.

These are the channels defined in SMPTE 2036-2-2008 Table 1 for 22.2 audio systems with the Surround and Wide channels from DTS Coherent Acoustics (v.1.3.1) and 10.2 and 7.1 layouts. In the caps the actual channel layout is expressed with a channel count and a channel mask, which describes the existing channels. The positions in the bit mask correspond to the enum values. For negotiation it is allowed to have more bits set in the channel mask than the number of channels to specify the allowed channel positions but this is not allowed in negotiated caps. It is not allowed in any situation other than the one mentioned below to have less bits set in the channel mask than the number of channels.

GST_AUDIO_CHANNEL_POSITION_MONO can only be used with a single mono channel that has no direction information and would be mixed into all directional channels. This is expressed in caps by having a single channel and no channel mask.

GST_AUDIO_CHANNEL_POSITION_NONE can only be used if all channels have this position. This is expressed in caps by having a channel mask with no bits set.

As another special case it is allowed to have two channels without a channel mask. This implicitly means that this is a stereo stream with a front left and front right channel.

const (
	// AudioChannelPositionNone: used for position-less channels, e.g. from a
	// sound card that records 1024 channels; mutually exclusive with any other
	// channel position.
	AudioChannelPositionNone AudioChannelPosition = -3
	// AudioChannelPositionMono: mono without direction; can only be used with 1
	// channel.
	AudioChannelPositionMono AudioChannelPosition = -2
	// AudioChannelPositionInvalid: invalid position.
	AudioChannelPositionInvalid AudioChannelPosition = -1
	// AudioChannelPositionFrontLeft: front left.
	AudioChannelPositionFrontLeft AudioChannelPosition = 0
	// AudioChannelPositionFrontRight: front right.
	AudioChannelPositionFrontRight AudioChannelPosition = 1
	// AudioChannelPositionFrontCenter: front center.
	AudioChannelPositionFrontCenter AudioChannelPosition = 2
	// AudioChannelPositionLfe1: low-frequency effects 1 (subwoofer).
	AudioChannelPositionLfe1 AudioChannelPosition = 3
	// AudioChannelPositionRearLeft: rear left.
	AudioChannelPositionRearLeft AudioChannelPosition = 4
	// AudioChannelPositionRearRight: rear right.
	AudioChannelPositionRearRight AudioChannelPosition = 5
	// AudioChannelPositionFrontLeftOfCenter: front left of center.
	AudioChannelPositionFrontLeftOfCenter AudioChannelPosition = 6
	// AudioChannelPositionFrontRightOfCenter: front right of center.
	AudioChannelPositionFrontRightOfCenter AudioChannelPosition = 7
	// AudioChannelPositionRearCenter: rear center.
	AudioChannelPositionRearCenter AudioChannelPosition = 8
	// AudioChannelPositionLfe2: low-frequency effects 2 (subwoofer).
	AudioChannelPositionLfe2 AudioChannelPosition = 9
	// AudioChannelPositionSideLeft: side left.
	AudioChannelPositionSideLeft AudioChannelPosition = 10
	// AudioChannelPositionSideRight: side right.
	AudioChannelPositionSideRight AudioChannelPosition = 11
	// AudioChannelPositionTopFrontLeft: top front left.
	AudioChannelPositionTopFrontLeft AudioChannelPosition = 12
	// AudioChannelPositionTopFrontRight: top front right.
	AudioChannelPositionTopFrontRight AudioChannelPosition = 13
	// AudioChannelPositionTopFrontCenter: top front center.
	AudioChannelPositionTopFrontCenter AudioChannelPosition = 14
	// AudioChannelPositionTopCenter: top center.
	AudioChannelPositionTopCenter AudioChannelPosition = 15
	// AudioChannelPositionTopRearLeft: top rear left.
	AudioChannelPositionTopRearLeft AudioChannelPosition = 16
	// AudioChannelPositionTopRearRight: top rear right.
	AudioChannelPositionTopRearRight AudioChannelPosition = 17
	// AudioChannelPositionTopSideLeft: top side right.
	AudioChannelPositionTopSideLeft AudioChannelPosition = 18
	// AudioChannelPositionTopSideRight: top rear right.
	AudioChannelPositionTopSideRight AudioChannelPosition = 19
	// AudioChannelPositionTopRearCenter: top rear center.
	AudioChannelPositionTopRearCenter AudioChannelPosition = 20
	// AudioChannelPositionBottomFrontCenter: bottom front center.
	AudioChannelPositionBottomFrontCenter AudioChannelPosition = 21
	// AudioChannelPositionBottomFrontLeft: bottom front left.
	AudioChannelPositionBottomFrontLeft AudioChannelPosition = 22
	// AudioChannelPositionBottomFrontRight: bottom front right.
	AudioChannelPositionBottomFrontRight AudioChannelPosition = 23
	// AudioChannelPositionWideLeft: wide left (between front left and side
	// left).
	AudioChannelPositionWideLeft AudioChannelPosition = 24
	// AudioChannelPositionWideRight: wide right (between front right and side
	// right).
	AudioChannelPositionWideRight AudioChannelPosition = 25
	// AudioChannelPositionSurroundLeft: surround left (between rear left and
	// side left).
	AudioChannelPositionSurroundLeft AudioChannelPosition = 26
	// AudioChannelPositionSurroundRight: surround right (between rear right and
	// side right).
	AudioChannelPositionSurroundRight AudioChannelPosition = 27
)

func (AudioChannelPosition) String

func (a AudioChannelPosition) String() string

String returns the name in string for AudioChannelPosition.

type AudioClippingMeta

type AudioClippingMeta struct {
	// contains filtered or unexported fields
}

AudioClippingMeta: extra buffer metadata describing how much audio has to be clipped from the start or end of a buffer. This is used for compressed formats, where the first frame usually has some additional samples due to encoder and decoder delays, and the last frame usually has some additional samples to be able to fill the complete last frame.

This is used to ensure that decoded data in the end has the same amount of samples, and multiply decoded streams can be gaplessly concatenated.

Note: If clipping of the start is done by adjusting the segment, this meta has to be dropped from buffers as otherwise clipping could happen twice.

An instance of this type is always passed by reference.

func BufferAddAudioClippingMeta

func BufferAddAudioClippingMeta(buffer *gst.Buffer, format gst.Format, start, end uint64) *AudioClippingMeta

BufferAddAudioClippingMeta attaches AudioClippingMeta metadata to buffer with the given parameters.

The function takes the following parameters:

  • buffer: Buffer.
  • format: gstFormat of start and stop, GST_FORMAT_DEFAULT is samples.
  • start: amount of audio to clip from start of buffer.
  • end: amount of to clip from end of buffer.

The function returns the following values:

  • audioClippingMeta on buffer.

func (*AudioClippingMeta) End

func (a *AudioClippingMeta) End() uint64

End: amount of to clip from end of buffer.

func (*AudioClippingMeta) Format

func (a *AudioClippingMeta) Format() gst.Format

Format of start and stop, GST_FORMAT_DEFAULT is samples.

func (*AudioClippingMeta) Meta

func (a *AudioClippingMeta) Meta() *gst.Meta

Meta: parent Meta.

func (*AudioClippingMeta) SetEnd

func (a *AudioClippingMeta) SetEnd(end uint64)

End: amount of to clip from end of buffer.

func (*AudioClippingMeta) SetStart

func (a *AudioClippingMeta) SetStart(start uint64)

Start: amount of audio to clip from start of buffer.

func (*AudioClippingMeta) Start

func (a *AudioClippingMeta) Start() uint64

Start: amount of audio to clip from start of buffer.

type AudioClock

type AudioClock struct {
	gst.SystemClock
	// contains filtered or unexported fields
}

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

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

func NewAudioClock

func NewAudioClock(name string, fn AudioClockGetTimeFunc) *AudioClock

NewAudioClock: create a new AudioClock instance. Whenever the clock time should be calculated it will call func with user_data. When func returns T_CLOCK_TIME_NONE, the clock will return the last reported time.

The function takes the following parameters:

  • name of the clock.
  • fn: function.

The function returns the following values:

  • audioClock: new AudioClock casted to a Clock.

func (*AudioClock) Adjust

func (clock *AudioClock) Adjust(time gst.ClockTime) gst.ClockTime

Adjust time with the internal offset of the audio clock.

The function takes the following parameters:

  • time: ClockTime.

The function returns the following values:

  • clockTime: time adjusted with the internal offset.

func (*AudioClock) Invalidate

func (clock *AudioClock) Invalidate()

Invalidate the clock function. Call this function when the provided 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.

func (*AudioClock) Reset

func (clock *AudioClock) Reset(time gst.ClockTime)

Reset: inform clock that future calls to 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 Clock object.

The function takes the following parameters:

  • time: ClockTime.

func (*AudioClock) Time

func (clock *AudioClock) Time() gst.ClockTime

Time: report the time as returned by the AudioClockGetTimeFunc without applying any offsets.

The function returns the following values:

  • clockTime: time as reported by the time function of the audio clock.

type AudioClockClass

type AudioClockClass struct {
	// contains filtered or unexported fields
}

AudioClockClass: instance of this type is always passed by reference.

func (*AudioClockClass) ParentClass

func (a *AudioClockClass) ParentClass() *gst.SystemClockClass

type AudioClockGetTimeFunc

type AudioClockGetTimeFunc func(clock gst.Clocker) (clockTime gst.ClockTime)

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

type AudioClockOverrides

type AudioClockOverrides struct {
}

AudioClockOverrides contains methods that are overridable.

type AudioConverter

type AudioConverter struct {
	// contains filtered or unexported fields
}

AudioConverter: this object is used to convert audio samples from one format to another. The object can perform conversion of:

  • audio format with optional dithering and noise shaping

  • audio samplerate

  • audio channels and channel layout

An instance of this type is always passed by reference.

func NewAudioConverter

func NewAudioConverter(flags AudioConverterFlags, inInfo *AudioInfo, outInfo *AudioInfo, config *gst.Structure) *AudioConverter

NewAudioConverter constructs a struct AudioConverter.

func (*AudioConverter) Config

func (convert *AudioConverter) Config() (inRate int, outRate int, structure *gst.Structure)

Config: get the current configuration of convert.

The function returns the following values:

  • inRate (optional): result input rate.
  • outRate (optional): result output rate.
  • structure: a Structure that remains valid for as long as convert is valid or until gst_audio_converter_update_config() is called.

func (*AudioConverter) Convert

func (convert *AudioConverter) Convert(flags AudioConverterFlags, in []byte) ([]byte, bool)

Convert: convenience wrapper around gst_audio_converter_samples(), which will perform allocation of the output buffer based on the result from gst_audio_converter_get_out_frames().

The function takes the following parameters:

  • flags: extra AudioConverterFlags.
  • in: input data.

The function returns the following values:

  • out: pointer where the output data will be written.
  • ok: TRUE is the conversion could be performed.

func (*AudioConverter) InFrames

func (convert *AudioConverter) InFrames(outFrames uint) uint

InFrames: calculate how many input frames are currently needed by convert to produce out_frames of output frames.

The function takes the following parameters:

  • outFrames: number of output frames.

The function returns the following values:

  • gsize: number of input frames.

func (*AudioConverter) IsPassthrough

func (convert *AudioConverter) IsPassthrough() bool

IsPassthrough returns whether the audio converter will operate in passthrough mode. The return value would be typically input to gst_base_transform_set_passthrough().

The function returns the following values:

  • ok: TRUE when no conversion will actually occur.

func (*AudioConverter) MaxLatency

func (convert *AudioConverter) MaxLatency() uint

MaxLatency: get the maximum number of input frames that the converter would need before producing output.

The function returns the following values:

  • gsize: latency of convert as expressed in the number of frames.

func (*AudioConverter) OutFrames

func (convert *AudioConverter) OutFrames(inFrames uint) uint

OutFrames: calculate how many output frames can be produced when in_frames input frames are given to convert.

The function takes the following parameters:

  • inFrames: number of input frames.

The function returns the following values:

  • gsize: number of output frames.

func (*AudioConverter) Reset

func (convert *AudioConverter) Reset()

Reset convert to the state it was when it was first created, clearing any history it might currently have.

func (*AudioConverter) Samples

func (convert *AudioConverter) Samples(flags AudioConverterFlags, in *unsafe.Pointer, inFrames uint, out *unsafe.Pointer, outFrames uint) bool

Samples: perform the conversion with in_frames in in to out_frames in out using convert.

In case the samples are interleaved, in and out must point to an array with a single element pointing to a block of interleaved samples.

If non-interleaved samples are used, in and out must point to an array with pointers to memory blocks, one for each channel.

in may be NULL, in which case in_frames of silence samples are processed by the converter.

This function always produces out_frames of output and consumes in_frames of input. Use gst_audio_converter_get_out_frames() and gst_audio_converter_get_in_frames() to make sure in_frames and out_frames are matching and in and out point to enough memory.

The function takes the following parameters:

  • flags: extra AudioConverterFlags.
  • in (optional): input frames.
  • inFrames: number of input frames.
  • out (optional): output frames.
  • outFrames: number of output frames.

The function returns the following values:

  • ok: TRUE is the conversion could be performed.

func (*AudioConverter) SupportsInplace

func (convert *AudioConverter) SupportsInplace() bool

SupportsInplace returns whether the audio converter can perform the conversion in-place. The return value would be typically input to gst_base_transform_set_in_place().

The function returns the following values:

  • ok: TRUE when the conversion can be done in place.

func (*AudioConverter) UpdateConfig

func (convert *AudioConverter) UpdateConfig(inRate int, outRate int, config *gst.Structure) bool

UpdateConfig: set in_rate, out_rate and config as extra configuration for convert.

in_rate and out_rate specify the new sample rates of input and output formats. A value of 0 leaves the sample rate unchanged.

config can be NULL, in which case, the current configuration is not changed.

If the parameters in config can not be set exactly, this function returns FALSE and will try to update as much state as possible. The new state can then be retrieved and refined with gst_audio_converter_get_config().

Look at the GST_AUDIO_CONVERTER_OPT_* fields to check valid configuration option and values.

The function takes the following parameters:

  • inRate: input rate.
  • outRate: output rate.
  • config (optional) or NULL.

The function returns the following values:

  • ok: TRUE when the new parameters could be set.

type AudioConverterFlags

type AudioConverterFlags C.guint

AudioConverterFlags: extra flags passed to gst_audio_converter_new() and gst_audio_converter_samples().

const (
	// AudioConverterFlagNone: no flag.
	AudioConverterFlagNone AudioConverterFlags = 0b0
	// AudioConverterFlagInWritable: input sample arrays are writable and can be
	// used as temporary storage during conversion.
	AudioConverterFlagInWritable AudioConverterFlags = 0b1
	// AudioConverterFlagVariableRate: allow arbitrary rate updates with
	// gst_audio_converter_update_config().
	AudioConverterFlagVariableRate AudioConverterFlags = 0b10
)

func (AudioConverterFlags) Has

Has returns true if a contains other.

func (AudioConverterFlags) String

func (a AudioConverterFlags) String() string

String returns the names in string for AudioConverterFlags.

type AudioDecoder

type AudioDecoder struct {
	gst.Element
	// contains filtered or unexported fields
}

AudioDecoder: this base class is for audio decoders turning encoded data into raw audio samples.

GstAudioDecoder and subclass should cooperate as follows.

Configuration

  • Initially, GstAudioDecoder calls start when the decoder element is activated, which allows subclass to perform any global setup. Base class (context) parameters can already be set according to subclass capabilities (or possibly upon receive more information in subsequent set_format).
  • GstAudioDecoder calls set_format to inform subclass of the format of input audio data that it is about to receive. While unlikely, it might be called more than once, if changing input parameters require reconfiguration.
  • GstAudioDecoder calls stop at end of all processing.

As of configuration stage, and throughout processing, GstAudioDecoder provides various (context) parameters, e.g. describing the format of output audio data (valid when output caps have been set) or current parsing state. Conversely, subclass can and should configure context to inform base class of its expectation w.r.t. buffer handling.

Data processing

  • Base class gathers input data, and optionally allows subclass to parse this into subsequently manageable (as defined by subclass) chunks. Such chunks are subsequently referred to as 'frames', though they may or may not correspond to 1 (or more) audio format frame.
  • Input frame is provided to subclass' handle_frame.
  • If codec processing results in decoded data, subclass should call gst_audio_decoder_finish_frame to have decoded data pushed downstream.
  • Just prior to actually pushing a buffer downstream, it is passed to pre_push. Subclass should either use this callback to arrange for additional downstream pushing or otherwise ensure such custom pushing occurs after at least a method call has finished since setting src pad caps.
  • During the parsing process GstAudioDecoderClass will handle both srcpad and sinkpad events. Sink events will be passed to subclass if event callback has been provided.

Shutdown phase

  • GstAudioDecoder class calls stop to inform the subclass that data parsing will be stopped.

Subclass is responsible for providing pad template caps for source and sink pads. The pads need to be named "sink" and "src". It also needs to set the fixed caps on srcpad, when the format is ensured. This is typically when base class calls subclass' set_format function, though it might be delayed until calling gst_audio_decoder_finish_frame.

In summary, above process should have subclass concentrating on codec data processing while leaving other matters to base class, such as most notably timestamp handling. While it may exert more control in this area (see e.g. pre_push), it is very much not recommended.

In particular, base class will try to arrange for perfect output timestamps as much as possible while tracking upstream timestamps. To this end, if deviation between the next ideal expected perfect timestamp and upstream exceeds AudioDecoder:tolerance, then resync to upstream occurs (which would happen always if the tolerance mechanism is disabled).

In non-live pipelines, baseclass can also (configurably) arrange for output buffer aggregation which may help to redue large(r) numbers of small(er) buffers being pushed and processed downstream. Note that this feature is only available if the buffer layout is interleaved. For planar buffers, the decoder implementation is fully responsible for the output buffer size.

On the other hand, it should be noted that baseclass only provides limited seeking support (upon explicit subclass request), as full-fledged support should rather be left to upstream demuxer, parser or alike. This simple approach caters for seeking and duration reporting using estimated input bitrates.

Things that subclass need to take care of:

  • Provide pad templates

  • Set source pad caps when appropriate

  • Set user-configurable properties to sane defaults for format and implementing codec at hand, and convey some subclass capabilities and expectations in context.

  • Accept data in handle_frame and provide encoded results to gst_audio_decoder_finish_frame. If it is prepared to perform PLC, it should also accept NULL data in handle_frame and provide for data for indicated duration.

func BaseAudioDecoder

func BaseAudioDecoder(obj AudioDecoderer) *AudioDecoder

BaseAudioDecoder returns the underlying base object.

func (*AudioDecoder) AllocateOutputBuffer

func (dec *AudioDecoder) AllocateOutputBuffer(size uint) *gst.Buffer

AllocateOutputBuffer: helper function that allocates a buffer to hold an audio frame for dec's current output format.

The function takes the following parameters:

  • size of the buffer.

The function returns the following values:

  • buffer: allocated buffer.

func (*AudioDecoder) Allocator

func (dec *AudioDecoder) Allocator() (gst.Allocatorrer, *gst.AllocationParams)

Allocator lets AudioDecoder sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

The function returns the following values:

  • allocator (optional): Allocator used.
  • params (optional) the AllocationParams of allocator.

func (*AudioDecoder) AudioInfo

func (dec *AudioDecoder) AudioInfo() *AudioInfo

The function returns the following values:

  • audioInfo describing the input audio format.

func (*AudioDecoder) Delay

func (dec *AudioDecoder) Delay() int

The function returns the following values:

  • gint: currently configured decoder delay.

func (*AudioDecoder) Drainable

func (dec *AudioDecoder) Drainable() bool

Drainable queries decoder drain handling.

The function returns the following values:

  • ok: TRUE if drainable handling is enabled.

    MT safe.

func (*AudioDecoder) EstimateRate

func (dec *AudioDecoder) EstimateRate() int

The function returns the following values:

  • gint: currently configured byte to time conversion setting.

func (*AudioDecoder) FinishFrame

func (dec *AudioDecoder) FinishFrame(buf *gst.Buffer, frames int) gst.FlowReturn

FinishFrame collects decoded data and pushes it downstream.

buf may be NULL in which case the indicated number of frames are discarded and considered to have produced no output (e.g. lead-in or setup frames). Otherwise, source pad caps must be set when it is called with valid data in buf.

Note that a frame received in AudioDecoderClass.handle_frame() may be invalidated by a call to this function.

The function takes the following parameters:

  • buf (optional): decoded data.
  • frames: number of decoded frames represented by decoded data.

The function returns the following values:

  • flowReturn that should be escalated to caller (of caller).

func (*AudioDecoder) FinishSubframe

func (dec *AudioDecoder) FinishSubframe(buf *gst.Buffer) gst.FlowReturn

FinishSubframe collects decoded data and pushes it downstream. This function may be called multiple times for a given input frame.

buf may be NULL in which case it is assumed that the current input frame is finished. This is equivalent to calling gst_audio_decoder_finish_subframe() with a NULL buffer and frames=1 after having pushed out all decoded audio subframes using this function.

When called with valid data in buf the source pad caps must have been set already.

Note that a frame received in AudioDecoderClass.handle_frame() may be invalidated by a call to this function.

The function takes the following parameters:

  • buf (optional): decoded data.

The function returns the following values:

  • flowReturn that should be escalated to caller (of caller).

func (*AudioDecoder) Latency

func (dec *AudioDecoder) Latency() (min, max gst.ClockTime)

Latency sets the variables pointed to by min and max to the currently configured latency.

The function returns the following values:

  • min (optional): pointer to storage to hold minimum latency.
  • max (optional): pointer to storage to hold maximum latency.

func (*AudioDecoder) MaxErrors

func (dec *AudioDecoder) MaxErrors() int

The function returns the following values:

  • gint: currently configured decoder tolerated error count.

func (*AudioDecoder) MinLatency

func (dec *AudioDecoder) MinLatency() gst.ClockTime

MinLatency queries decoder's latency aggregation.

The function returns the following values:

  • clockTime: aggregation latency.

    MT safe.

func (*AudioDecoder) NeedsFormat

func (dec *AudioDecoder) NeedsFormat() bool

NeedsFormat queries decoder required format handling.

The function returns the following values:

  • ok: TRUE if required format handling is enabled.

    MT safe.

func (*AudioDecoder) Negotiate

func (dec *AudioDecoder) Negotiate() bool

Negotiate with downstream elements to currently configured AudioInfo. Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if negotiate fails.

The function returns the following values:

  • ok: TRUE if the negotiation succeeded, else FALSE.

func (*AudioDecoder) ParseState

func (dec *AudioDecoder) ParseState() (sync, eos bool)

ParseState: return current parsing (sync and eos) state.

The function returns the following values:

  • sync (optional): pointer to a variable to hold the current sync state.
  • eos (optional): pointer to a variable to hold the current eos state.

func (*AudioDecoder) Plc

func (dec *AudioDecoder) Plc() bool

Plc queries decoder packet loss concealment handling.

The function returns the following values:

  • ok: TRUE if packet loss concealment is enabled.

    MT safe.

func (*AudioDecoder) PlcAware

func (dec *AudioDecoder) PlcAware() int

The function returns the following values:

  • gint: currently configured plc handling.

func (*AudioDecoder) ProxyGetcaps

func (decoder *AudioDecoder) ProxyGetcaps(caps, filter *gst.Caps) *gst.Caps

ProxyGetcaps returns caps that express caps (or sink template caps if caps == NULL) restricted to rate/channels/... combinations supported by downstream elements.

The function takes the following parameters:

  • caps (optional): initial caps.
  • filter (optional) caps.

The function returns the following values:

  • ret owned by caller.

func (*AudioDecoder) SetAllocationCaps

func (dec *AudioDecoder) SetAllocationCaps(allocationCaps *gst.Caps)

SetAllocationCaps sets a caps in allocation query which are different from the set pad's caps. Use this function before calling gst_audio_decoder_negotiate(). Setting to NULL the allocation query will use the caps from the pad.

The function takes the following parameters:

  • allocationCaps (optional) or NULL.

func (*AudioDecoder) SetDrainable

func (dec *AudioDecoder) SetDrainable(enabled bool)

SetDrainable configures decoder drain handling. If drainable, subclass might be handed a NULL buffer to have it return any leftover decoded data. Otherwise, it is not considered so capable and will only ever be passed real data.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioDecoder) SetEstimateRate

func (dec *AudioDecoder) SetEstimateRate(enabled bool)

SetEstimateRate allows baseclass to perform byte to time estimated conversion.

The function takes the following parameters:

  • enabled: whether to enable byte to time conversion.

func (*AudioDecoder) SetLatency

func (dec *AudioDecoder) SetLatency(min, max gst.ClockTime)

SetLatency sets decoder latency.

The function takes the following parameters:

  • min: minimum latency.
  • max: maximum latency.

func (*AudioDecoder) SetMaxErrors

func (dec *AudioDecoder) SetMaxErrors(num int)

SetMaxErrors sets numbers of tolerated decoder errors, where a tolerated one is then only warned about, but more than tolerated will lead to fatal error. You can set -1 for never returning fatal errors. Default is set to GST_AUDIO_DECODER_MAX_ERRORS.

The function takes the following parameters:

  • num: max tolerated errors.

func (*AudioDecoder) SetMinLatency

func (dec *AudioDecoder) SetMinLatency(num gst.ClockTime)

SetMinLatency sets decoder minimum aggregation latency.

MT safe.

The function takes the following parameters:

  • num: new minimum latency.

func (*AudioDecoder) SetNeedsFormat

func (dec *AudioDecoder) SetNeedsFormat(enabled bool)

SetNeedsFormat configures decoder format needs. If enabled, subclass needs to be negotiated with format caps before it can process any data. It will then never be handed any data before it has been configured. Otherwise, it might be handed data without having been configured and is then expected being able to do so either by default or based on the input data.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioDecoder) SetOutputCaps

func (dec *AudioDecoder) SetOutputCaps(caps *gst.Caps) bool

SetOutputCaps: configure output caps on the srcpad of dec. Similar to gst_audio_decoder_set_output_format(), but allows subclasses to specify output caps that can't be expressed via AudioInfo e.g. caps that have caps features.

The function takes the following parameters:

  • caps: (fixed) Caps.

The function returns the following values:

  • ok: TRUE on success.

func (*AudioDecoder) SetOutputFormat

func (dec *AudioDecoder) SetOutputFormat(info *AudioInfo) bool

SetOutputFormat: configure output info on the srcpad of dec.

The function takes the following parameters:

  • info: AudioInfo.

The function returns the following values:

  • ok: TRUE on success.

func (*AudioDecoder) SetPlc

func (dec *AudioDecoder) SetPlc(enabled bool)

SetPlc: enable or disable decoder packet loss concealment, provided subclass and codec are capable and allow handling plc.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioDecoder) SetPlcAware

func (dec *AudioDecoder) SetPlcAware(plc bool)

SetPlcAware indicates whether or not subclass handles packet loss concealment (plc).

The function takes the following parameters:

  • plc: new plc state.

func (*AudioDecoder) SetTolerance

func (dec *AudioDecoder) SetTolerance(tolerance gst.ClockTime)

SetTolerance configures decoder audio jitter tolerance threshold.

MT safe.

The function takes the following parameters:

  • tolerance: new tolerance.

func (*AudioDecoder) SetUseDefaultPadAcceptcaps

func (decoder *AudioDecoder) SetUseDefaultPadAcceptcaps(use bool)

SetUseDefaultPadAcceptcaps lets AudioDecoder sub-classes decide if they want the sink pad to use the default pad query handler to reply to accept-caps queries.

By setting this to true it is possible to further customize the default handler with GST_PAD_SET_ACCEPT_INTERSECT and GST_PAD_SET_ACCEPT_TEMPLATE.

The function takes the following parameters:

  • use: if the default pad accept-caps query handling should be used.

func (*AudioDecoder) Tolerance

func (dec *AudioDecoder) Tolerance() gst.ClockTime

Tolerance queries current audio jitter tolerance threshold.

The function returns the following values:

  • clockTime: decoder audio jitter tolerance threshold.

    MT safe.

type AudioDecoderClass

type AudioDecoderClass struct {
	// contains filtered or unexported fields
}

AudioDecoderClass subclasses can override any of the available virtual methods or not, as needed. At minimum handle_frame (and likely set_format) needs to be overridden.

An instance of this type is always passed by reference.

func (*AudioDecoderClass) ElementClass

func (a *AudioDecoderClass) ElementClass() *gst.ElementClass

ElementClass: parent class structure.

type AudioDecoderOverrides

type AudioDecoderOverrides struct {
	// The function returns the following values:
	//
	Close func() bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	DecideAllocation func(query *gst.Query) bool
	// The function takes the following parameters:
	//
	Flush func(hard bool)

	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	HandleFrame func(buffer *gst.Buffer) gst.FlowReturn
	// Negotiate with downstream elements to currently configured AudioInfo.
	// Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if
	// negotiate fails.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the negotiation succeeded, else FALSE.
	//
	Negotiate func() bool
	// The function returns the following values:
	//
	Open func() bool
	// The function takes the following parameters:
	//
	//    - adapter
	//    - offset
	//    - length
	//
	// The function returns the following values:
	//
	Parse func(adapter *gstbase.Adapter, offset, length *int) gst.FlowReturn
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	ProposeAllocation func(query *gst.Query) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SetFormat func(caps *gst.Caps) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SinkEvent func(event *gst.Event) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SinkQuery func(query *gst.Query) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SrcEvent func(event *gst.Event) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SrcQuery func(query *gst.Query) bool
	// The function returns the following values:
	//
	Start func() bool
	// The function returns the following values:
	//
	Stop func() bool
	// The function takes the following parameters:
	//
	//    - outbuf
	//    - meta
	//    - inbuf
	//
	// The function returns the following values:
	//
	TransformMeta func(outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool
	// contains filtered or unexported fields
}

AudioDecoderOverrides contains methods that are overridable.

type AudioDecoderer

type AudioDecoderer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AudioDecoderer describes types inherited from class AudioDecoder.

To get the original type, the caller must assert this to an interface or another type.

type AudioDitherMethod

type AudioDitherMethod C.gint

AudioDitherMethod: set of available dithering methods.

const (
	// AudioDitherNone: no dithering.
	AudioDitherNone AudioDitherMethod = iota
	// AudioDitherRpdf: rectangular dithering.
	AudioDitherRpdf
	// AudioDitherTpdf: triangular dithering (default).
	AudioDitherTpdf
	// AudioDitherTpdfHf: high frequency triangular dithering.
	AudioDitherTpdfHf
)

func (AudioDitherMethod) String

func (a AudioDitherMethod) String() string

String returns the name in string for AudioDitherMethod.

type AudioDownmixMeta

type AudioDownmixMeta struct {
	// contains filtered or unexported fields
}

AudioDownmixMeta: extra buffer metadata describing audio downmixing matrix. This metadata is attached to audio buffers and contains a matrix to downmix the buffer number of channels to channels.

matrix is an two-dimensional array of to_channels times from_channels coefficients, i.e. the i-th output channels is constructed by multiplicating the input channels with the coefficients in matrix[i] and taking the sum of the results.

An instance of this type is always passed by reference.

func BufferAddAudioDownmixMeta

func BufferAddAudioDownmixMeta(buffer *gst.Buffer, fromPosition, toPosition []AudioChannelPosition, matrix **float32) *AudioDownmixMeta

BufferAddAudioDownmixMeta attaches AudioDownmixMeta metadata to buffer with the given parameters.

matrix is an two-dimensional array of to_channels times from_channels coefficients, i.e. the i-th output channels is constructed by multiplicating the input channels with the coefficients in matrix[i] and taking the sum of the results.

The function takes the following parameters:

  • buffer: Buffer.
  • fromPosition: channel positions of the source.
  • toPosition: channel positions of the destination.
  • matrix coefficients.

The function returns the following values:

  • audioDownmixMeta on buffer.

func BufferGetAudioDownmixMetaForChannels

func BufferGetAudioDownmixMetaForChannels(buffer *gst.Buffer, toPosition []AudioChannelPosition) *AudioDownmixMeta

BufferGetAudioDownmixMetaForChannels: find the AudioDownmixMeta on buffer for the given destination channel positions.

The function takes the following parameters:

  • buffer: Buffer.
  • toPosition: channel positions of the destination.

The function returns the following values:

  • audioDownmixMeta on buffer.

func (*AudioDownmixMeta) FromChannels

func (a *AudioDownmixMeta) FromChannels() int

FromChannels: number of channels of the source.

func (*AudioDownmixMeta) FromPosition

func (a *AudioDownmixMeta) FromPosition() *AudioChannelPosition

FromPosition: channel positions of the source.

func (*AudioDownmixMeta) Matrix

func (a *AudioDownmixMeta) Matrix() **float32

Matrix: matrix coefficients.

func (*AudioDownmixMeta) Meta

func (a *AudioDownmixMeta) Meta() *gst.Meta

Meta: parent Meta.

func (*AudioDownmixMeta) SetFromChannels

func (a *AudioDownmixMeta) SetFromChannels(fromChannels int)

FromChannels: number of channels of the source.

func (*AudioDownmixMeta) SetToChannels

func (a *AudioDownmixMeta) SetToChannels(toChannels int)

ToChannels: number of channels of the destination.

func (*AudioDownmixMeta) ToChannels

func (a *AudioDownmixMeta) ToChannels() int

ToChannels: number of channels of the destination.

func (*AudioDownmixMeta) ToPosition

func (a *AudioDownmixMeta) ToPosition() *AudioChannelPosition

ToPosition: channel positions of the destination.

type AudioEncoder

type AudioEncoder struct {
	gst.Element

	gst.Preset
	// contains filtered or unexported fields
}

AudioEncoder: this base class is for audio encoders turning raw audio samples into encoded audio data.

GstAudioEncoder and subclass should cooperate as follows.

Configuration

  • Initially, GstAudioEncoder calls start when the encoder element is activated, which allows subclass to perform any global setup.

  • GstAudioEncoder calls set_format to inform subclass of the format of input audio data that it is about to receive. Subclass should setup for encoding and configure various base class parameters appropriately, notably those directing desired input data handling. While unlikely, it might be called more than once, if changing input parameters require reconfiguration.

  • GstAudioEncoder calls stop at end of all processing.

As of configuration stage, and throughout processing, GstAudioEncoder maintains various parameters that provide required context, e.g. describing the format of input audio data. Conversely, subclass can and should configure these context parameters to inform base class of its expectation w.r.t. buffer handling.

Data processing

  • Base class gathers input sample data (as directed by the context's frame_samples and frame_max) and provides this to subclass' handle_frame.
  • If codec processing results in encoded data, subclass should call gst_audio_encoder_finish_frame() to have encoded data pushed downstream. Alternatively, it might also call gst_audio_encoder_finish_frame() (with a NULL buffer and some number of dropped samples) to indicate dropped (non-encoded) samples.
  • Just prior to actually pushing a buffer downstream, it is passed to pre_push.
  • During the parsing process GstAudioEncoderClass will handle both srcpad and sinkpad events. Sink events will be passed to subclass if event callback has been provided.

Shutdown phase

  • GstAudioEncoder class calls stop to inform the subclass that data parsing will be stopped.

Subclass is responsible for providing pad template caps for source and sink pads. The pads need to be named "sink" and "src". It also needs to set the fixed caps on srcpad, when the format is ensured. This is typically when base class calls subclass' set_format function, though it might be delayed until calling gst_audio_encoder_finish_frame.

In summary, above process should have subclass concentrating on codec data processing while leaving other matters to base class, such as most notably timestamp handling. While it may exert more control in this area (see e.g. pre_push), it is very much not recommended.

In particular, base class will either favor tracking upstream timestamps (at the possible expense of jitter) or aim to arrange for a perfect stream of output timestamps, depending on AudioEncoder:perfect-timestamp. However, in the latter case, the input may not be so perfect or ideal, which is handled as follows. An input timestamp is compared with the expected timestamp as dictated by input sample stream and if the deviation is less than AudioEncoder:tolerance, the deviation is discarded. Otherwise, it is considered a discontuinity and subsequent output timestamp is resynced to the new position after performing configured discontinuity processing. In the non-perfect-timestamp case, an upstream variation exceeding tolerance only leads to marking DISCONT on subsequent outgoing (while timestamps are adjusted to upstream regardless of variation). While DISCONT is also marked in the perfect-timestamp case, this one optionally (see AudioEncoder:hard-resync) performs some additional steps, such as clipping of (early) input samples or draining all currently remaining input data, depending on the direction of the discontuinity.

If perfect timestamps are arranged, it is also possible to request baseclass (usually set by subclass) to provide additional buffer metadata (in OFFSET and OFFSET_END) fields according to granule defined semantics currently needed by oggmux. Specifically, OFFSET is set to granulepos (= sample count including buffer) and OFFSET_END to corresponding timestamp (as determined by same sample count and sample rate).

Things that subclass need to take care of:

  • Provide pad templates
  • Set source pad caps when appropriate
  • Inform base class of buffer processing needs using context's frame_samples and frame_bytes.
  • Set user-configurable properties to sane defaults for format and implementing codec at hand, e.g. those controlling timestamp behaviour and discontinuity processing.
  • Accept data in handle_frame and provide encoded results to gst_audio_encoder_finish_frame().

func BaseAudioEncoder

func BaseAudioEncoder(obj AudioEncoderer) *AudioEncoder

BaseAudioEncoder returns the underlying base object.

func (*AudioEncoder) AllocateOutputBuffer

func (enc *AudioEncoder) AllocateOutputBuffer(size uint) *gst.Buffer

AllocateOutputBuffer: helper function that allocates a buffer to hold an encoded audio frame for enc's current output format.

The function takes the following parameters:

  • size of the buffer.

The function returns the following values:

  • buffer: allocated buffer.

func (*AudioEncoder) Allocator

func (enc *AudioEncoder) Allocator() (gst.Allocatorrer, *gst.AllocationParams)

Allocator lets AudioEncoder sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after use it.

The function returns the following values:

  • allocator (optional): Allocator used.
  • params (optional) the AllocationParams of allocator.

func (*AudioEncoder) AudioInfo

func (enc *AudioEncoder) AudioInfo() *AudioInfo

The function returns the following values:

  • audioInfo describing the input audio format.

func (*AudioEncoder) Drainable

func (enc *AudioEncoder) Drainable() bool

Drainable queries encoder drain handling.

The function returns the following values:

  • ok: TRUE if drainable handling is enabled.

    MT safe.

func (*AudioEncoder) FinishFrame

func (enc *AudioEncoder) FinishFrame(buffer *gst.Buffer, samples int) gst.FlowReturn

FinishFrame collects encoded data and pushes encoded data downstream. Source pad caps must be set when this is called.

If samples < 0, then best estimate is all samples provided to encoder (subclass) so far. buf may be NULL, in which case next number of samples are considered discarded, e.g. as a result of discontinuous transmission, and a discontinuity is marked.

Note that samples received in AudioEncoderClass.handle_frame() may be invalidated by a call to this function.

The function takes the following parameters:

  • buffer (optional): encoded data.
  • samples: number of samples (per channel) represented by encoded data.

The function returns the following values:

  • flowReturn that should be escalated to caller (of caller).

func (*AudioEncoder) FrameMax

func (enc *AudioEncoder) FrameMax() int

The function returns the following values:

  • gint: currently configured maximum handled frames.

func (*AudioEncoder) FrameSamplesMax

func (enc *AudioEncoder) FrameSamplesMax() int

The function returns the following values:

  • gint: currently maximum requested samples per frame.

func (*AudioEncoder) FrameSamplesMin

func (enc *AudioEncoder) FrameSamplesMin() int

The function returns the following values:

  • gint: currently minimum requested samples per frame.

func (*AudioEncoder) HardMin

func (enc *AudioEncoder) HardMin() bool

HardMin queries encoder hard minimum handling.

The function returns the following values:

  • ok: TRUE if hard minimum handling is enabled.

    MT safe.

func (*AudioEncoder) HardResync

func (enc *AudioEncoder) HardResync() bool

The function returns the following values:

func (*AudioEncoder) Latency

func (enc *AudioEncoder) Latency() (min, max gst.ClockTime)

Latency sets the variables pointed to by min and max to the currently configured latency.

The function returns the following values:

  • min (optional): pointer to storage to hold minimum latency.
  • max (optional): pointer to storage to hold maximum latency.

func (*AudioEncoder) Lookahead

func (enc *AudioEncoder) Lookahead() int

The function returns the following values:

  • gint: currently configured encoder lookahead.

func (*AudioEncoder) MarkGranule

func (enc *AudioEncoder) MarkGranule() bool

MarkGranule queries if the encoder will handle granule marking.

The function returns the following values:

  • ok: TRUE if granule marking is enabled.

    MT safe.

func (*AudioEncoder) Negotiate

func (enc *AudioEncoder) Negotiate() bool

Negotiate with downstream elements to currently configured Caps. Unmark GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if negotiate fails.

The function returns the following values:

  • ok: TRUE if the negotiation succeeded, else FALSE.

func (*AudioEncoder) PerfectTimestamp

func (enc *AudioEncoder) PerfectTimestamp() bool

PerfectTimestamp queries encoder perfect timestamp behaviour.

The function returns the following values:

  • ok: TRUE if perfect timestamp setting enabled.

    MT safe.

func (*AudioEncoder) ProxyGetcaps

func (enc *AudioEncoder) ProxyGetcaps(caps, filter *gst.Caps) *gst.Caps

ProxyGetcaps returns caps that express caps (or sink template caps if caps == NULL) restricted to channel/rate combinations supported by downstream elements (e.g. muxers).

The function takes the following parameters:

  • caps (optional): initial caps.
  • filter (optional) caps.

The function returns the following values:

  • ret owned by caller.

func (*AudioEncoder) SetAllocationCaps

func (enc *AudioEncoder) SetAllocationCaps(allocationCaps *gst.Caps)

SetAllocationCaps sets a caps in allocation query which are different from the set pad's caps. Use this function before calling gst_audio_encoder_negotiate(). Setting to NULL the allocation query will use the caps from the pad.

The function takes the following parameters:

  • allocationCaps (optional) or NULL.

func (*AudioEncoder) SetDrainable

func (enc *AudioEncoder) SetDrainable(enabled bool)

SetDrainable configures encoder drain handling. If drainable, subclass might be handed a NULL buffer to have it return any leftover encoded data. Otherwise, it is not considered so capable and will only ever be passed real data.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioEncoder) SetFrameMax

func (enc *AudioEncoder) SetFrameMax(num int)

SetFrameMax sets max number of frames accepted at once (assumed minimally 1). Requires frame_samples_min and frame_samples_max to be the equal.

Note: This value will be reset to 0 every time before AudioEncoderClass.set_format() is called.

The function takes the following parameters:

  • num: number of frames.

func (*AudioEncoder) SetFrameSamplesMax

func (enc *AudioEncoder) SetFrameSamplesMax(num int)

SetFrameSamplesMax sets number of samples (per channel) subclass needs to be handed, at most or will be handed all available if 0.

If an exact number of samples is required, gst_audio_encoder_set_frame_samples_min() must be called with the same number.

Note: This value will be reset to 0 every time before AudioEncoderClass.set_format() is called.

The function takes the following parameters:

  • num: number of samples per frame.

func (*AudioEncoder) SetFrameSamplesMin

func (enc *AudioEncoder) SetFrameSamplesMin(num int)

SetFrameSamplesMin sets number of samples (per channel) subclass needs to be handed, at least or will be handed all available if 0.

If an exact number of samples is required, gst_audio_encoder_set_frame_samples_max() must be called with the same number.

Note: This value will be reset to 0 every time before AudioEncoderClass.set_format() is called.

The function takes the following parameters:

  • num: number of samples per frame.

func (*AudioEncoder) SetHardMin

func (enc *AudioEncoder) SetHardMin(enabled bool)

SetHardMin configures encoder hard minimum handling. If enabled, subclass will never be handed less samples than it configured, which otherwise might occur near end-of-data handling. Instead, the leftover samples will simply be discarded.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioEncoder) SetHardResync

func (enc *AudioEncoder) SetHardResync(enabled bool)

The function takes the following parameters:

func (*AudioEncoder) SetHeaders

func (enc *AudioEncoder) SetHeaders(headers []*gst.Buffer)

SetHeaders: set the codec headers to be sent downstream whenever requested.

The function takes the following parameters:

  • headers: list of Buffer containing the codec header.

func (*AudioEncoder) SetLatency

func (enc *AudioEncoder) SetLatency(min, max gst.ClockTime)

SetLatency sets encoder latency.

The function takes the following parameters:

  • min: minimum latency.
  • max: maximum latency.

func (*AudioEncoder) SetLookahead

func (enc *AudioEncoder) SetLookahead(num int)

SetLookahead sets encoder lookahead (in units of input rate samples)

Note: This value will be reset to 0 every time before AudioEncoderClass.set_format() is called.

The function takes the following parameters:

  • num: lookahead.

func (*AudioEncoder) SetMarkGranule

func (enc *AudioEncoder) SetMarkGranule(enabled bool)

SetMarkGranule: enable or disable encoder granule handling.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioEncoder) SetOutputFormat

func (enc *AudioEncoder) SetOutputFormat(caps *gst.Caps) bool

SetOutputFormat: configure output caps on the srcpad of enc.

The function takes the following parameters:

  • caps: Caps.

The function returns the following values:

  • ok: TRUE on success.

func (*AudioEncoder) SetPerfectTimestamp

func (enc *AudioEncoder) SetPerfectTimestamp(enabled bool)

SetPerfectTimestamp: enable or disable encoder perfect output timestamp preference.

MT safe.

The function takes the following parameters:

  • enabled: new state.

func (*AudioEncoder) SetTolerance

func (enc *AudioEncoder) SetTolerance(tolerance gst.ClockTime)

SetTolerance configures encoder audio jitter tolerance threshold.

MT safe.

The function takes the following parameters:

  • tolerance: new tolerance.

func (*AudioEncoder) Tolerance

func (enc *AudioEncoder) Tolerance() gst.ClockTime

Tolerance queries current audio jitter tolerance threshold.

The function returns the following values:

  • clockTime: encoder audio jitter tolerance threshold.

    MT safe.

type AudioEncoderClass

type AudioEncoderClass struct {
	// contains filtered or unexported fields
}

AudioEncoderClass subclasses can override any of the available virtual methods or not, as needed. At minimum set_format and handle_frame needs to be overridden.

An instance of this type is always passed by reference.

func (*AudioEncoderClass) ElementClass

func (a *AudioEncoderClass) ElementClass() *gst.ElementClass

ElementClass: parent class structure.

type AudioEncoderOverrides

type AudioEncoderOverrides struct {
	// The function returns the following values:
	//
	Close func() bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	DecideAllocation func(query *gst.Query) bool
	Flush            func()

	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	HandleFrame func(buffer *gst.Buffer) gst.FlowReturn
	// Negotiate with downstream elements to currently configured Caps. Unmark
	// GST_PAD_FLAG_NEED_RECONFIGURE in any case. But mark it again if negotiate
	// fails.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the negotiation succeeded, else FALSE.
	//
	Negotiate func() bool
	// The function returns the following values:
	//
	Open func() bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	ProposeAllocation func(query *gst.Query) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SetFormat func(info *AudioInfo) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SinkEvent func(event *gst.Event) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SinkQuery func(query *gst.Query) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SrcEvent func(event *gst.Event) bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	SrcQuery func(query *gst.Query) bool
	// The function returns the following values:
	//
	Start func() bool
	// The function returns the following values:
	//
	Stop func() bool
	// The function takes the following parameters:
	//
	//    - outbuf
	//    - meta
	//    - inbuf
	//
	// The function returns the following values:
	//
	TransformMeta func(outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool
	// contains filtered or unexported fields
}

AudioEncoderOverrides contains methods that are overridable.

type AudioEncoderer

type AudioEncoderer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AudioEncoderer describes types inherited from class AudioEncoder.

To get the original type, the caller must assert this to an interface or another type.

type AudioFilter

type AudioFilter struct {
	gstbase.BaseTransform
	// contains filtered or unexported fields
}

AudioFilter is a BaseTransform<!-- -->-derived base class for simple audio filters, ie. those that output the same format that they get as input.

AudioFilter will parse the input format for you (with error checking) before calling your setup function. Also, elements deriving from AudioFilter may use gst_audio_filter_class_add_pad_templates() from their class_init function to easily configure the set of caps/formats that the element is able to handle.

Derived classes should override the AudioFilterClass.setup() and BaseTransformClass.transform_ip() and/or BaseTransformClass.transform() virtual functions in their class_init function.

func BaseAudioFilter

func BaseAudioFilter(obj AudioFilterer) *AudioFilter

BaseAudioFilter returns the underlying base object.

type AudioFilterClass

type AudioFilterClass struct {
	// contains filtered or unexported fields
}

AudioFilterClass: in addition to the setup virtual function, you should also override the GstBaseTransform::transform and/or GstBaseTransform::transform_ip virtual function.

An instance of this type is always passed by reference.

func (*AudioFilterClass) AddPadTemplates

func (klass *AudioFilterClass) AddPadTemplates(allowedCaps *gst.Caps)

AddPadTemplates: convenience function to add pad templates to this element class, with allowed_caps as the caps that can be handled.

This function is usually used from within a GObject class_init function.

The function takes the following parameters:

  • allowedCaps: what formats the filter can handle, as Caps.

func (*AudioFilterClass) Basetransformclass

func (a *AudioFilterClass) Basetransformclass() *gstbase.BaseTransformClass

Basetransformclass: parent class.

type AudioFilterOverrides

type AudioFilterOverrides struct {
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Setup func(info *AudioInfo) bool
}

AudioFilterOverrides contains methods that are overridable.

type AudioFilterer

type AudioFilterer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AudioFilterer describes types inherited from class AudioFilter.

To get the original type, the caller must assert this to an interface or another type.

type AudioFlags

type AudioFlags C.guint

AudioFlags: extra audio flags.

const (
	// AudioFlagNone: no valid flag.
	AudioFlagNone AudioFlags = 0b0
	// AudioFlagUnpositioned: position array explicitly contains unpositioned
	// channels.
	AudioFlagUnpositioned AudioFlags = 0b1
)

func (AudioFlags) Has

func (a AudioFlags) Has(other AudioFlags) bool

Has returns true if a contains other.

func (AudioFlags) String

func (a AudioFlags) String() string

String returns the names in string for AudioFlags.

type AudioFormat

type AudioFormat C.gint

AudioFormat: enum value describing the most common audio formats.

const (
	// AudioFormatUnknown: unknown or unset audio format.
	AudioFormatUnknown AudioFormat = 0
	// AudioFormatEncoded: encoded audio format.
	AudioFormatEncoded AudioFormat = 1
	// AudioFormatS8: 8 bits in 8 bits, signed.
	AudioFormatS8 AudioFormat = 2
	// AudioFormatU8: 8 bits in 8 bits, unsigned.
	AudioFormatU8 AudioFormat = 3
	// AudioFormatS16LE: 16 bits in 16 bits, signed, little endian.
	AudioFormatS16LE AudioFormat = 4
	// AudioFormatS16Be: 16 bits in 16 bits, signed, big endian.
	AudioFormatS16Be AudioFormat = 5
	// AudioFormatU16LE: 16 bits in 16 bits, unsigned, little endian.
	AudioFormatU16LE AudioFormat = 6
	// AudioFormatU16Be: 16 bits in 16 bits, unsigned, big endian.
	AudioFormatU16Be AudioFormat = 7
	// AudioFormatS2432LE: 24 bits in 32 bits, signed, little endian.
	AudioFormatS2432LE AudioFormat = 8
	// AudioFormatS2432Be: 24 bits in 32 bits, signed, big endian.
	AudioFormatS2432Be AudioFormat = 9
	// AudioFormatU2432LE: 24 bits in 32 bits, unsigned, little endian.
	AudioFormatU2432LE AudioFormat = 10
	// AudioFormatU2432Be: 24 bits in 32 bits, unsigned, big endian.
	AudioFormatU2432Be AudioFormat = 11
	// AudioFormatS32LE: 32 bits in 32 bits, signed, little endian.
	AudioFormatS32LE AudioFormat = 12
	// AudioFormatS32Be: 32 bits in 32 bits, signed, big endian.
	AudioFormatS32Be AudioFormat = 13
	// AudioFormatU32LE: 32 bits in 32 bits, unsigned, little endian.
	AudioFormatU32LE AudioFormat = 14
	// AudioFormatU32Be: 32 bits in 32 bits, unsigned, big endian.
	AudioFormatU32Be AudioFormat = 15
	// AudioFormatS24LE: 24 bits in 24 bits, signed, little endian.
	AudioFormatS24LE AudioFormat = 16
	// AudioFormatS24Be: 24 bits in 24 bits, signed, big endian.
	AudioFormatS24Be AudioFormat = 17
	// AudioFormatU24LE: 24 bits in 24 bits, unsigned, little endian.
	AudioFormatU24LE AudioFormat = 18
	// AudioFormatU24Be: 24 bits in 24 bits, unsigned, big endian.
	AudioFormatU24Be AudioFormat = 19
	// AudioFormatS20LE: 20 bits in 24 bits, signed, little endian.
	AudioFormatS20LE AudioFormat = 20
	// AudioFormatS20Be: 20 bits in 24 bits, signed, big endian.
	AudioFormatS20Be AudioFormat = 21
	// AudioFormatU20LE: 20 bits in 24 bits, unsigned, little endian.
	AudioFormatU20LE AudioFormat = 22
	// AudioFormatU20Be: 20 bits in 24 bits, unsigned, big endian.
	AudioFormatU20Be AudioFormat = 23
	// AudioFormatS18LE: 18 bits in 24 bits, signed, little endian.
	AudioFormatS18LE AudioFormat = 24
	// AudioFormatS18Be: 18 bits in 24 bits, signed, big endian.
	AudioFormatS18Be AudioFormat = 25
	// AudioFormatU18LE: 18 bits in 24 bits, unsigned, little endian.
	AudioFormatU18LE AudioFormat = 26
	// AudioFormatU18Be: 18 bits in 24 bits, unsigned, big endian.
	AudioFormatU18Be AudioFormat = 27
	// AudioFormatF32LE: 32-bit floating point samples, little endian.
	AudioFormatF32LE AudioFormat = 28
	// AudioFormatF32Be: 32-bit floating point samples, big endian.
	AudioFormatF32Be AudioFormat = 29
	// AudioFormatF64LE: 64-bit floating point samples, little endian.
	AudioFormatF64LE AudioFormat = 30
	// AudioFormatF64Be: 64-bit floating point samples, big endian.
	AudioFormatF64Be AudioFormat = 31
	// AudioFormatS16: 16 bits in 16 bits, signed, native endianness.
	AudioFormatS16 AudioFormat = 4
	// AudioFormatU16: 16 bits in 16 bits, unsigned, native endianness.
	AudioFormatU16 AudioFormat = 6
	// AudioFormatS2432: 24 bits in 32 bits, signed, native endianness.
	AudioFormatS2432 AudioFormat = 8
	// AudioFormatU2432: 24 bits in 32 bits, unsigned, native endianness.
	AudioFormatU2432 AudioFormat = 10
	// AudioFormatS32: 32 bits in 32 bits, signed, native endianness.
	AudioFormatS32 AudioFormat = 12
	// AudioFormatU32: 32 bits in 32 bits, unsigned, native endianness.
	AudioFormatU32 AudioFormat = 14
	// AudioFormatS24: 24 bits in 24 bits, signed, native endianness.
	AudioFormatS24 AudioFormat = 16
	// AudioFormatU24: 24 bits in 24 bits, unsigned, native endianness.
	AudioFormatU24 AudioFormat = 18
	// AudioFormatS20: 20 bits in 24 bits, signed, native endianness.
	AudioFormatS20 AudioFormat = 20
	// AudioFormatU20: 20 bits in 24 bits, unsigned, native endianness.
	AudioFormatU20 AudioFormat = 22
	// AudioFormatS18: 18 bits in 24 bits, signed, native endianness.
	AudioFormatS18 AudioFormat = 24
	// AudioFormatU18: 18 bits in 24 bits, unsigned, native endianness.
	AudioFormatU18 AudioFormat = 26
	// AudioFormatF32: 32-bit floating point samples, native endianness.
	AudioFormatF32 AudioFormat = 28
	// AudioFormatF64: 64-bit floating point samples, native endianness.
	AudioFormatF64 AudioFormat = 30
)

func AudioFormatBuildInteger

func AudioFormatBuildInteger(sign bool, endianness, width, depth int) AudioFormat

AudioFormatBuildInteger: construct a AudioFormat with given parameters.

The function takes the following parameters:

  • sign: signed or unsigned format.
  • endianness: g_LITTLE_ENDIAN or G_BIG_ENDIAN.
  • width: amount of bits used per sample.
  • depth: amount of used bits in width.

The function returns the following values:

  • audioFormat or GST_AUDIO_FORMAT_UNKNOWN when no audio format exists with the given parameters.

func AudioFormatFromString

func AudioFormatFromString(format string) AudioFormat

AudioFormatFromString: convert the format string to its AudioFormat.

The function takes the following parameters:

  • format string.

The function returns the following values:

  • audioFormat for format or GST_AUDIO_FORMAT_UNKNOWN when the string is not a known format.

func AudioFormatsRaw

func AudioFormatsRaw() []AudioFormat

AudioFormatsRaw: return all the raw audio formats supported by GStreamer.

The function returns the following values:

  • audioFormats: array of AudioFormat.

func (AudioFormat) String

func (a AudioFormat) String() string

String returns the name in string for AudioFormat.

type AudioFormatFlags

type AudioFormatFlags C.guint

AudioFormatFlags: different audio flags that a format info can have.

const (
	// AudioFormatFlagInteger: integer samples.
	AudioFormatFlagInteger AudioFormatFlags = 0b1
	// AudioFormatFlagFloat: float samples.
	AudioFormatFlagFloat AudioFormatFlags = 0b10
	// AudioFormatFlagSigned: signed samples.
	AudioFormatFlagSigned AudioFormatFlags = 0b100
	// AudioFormatFlagComplex: complex layout.
	AudioFormatFlagComplex AudioFormatFlags = 0b10000
	// AudioFormatFlagUnpack: format can be used in AudioFormatUnpack and
	// AudioFormatPack functions.
	AudioFormatFlagUnpack AudioFormatFlags = 0b100000
)

func (AudioFormatFlags) Has

func (a AudioFormatFlags) Has(other AudioFormatFlags) bool

Has returns true if a contains other.

func (AudioFormatFlags) String

func (a AudioFormatFlags) String() string

String returns the names in string for AudioFormatFlags.

type AudioFormatInfo

type AudioFormatInfo struct {
	// contains filtered or unexported fields
}

AudioFormatInfo: information for an audio format.

An instance of this type is always passed by reference.

func AudioFormatGetInfo

func AudioFormatGetInfo(format AudioFormat) *AudioFormatInfo

AudioFormatGetInfo: get the AudioFormatInfo for format.

The function takes the following parameters:

  • format: AudioFormat.

The function returns the following values:

  • audioFormatInfo for format.

func (*AudioFormatInfo) FillSilence

func (info *AudioFormatInfo) FillSilence(dest []byte)

FillSilence: fill length bytes in dest with silence samples for info.

The function takes the following parameters:

  • dest: destination to fill.

type AudioInfo

type AudioInfo struct {
	// contains filtered or unexported fields
}

AudioInfo: information describing audio properties. This information can be filled in from GstCaps with gst_audio_info_from_caps().

Use the provided macros to access the info in this structure.

An instance of this type is always passed by reference.

func AudioInfoFromCaps

func AudioInfoFromCaps(caps *gst.Caps) (*AudioInfo, bool)

AudioInfoFromCaps: parse caps and update info.

The function takes the following parameters:

  • caps: Caps.

The function returns the following values:

  • info: AudioInfo.
  • ok: TRUE if caps could be parsed.

func AudioInfoInit

func AudioInfoInit() *AudioInfo

AudioInfoInit: initialize info with default values.

The function returns the following values:

  • info: AudioInfo.

func NewAudioInfo

func NewAudioInfo() *AudioInfo

NewAudioInfo constructs a struct AudioInfo.

func NewAudioInfoFromCaps

func NewAudioInfoFromCaps(caps *gst.Caps) *AudioInfo

NewAudioInfoFromCaps constructs a struct AudioInfo.

func (*AudioInfo) Bpf

func (a *AudioInfo) Bpf() int

Bpf: number of bytes for one frame, this is the size of one sample * channels.

func (*AudioInfo) Channels

func (a *AudioInfo) Channels() int

Channels: number of channels.

func (*AudioInfo) Convert

func (info *AudioInfo) Convert(srcFmt gst.Format, srcVal int64, destFmt gst.Format) (int64, bool)

Convert converts among various Format types. This function handles GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For raw audio, GST_FORMAT_DEFAULT corresponds to audio frames. This function can be used to handle pad queries of the type GST_QUERY_CONVERT.

The function takes the following parameters:

  • srcFmt of the src_val.
  • srcVal: value to convert.
  • destFmt of the dest_val.

The function returns the following values:

  • destVal: pointer to destination value.
  • ok: TRUE if the conversion was successful.

func (*AudioInfo) Copy

func (info *AudioInfo) Copy() *AudioInfo

Copy a GstAudioInfo structure.

The function returns the following values:

  • audioInfo: new AudioInfo. free with gst_audio_info_free.

func (*AudioInfo) Finfo

func (a *AudioInfo) Finfo() *AudioFormatInfo

Finfo: format info of the audio.

func (*AudioInfo) Flags

func (a *AudioInfo) Flags() AudioFlags

Flags: additional audio flags.

func (*AudioInfo) IsEqual

func (info *AudioInfo) IsEqual(other *AudioInfo) bool

IsEqual compares two AudioInfo and returns whether they are equal or not.

The function takes the following parameters:

  • other: AudioInfo.

The function returns the following values:

  • ok: TRUE if info and other are equal, else FALSE.

func (*AudioInfo) Layout

func (a *AudioInfo) Layout() AudioLayout

Layout: audio layout.

func (*AudioInfo) Position

func (a *AudioInfo) Position() [64]AudioChannelPosition

Position positions for each channel.

func (*AudioInfo) Rate

func (a *AudioInfo) Rate() int

Rate: audio sample rate.

func (*AudioInfo) SetBpf

func (a *AudioInfo) SetBpf(bpf int)

Bpf: number of bytes for one frame, this is the size of one sample * channels.

func (*AudioInfo) SetChannels

func (a *AudioInfo) SetChannels(channels int)

Channels: number of channels.

func (*AudioInfo) SetFormat

func (info *AudioInfo) SetFormat(format AudioFormat, rate int, channels int, position [64]AudioChannelPosition)

SetFormat: set the default info for the audio info of format and rate and channels.

Note: This initializes info first, no values are preserved.

The function takes the following parameters:

  • format: format.
  • rate: samplerate.
  • channels: number of channels.
  • position (optional): channel positions.

func (*AudioInfo) SetRate

func (a *AudioInfo) SetRate(rate int)

Rate: audio sample rate.

func (*AudioInfo) ToCaps

func (info *AudioInfo) ToCaps() *gst.Caps

ToCaps: convert the values of info into a Caps.

The function returns the following values:

  • caps: new Caps containing the info of info.

type AudioLayout

type AudioLayout C.gint

AudioLayout: layout of the audio samples for the different channels.

const (
	// AudioLayoutInterleaved: interleaved audio.
	AudioLayoutInterleaved AudioLayout = iota
	// AudioLayoutNonInterleaved: non-interleaved audio.
	AudioLayoutNonInterleaved
)

func (AudioLayout) String

func (a AudioLayout) String() string

String returns the name in string for AudioLayout.

type AudioLevelMeta

type AudioLevelMeta struct {
	// contains filtered or unexported fields
}

AudioLevelMeta: meta containing Audio Level Indication: https://tools.ietf.org/html/rfc6464

An instance of this type is always passed by reference.

func BufferAddAudioLevelMeta

func BufferAddAudioLevelMeta(buffer *gst.Buffer, level byte, voiceActivity bool) *AudioLevelMeta

BufferAddAudioLevelMeta attaches audio level information to buffer. (RFC 6464).

The function takes the following parameters:

  • buffer: Buffer.
  • level: -dBov from 0-127 (127 is silence).
  • voiceActivity: whether the buffer contains voice activity.

The function returns the following values:

  • audioLevelMeta (optional) on buffer.

func BufferGetAudioLevelMeta

func BufferGetAudioLevelMeta(buffer *gst.Buffer) *AudioLevelMeta

BufferGetAudioLevelMeta: find the AudioLevelMeta on buffer.

The function takes the following parameters:

  • buffer: Buffer.

The function returns the following values:

  • audioLevelMeta (optional) or NULL when there is no such metadata on buffer.

func (*AudioLevelMeta) Level

func (a *AudioLevelMeta) Level() byte

Level: -dBov from 0-127 (127 is silence).

func (*AudioLevelMeta) Meta

func (a *AudioLevelMeta) Meta() *gst.Meta

Meta: parent Meta.

func (*AudioLevelMeta) SetLevel

func (a *AudioLevelMeta) SetLevel(level byte)

Level: -dBov from 0-127 (127 is silence).

func (*AudioLevelMeta) SetVoiceActivity

func (a *AudioLevelMeta) SetVoiceActivity(voiceActivity bool)

VoiceActivity: whether the buffer contains voice activity.

func (*AudioLevelMeta) VoiceActivity

func (a *AudioLevelMeta) VoiceActivity() bool

VoiceActivity: whether the buffer contains voice activity.

type AudioMeta

type AudioMeta struct {
	// contains filtered or unexported fields
}

AudioMeta defines an audio downmix matrix to be send along with audio buffers. These functions in this module help to create and attach the meta as well as extracting it.

An instance of this type is always passed by reference.

func BufferAddAudioMeta

func BufferAddAudioMeta(buffer *gst.Buffer, info *AudioInfo, samples uint, offsets *uint) *AudioMeta

BufferAddAudioMeta allocates and attaches a AudioMeta on buffer, which must be writable for that purpose. The fields of the AudioMeta are directly populated from the arguments of this function.

When info->layout is GST_AUDIO_LAYOUT_NON_INTERLEAVED and offsets is NULL, the offsets are calculated with a formula that assumes the planes are tightly packed and in sequence: offsets[channel] = channel * samples * sample_stride

It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range [offsets[i], offsets[i] + samples * sample_stride) must not overlap with any other such range. This function will assert if the parameters specified cause this restriction to be violated.

It is, obviously, also not allowed to specify parameters that would cause out-of-bounds memory access on buffer. This is also checked, which means that you must add enough memory on the buffer before adding this meta.

The function takes the following parameters:

  • buffer: Buffer.
  • info: audio properties of the buffer.
  • samples: number of valid samples in the buffer.
  • offsets (optional) (in bytes) where each channel plane starts in the buffer or NULL to calculate it (see below); must be NULL also when info->layout is GST_AUDIO_LAYOUT_INTERLEAVED.

The function returns the following values:

  • audioMeta that was attached on the buffer.

func (*AudioMeta) Info

func (a *AudioMeta) Info() *AudioInfo

Info: audio properties of the buffer.

func (*AudioMeta) Meta

func (a *AudioMeta) Meta() *gst.Meta

Meta: parent Meta.

func (*AudioMeta) Offsets

func (a *AudioMeta) Offsets() *uint

Offsets offsets (in bytes) where each channel plane starts in the buffer or NULL if the buffer has interleaved layout; if not NULL, this is guaranteed to be an array of info.channels elements.

func (*AudioMeta) Samples

func (a *AudioMeta) Samples() uint

Samples: number of valid samples in the buffer.

func (*AudioMeta) SetSamples

func (a *AudioMeta) SetSamples(samples uint)

Samples: number of valid samples in the buffer.

type AudioNoiseShapingMethod

type AudioNoiseShapingMethod C.gint

AudioNoiseShapingMethod: set of available noise shaping methods.

const (
	// AudioNoiseShapingNone: no noise shaping (default).
	AudioNoiseShapingNone AudioNoiseShapingMethod = iota
	// AudioNoiseShapingErrorFeedback: error feedback.
	AudioNoiseShapingErrorFeedback
	// AudioNoiseShapingSimple: simple 2-pole noise shaping.
	AudioNoiseShapingSimple
	// AudioNoiseShapingMedium: medium 5-pole noise shaping.
	AudioNoiseShapingMedium
	// AudioNoiseShapingHigh: high 8-pole noise shaping.
	AudioNoiseShapingHigh
)

func (AudioNoiseShapingMethod) String

func (a AudioNoiseShapingMethod) String() string

String returns the name in string for AudioNoiseShapingMethod.

type AudioPackFlags

type AudioPackFlags C.guint

AudioPackFlags: different flags that can be used when packing and unpacking.

const (
	// AudioPackFlagNone: no flag.
	AudioPackFlagNone AudioPackFlags = 0b0
	// AudioPackFlagTruncateRange: when the source has a smaller depth than the
	// target format, set the least significant bits of the target to 0. This is
	// likely slightly faster but less accurate. When this flag is not
	// specified, the most significant bits of the source are duplicated in the
	// least significant bits of the destination.
	AudioPackFlagTruncateRange AudioPackFlags = 0b1
)

func (AudioPackFlags) Has

func (a AudioPackFlags) Has(other AudioPackFlags) bool

Has returns true if a contains other.

func (AudioPackFlags) String

func (a AudioPackFlags) String() string

String returns the names in string for AudioPackFlags.

type AudioQuantizeFlags

type AudioQuantizeFlags C.guint

AudioQuantizeFlags: extra flags that can be passed to gst_audio_quantize_new().

const (
	// AudioQuantizeFlagNone: no flags.
	AudioQuantizeFlagNone AudioQuantizeFlags = 0b0
	// AudioQuantizeFlagNonInterleaved samples are non-interleaved.
	AudioQuantizeFlagNonInterleaved AudioQuantizeFlags = 0b1
)

func (AudioQuantizeFlags) Has

Has returns true if a contains other.

func (AudioQuantizeFlags) String

func (a AudioQuantizeFlags) String() string

String returns the names in string for AudioQuantizeFlags.

type AudioResamplerFilterInterpolation

type AudioResamplerFilterInterpolation C.gint

AudioResamplerFilterInterpolation: different filter interpolation methods.

const (
	// AudioResamplerFilterInterpolationNone: no interpolation.
	AudioResamplerFilterInterpolationNone AudioResamplerFilterInterpolation = iota
	// AudioResamplerFilterInterpolationLinear: linear interpolation of the
	// filter coefficients.
	AudioResamplerFilterInterpolationLinear
	// AudioResamplerFilterInterpolationCubic: cubic interpolation of the filter
	// coefficients.
	AudioResamplerFilterInterpolationCubic
)

func (AudioResamplerFilterInterpolation) String

String returns the name in string for AudioResamplerFilterInterpolation.

type AudioResamplerFilterMode

type AudioResamplerFilterMode C.gint

AudioResamplerFilterMode: select for the filter tables should be set up.

const (
	// AudioResamplerFilterModeInterpolated: use interpolated filter tables.
	// This uses less memory but more CPU and is slightly less accurate but it
	// allows for more efficient variable rate resampling with
	// gst_audio_resampler_update().
	AudioResamplerFilterModeInterpolated AudioResamplerFilterMode = iota
	// AudioResamplerFilterModeFull: use full filter table. This uses more
	// memory but less CPU.
	AudioResamplerFilterModeFull
	// AudioResamplerFilterModeAuto: automatically choose between interpolated
	// and full filter tables.
	AudioResamplerFilterModeAuto
)

func (AudioResamplerFilterMode) String

func (a AudioResamplerFilterMode) String() string

String returns the name in string for AudioResamplerFilterMode.

type AudioResamplerFlags

type AudioResamplerFlags C.guint

AudioResamplerFlags: different resampler flags.

const (
	// AudioResamplerFlagNone: no flags.
	AudioResamplerFlagNone AudioResamplerFlags = 0b0
	// AudioResamplerFlagNonInterleavedIn: input samples are non-interleaved. an
	// array of blocks of samples, one for each channel, should be passed to the
	// resample function.
	AudioResamplerFlagNonInterleavedIn AudioResamplerFlags = 0b1
	// AudioResamplerFlagNonInterleavedOut: output samples are non-interleaved.
	// an array of blocks of samples, one for each channel, should be passed to
	// the resample function.
	AudioResamplerFlagNonInterleavedOut AudioResamplerFlags = 0b10
	// AudioResamplerFlagVariableRate: optimize for dynamic updates of the
	// sample rates with gst_audio_resampler_update(). This will select an
	// interpolating filter when T_AUDIO_RESAMPLER_FILTER_MODE_AUTO is
	// configured.
	AudioResamplerFlagVariableRate AudioResamplerFlags = 0b100
)

func (AudioResamplerFlags) Has

Has returns true if a contains other.

func (AudioResamplerFlags) String

func (a AudioResamplerFlags) String() string

String returns the names in string for AudioResamplerFlags.

type AudioResamplerMethod

type AudioResamplerMethod C.gint

AudioResamplerMethod: different subsampling and upsampling methods.

const (
	// AudioResamplerMethodNearest duplicates the samples when upsampling and
	// drops when downsampling.
	AudioResamplerMethodNearest AudioResamplerMethod = iota
	// AudioResamplerMethodLinear uses linear interpolation to reconstruct
	// missing samples and averaging to downsample.
	AudioResamplerMethodLinear
	// AudioResamplerMethodCubic uses cubic interpolation.
	AudioResamplerMethodCubic
	// AudioResamplerMethodBlackmanNuttall uses Blackman-Nuttall windowed sinc
	// interpolation.
	AudioResamplerMethodBlackmanNuttall
	// AudioResamplerMethodKaiser uses Kaiser windowed sinc interpolation.
	AudioResamplerMethodKaiser
)

func (AudioResamplerMethod) String

func (a AudioResamplerMethod) String() string

String returns the name in string for AudioResamplerMethod.

type AudioRingBuffer

type AudioRingBuffer struct {
	gst.GstObject
	// contains filtered or unexported fields
}

AudioRingBuffer: this object is the base class for audio ringbuffers used by the base audio source and sink classes.

The ringbuffer abstracts a circular buffer of data. One reader and one writer can operate on the data from different threads in a lockfree manner. The base class is sufficiently flexible to be used as an abstraction for DMA based ringbuffers as well as a pure software implementations.

func BaseAudioRingBuffer

func BaseAudioRingBuffer(obj AudioRingBufferer) *AudioRingBuffer

BaseAudioRingBuffer returns the underlying base object.

func (*AudioRingBuffer) Acquire

func (buf *AudioRingBuffer) Acquire(spec *AudioRingBufferSpec) bool

Acquire: allocate the resources for the ringbuffer. This function fills in the data pointer of the ring buffer with a valid Buffer to which samples can be written.

The function takes the following parameters:

  • spec specs of the buffer.

The function returns the following values:

  • ok: TRUE if the device could be acquired, FALSE on error.

    MT safe.

func (*AudioRingBuffer) Activate

func (buf *AudioRingBuffer) Activate(active bool) bool

Activate buf to start or stop pulling data.

MT safe.

The function takes the following parameters:

  • active: new mode.

The function returns the following values:

  • ok: TRUE if the device could be activated in the requested mode, FALSE on error.

func (*AudioRingBuffer) Advance

func (buf *AudioRingBuffer) Advance(advance uint)

Advance subclasses should call this function to notify the fact that advance segments are now processed by the device.

MT safe.

The function takes the following parameters:

  • advance: number of segments written.

func (*AudioRingBuffer) Clear

func (buf *AudioRingBuffer) Clear(segment int)

Clear the given segment of the buffer with silence samples. This function is used by subclasses.

MT safe.

The function takes the following parameters:

  • segment to clear.

func (*AudioRingBuffer) ClearAll

func (buf *AudioRingBuffer) ClearAll()

ClearAll: clear all samples from the ringbuffer.

MT safe.

func (*AudioRingBuffer) CloseDevice

func (buf *AudioRingBuffer) CloseDevice() bool

CloseDevice: close the audio device associated with the ring buffer. The ring buffer should already have been released via gst_audio_ring_buffer_release().

The function returns the following values:

  • ok: TRUE if the device could be closed, FALSE on error.

    MT safe.

func (*AudioRingBuffer) Convert

func (buf *AudioRingBuffer) Convert(srcFmt gst.Format, srcVal int64, destFmt gst.Format) (int64, bool)

Convert src_val in src_fmt to the equivalent value in dest_fmt. The result will be put in dest_val.

The function takes the following parameters:

  • srcFmt: source format.
  • srcVal: source value.
  • destFmt: destination format.

The function returns the following values:

  • destVal: location to store the converted value.
  • ok: TRUE if the conversion succeeded.

func (*AudioRingBuffer) Delay

func (buf *AudioRingBuffer) Delay() uint

Delay: get the number of samples queued in the audio device. This is usually less than the segment size but can be bigger when the implementation uses another internal buffer between the audio device.

For playback ringbuffers this is the amount of samples transferred from the ringbuffer to the device but still not played.

For capture ringbuffers this is the amount of samples in the device that are not yet transferred to the ringbuffer.

The function returns the following values:

  • guint: number of samples queued in the audio device.

    MT safe.

func (*AudioRingBuffer) DeviceIsOpen

func (buf *AudioRingBuffer) DeviceIsOpen() bool

DeviceIsOpen checks the status of the device associated with the ring buffer.

The function returns the following values:

  • ok: TRUE if the device was open, FALSE if it was closed.

    MT safe.

func (*AudioRingBuffer) IsAcquired

func (buf *AudioRingBuffer) IsAcquired() bool

IsAcquired: check if the ringbuffer is acquired and ready to use.

The function returns the following values:

  • ok: TRUE if the ringbuffer is acquired, FALSE on error.

    MT safe.

func (*AudioRingBuffer) IsActive

func (buf *AudioRingBuffer) IsActive() bool

IsActive: check if buf is activated.

MT safe.

The function returns the following values:

  • ok: TRUE if the device is active.

func (*AudioRingBuffer) IsFlushing

func (buf *AudioRingBuffer) IsFlushing() bool

IsFlushing: check if buf is flushing.

MT safe.

The function returns the following values:

  • ok: TRUE if the device is flushing.

func (*AudioRingBuffer) MayStart

func (buf *AudioRingBuffer) MayStart(allowed bool)

MayStart: tell the ringbuffer that it is allowed to start playback when the ringbuffer is filled with samples.

MT safe.

The function takes the following parameters:

  • allowed: new value.

func (*AudioRingBuffer) OpenDevice

func (buf *AudioRingBuffer) OpenDevice() bool

OpenDevice: open the audio device associated with the ring buffer. Does not perform any setup on the device. You must open the device before acquiring the ring buffer.

The function returns the following values:

  • ok: TRUE if the device could be opened, FALSE on error.

    MT safe.

func (*AudioRingBuffer) Pause

func (buf *AudioRingBuffer) Pause() bool

Pause processing samples from the ringbuffer.

The function returns the following values:

  • ok: TRUE if the device could be paused, FALSE on error.

    MT safe.

func (*AudioRingBuffer) PrepareRead

func (buf *AudioRingBuffer) PrepareRead() (int, []byte, bool)

PrepareRead returns a pointer to memory where the data from segment segment can be found. This function is mostly used by subclasses.

The function returns the following values:

  • segment to read.

  • readptr: the pointer to the memory where samples can be read.

  • ok: FALSE if the buffer is not started.

    MT safe.

func (*AudioRingBuffer) Read

func (buf *AudioRingBuffer) Read(sample uint64, data []byte) (gst.ClockTime, uint)

Read len samples from the ringbuffer into the memory pointed to by data. The first sample should be read from position sample in the ringbuffer.

len should not be a multiple of the segment size of the ringbuffer although it is recommended.

timestamp will return the timestamp associated with the data returned.

The function takes the following parameters:

  • sample position of the data.
  • data: where the data should be read.

The function returns the following values:

  • timestamp: where the timestamp is returned.

  • guint: number of samples read from the ringbuffer or -1 on error.

    MT safe.

func (*AudioRingBuffer) Release

func (buf *AudioRingBuffer) Release() bool

Release: free the resources of the ringbuffer.

The function returns the following values:

  • ok: TRUE if the device could be released, FALSE on error.

    MT safe.

func (*AudioRingBuffer) SamplesDone

func (buf *AudioRingBuffer) SamplesDone() uint64

SamplesDone: get the number of samples that were processed by the ringbuffer since it was last started. This does not include the number of samples not yet processed (see gst_audio_ring_buffer_delay()).

The function returns the following values:

  • guint64: number of samples processed by the ringbuffer.

    MT safe.

func (*AudioRingBuffer) SetCallback

func (buf *AudioRingBuffer) SetCallback(cb AudioRingBufferCallback)

SetCallback sets the given callback function on the buffer. This function will be called every time a segment has been written to a device.

MT safe.

The function takes the following parameters:

  • cb (optional): callback to set.

func (*AudioRingBuffer) SetFlushing

func (buf *AudioRingBuffer) SetFlushing(flushing bool)

SetFlushing: set the ringbuffer to flushing mode or normal mode.

MT safe.

The function takes the following parameters:

  • flushing: new mode.

func (*AudioRingBuffer) SetSample

func (buf *AudioRingBuffer) SetSample(sample uint64)

SetSample: make sure that the next sample written to the device is accounted for as being the sample sample written to the device. This value will be used in reporting the current sample position of the ringbuffer.

This function will also clear the buffer with silence.

MT safe.

The function takes the following parameters:

  • sample number to set.

func (*AudioRingBuffer) SetTimestamp

func (buf *AudioRingBuffer) SetTimestamp(readseg int, timestamp gst.ClockTime)

The function takes the following parameters:

  • readseg
  • timestamp

func (*AudioRingBuffer) Start

func (buf *AudioRingBuffer) Start() bool

Start processing samples from the ringbuffer.

The function returns the following values:

  • ok: TRUE if the device could be started, FALSE on error.

    MT safe.

func (*AudioRingBuffer) Stop

func (buf *AudioRingBuffer) Stop() bool

Stop processing samples from the ringbuffer.

The function returns the following values:

  • ok: TRUE if the device could be stopped, FALSE on error.

    MT safe.

type AudioRingBufferCallback

type AudioRingBufferCallback func(rbuf AudioRingBufferer, data []byte)

AudioRingBufferCallback: this function is set with gst_audio_ring_buffer_set_callback() and is called to fill the memory at data with len bytes of samples.

type AudioRingBufferClass

type AudioRingBufferClass struct {
	// contains filtered or unexported fields
}

AudioRingBufferClass vmethods that subclasses can override to implement the ringbuffer.

An instance of this type is always passed by reference.

func (*AudioRingBufferClass) ParentClass

func (a *AudioRingBufferClass) ParentClass() *gst.ObjectClass

ParentClass: parent class.

type AudioRingBufferFormatType

type AudioRingBufferFormatType C.gint

AudioRingBufferFormatType: format of the samples in the ringbuffer.

const (
	// AudioRingBufferFormatTypeRaw samples in linear or float.
	AudioRingBufferFormatTypeRaw AudioRingBufferFormatType = iota
	// AudioRingBufferFormatTypeMuLaw samples in mulaw.
	AudioRingBufferFormatTypeMuLaw
	// AudioRingBufferFormatTypeALaw samples in alaw.
	AudioRingBufferFormatTypeALaw
	// AudioRingBufferFormatTypeImaAdpcm samples in ima adpcm.
	AudioRingBufferFormatTypeImaAdpcm
	// AudioRingBufferFormatTypeMpeg samples in mpeg audio (but not AAC) format.
	AudioRingBufferFormatTypeMpeg
	// AudioRingBufferFormatTypeGsm samples in gsm format.
	AudioRingBufferFormatTypeGsm
	// AudioRingBufferFormatTypeIec958 samples in IEC958 frames (e.g. AC3).
	AudioRingBufferFormatTypeIec958
	// AudioRingBufferFormatTypeAc3 samples in AC3 format.
	AudioRingBufferFormatTypeAc3
	// AudioRingBufferFormatTypeEac3 samples in EAC3 format.
	AudioRingBufferFormatTypeEac3
	// AudioRingBufferFormatTypeDts samples in DTS format.
	AudioRingBufferFormatTypeDts
	// AudioRingBufferFormatTypeMpeg2Aac samples in MPEG-2 AAC ADTS format.
	AudioRingBufferFormatTypeMpeg2Aac
	// AudioRingBufferFormatTypeMpeg4Aac samples in MPEG-4 AAC ADTS format.
	AudioRingBufferFormatTypeMpeg4Aac
	// AudioRingBufferFormatTypeMpeg2AacRaw samples in MPEG-2 AAC raw format
	// (Since: 1.12).
	AudioRingBufferFormatTypeMpeg2AacRaw
	// AudioRingBufferFormatTypeMpeg4AacRaw samples in MPEG-4 AAC raw format
	// (Since: 1.12).
	AudioRingBufferFormatTypeMpeg4AacRaw
	// AudioRingBufferFormatTypeFlac samples in FLAC format (Since: 1.12).
	AudioRingBufferFormatTypeFlac
)

func (AudioRingBufferFormatType) String

func (a AudioRingBufferFormatType) String() string

String returns the name in string for AudioRingBufferFormatType.

type AudioRingBufferOverrides

type AudioRingBufferOverrides struct {
	// Acquire: allocate the resources for the ringbuffer. This function fills
	// in the data pointer of the ring buffer with a valid Buffer to which
	// samples can be written.
	//
	// The function takes the following parameters:
	//
	//    - spec specs of the buffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be acquired, FALSE on error.
	//
	//      MT safe.
	//
	Acquire func(spec *AudioRingBufferSpec) bool
	// Activate buf to start or stop pulling data.
	//
	// MT safe.
	//
	// The function takes the following parameters:
	//
	//    - active: new mode.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be activated in the requested mode,
	//      FALSE on error.
	//
	Activate func(active bool) bool
	// ClearAll: clear all samples from the ringbuffer.
	//
	// MT safe.
	ClearAll func()
	// CloseDevice: close the audio device associated with the ring buffer. The
	// ring buffer should already have been released via
	// gst_audio_ring_buffer_release().
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be closed, FALSE on error.
	//
	//      MT safe.
	//
	CloseDevice func() bool
	// Delay: get the number of samples queued in the audio device. This is
	// usually less than the segment size but can be bigger when the
	// implementation uses another internal buffer between the audio device.
	//
	// For playback ringbuffers this is the amount of samples transferred from
	// the ringbuffer to the device but still not played.
	//
	// For capture ringbuffers this is the amount of samples in the device that
	// are not yet transferred to the ringbuffer.
	//
	// The function returns the following values:
	//
	//    - guint: number of samples queued in the audio device.
	//
	//      MT safe.
	//
	Delay func() uint
	// OpenDevice: open the audio device associated with the ring buffer. Does
	// not perform any setup on the device. You must open the device before
	// acquiring the ring buffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be opened, FALSE on error.
	//
	//      MT safe.
	//
	OpenDevice func() bool
	// Pause processing samples from the ringbuffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be paused, FALSE on error.
	//
	//      MT safe.
	//
	Pause func() bool
	// Release: free the resources of the ringbuffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be released, FALSE on error.
	//
	//      MT safe.
	//
	Release func() bool
	// The function returns the following values:
	//
	Resume func() bool
	// Start processing samples from the ringbuffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be started, FALSE on error.
	//
	//      MT safe.
	//
	Start func() bool
	// Stop processing samples from the ringbuffer.
	//
	// The function returns the following values:
	//
	//    - ok: TRUE if the device could be stopped, FALSE on error.
	//
	//      MT safe.
	//
	Stop func() bool
}

AudioRingBufferOverrides contains methods that are overridable.

type AudioRingBufferSpec

type AudioRingBufferSpec struct {
	// contains filtered or unexported fields
}

AudioRingBufferSpec: structure containing the format specification of the ringbuffer.

An instance of this type is always passed by reference.

func (*AudioRingBufferSpec) BufferTime

func (a *AudioRingBufferSpec) BufferTime() uint64

BufferTime: total buffer size in microseconds.

func (*AudioRingBufferSpec) Caps

func (a *AudioRingBufferSpec) Caps() *gst.Caps

Caps caps that generated the Spec.

func (*AudioRingBufferSpec) Info

func (a *AudioRingBufferSpec) Info() *AudioInfo

Info: AudioInfo.

func (*AudioRingBufferSpec) LatencyTime

func (a *AudioRingBufferSpec) LatencyTime() uint64

LatencyTime: latency in microseconds.

func (*AudioRingBufferSpec) Seglatency

func (a *AudioRingBufferSpec) Seglatency() int

Seglatency: number of segments queued in the lower level device, defaults to segtotal.

func (*AudioRingBufferSpec) Segsize

func (a *AudioRingBufferSpec) Segsize() int

Segsize: size of one segment in bytes.

func (*AudioRingBufferSpec) Segtotal

func (a *AudioRingBufferSpec) Segtotal() int

Segtotal: total number of segments.

func (*AudioRingBufferSpec) SetBufferTime

func (a *AudioRingBufferSpec) SetBufferTime(bufferTime uint64)

BufferTime: total buffer size in microseconds.

func (*AudioRingBufferSpec) SetLatencyTime

func (a *AudioRingBufferSpec) SetLatencyTime(latencyTime uint64)

LatencyTime: latency in microseconds.

func (*AudioRingBufferSpec) SetSeglatency

func (a *AudioRingBufferSpec) SetSeglatency(seglatency int)

Seglatency: number of segments queued in the lower level device, defaults to segtotal.

func (*AudioRingBufferSpec) SetSegsize

func (a *AudioRingBufferSpec) SetSegsize(segsize int)

Segsize: size of one segment in bytes.

func (*AudioRingBufferSpec) SetSegtotal

func (a *AudioRingBufferSpec) SetSegtotal(segtotal int)

Segtotal: total number of segments.

func (*AudioRingBufferSpec) Type

Type: sample type.

type AudioRingBufferState

type AudioRingBufferState C.gint

AudioRingBufferState: state of the ringbuffer.

const (
	// AudioRingBufferStateStopped: ringbuffer is stopped.
	AudioRingBufferStateStopped AudioRingBufferState = iota
	// AudioRingBufferStatePaused: ringbuffer is paused.
	AudioRingBufferStatePaused
	// AudioRingBufferStateStarted: ringbuffer is started.
	AudioRingBufferStateStarted
	// AudioRingBufferStateError: ringbuffer has encountered an error after it
	// has been started, e.g. because the device was disconnected (Since: 1.2).
	AudioRingBufferStateError
)

func (AudioRingBufferState) String

func (a AudioRingBufferState) String() string

String returns the name in string for AudioRingBufferState.

type AudioRingBufferer

type AudioRingBufferer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

AudioRingBufferer describes types inherited from class AudioRingBuffer.

To get the original type, the caller must assert this to an interface or another type.

type AudioSink

type AudioSink struct {
	AudioBaseSink
	// contains filtered or unexported fields
}

AudioSink: this is the most simple base class for audio sinks that only requires subclasses to implement a set of simple functions:

* open() :Open the device.

* prepare() :Configure the device with the specified format.

* write() :Write samples to the device.

* reset() :Unblock writes and flush the device.

* delay() :Get the number of samples written but not yet played by the device.

* unprepare() :Undo operations done by prepare.

* close() :Close the device.

All scheduling of samples and timestamps is done in this base class together with AudioBaseSink using a default implementation of a AudioRingBuffer that uses threads.

type AudioSinkClass

type AudioSinkClass struct {
	// contains filtered or unexported fields
}

AudioSinkClass: instance of this type is always passed by reference.

func (*AudioSinkClass) Extension

func (a *AudioSinkClass) Extension() *AudioSinkClassExtension

Extension class extension structure. Since: 1.18.

func (*AudioSinkClass) ParentClass

func (a *AudioSinkClass) ParentClass() *AudioBaseSinkClass

ParentClass: parent class structure.

type AudioSinkClassExtension

type AudioSinkClassExtension struct {
	// contains filtered or unexported fields
}

AudioSinkClassExtension: instance of this type is always passed by reference.

type AudioSinkOverrides

type AudioSinkOverrides struct {
	// The function returns the following values:
	//
	Close func() bool
	// The function returns the following values:
	//
	Delay func() uint
	// The function returns the following values:
	//
	Open  func() bool
	Pause func()
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Prepare func(spec *AudioRingBufferSpec) bool
	Reset   func()
	Resume  func()
	Stop    func()
	// The function returns the following values:
	//
	Unprepare func() bool
	// The function takes the following parameters:
	//
	//    - data (optional)
	//    - length
	//
	// The function returns the following values:
	//
	Write func(data unsafe.Pointer, length uint) int
}

AudioSinkOverrides contains methods that are overridable.

type AudioSrc

type AudioSrc struct {
	AudioBaseSrc
	// contains filtered or unexported fields
}

AudioSrc: this is the most simple base class for audio sources that only requires subclasses to implement a set of simple functions:

* open() :Open the device. * prepare() :Configure the device with the specified format. * read() :Read samples from the device. * reset() :Unblock reads and flush the device. * delay() :Get the number of samples in the device but not yet read. * unprepare() :Undo operations done by prepare. * close() :Close the device.

All scheduling of samples and timestamps is done in this base class together with AudioBaseSrc using a default implementation of a AudioRingBuffer that uses threads.

type AudioSrcClass

type AudioSrcClass struct {
	// contains filtered or unexported fields
}

AudioSrcClass class. Override the vmethod to implement functionality.

An instance of this type is always passed by reference.

func (*AudioSrcClass) ParentClass

func (a *AudioSrcClass) ParentClass() *AudioBaseSrcClass

ParentClass: parent class.

type AudioSrcOverrides

type AudioSrcOverrides struct {
	// The function returns the following values:
	//
	Close func() bool
	// The function returns the following values:
	//
	Delay func() uint
	// The function returns the following values:
	//
	Open func() bool
	// The function takes the following parameters:
	//
	// The function returns the following values:
	//
	Prepare func(spec *AudioRingBufferSpec) bool
	// The function takes the following parameters:
	//
	//    - data (optional)
	//    - length
	//    - timestamp
	//
	// The function returns the following values:
	//
	Read  func(data unsafe.Pointer, length uint, timestamp *gst.ClockTime) uint
	Reset func()
	// The function returns the following values:
	//
	Unprepare func() bool
}

AudioSrcOverrides contains methods that are overridable.

type AudioStreamAlign

type AudioStreamAlign struct {
	// contains filtered or unexported fields
}

AudioStreamAlign provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible.

See gst_audio_stream_align_new() for a description of its parameters and gst_audio_stream_align_process() for the details of the processing.

An instance of this type is always passed by reference.

func NewAudioStreamAlign

func NewAudioStreamAlign(rate int, alignmentThreshold gst.ClockTime, discontWait gst.ClockTime) *AudioStreamAlign

NewAudioStreamAlign constructs a struct AudioStreamAlign.

func (*AudioStreamAlign) AlignmentThreshold

func (align *AudioStreamAlign) AlignmentThreshold() gst.ClockTime

AlignmentThreshold gets the currently configured alignment threshold.

The function returns the following values:

  • clockTime: currently configured alignment threshold.

func (*AudioStreamAlign) Copy

func (align *AudioStreamAlign) Copy() *AudioStreamAlign

Copy a GstAudioStreamAlign structure.

The function returns the following values:

  • audioStreamAlign: new AudioStreamAlign. free with gst_audio_stream_align_free.

func (*AudioStreamAlign) DiscontWait

func (align *AudioStreamAlign) DiscontWait() gst.ClockTime

DiscontWait gets the currently configured discont wait.

The function returns the following values:

  • clockTime: currently configured discont wait.

func (*AudioStreamAlign) MarkDiscont

func (align *AudioStreamAlign) MarkDiscont()

MarkDiscont marks the next buffer as discontinuous and resets timestamp tracking.

func (*AudioStreamAlign) Process

func (align *AudioStreamAlign) Process(discont bool, timestamp gst.ClockTime, nSamples uint) (outTimestamp gst.ClockTime, outDuration gst.ClockTime, outSamplePosition uint64, ok bool)

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

The function takes the following parameters:

  • discont: if this data is considered to be discontinuous.
  • timestamp of the start of the data.
  • nSamples: number of samples to process.

The function returns the following values:

  • outTimestamp: output timestamp of the data.
  • outDuration: output duration of the data.
  • outSamplePosition: output sample position of the start of the data.
  • ok: TRUE if a discontinuity was detected, FALSE otherwise.

func (*AudioStreamAlign) Rate

func (align *AudioStreamAlign) Rate() int

Rate gets the currently configured sample rate.

The function returns the following values:

  • gint: currently configured sample rate.

func (*AudioStreamAlign) SamplesSinceDiscont

func (align *AudioStreamAlign) SamplesSinceDiscont() uint64

SamplesSinceDiscont returns the number of samples that were processed since the last discontinuity was detected.

The function returns the following values:

  • guint64: number of samples processed since the last discontinuity.

func (*AudioStreamAlign) SetAlignmentThreshold

func (align *AudioStreamAlign) SetAlignmentThreshold(alignmentThreshold gst.ClockTime)

SetAlignmentThreshold sets alignment_treshold as new alignment threshold for the following processing.

The function takes the following parameters:

  • alignmentThreshold: new alignment threshold.

func (*AudioStreamAlign) SetDiscontWait

func (align *AudioStreamAlign) SetDiscontWait(discontWait gst.ClockTime)

SetDiscontWait sets alignment_treshold as new discont wait for the following processing.

The function takes the following parameters:

  • discontWait: new discont wait.

func (*AudioStreamAlign) SetRate

func (align *AudioStreamAlign) SetRate(rate int)

SetRate sets rate as new sample rate for the following processing. If the sample rate differs this implicitly marks the next data as discontinuous.

The function takes the following parameters:

  • rate: new sample rate.

func (*AudioStreamAlign) TimestampAtDiscont

func (align *AudioStreamAlign) TimestampAtDiscont() gst.ClockTime

TimestampAtDiscont: timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity.

The function returns the following values:

  • clockTime: last timestamp at when a discontinuity was detected.

type StreamVolume

type StreamVolume struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

StreamVolume: this interface is implemented by elements that provide a stream volume. Examples for such elements are #volume and #playbin.

Applications can use this interface to get or set the current stream volume. For this the "volume" #GObject property can be used or the helper functions gst_stream_volume_set_volume() and gst_stream_volume_get_volume(). This volume is always a linear factor, i.e. 0.0 is muted 1.0 is 100%. For showing the volume in a GUI it might make sense to convert it to a different format by using gst_stream_volume_convert_volume(). Volume sliders should usually use a cubic volume.

Separate from the volume the stream can also be muted by the "mute" #GObject property or gst_stream_volume_set_mute() and gst_stream_volume_get_mute().

Elements that provide some kind of stream volume should implement the "volume" and "mute" #GObject properties and handle setting and getting of them properly. The volume property is defined to be a linear volume factor.

StreamVolume wraps an interface. This means the user can get the underlying type by calling Cast().

func (*StreamVolume) Mute

func (volume *StreamVolume) Mute() bool

The function returns the following values:

  • ok returns TRUE if the stream is muted.

func (*StreamVolume) SetMute

func (volume *StreamVolume) SetMute(mute bool)

The function takes the following parameters:

  • mute: mute state that should be set.

func (*StreamVolume) SetVolume

func (volume *StreamVolume) SetVolume(format StreamVolumeFormat, val float64)

The function takes the following parameters:

  • format of val.
  • val: linear volume factor that should be set.

func (*StreamVolume) Volume

func (volume *StreamVolume) Volume(format StreamVolumeFormat) float64

The function takes the following parameters:

  • format which should be returned.

The function returns the following values:

  • gdouble: current stream volume as linear factor.

type StreamVolumeFormat

type StreamVolumeFormat C.gint

StreamVolumeFormat: different representations of a stream volume. gst_stream_volume_convert_volume() allows to convert between the different representations.

Formulas to convert from a linear to a cubic or dB volume are cbrt(val) and 20 * log10 (val).

const (
	// StreamVolumeFormatLinear: linear scale factor, 1.0 = 100%.
	StreamVolumeFormatLinear StreamVolumeFormat = iota
	// StreamVolumeFormatCubic: cubic volume scale.
	StreamVolumeFormatCubic
	// StreamVolumeFormatDb: logarithmic volume scale (dB, amplitude not power).
	StreamVolumeFormatDb
)

func (StreamVolumeFormat) String

func (s StreamVolumeFormat) String() string

String returns the name in string for StreamVolumeFormat.

type StreamVolumeInterface

type StreamVolumeInterface struct {
	// contains filtered or unexported fields
}

StreamVolumeInterface: instance of this type is always passed by reference.

type StreamVolumeOverrider

type StreamVolumeOverrider interface {
}

StreamVolumeOverrider contains methods that are overridable.

type StreamVolumer

type StreamVolumer interface {
	coreglib.Objector

	Mute() bool
	Volume(format StreamVolumeFormat) float64
	SetMute(mute bool)
	SetVolume(format StreamVolumeFormat, val float64)
}

StreamVolumer describes StreamVolume's interface methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL