|
| 1 | +// SPDX-License-Identifier: BSD-3-Clause |
| 2 | +// |
| 3 | +// Copyright(c) 2025 Intel Corporation. All rights reserved. |
| 4 | +// |
| 5 | +// Author: Piotr Hoppe <piotr.hoppe@intel.com> |
| 6 | + |
| 7 | +/** |
| 8 | + * @file crossover_test_mocks.c |
| 9 | + * @brief Trivial source/sink API stubs for the crossover unit tests. |
| 10 | + * |
| 11 | + * The crossover_generic.c translation unit also contains the per-format |
| 12 | + * processing functions (crossover_s16/s24/s32_default and the passthrough), |
| 13 | + * which reference the source/sink API. The split functions under test never |
| 14 | + * call them, but the linker still needs the referenced symbols defined. |
| 15 | + * |
| 16 | + * The stubs are provided by this separate translation unit so that any number |
| 17 | + * of test executables can link them via CMake without risking multiple |
| 18 | + * definitions. The prototypes come from the real source/sink API headers. |
| 19 | + */ |
| 20 | + |
| 21 | +#include <stdbool.h> |
| 22 | +#include <stddef.h> |
| 23 | +#include <stdint.h> |
| 24 | +#include <sof/audio/source_api.h> |
| 25 | +#include <sof/audio/sink_api.h> |
| 26 | +#include <sof/audio/sink_source_utils.h> |
| 27 | + |
| 28 | +size_t source_get_frame_bytes(struct sof_source *source) |
| 29 | +{ |
| 30 | + (void)source; |
| 31 | + return 0; |
| 32 | +} |
| 33 | + |
| 34 | +int source_get_data_s16(struct sof_source *source, size_t req_size, int16_t const **data_ptr, |
| 35 | + int16_t const **buffer_start, int *buffer_samples) |
| 36 | +{ |
| 37 | + (void)source; (void)req_size; (void)data_ptr; (void)buffer_start; (void)buffer_samples; |
| 38 | + return 0; |
| 39 | +} |
| 40 | + |
| 41 | +int source_get_data_s32(struct sof_source *source, size_t req_size, int32_t const **data_ptr, |
| 42 | + int32_t const **buffer_start, int *buffer_samples) |
| 43 | +{ |
| 44 | + (void)source; (void)req_size; (void)data_ptr; (void)buffer_start; (void)buffer_samples; |
| 45 | + return 0; |
| 46 | +} |
| 47 | + |
| 48 | +int source_release_data(struct sof_source *source, size_t free_size) |
| 49 | +{ |
| 50 | + (void)source; (void)free_size; |
| 51 | + return 0; |
| 52 | +} |
| 53 | + |
| 54 | +int sink_get_buffer_s16(struct sof_sink *sink, size_t req_size, int16_t **data_ptr, |
| 55 | + int16_t **buffer_start, int *buffer_samples) |
| 56 | +{ |
| 57 | + (void)sink; (void)req_size; (void)data_ptr; (void)buffer_start; (void)buffer_samples; |
| 58 | + return 0; |
| 59 | +} |
| 60 | + |
| 61 | +int sink_get_buffer_s32(struct sof_sink *sink, size_t req_size, int32_t **data_ptr, |
| 62 | + int32_t **buffer_start, int *buffer_samples) |
| 63 | +{ |
| 64 | + (void)sink; (void)req_size; (void)data_ptr; (void)buffer_start; (void)buffer_samples; |
| 65 | + return 0; |
| 66 | +} |
| 67 | + |
| 68 | +int sink_commit_buffer(struct sof_sink *sink, size_t commit_size) |
| 69 | +{ |
| 70 | + (void)sink; (void)commit_size; |
| 71 | + return 0; |
| 72 | +} |
| 73 | + |
| 74 | +int source_to_sink_copy(struct sof_source *source, struct sof_sink *sink, bool free, size_t size) |
| 75 | +{ |
| 76 | + (void)source; (void)sink; (void)free; (void)size; |
| 77 | + return 0; |
| 78 | +} |
0 commit comments