|
Packit |
229ac0 |
// SPDX-License-Identifier: GPL-2.0
|
|
Packit |
229ac0 |
//
|
|
Packit |
229ac0 |
// generator.c - a generator for test with buffers of PCM frames.
|
|
Packit |
229ac0 |
//
|
|
Packit |
229ac0 |
// Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
|
|
Packit |
229ac0 |
//
|
|
Packit |
229ac0 |
// Licensed under the terms of the GNU General Public License, version 2.
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
#ifndef __ALSA_UTILS_AXFER_TEST_GENERATOR__H_
|
|
Packit |
229ac0 |
#define __ALSA_UTILS_AXFER_TEST_GENERATOR__H_
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
#include <stdint.h>
|
|
Packit |
229ac0 |
#include <alsa/asoundlib.h>
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
struct test_generator;
|
|
Packit |
229ac0 |
typedef int (*generator_cb_t)(struct test_generator *gen,
|
|
Packit |
229ac0 |
snd_pcm_access_t access,
|
|
Packit |
229ac0 |
snd_pcm_format_t sample_format,
|
|
Packit |
229ac0 |
unsigned int samples_per_frame,
|
|
Packit |
229ac0 |
void *frame_buffer, unsigned int frame_count);
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
struct test_generator {
|
|
Packit |
229ac0 |
int fd;
|
|
Packit |
229ac0 |
uint64_t access_mask;
|
|
Packit |
229ac0 |
uint64_t sample_format_mask;
|
|
Packit |
229ac0 |
unsigned int min_samples_per_frame;
|
|
Packit |
229ac0 |
unsigned int max_samples_per_frame;
|
|
Packit |
229ac0 |
unsigned int min_frame_count;
|
|
Packit |
229ac0 |
unsigned int max_frame_count;
|
|
Packit |
229ac0 |
unsigned int step_frame_count;
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
generator_cb_t cb;
|
|
Packit |
229ac0 |
void *private_data;
|
|
Packit |
229ac0 |
};
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
int generator_context_init(struct test_generator *gen,
|
|
Packit |
229ac0 |
uint64_t access_mask, uint64_t sample_format_mask,
|
|
Packit |
229ac0 |
unsigned int min_samples_per_frame,
|
|
Packit |
229ac0 |
unsigned int max_samples_per_frame,
|
|
Packit |
229ac0 |
unsigned int min_frame_count,
|
|
Packit |
229ac0 |
unsigned int max_frame_count,
|
|
Packit |
229ac0 |
unsigned int step_frame_count,
|
|
Packit |
229ac0 |
unsigned int private_size);
|
|
Packit |
229ac0 |
int generator_context_run(struct test_generator *gen, generator_cb_t cb);
|
|
Packit |
229ac0 |
void generator_context_destroy(struct test_generator *gen);
|
|
Packit |
229ac0 |
|
|
Packit |
229ac0 |
#endif
|