Skip to content

Commit 5801681

Browse files
committed
pulse: constify, fix dynlink for pulseaudio v12.99.1+
1 parent 9bd578b commit 5801681

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/dynlink/pulse.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
#include <iostream>
55
#include <atomic>
66

7+
#if PA_CHECK_VERSION(12,99,1)
8+
#define CONST const
9+
#else
10+
#define CONST
11+
#endif
12+
713
#define FUNDEFDECL(x) static decltype(&x) pfn_##x = nullptr
814
#define FUN_UNLOAD(fun) pfn_##fun = nullptr
915
#define FUN_LOAD(h,fun) \
@@ -243,7 +249,7 @@ pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name)
243249
return NULL;
244250
}
245251

246-
pa_context_state_t pa_context_get_state(pa_context *c)
252+
pa_context_state_t pa_context_get_state(CONST pa_context *c)
247253
{
248254
if (pfn_pa_context_get_state)
249255
return pfn_pa_context_get_state(c);
@@ -278,7 +284,7 @@ pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t
278284
return NULL;
279285
}
280286

281-
pa_operation_state_t pa_operation_get_state(pa_operation *o)
287+
pa_operation_state_t pa_operation_get_state(CONST pa_operation *o)
282288
{
283289
if (pfn_pa_operation_get_state)
284290
return pfn_pa_operation_get_state(o);
@@ -425,7 +431,7 @@ int pa_stream_write(pa_stream *p, const void *data, size_t nbytes, pa_free_cb_t
425431
return PA_ERR_NOTIMPLEMENTED;
426432
}
427433

428-
pa_stream_state_t pa_stream_get_state(pa_stream *p)
434+
pa_stream_state_t pa_stream_get_state(CONST pa_stream *p)
429435
{
430436
if (pfn_pa_stream_get_state)
431437
return pfn_pa_stream_get_state(p);
@@ -439,7 +445,7 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
439445
return NULL;
440446
}
441447

442-
int pa_stream_is_corked(pa_stream *s)
448+
int pa_stream_is_corked(CONST pa_stream *s)
443449
{
444450
if (pfn_pa_stream_is_corked)
445451
return pfn_pa_stream_is_corked (s);
@@ -470,7 +476,7 @@ void pa_threaded_mainloop_wait(pa_threaded_mainloop *m)
470476
pfn_pa_threaded_mainloop_wait(m);
471477
}
472478

473-
int pa_stream_is_suspended(pa_stream *s)
479+
int pa_stream_is_suspended(CONST pa_stream *s)
474480
{
475481
if (pfn_pa_stream_is_suspended)
476482
return pfn_pa_stream_is_suspended(s);

0 commit comments

Comments
 (0)