mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 03:35:42 +01:00
a5f21d610d
In usual use case of aplay, single file is used to playback or capture data frames. This commit adds support of single type mapper for this use case. All of supported file format can include data frame with interleaved alignment, thus this mapper have a functionality to convert from several types of data frame alignment to interleaved alignment or vise versa. When handling non-interleaved buffer, a caller should use an array of buffer for each of channels with non-interleaved data frames. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
83 lines
2.2 KiB
C
83 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
//
|
|
// mapper.h - an interface of muxer/demuxer between buffer with data frames and
|
|
// formatted files.
|
|
//
|
|
// 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_MAPPER__H_
|
|
#define __ALSA_UTILS_AXFER_MAPPER__H_
|
|
|
|
#include "container.h"
|
|
|
|
enum mapper_type {
|
|
MAPPER_TYPE_MUXER = 0,
|
|
MAPPER_TYPE_DEMUXER,
|
|
MAPPER_TYPE_COUNT,
|
|
};
|
|
|
|
enum mapper_target {
|
|
MAPPER_TARGET_SINGLE = 0,
|
|
MAPPER_TARGET_COUNT,
|
|
};
|
|
|
|
struct mapper_ops;
|
|
|
|
struct mapper_context {
|
|
enum mapper_type type;
|
|
enum mapper_target target;
|
|
const struct mapper_ops *ops;
|
|
unsigned int private_size;
|
|
|
|
void *private_data;
|
|
unsigned int cntr_count;
|
|
|
|
// A part of parameters of PCM substream.
|
|
snd_pcm_access_t access;
|
|
unsigned int bytes_per_sample;
|
|
unsigned int samples_per_frame;
|
|
snd_pcm_uframes_t frames_per_buffer;
|
|
|
|
unsigned int verbose;
|
|
};
|
|
|
|
int mapper_context_init(struct mapper_context *mapper,
|
|
enum mapper_type type, unsigned int cntr_count,
|
|
unsigned int verbose);
|
|
int mapper_context_pre_process(struct mapper_context *mapper,
|
|
snd_pcm_access_t access,
|
|
unsigned int bytes_per_sample,
|
|
unsigned int samples_per_frame,
|
|
unsigned int frames_per_buffer,
|
|
struct container_context *cntrs);
|
|
int mapper_context_process_frames(struct mapper_context *mapper,
|
|
void *frame_buffer,
|
|
unsigned int *frame_count,
|
|
struct container_context *cntrs);
|
|
void mapper_context_post_process(struct mapper_context *mapper);
|
|
void mapper_context_destroy(struct mapper_context *mapper);
|
|
|
|
// For internal use in 'mapper' module.
|
|
|
|
struct mapper_ops {
|
|
int (*pre_process)(struct mapper_context *mapper,
|
|
struct container_context *cntrs,
|
|
unsigned int cntr_count);
|
|
int (*process_frames)(struct mapper_context *mapper,
|
|
void *frame_buffer, unsigned int *frame_count,
|
|
struct container_context *cntrs,
|
|
unsigned int cntr_count);
|
|
void (*post_process)(struct mapper_context *mapper);
|
|
};
|
|
|
|
struct mapper_data {
|
|
struct mapper_ops ops;
|
|
unsigned int private_size;
|
|
};
|
|
|
|
extern const struct mapper_data mapper_muxer_single;
|
|
extern const struct mapper_data mapper_demuxer_single;
|
|
|
|
#endif
|