Class DsdInfo
- All Implemented Interfaces:
Proxy
In DSD, the "sample format" is the bit. Unlike PCM, there are no further
"sample formats" in DSD. However, in software, DSD bits are grouped into
bytes (since dealing with individual bits is impractical), and these bytes
in turn are grouped into words. This becomes relevant when interleaving
channels and transmitting DSD data through audio APIs. The different
types of grouping DSD bytes are referred to as the "DSD grouping forma"
or just "DSD format". GstDsdFormat has a list of valid ways of grouping
DSD bytes into words.
DSD rates are equivalent to PCM sample rates, except that they specify
how many DSD bytes are consumed per second. This refers to the bytes per
second _per channel_; the rate does not change when the number of channel
changes. (Strictly speaking, it would be more correct to measure the bits per second, since the bit is the DSD "sample format", but it is
more practical to use bytes.) In DSD, bit rates are always an integer
multiple of the CD audio rate (44100) or the DAT rate (48000). DSD64-44x
is 44100 * 64 = 2822400 bits per second, or 352800 bytes per second
(the latter would be used in this info structure). DSD64-48x is
48000 * 64 = 3072000 bits per second, or 384000 bytes per second.
GST_DSD_MAKE_DSD_RATE_44x can be used for specifying DSD-44x rates,
*and GST_DSD_MAKE_DSD_RATE_48x can be used for specifying DSD-48x ones.
Also, since DSD-48x is less well known, when the multiplier is given
without the 44x/48x specifier, 44x is typically implied.
It is important to know that in DSD, different format widths correspond to different playtimes. That is, a word with 32 DSD bits covers two times as much playtime as a word with 16 DSD bits. This is in contrast to PCM, where one word (= one PCM sample) always covers a time period of 1/samplerate, no matter how many bits a PCM sample is made of. For this reason, DSD and PCM widths and strides cannot be used the same way.
Multiple channels are arranged in DSD data either interleaved or non- interleaved. This is similar to PCM. Interleaved layouts rotate between channels and words. First, word 0 of channel 0 is present. Then word 0 of channel 1 follows. Then word 0 of channel 2 etc. until all channels are through, then comes word 1 of channel 0 etc.
Non-interleaved data is planar. First, all words of channel 0 are
present, then all words of channel 1 etc. Unlike interleaved data,
non-interleaved data can be sparse, that is, there can be space in
between the planes. the positions array specifies the plane offsets.
In uncommon cases, the DSD bits in the data bytes can be stored in reverse
order. For example, normally, in DSDU8, the first byte contains DSD bits
0 to 7, and the most significant bit of that byte is DSD bit 0. If this
order is reversed, then bit 7 is the first one instead. In that ase,
reversedBytes is set to TRUE.
Use the provided macros to access the info in this structure.
- Since:
- 1.24
-
Constructor Summary
ConstructorsConstructorDescriptionDsdInfo()Allocate a newGstDsdInfothat is also initialized with gst_dsd_info_init().DsdInfo(MemorySegment address) Create a DsdInfo proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copy a GstDsdInfo structure.voidfree()Free a GstDsdInfo structure previously allocated with gst_dsd_info_new() or gst_dsd_info_copy().static DsdInfoParsecapsto generate aGstDsdInfo.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the DsdInfo classstatic voidInitializeinfowith default values.booleanCompares twoGstDsdInfoand returns whether they are equal or notintRead the value of the fieldchannels.Read the value of the fieldflags.Read the value of the fieldformat.Read the value of the fieldlayout.@Nullable AudioChannelPosition @Nullable []Read the value of the fieldpositions.intreadRate()Read the value of the fieldrate.booleanRead the value of the fieldreversed_bytes.voidsetFormat(DsdFormat format, int rate, int channels, @Nullable AudioChannelPosition @Nullable [] positions) Set the default info for the DSD info offormatandrateandchannels.toCaps()Convert the values of this DsdInfo into aGstCaps.static booleanParsecapsand updateinfo.voidwriteChannels(int channels) Write a value in the fieldchannels.voidwriteFlags(Set<AudioFlags> flags) Write a value in the fieldflags.voidwriteFormat(DsdFormat format) Write a value in the fieldformat.voidwriteLayout(AudioLayout layout) Write a value in the fieldlayout.voidwritePositions(@Nullable AudioChannelPosition @Nullable [] positions, Arena _arena) Write a value in the fieldpositions.voidwriteRate(int rate) Write a value in the fieldrate.voidwriteReversedBytes(boolean reversedBytes) Write a value in the fieldreversed_bytes.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
DsdInfo
Create a DsdInfo proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
DsdInfo
public DsdInfo()Allocate a newGstDsdInfothat is also initialized with gst_dsd_info_init().- Since:
- 1.24
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readFormat
Read the value of the fieldformat.- Returns:
- The value of the field
format
-
writeFormat
Write a value in the fieldformat.- Parameters:
format- The new value for the fieldformat
-
readRate
public int readRate()Read the value of the fieldrate.- Returns:
- The value of the field
rate
-
writeRate
public void writeRate(int rate) Write a value in the fieldrate.- Parameters:
rate- The new value for the fieldrate
-
readChannels
public int readChannels()Read the value of the fieldchannels.- Returns:
- The value of the field
channels
-
writeChannels
public void writeChannels(int channels) Write a value in the fieldchannels.- Parameters:
channels- The new value for the fieldchannels
-
readLayout
Read the value of the fieldlayout.- Returns:
- The value of the field
layout
-
writeLayout
Write a value in the fieldlayout.- Parameters:
layout- The new value for the fieldlayout
-
readReversedBytes
public boolean readReversedBytes()Read the value of the fieldreversed_bytes.- Returns:
- The value of the field
reversed_bytes
-
writeReversedBytes
public void writeReversedBytes(boolean reversedBytes) Write a value in the fieldreversed_bytes.- Parameters:
reversedBytes- The new value for the fieldreversed_bytes
-
readPositions
Read the value of the fieldpositions.- Returns:
- The value of the field
positions
-
writePositions
Write a value in the fieldpositions.- Parameters:
positions- The new value for the fieldpositions
-
readFlags
Read the value of the fieldflags.- Returns:
- The value of the field
flags
-
writeFlags
Write a value in the fieldflags.- Parameters:
flags- The new value for the fieldflags
-
fromCaps
-
withCaps
-
init
Initializeinfowith default values.- Parameters:
info- aGstDsdInfo- Since:
- 1.24
-
copy
Copy a GstDsdInfo structure.- Returns:
- a new
GstDsdInfo. free with gst_dsd_info_free. - Since:
- 1.24
-
free
public void free()Free a GstDsdInfo structure previously allocated with gst_dsd_info_new() or gst_dsd_info_copy().- Since:
- 1.24
-
isEqual
Compares twoGstDsdInfoand returns whether they are equal or not- Parameters:
other- aGstDsdInfo- Returns:
trueif this DsdInfo andotherare equal, elsefalse.- Since:
- 1.24
-
setFormat
public void setFormat(DsdFormat format, int rate, int channels, @Nullable AudioChannelPosition @Nullable [] positions) Set the default info for the DSD info offormatandrateandchannels.Note: This initializes this DsdInfo first, no values are preserved.
- Parameters:
format- the formatrate- the DSD ratechannels- the number of channelspositions- the channel positions- Throws:
IllegalArgumentException- when length ofpositionsis less than 64- Since:
- 1.24
-
toCaps
Convert the values of this DsdInfo into aGstCaps.- Returns:
- the new
GstCapscontaining the info ofinfo. - Since:
- 1.24
-