blob: 98d1bbd8f551124e81594caf70d1b96615b2406e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
// SPDX-License-Identifier: GPL-2.0
/*
* ALSA Virtual Soundcard
*
* core.h - System-level header for virtual ALSA card
*
* Copyright (C) 2010-2018 Fiberdyne Systems Pty Ltd
*/
#ifndef __AVIRT_CORE_H__
#define __AVIRT_CORE_H__
#include <sound/pcm.h>
#define MAX_NAME_LEN 32
/**
* PCM buffer complete callback
*
* These are called from the audiopath when a PCM buffer has completed, and
* new data can be submitted/retrieved
*/
typedef int (*avirt_buff_complete)(struct snd_pcm_substream *substream);
/**
* AVIRT Audio Path info
*/
struct avirt_audiopath {
const char *uid; /* Unique identifier */
const char *name; /* Pretty name */
unsigned int version[3]; /* Version - Major.Minor.Ext */
struct snd_pcm_hardware *hw; /* ALSA PCM HW conf */
struct snd_pcm_ops *pcm_ops; /* ALSA PCM op table */
unsigned int blocksize; /* Audio frame size accepted */
void *context;
};
/*
* ALSA Substream device configuration
*/
struct avirt_alsa_devconfig {
const char devicename[MAX_NAME_LEN];
int channels;
};
/**
* Collection of ALSA devices
*/
struct avirt_alsa_group {
struct avirt_alsa_devconfig *config;
int devices;
};
/**
* AVIRT core info
*/
struct avirt_coreinfo {
unsigned int version[3];
struct avirt_alsa_group playback;
struct avirt_alsa_group capture;
avirt_buff_complete pcm_buff_complete;
};
/**
* avirt_register_audiopath - register Audio Path with ALSA virtual driver
* @audiopath: Audio Path to be registered
* @core: ALSA virtual driver core info
* @return: 0 on success or error code otherwise
*/
int avirt_register_audiopath(struct avirt_audiopath *audiopath,
struct avirt_coreinfo **coreinfo);
/**
* avirt_deregister_audiopath - deregister Audio Path with ALSA virtual driver
* @audiopath: Audio Path to be deregistered
* @return: 0 on success or error code otherwise
*/
int avirt_deregister_audiopath(struct avirt_audiopath *audiopath);
/**
* avirt_get_audiopath - retrieves the Audio Path by it's UID
* @uid: Unique ID for the Audio Path
* @return: Corresponding Audio Path
*/
struct avirt_audiopath *avirt_get_audiopath(const char *uid);
/**
* avirt_subscribe_stream - subscribe the Audio Path to the given streams
* @audiopath: Audio Path to subscribe for
* @streams: The streams to subscribe the Audio Path to
* return: 0 on success or error code otherwise
*/
int avirt_subscribe_stream(struct avirt_audiopath *audiopath,
const char **streams);
#endif // __AVIRT_CORE_H__
|