mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 03:35:42 +01:00
c2f79d9fdf
In alsa-lib PCM API, snd_pcm_read[i|n]() and snd_pcm_write[i|n]() are used to transfer data frames from/to hardware. When a handler is not opened with specific flags, these functions perform blocking operation; i.e. the function call doesn't return till all of request number of data frames are actually handled, or call is interrupted by Unix signals, or PCM substeam corrupts due to hardware reasons. This commit adds support for this type of data transmission. For cases that requested data frames are not processed by container interface, this commit adds internal cache mechanism to handle rest of data frames in next timing. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
//
|
|
// xfer-libasound.h - a header for receiver/transmitter of frames by alsa-lib.
|
|
//
|
|
// Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
|
|
//
|
|
// Licensed under the terms of the GNU General Public License, version 2.
|
|
|
|
#ifndef __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
|
|
#define __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
|
|
|
|
#include "xfer.h"
|
|
|
|
#define logging(state, ...) \
|
|
snd_output_printf(state->log, __VA_ARGS__)
|
|
|
|
struct xfer_libasound_ops;
|
|
|
|
struct libasound_state {
|
|
snd_pcm_t *handle;
|
|
|
|
snd_output_t *log;
|
|
snd_pcm_hw_params_t *hw_params;
|
|
snd_pcm_sw_params_t *sw_params;
|
|
|
|
const struct xfer_libasound_ops *ops;
|
|
void *private_data;
|
|
|
|
bool verbose;
|
|
|
|
char *node_literal;
|
|
};
|
|
|
|
// For internal use in 'libasound' module.
|
|
|
|
struct xfer_libasound_ops {
|
|
int (*pre_process)(struct libasound_state *state);
|
|
int (*process_frames)(struct libasound_state *state,
|
|
unsigned int *frame_count,
|
|
struct mapper_context *mapper,
|
|
struct container_context *cntrs);
|
|
void (*post_process)(struct libasound_state *state);
|
|
unsigned int private_size;
|
|
};
|
|
|
|
extern const struct xfer_libasound_ops xfer_libasound_irq_rw_ops;
|
|
|
|
#endif
|