1 // SPDX-License-Identifier: GPL-2.0
3 // mapper.h - an interface of muxer/demuxer between buffer with data frames and
6 // Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
8 // Licensed under the terms of the GNU General Public License, version 2.
10 #ifndef __ALSA_UTILS_AXFER_MAPPER__H_
11 #define __ALSA_UTILS_AXFER_MAPPER__H_
13 #include "container.h"
16 MAPPER_TYPE_MUXER = 0,
22 MAPPER_TARGET_SINGLE = 0,
23 MAPPER_TARGET_MULTIPLE,
29 struct mapper_context {
30 enum mapper_type type;
31 enum mapper_target target;
32 const struct mapper_ops *ops;
33 unsigned int private_size;
36 unsigned int cntr_count;
38 // A part of parameters of PCM substream.
39 snd_pcm_access_t access;
40 unsigned int bytes_per_sample;
41 unsigned int samples_per_frame;
42 snd_pcm_uframes_t frames_per_buffer;
47 int mapper_context_init(struct mapper_context *mapper,
48 enum mapper_type type, unsigned int cntr_count,
49 unsigned int verbose);
50 int mapper_context_pre_process(struct mapper_context *mapper,
51 snd_pcm_access_t access,
52 unsigned int bytes_per_sample,
53 unsigned int samples_per_frame,
54 unsigned int frames_per_buffer,
55 struct container_context *cntrs);
56 int mapper_context_process_frames(struct mapper_context *mapper,
58 unsigned int *frame_count,
59 struct container_context *cntrs);
60 void mapper_context_post_process(struct mapper_context *mapper);
61 void mapper_context_destroy(struct mapper_context *mapper);
63 // For internal use in 'mapper' module.
66 int (*pre_process)(struct mapper_context *mapper,
67 struct container_context *cntrs,
68 unsigned int cntr_count);
69 int (*process_frames)(struct mapper_context *mapper,
70 void *frame_buffer, unsigned int *frame_count,
71 struct container_context *cntrs,
72 unsigned int cntr_count);
73 void (*post_process)(struct mapper_context *mapper);
77 struct mapper_ops ops;
78 unsigned int private_size;
81 extern const struct mapper_data mapper_muxer_single;
82 extern const struct mapper_data mapper_demuxer_single;
84 extern const struct mapper_data mapper_muxer_multiple;
85 extern const struct mapper_data mapper_demuxer_multiple;