mirror of
https://github.com/openharmony/third_party_tinyalsa.git
synced 2026-07-18 21:34:26 -04:00
Added format related getters for PCM
Added functions: - pcm_get_channels - pcm_get_rate - pcm_get_format These were added since they're required for iterating samples and frames.
This commit is contained in:
@@ -240,6 +240,12 @@ int pcm_close(struct pcm *pcm);
|
||||
|
||||
int pcm_is_ready(const struct pcm *pcm);
|
||||
|
||||
unsigned int pcm_get_channels(const struct pcm *pcm);
|
||||
|
||||
unsigned int pcm_get_rate(const struct pcm *pcm);
|
||||
|
||||
enum pcm_format pcm_get_format(const struct pcm *pcm);
|
||||
|
||||
int pcm_get_file_descriptor(const struct pcm *pcm);
|
||||
|
||||
const char *pcm_get_error(const struct pcm *pcm);
|
||||
|
||||
@@ -204,6 +204,37 @@ unsigned int pcm_get_buffer_size(const struct pcm *pcm)
|
||||
return pcm->buffer_size;
|
||||
}
|
||||
|
||||
/** Gets the channel count of the PCM.
|
||||
* @param pcm A PCM handle.
|
||||
* @return The channel count of the PCM.
|
||||
* @ingroup libtinyalsa-pcm
|
||||
*/
|
||||
unsigned int pcm_get_channels(const struct pcm *pcm)
|
||||
{
|
||||
return pcm->config.channels;
|
||||
}
|
||||
|
||||
/** Gets the rate of the PCM.
|
||||
* The rate is given in frames per second.
|
||||
* @param pcm A PCM handle.
|
||||
* @return The rate of the PCM.
|
||||
* @ingroup libtinyalsa-pcm
|
||||
*/
|
||||
unsigned int pcm_get_rate(const struct pcm *pcm)
|
||||
{
|
||||
return pcm->config.rate;
|
||||
}
|
||||
|
||||
/** Gets the format of the PCM.
|
||||
* @param pcm A PCM handle.
|
||||
* @return The format of the PCM.
|
||||
* @ingroup libtinyalsa-pcm
|
||||
*/
|
||||
enum pcm_format pcm_get_format(const struct pcm *pcm)
|
||||
{
|
||||
return pcm->config.format;
|
||||
}
|
||||
|
||||
/** Gets the file descriptor of the PCM.
|
||||
* Useful for extending functionality of the PCM when needed.
|
||||
* @param pcm A PCM handle.
|
||||
|
||||
Reference in New Issue
Block a user