File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313#include <stdbool.h>
1414#include "../ipc/stream.h"
1515
16+
17+ /**
18+ * @enum sof_audio_buffer_state
19+ * @brief Define states of an audio stream buffer connecting two components.
20+ *
21+ * This enum represents the lifecycle of an audio stream, including its
22+ * initialization, readiness, and end-of-stream handling. It is used to
23+ * track and manage the state transitions of the stream during audio processing.
24+ */
25+ enum sof_audio_buffer_state {
26+ AUDIOBUF_STATE_INITIAL , /* Initial state, hw params not configured. */
27+ AUDIOBUF_STATE_READY , /* Stream ready, hw params configured */
28+ };
29+
1630/**
1731 * set of parameters describing audio stream
1832 * this structure is shared between audio_stream.h and sink/source interface
@@ -53,7 +67,7 @@ struct sof_audio_stream_params {
5367
5468 uint16_t chmap [SOF_IPC_MAX_CHANNELS ]; /**< channel map - SOF_CHMAP_ */
5569
56- bool hw_params_configured ; /**< indicates whether hw params were set */
70+ enum sof_audio_buffer_state state ; /**< audio stream state */
5771};
5872
5973#endif /* __MODULE_AUDIO_AUDIO_STREAM_H__ */
Original file line number Diff line number Diff line change @@ -214,17 +214,17 @@ static inline bool audio_buffer_is_shared(struct sof_audio_buffer *buffer)
214214
215215static inline bool audio_buffer_hw_params_configured (struct sof_audio_buffer * buffer )
216216{
217- return buffer -> audio_stream_params -> hw_params_configured ;
217+ return buffer -> audio_stream_params -> state != AUDIOBUF_STATE_INITIAL ;
218218}
219219
220220static inline void audio_buffer_set_hw_params_configured (struct sof_audio_buffer * buffer )
221221{
222- buffer -> audio_stream_params -> hw_params_configured = true ;
222+ buffer -> audio_stream_params -> state = AUDIOBUF_STATE_READY ;
223223}
224224
225225static inline void audio_buffer_reset_params (struct sof_audio_buffer * buffer )
226226{
227- buffer -> audio_stream_params -> hw_params_configured = false ;
227+ buffer -> audio_stream_params -> state = AUDIOBUF_STATE_INITIAL ;
228228}
229229
230230static inline uint16_t audio_buffer_get_chmap (struct sof_audio_buffer * buffer , size_t index )
You can’t perform that action at this time.
0 commit comments