summaryrefslogtreecommitdiff
path: root/src/symversioning-hell.h
blob: f3e9b35a314842b6be077d49b9f7c34f1cc1a1f9 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// symversioning... jesus fucking christ... stop doing this people...
// below is madness copied from upstream libasound's src/pcm/pcm.c

#define __SYMBOL_PREFIX ""
#define ASM_NAME(name) __SYMBOL_PREFIX name
#define INTERNAL(Name) Name

#define symbol_version(real, name, version) \
   __asm__(".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
#define default_symbol_version(real, name, version) \
   __asm__(".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)

#define OBSOLETE1(name, what, new) \
  default_symbol_version(__##name, name, new); \
  symbol_version(__old_##name, name, what);

#define __P_OLD_GET(pfx, name, val_type, ret_type) \
ret_type pfx##name(const snd_pcm_hw_params_t *params) \
{ \
   val_type val; \
   if (INTERNAL(name)(params, &val) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __P_OLD_GET1(pfx, name, val_type, ret_type) \
ret_type pfx##name(const snd_pcm_hw_params_t *params, int *dir) \
{ \
   val_type val; \
   if (INTERNAL(name)(params, &val, dir) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __OLD_GET(name, val_type, ret_type) __P_OLD_GET(__old_, name, val_type, ret_type)
#define __OLD_GET1(name, val_type, ret_type) __P_OLD_GET1(__old_, name, val_type, ret_type)

__OLD_GET(snd_pcm_hw_params_get_access, snd_pcm_access_t, int)
__OLD_GET(snd_pcm_hw_params_get_format, snd_pcm_format_t, int)
__OLD_GET(snd_pcm_hw_params_get_subformat, snd_pcm_subformat_t, int)
__OLD_GET(snd_pcm_hw_params_get_channels, unsigned intint)
__OLD_GET1(snd_pcm_hw_params_get_rate, unsigned intint)
__OLD_GET1(snd_pcm_hw_params_get_period_time, unsigned intint)
__OLD_GET1(snd_pcm_hw_params_get_period_size, snd_pcm_uframes_t, snd_pcm_sframes_t)
__OLD_GET1(snd_pcm_hw_params_get_periods, unsigned intint)
__OLD_GET1(snd_pcm_hw_params_get_buffer_time, unsigned intint)
__OLD_GET(snd_pcm_hw_params_get_buffer_size, snd_pcm_uframes_t, snd_pcm_sframes_t)
__OLD_GET1(snd_pcm_hw_params_get_tick_time, unsigned intint)

__OLD_GET(snd_pcm_hw_params_get_channels_min, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_rate_min, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_period_time_min, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_period_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t)
__OLD_GET1(snd_pcm_hw_params_get_periods_min, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_buffer_time_min, unsigned intunsigned int)
__OLD_GET(snd_pcm_hw_params_get_buffer_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t)
__OLD_GET1(snd_pcm_hw_params_get_tick_time_min, unsigned intunsigned int)

__OLD_GET(snd_pcm_hw_params_get_channels_max, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_rate_max, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_period_time_max, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_period_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t)
__OLD_GET1(snd_pcm_hw_params_get_periods_max, unsigned intunsigned int)
__OLD_GET1(snd_pcm_hw_params_get_buffer_time_max, unsigned intunsigned int)
__OLD_GET(snd_pcm_hw_params_get_buffer_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t)
__OLD_GET1(snd_pcm_hw_params_get_tick_time_max, unsigned intunsigned int)

#define __P_OLD_NEAR(pfx, name, ret_type) \
ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val) \
{ \
   if (INTERNAL(name)(pcm, params, &val) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __P_OLD_NEAR1(pfx, name, ret_type) \
ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val, int *dir) \
{ \
   if (INTERNAL(name)(pcm, params, &val, dir) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __OLD_NEAR(name, ret_type) __P_OLD_NEAR(__old_, name, ret_type)
#define __OLD_NEAR1(name, ret_type) __P_OLD_NEAR1(__old_, name, ret_type)

__OLD_NEAR(snd_pcm_hw_params_set_channels_near, unsigned int)
__OLD_NEAR1(snd_pcm_hw_params_set_rate_near, unsigned int)
__OLD_NEAR1(snd_pcm_hw_params_set_period_time_near, unsigned int)
__OLD_NEAR1(snd_pcm_hw_params_set_period_size_near, snd_pcm_uframes_t)
__OLD_NEAR1(snd_pcm_hw_params_set_periods_near, unsigned int)
__OLD_NEAR1(snd_pcm_hw_params_set_buffer_time_near, unsigned int)
__OLD_NEAR(snd_pcm_hw_params_set_buffer_size_near, snd_pcm_uframes_t)
__OLD_NEAR1(snd_pcm_hw_params_set_tick_time_near, unsigned int)

#define __P_OLD_SET_FL(pfx, name, ret_type) \
ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) \
{ \
   ret_type val; \
   if (INTERNAL(name)(pcm, params, &val) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __P_OLD_SET_FL1(pfx, name, ret_type) \
ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) \
{ \
   ret_type val; \
   if (INTERNAL(name)(pcm, params, &val, dir) < 0) \
      return 0; \
   return (ret_type)val; \
}

#define __OLD_SET_FL(name, ret_type) __P_OLD_SET_FL(__old_, name, ret_type)
#define __OLD_SET_FL1(name, ret_type) __P_OLD_SET_FL1(__old_, name, ret_type)

__OLD_SET_FL(snd_pcm_hw_params_set_access_first, snd_pcm_access_t)
__OLD_SET_FL(snd_pcm_hw_params_set_format_first, snd_pcm_format_t)
__OLD_SET_FL(snd_pcm_hw_params_set_subformat_first, snd_pcm_subformat_t)
__OLD_SET_FL(snd_pcm_hw_params_set_channels_first, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_rate_first, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_first, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_first, snd_pcm_uframes_t)
__OLD_SET_FL1(snd_pcm_hw_params_set_periods_first, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_first, unsigned int)
__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_first, snd_pcm_uframes_t)
__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_first, unsigned int)

__OLD_SET_FL(snd_pcm_hw_params_set_access_last, snd_pcm_access_t)
__OLD_SET_FL(snd_pcm_hw_params_set_format_last, snd_pcm_format_t)
__OLD_SET_FL(snd_pcm_hw_params_set_subformat_last, snd_pcm_subformat_t)
__OLD_SET_FL(snd_pcm_hw_params_set_channels_last, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_rate_last, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_last, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_last, snd_pcm_uframes_t)
__OLD_SET_FL1(snd_pcm_hw_params_set_periods_last, unsigned int)
__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_last, unsigned int)
__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_last, snd_pcm_uframes_t)
__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_last, unsigned int)

#define __P_OLD_GET_SW(pfx, name, ret_type) \
ret_type pfx##name(snd_pcm_sw_params_t *params) \
{ \
        ret_type val; \
        if (INTERNAL(name)(params, &val) < 0) \
                return 0; \
        return (ret_type)val; \
}

#define __OLD_GET_SW(name, ret_type) __P_OLD_GET_SW(__old_, name, ret_type)

__OLD_GET_SW(snd_pcm_sw_params_get_tstamp_mode, snd_pcm_tstamp_t)
__OLD_GET_SW(snd_pcm_sw_params_get_sleep_min, unsigned int)
__OLD_GET_SW(snd_pcm_sw_params_get_avail_min, snd_pcm_uframes_t)
__OLD_GET_SW(snd_pcm_sw_params_get_xfer_align, snd_pcm_uframes_t)
__OLD_GET_SW(snd_pcm_sw_params_get_start_threshold, snd_pcm_uframes_t)
__OLD_GET_SW(snd_pcm_sw_params_get_stop_threshold, snd_pcm_uframes_t)
__OLD_GET_SW(snd_pcm_sw_params_get_silence_threshold, snd_pcm_uframes_t)
__OLD_GET_SW(snd_pcm_sw_params_get_silence_size, snd_pcm_uframes_t)

OBSOLETE1(snd_pcm_hw_params_get_access, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_access_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_access_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_format, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_format_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_format_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_subformat, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_subformat_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_subformat_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_channels, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_channels_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_channels_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_channels_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_channels_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_channels_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_rate, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_rate_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_rate_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_rate_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_rate_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_rate_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_period_time, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_period_time_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_period_time_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_time_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_time_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_time_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_period_size, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_period_size_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_period_size_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_size_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_size_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_period_size_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_periods, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_periods_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_periods_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_periods_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_periods_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_periods_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_buffer_time, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_buffer_time_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_buffer_time_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_time_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_time_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_time_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_buffer_size, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_buffer_size_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_buffer_size_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_size_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_size_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_buffer_size_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_hw_params_get_tick_time, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_tick_time_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_get_tick_time_max, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_tick_time_near, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_tick_time_first, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_hw_params_set_tick_time_last, ALSA_0.9, ALSA_0.9.0rc4)

OBSOLETE1(snd_pcm_sw_params_get_tstamp_mode, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_sleep_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_avail_min, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_xfer_align, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_start_threshold, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_stop_threshold, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_silence_threshold, ALSA_0.9, ALSA_0.9.0rc4)
OBSOLETE1(snd_pcm_sw_params_get_silence_size, ALSA_0.9, ALSA_0.9.0rc4)