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,
28 struct mapper_context {
29 enum mapper_type type;
30 enum mapper_target target;
31 const struct mapper_ops *ops;
32 unsigned int private_size;
35 unsigned int cntr_count;
37 // A part of parameters of PCM substream.
38 snd_pcm_access_t access;
39 unsigned int bytes_per_sample;
40 unsigned int samples_per_frame;
41 snd_pcm_uframes_t frames_per_buffer;
46 int mapper_context_init(struct mapper_context *mapper,
47 enum mapper_type type, unsigned int cntr_count,
48 unsigned int verbose);
49 int mapper_context_pre_process(struct mapper_context *mapper,
50 snd_pcm_access_t access,
51 unsigned int bytes_per_sample,
52 unsigned int samples_per_frame,
53 unsigned int frames_per_buffer,
54 struct container_context *cntrs);
55 int mapper_context_process_frames(struct mapper_context *mapper,
57 unsigned int *frame_count,
58 struct container_context *cntrs);
59 void mapper_context_post_process(struct mapper_context *mapper);
60 void mapper_context_destroy(struct mapper_context *mapper);
62 // For internal use in 'mapper' module.
65 int (*pre_process)(struct mapper_context *mapper,
66 struct container_context *cntrs,
67 unsigned int cntr_count);
68 int (*process_frames)(struct mapper_context *mapper,
69 void *frame_buffer, unsigned int *frame_count,
70 struct container_context *cntrs,
71 unsigned int cntr_count);
72 void (*post_process)(struct mapper_context *mapper);
76 struct mapper_ops ops;
77 unsigned int private_size;
80 extern const struct mapper_data mapper_muxer_single;
81 extern const struct mapper_data mapper_demuxer_single;