Sound Open Firmware
Loading...
Searching...
No Matches
sink_source_utils.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2023 Intel Corporation. All rights reserved.
4 *
5 */
6
7#ifndef SINK_SOURCE_UTILS_H
8#define SINK_SOURCE_UTILS_H
9
10#include <sof/audio/sink_api.h>
12#include <sof/math/numbers.h>
13
23int source_to_sink_copy(struct sof_source *source,
24 struct sof_sink *sink, bool free, size_t size);
25
32int sink_fill_with_silence(struct sof_sink *sink, size_t size);
33
40int source_drop_data(struct sof_source *source, size_t size);
41
51static inline size_t source_sink_avail_frames_aligned(struct sof_source *source,
52 struct sof_sink *sink)
53{
54 size_t src_frames = source_get_data_frames_available(source);
55 size_t sink_frames = sink_get_free_frames(sink);
56 size_t n = MIN(src_frames, sink_frames);
57
58 return source_align_frames_round_down(source, n);
59}
60
61#endif /* SINK_SOURCE_UTILS_H */
#define MIN(a, b)
Definition numbers.h:19
static size_t source_sink_avail_frames_aligned(struct sof_source *source, struct sof_sink *sink)
Computes maximum number of frames aligned with the source align criteria that can be copied from sour...
Definition sink_source_utils.h:51
int source_to_sink_copy(struct sof_source *source, struct sof_sink *sink, bool free, size_t size)
copy bytes from source to sink
int sink_fill_with_silence(struct sof_sink *sink, size_t size)
fill sink with silence (zeros)
int source_drop_data(struct sof_source *source, size_t size)
drop data from source