logo
pub struct Info { /* private fields */ }
Expand description

Represents the format of data provided in a stream or processed by a sink.

Implementations

Allocates a new Info structure.

Clients must initialise at least the encoding field themselves. Returns None on failure.

Parses a human-readable string of the form generated by print() into an Info structure.

Returns None on failure.

Utility function to take a Spec and generate the corresponding Info.

Note that if you want the server to choose some of the stream parameters, for example the sample rate, so that they match the device parameters, then you shouldn’t use this function. In order to allow the server to choose a parameter value, that parameter must be left unspecified in the Info object, and this function always specifies all parameters. An exception is the channel map: if you pass None for the channel map, then the channel map will be left unspecified, allowing the server to choose it.

Returns None on failure.

Checks whether the Info structure is valid.

Checks whether the Info structure represents a PCM (i.e. uncompressed data) format.

Checks whether the format represented by self is a subset of the format represented by with.

This means that with must have all the fields that self does, but the reverse need not be true. This is typically expected to be used to check if a stream’s format is compatible with a given sink. In such a case, self would be the sink’s format and with would be the streams.

Gets a human-readable string representing the given format.

Utility function to generate a Spec and Map corresponding to a given Info.

The conversion for PCM formats is straight-forward. For non-PCM formats, if there is a fixed size-time conversion (i.e. all IEC61937-encapsulated formats), a “fake” sample spec whose size-time conversion corresponds to this format is provided and the channel map argument is ignored. For formats with variable size-time conversion, this function will fail.

Gets the encoding.

Sets the encoding attribute.

Gets an immutable reference to the property list.

Gets a mutable reference to the property list.

Gets the type of property key.

Gets an integer property.

Gets an integer range property. On success, returns min-max tuple.

Gets an integer array property.

Returns None on error.

Gets a string property.

Gets a string array property.

This is supported on crate feature pa_v13 only.

Gets the sample format stored in the format info.

Returns Err if the sample format property is not set at all, or is invalid.

This is supported on crate feature pa_v13 only.

Gets the sample rate stored in the format info.

Returns Err if the sample rate property is not set at all, or is invalid.

This is supported on crate feature pa_v13 only.

Gets the channel count stored in the format info.

Returns Err if the channels property is not set at all, or is invalid.

This is supported on crate feature pa_v13 only.

Gets the channel map stored in the format info.

Returns Err if the channel map property is not set at all, or if the string form it is stored in within the property set fails to parse successfully.

Sets an integer property.

Sets a property with a list of integer values.

Sets a property which can have any value in a given integer range.

Sets a string property.

Sets a property with a list of string values.

Convenience method to set the sample format as a property.

Note for PCM: If the sample format is left unspecified in the Info object, then the server will select the stream sample format. In that case the stream sample format will most likely match the device sample format, meaning that sample format conversion will be avoided.

Convenience method to set the sampling rate as a property.

Note for PCM: If the sample rate is left unspecified in the Info object, then the server will select the stream sample rate. In that case the stream sample rate will most likely match the device sample rate, meaning that sample rate conversion will be avoided.

Convenience method to set the number of channels as a property.

Note for PCM: If the channel count is left unspecified in the Info object, then the server will select the stream channel count. In that case the stream channel count will most likely match the device channel count, meaning that up/downmixing will be avoided.

Convenience method to set the channel map as a property.

Note for PCM: If the channel map is left unspecified in the Info object, then the server will select the stream channel map. In that case the stream channel map will most likely match the device channel map, meaning that remixing will be avoided.

Trait Implementations

Returns a new Info struct and representing the same format. If this is called on a ‘weak’ instance, a non-weak object is returned.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.