Class GstAudio
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMaximum range of allowed channels, for use in template caps strings.static final StringGstAudioDitherMethod, The dither method to use when changing bit depth.static final StringThreshold for the output bit depth at/below which to apply dithering.static final StringGST_TYPE_LIST, The channel mapping matrix.static final StringGstAudioNoiseShapingMethod, The noise shaping method to use to mask noise from quantization errors.static final StringG_TYPE_UINT, The quantization amount.static final StringGstAudioResamplerMethod, The resampler method to use when changing sample rates.static final intDefault maximum number of errors tolerated before signaling error.static final StringThe name of the templates for the sink pad.static final StringThe name of the templates for the source pad.static final intStandard number of channels used in consumer audio.static final StringStandard format used in consumer audio.static final intStandard sampling rate used in consumer audio.static final Stringthe name of the templates for the sink padstatic final Stringthe name of the templates for the source padstatic final intNumber of audio formats inGstAudioFormat.static final StringList of all audio formats, for use in template caps strings.static final StringMaximum range of allowed sample rates, for use in template caps strings.static final StringG_TYPE_DOUBLE, B parameter of the cubic filter.static final StringG_TYPE_DOUBLE, C parameter of the cubic filter.static final StringG_TYPE_DOUBLE, Cutoff parameter for the filter.static final StringGST_TYPE_AUDIO_RESAMPLER_INTERPOLATION: how the filter coefficients should be interpolated.static final StringGST_TYPE_AUDIO_RESAMPLER_FILTER_MODE: how the filter tables should be constructed.static final StringG_TYPE_UINT: the amount of memory to use for full filter tables before switching to interpolated filter tables.static final StringG_TYPE_UINT, oversampling to use when interpolating filters 8 is the default.static final StringG_TYPE_DOUBLE: The maximum allowed phase error when switching sample rates.static final StringG_TYPE_INT: the number of taps to use for the filter.static final StringG_TYPE_DOUBLE, stopband attenuation in decibels.static final StringG_TYPE_DOUBLE, transition bandwidth.static final intstatic final intstatic final intstatic final StringList of all DSD formats, for use in template caps strings.static final StringThe GStreamer media type for DSD.static final intSilence pattern for DSD data.static final StringThis metadata stays relevant as long as channels are unchanged.static final StringThis metadata stays relevant as long as sample rate is unchanged.static final StringThis metadata is relevant for audio streams.static final StringThis metadata stays relevant as long as the DSD plane offsets are unchanged. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longaudioChannelGetFallbackMask(int channels) Get the fallback channel-mask for the given number of channels.static booleanaudioChannelPositionsFromMask(long channelMask, @Nullable AudioChannelPosition @Nullable [] position) Convert thechannelspresent inchannelMaskto apositionarray (which should have at leastchannelsentries ensured by caller).static booleanaudioChannelPositionsToMask(@Nullable AudioChannelPosition @Nullable [] position, boolean forceOrder, Out<Long> channelMask) Convert thepositionarray ofchannelschannels to a bitmask.static StringaudioChannelPositionsToString(@Nullable AudioChannelPosition @Nullable [] position) Convertspositionto a human-readable string representation for debugging purposes.static booleanaudioChannelPositionsToValidOrder(@Nullable AudioChannelPosition @Nullable [] position) Reorders the channel positions inpositionfrom any order to the GStreamer channel order.static booleanaudioCheckValidChannelPositions(@Nullable AudioChannelPosition @Nullable [] position, boolean forceOrder) Checks ifpositioncontains valid channel positions forchannelschannels.static Typestatic Typestatic AudioFormat[]Return all the raw audio formats supported by GStreamer.static booleanaudioGetChannelReorderMap(@Nullable AudioChannelPosition @Nullable [] from, @Nullable AudioChannelPosition @Nullable [] to, @org.jspecify.annotations.Nullable int @Nullable [] reorderMap) Returns a reorder map forfromtotothat can be used in custom channel reordering code, e.g.static intCalculated the size of the buffer expected by gst_audio_iec61937_payload() for payloading type fromspec.static booleanaudioIec61937Payload(@org.jspecify.annotations.Nullable byte @Nullable [] src, @org.jspecify.annotations.Nullable byte @Nullable [] dst, AudioRingBufferSpec spec, int endianness) Payloadssrcin the form specified by IEC 61937 for the type fromspecand stores the result indst.srcmust contain exactly one frame of data and the frame is not checked for errors.static TypeReturn theGTypeassociated withGstAudioLevelMeta.static CapsaudioMakeRawCaps(@Nullable AudioFormat @Nullable [] formats, AudioLayout layout) Return a generic raw audio caps for formats defined informats.Ifformatsisnullreturns a caps for all the supported raw audio formats, see gst_audio_formats_raw().static Typestatic booleanaudioReorderChannels(@org.jspecify.annotations.Nullable byte @Nullable [] data, AudioFormat format, @Nullable AudioChannelPosition @Nullable [] from, @Nullable AudioChannelPosition @Nullable [] to) Reordersdatafrom the channel positionsfromto the channel positionsto.fromandtomust contain the same number of positions and the same positions, only in a different order.static voidaudioReorderChannelsWithReorderMap(@org.jspecify.annotations.Nullable byte @Nullable [] data, int bps, @org.jspecify.annotations.Nullable int @Nullable [] reorderMap) Reordersdatawith the givenreorderMap.static AudioClippingMetabufferAddAudioClippingMeta(Buffer buffer, Format format, long start, long end) AttachesGstAudioClippingMetametadata tobufferwith the given parameters.static AudioDownmixMetabufferAddAudioDownmixMeta(Buffer buffer, @Nullable AudioChannelPosition @Nullable [] fromPosition, @Nullable AudioChannelPosition @Nullable [] toPosition, MemorySegment[] matrix) AttachesGstAudioDownmixMetametadata tobufferwith the given parameters.static @Nullable AudioLevelMetabufferAddAudioLevelMeta(Buffer buffer, byte level, boolean voiceActivity) Attaches audio level information tobuffer.(RFC 6464)static AudioMetabufferAddAudioMeta(Buffer buffer, AudioInfo info, long samples, @Nullable MemorySegment offsets) Allocates and attaches aGstAudioMetaonbuffer,which must be writable for that purpose.static DsdPlaneOffsetMetabufferAddDsdPlaneOffsetMeta(Buffer buffer, int numChannels, long numBytesPerChannel, @Nullable MemorySegment offsets) Allocates and attaches aGstDsdPlaneOffsetMetaonbuffer,which must be writable for that purpose.static AudioDownmixMetabufferGetAudioDownmixMetaForChannels(Buffer buffer, @Nullable AudioChannelPosition @Nullable [] toPosition) Find theGstAudioDownmixMetaonbufferfor the given destination channel positions.static @Nullable AudioLevelMetabufferGetAudioLevelMeta(Buffer buffer) Find theGstAudioLevelMetaonbuffer.static voiddsdConvert(MemorySegment inputData, MemorySegment outputData, DsdFormat inputFormat, DsdFormat outputFormat, AudioLayout inputLayout, AudioLayout outputLayout, MemorySegment inputPlaneOffsets, MemorySegment outputPlaneOffsets, long numDsdBytes, int numChannels, boolean reverseByteBits) Converts DSD data from one layout and grouping format to another.static Typestatic void
-
Field Details
-
AUDIO_CHANNELS_RANGE
Maximum range of allowed channels, for use in template caps strings.- See Also:
-
AUDIO_CONVERTER_OPT_DITHER_METHOD
GstAudioDitherMethod, The dither method to use when changing bit depth. Default isGST_AUDIO_DITHER_NONE.- See Also:
-
AUDIO_CONVERTER_OPT_DITHER_THRESHOLD
Threshold for the output bit depth at/below which to apply dithering.Default is 20 bit.
- Since:
- 1.22
- See Also:
-
AUDIO_CONVERTER_OPT_MIX_MATRIX
GST_TYPE_LIST, 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);- See Also:
-
AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD
GstAudioNoiseShapingMethod, The noise shaping method to use to mask noise from quantization errors. Default isGST_AUDIO_NOISE_SHAPING_NONE.- See Also:
-
AUDIO_CONVERTER_OPT_QUANTIZATION
G_TYPE_UINT, The quantization amount. Components will be quantized to multiples of this value. Default is 1- See Also:
-
AUDIO_CONVERTER_OPT_RESAMPLER_METHOD
GstAudioResamplerMethod, The resampler method to use when changing sample rates. Default isGST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL.- See Also:
-
AUDIO_DECODER_MAX_ERRORS
public static final int AUDIO_DECODER_MAX_ERRORSDefault maximum number of errors tolerated before signaling error.- See Also:
-
AUDIO_DECODER_SINK_NAME
The name of the templates for the sink pad.- See Also:
-
AUDIO_DECODER_SRC_NAME
The name of the templates for the source pad.- See Also:
-
AUDIO_DEF_CHANNELS
public static final int AUDIO_DEF_CHANNELSStandard number of channels used in consumer audio.- See Also:
-
AUDIO_DEF_FORMAT
-
AUDIO_DEF_RATE
public static final int AUDIO_DEF_RATEStandard sampling rate used in consumer audio.- See Also:
-
AUDIO_ENCODER_SINK_NAME
the name of the templates for the sink pad- See Also:
-
AUDIO_ENCODER_SRC_NAME
the name of the templates for the source pad- See Also:
-
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
- See Also:
-
AUDIO_FORMAT_LAST
public static final int AUDIO_FORMAT_LASTNumber of audio formats inGstAudioFormat.- Since:
- 1.26
- See Also:
-
AUDIO_RATE_RANGE
Maximum range of allowed sample rates, for use in template caps strings.- See Also:
-
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
- See Also:
-
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
GST_AUDIO_RESAMPLER_OPT_CUBIC_Bfor some more common values- See Also:
-
AUDIO_RESAMPLER_OPT_CUTOFF
G_TYPE_DOUBLE, Cutoff parameter for the filter. 0.940 is the default.- See Also:
-
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.- See Also:
-
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.- See Also:
-
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.- See Also:
-
AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE
G_TYPE_UINT, oversampling to use when interpolating filters 8 is the default.- See Also:
-
AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR
G_TYPE_DOUBLE: The maximum allowed phase error when switching sample rates. 0.1 is the default.- See Also:
-
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.- See Also:
-
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.- See Also:
-
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.- See Also:
-
AUDIO_RESAMPLER_QUALITY_DEFAULT
public static final int AUDIO_RESAMPLER_QUALITY_DEFAULT- See Also:
-
AUDIO_RESAMPLER_QUALITY_MAX
public static final int AUDIO_RESAMPLER_QUALITY_MAX- See Also:
-
AUDIO_RESAMPLER_QUALITY_MIN
public static final int AUDIO_RESAMPLER_QUALITY_MIN- See Also:
-
DSD_FORMATS_ALL
List of all DSD formats, for use in template caps strings.Big endian formats are preferred, since little-endian ones flip around the DSD bytes, and most DSD hardware uses big endian formats.
- Since:
- 1.24
- See Also:
-
DSD_MEDIA_TYPE
-
DSD_SILENCE_PATTERN_BYTE
public static final int DSD_SILENCE_PATTERN_BYTESilence pattern for DSD data.In DSD, a nullbyte does not correspond to silence. To fill memory regions with "DSD silence", these regions must be filled with byte 0x69 instead (this is the DSD silence pattern). This constant provides that pattern in a more readable fashion.
- Since:
- 1.24
- See Also:
-
META_TAG_AUDIO_CHANNELS_STR
This metadata stays relevant as long as channels are unchanged.- Since:
- 1.2
- See Also:
-
META_TAG_AUDIO_RATE_STR
This metadata stays relevant as long as sample rate is unchanged.- Since:
- 1.8
- See Also:
-
META_TAG_AUDIO_STR
This metadata is relevant for audio streams.- Since:
- 1.2
- See Also:
-
META_TAG_DSD_PLANE_OFFSETS_STR
This metadata stays relevant as long as the DSD plane offsets are unchanged.- Since:
- 1.24
- See Also:
-
-
Constructor Details
-
GstAudio
public GstAudio()
-
-
Method Details
-
javagi$ensureInitialized
public static void javagi$ensureInitialized() -
audioChannelGetFallbackMask
public static long audioChannelGetFallbackMask(int channels) 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.
- Parameters:
channels- the number of channels- Returns:
- a fallback channel-mask for
channelsor 0 when there is no mask and mono. - Since:
- 1.8
-
audioChannelPositionsFromMask
public static boolean audioChannelPositionsFromMask(long channelMask, @Nullable AudioChannelPosition @Nullable [] position) Convert thechannelspresent inchannelMaskto apositionarray (which should have at leastchannelsentries ensured by caller). IfchannelMaskis set to 0, it is considered as 'not present' for purpose of conversion. A partially validchannelMaskwith less bits set than the number of channels is considered valid.- Parameters:
channelMask- The input channel_maskposition- TheGstAudioChannelPosition<!-- -->s- Returns:
trueif channel and channel mask are valid and could be converted
-
audioChannelPositionsToMask
public static boolean audioChannelPositionsToMask(@Nullable AudioChannelPosition @Nullable [] position, boolean forceOrder, Out<Long> channelMask) Convert thepositionarray ofchannelschannels to a bitmask.If
forceOrderistrueit additionally checks if the channels are in the order required by GStreamer.- Parameters:
position- TheGstAudioChannelPositionsforceOrder- Only consider the GStreamer channel order.channelMask- the output channel mask- Returns:
trueif the channel positions are valid and could be converted.
-
audioChannelPositionsToString
public static String audioChannelPositionsToString(@Nullable AudioChannelPosition @Nullable [] position) Convertspositionto a human-readable string representation for debugging purposes.- Parameters:
position- TheGstAudioChannelPositionsto convert.- Returns:
- a newly allocated string representing
position - Since:
- 1.10
-
audioChannelPositionsToValidOrder
public static boolean audioChannelPositionsToValidOrder(@Nullable AudioChannelPosition @Nullable [] position) Reorders the channel positions inpositionfrom any order to the GStreamer channel order.- Parameters:
position- The channel positions to reorder to.- Returns:
trueif the channel positions are valid and reordering was successful.
-
audioCheckValidChannelPositions
public static boolean audioCheckValidChannelPositions(@Nullable AudioChannelPosition @Nullable [] position, boolean forceOrder) Checks ifpositioncontains valid channel positions forchannelschannels. IfforceOrderistrueit additionally checks if the channels are in the order required by GStreamer.- Parameters:
position- TheGstAudioChannelPositionsto check.forceOrder- Only consider the GStreamer channel order.- Returns:
trueif the channel positions are valid.
-
audioClippingMetaApiGetType
-
audioDownmixMetaApiGetType
-
audioFormatsRaw
Return all the raw audio formats supported by GStreamer.- Returns:
- an array of
GstAudioFormat - Since:
- 1.18
-
audioGetChannelReorderMap
public static boolean audioGetChannelReorderMap(@Nullable AudioChannelPosition @Nullable [] from, @Nullable AudioChannelPosition @Nullable [] to, @org.jspecify.annotations.Nullable int @Nullable [] reorderMap) Returns a reorder map forfromtotothat can be used in custom channel reordering code, e.g. to convert from or to the GStreamer channel order.fromandtomust contain the same number of positions and the same positions, only in a different order.The resulting
reorderMapcan be used for reordering by assigning channel i of the input to channel reorder_map[i] of the output.- Parameters:
from- The channel positions to reorder from.to- The channel positions to reorder to.reorderMap- Pointer to the reorder map.- Returns:
trueif the channel positions are valid and reordering is possible.
-
audioIec61937FrameSize
Calculated the size of the buffer expected by gst_audio_iec61937_payload() for payloading type fromspec.- Parameters:
spec- the ringbufer spec- Returns:
- the size or 0 if the given
typeis not supported or cannot be payloaded.
-
audioIec61937Payload
public static boolean audioIec61937Payload(@org.jspecify.annotations.Nullable byte @Nullable [] src, @org.jspecify.annotations.Nullable byte @Nullable [] dst, AudioRingBufferSpec spec, int endianness) Payloadssrcin the form specified by IEC 61937 for the type fromspecand stores the result indst.srcmust contain exactly one frame of data and the frame is not checked for errors.- Parameters:
src- a buffer containing the data to payloaddst- the destination buffer to store the payloaded contents in. Should not overlap withsrcspec- the ringbufer spec forsrcendianness- the expected byte order of the payloaded data- Returns:
- transfer-full:
trueif the payloading was successful,falseotherwise.
-
audioLevelMetaApiGetType
Return theGTypeassociated withGstAudioLevelMeta.- Returns:
- a
GType - Since:
- 1.20
-
audioMakeRawCaps
Return a generic raw audio caps for formats defined informats.Ifformatsisnullreturns a caps for all the supported raw audio formats, see gst_audio_formats_raw().- Parameters:
formats- an array of rawGstAudioFormat, ornulllayout- the layout of audio samples- Returns:
- an audio
GstCaps - Since:
- 1.18
-
audioMetaApiGetType
-
audioReorderChannels
public static boolean audioReorderChannels(@org.jspecify.annotations.Nullable byte @Nullable [] data, AudioFormat format, @Nullable AudioChannelPosition @Nullable [] from, @Nullable AudioChannelPosition @Nullable [] to) Reordersdatafrom the channel positionsfromto the channel positionsto.fromandtomust contain the same number of positions and the same positions, only in a different order.This function internally calls gst_audio_get_channel_reorder_map() and gst_audio_reorder_channels_with_reorder_map(). It is more efficient to call gst_audio_get_channel_reorder_map() once to retrieve the reorder map and then call gst_audio_reorder_channels_with_reorder_map() with the same reorder map until the channel positions change.
Note: this function assumes the audio data is in interleaved layout
- Parameters:
data- The pointer to the memory.format- TheGstAudioFormatof the buffer.from- The channel positions in the buffer.to- The channel positions to convert to.- Returns:
trueif the reordering was possible.
-
audioReorderChannelsWithReorderMap
public static void audioReorderChannelsWithReorderMap(@org.jspecify.annotations.Nullable byte @Nullable [] data, int bps, @org.jspecify.annotations.Nullable int @Nullable [] reorderMap) Reordersdatawith the givenreorderMap.The reorder map can be retrieved for example with gst_audio_get_channel_reorder_map().
Note: this function assumes the audio data is in interleaved layout
- Parameters:
data- The pointer to the memory.bps- The number of bytes per sample.reorderMap- The channel reorder map.- Since:
- 1.26
-
bufferAddAudioClippingMeta
public static AudioClippingMeta bufferAddAudioClippingMeta(Buffer buffer, Format format, long start, long end) AttachesGstAudioClippingMetametadata tobufferwith the given parameters.- Parameters:
buffer- aGstBufferformat- GstFormat ofstartandstop,GST_FORMAT_DEFAULT is samplesstart- Amount of audio to clip from start of bufferend- Amount of to clip from end of buffer- Returns:
- the
GstAudioClippingMetaonbuffer. - Since:
- 1.8
-
bufferAddAudioDownmixMeta
public static AudioDownmixMeta bufferAddAudioDownmixMeta(Buffer buffer, @Nullable AudioChannelPosition @Nullable [] fromPosition, @Nullable AudioChannelPosition @Nullable [] toPosition, MemorySegment[] matrix) AttachesGstAudioDownmixMetametadata tobufferwith the given parameters.matrixis an two-dimensional array oftoChannelstimesfromChannelscoefficients, i.e. the i-th output channels is constructed by multiplicating the input channels with the coefficients inmatrix[i]and taking the sum of the results.- Parameters:
buffer- aGstBufferfromPosition- the channel positions of the sourcetoPosition- the channel positions of the destinationmatrix- The matrix coefficients.- Returns:
- the
GstAudioDownmixMetaonbuffer.
-
bufferAddAudioLevelMeta
public static @Nullable AudioLevelMeta bufferAddAudioLevelMeta(Buffer buffer, byte level, boolean voiceActivity) Attaches audio level information tobuffer.(RFC 6464)- Parameters:
buffer- aGstBufferlevel- the -dBov from 0-127 (127 is silence).voiceActivity- whether the buffer contains voice activity.- Returns:
- the
GstAudioLevelMetaonbuffer. - Since:
- 1.20
-
bufferAddAudioMeta
public static AudioMeta bufferAddAudioMeta(Buffer buffer, AudioInfo info, long samples, @Nullable MemorySegment offsets) Allocates and attaches aGstAudioMetaonbuffer,which must be writable for that purpose. The fields of theGstAudioMetaare directly populated from the arguments of this function.When
info>layoutisAudioLayout.NON_INTERLEAVEDandoffsetsisnull, the offsets are calculated with a formula that assumes the planes are tightly packed and in sequence: offsetssamples * 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 thebufferbefore adding this meta.- Parameters:
buffer- aGstBufferinfo- the audio properties of the buffersamples- the number of valid samples in the bufferoffsets- the offsets (in bytes) where each channel plane starts in the buffer ornullto calculate it (see below); must benullalso wheninfo>layoutisAudioLayout.INTERLEAVED- Returns:
- the
GstAudioMetathat was attached on thebuffer - Since:
- 1.16
-
bufferAddDsdPlaneOffsetMeta
public static DsdPlaneOffsetMeta bufferAddDsdPlaneOffsetMeta(Buffer buffer, int numChannels, long numBytesPerChannel, @Nullable MemorySegment offsets) Allocates and attaches aGstDsdPlaneOffsetMetaonbuffer,which must be writable for that purpose. The fields of theGstDsdPlaneOffsetMetaare directly populated from the arguments of this function.If
offsetsis NULL, then the meta's offsets field is left uninitialized. This is useful if for example offset values are to be calculated in the meta's offsets field in-place. Similarly,numBytesPerChannelcan be set to 0, but only ifoffsetsis NULL. This is useful if the number of bytes per channel is known only later.It is not allowed for channels to overlap in memory, i.e. for each i in [0, channels), the range
offsets[i+numBytesPerChannel)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 thebufferbefore adding this meta.This meta is only needed for non-interleaved (= planar) DSD data.
- Parameters:
buffer- aGstBuffernumChannels- Number of channels in the DSD datanumBytesPerChannel- Number of bytes per channeloffsets- the offsets (in bytes) where each channel plane starts in the buffer- Returns:
- the
GstDsdPlaneOffsetMetathat was attached on thebuffer - Since:
- 1.24
-
bufferGetAudioDownmixMetaForChannels
public static AudioDownmixMeta bufferGetAudioDownmixMetaForChannels(Buffer buffer, @Nullable AudioChannelPosition @Nullable [] toPosition) Find theGstAudioDownmixMetaonbufferfor the given destination channel positions.- Parameters:
buffer- aGstBuffertoPosition- the channel positions of the destination- Returns:
- the
GstAudioDownmixMetaonbuffer.
-
bufferGetAudioLevelMeta
Find theGstAudioLevelMetaonbuffer.- Parameters:
buffer- aGstBuffer- Returns:
- the
GstAudioLevelMetaornullwhen there is no such metadata onbuffer. - Since:
- 1.20
-
dsdConvert
public static void dsdConvert(MemorySegment inputData, MemorySegment outputData, DsdFormat inputFormat, DsdFormat outputFormat, AudioLayout inputLayout, AudioLayout outputLayout, MemorySegment inputPlaneOffsets, MemorySegment outputPlaneOffsets, long numDsdBytes, int numChannels, boolean reverseByteBits) Converts DSD data from one layout and grouping format to another.numBytesmust be an integer multiple of the width of both input and output format. For example, if the input format is GST_DSD_FORMAT_U32LE, and the output format is GST_DSD_FORMAT_U16BE, thennumBytesmust be an integer multiple of both 4 (U32LE width) and 2 (U16BE width).reverseByteBitsis necessary if the bit order within the DSD bytes needs to be reversed. This is rarely necessary, and is not to be confused with the endianness of formats (which determines the ordering of *bytes*).inputPlaneOffsetsmust not be NULL ifinputLayoutis set toGST_AUDIO_LAYOUT_NON_INTERLEAVED. The same applies tooutputPlaneOffsets.These plane offsets define the starting offset of the planes (there is exactly one plane per channel) withininputDataandoutputDatarespectively. If GST_AUDIO_LAYOUT_INTERLEAVED is used, the plane offsets are ignored.- Parameters:
inputData- the DSD format conversion's input sourceoutputData- the DSD format conversion's output destinationinputFormat- DSD format of the input data to convert fromoutputFormat- DSD format of the output data to convert toinputLayout- Input data layoutoutputLayout- Output data layoutinputPlaneOffsets- Plane offsets for non-interleaved input dataoutputPlaneOffsets- Plane offsets for non-interleaved output datanumDsdBytes- How many bytes with DSD data to convertnumChannels- Number of channels (must be at least 1)reverseByteBits- If TRUE, reverse the bits in each DSD byte- Since:
- 1.24
-
dsdPlaneOffsetMetaApiGetType
-