Add cls pointer to the logger
[deb_shairplay.git] / src / include / raop.h
CommitLineData
2340bcd3
JVH
1#ifndef RAOP_H
2#define RAOP_H
f21dfead
JVH
3
4#if defined (WIN32) && defined(DLL_EXPORT)
5# define RAOP_API __declspec(dllexport)
6#else
7# define RAOP_API
8#endif
9
2340bcd3
JVH
10#ifdef __cplusplus
11extern "C" {
12#endif
13
fda63ad4
JVH
14
15/* Define syslog style log levels */
16#define RAOP_LOG_EMERG 0 /* system is unusable */
17#define RAOP_LOG_ALERT 1 /* action must be taken immediately */
18#define RAOP_LOG_CRIT 2 /* critical conditions */
19#define RAOP_LOG_ERR 3 /* error conditions */
20#define RAOP_LOG_WARNING 4 /* warning conditions */
21#define RAOP_LOG_NOTICE 5 /* normal but significant condition */
22#define RAOP_LOG_INFO 6 /* informational */
23#define RAOP_LOG_DEBUG 7 /* debug-level messages */
24
25
2340bcd3
JVH
26typedef struct raop_s raop_t;
27
2975b4b8 28typedef void (*raop_log_callback_t)(void *cls, int level, const char *msg);
fda63ad4 29
2340bcd3
JVH
30struct raop_callbacks_s {
31 void* cls;
fda63ad4
JVH
32
33 /* Compulsory callback functions */
067f00ef 34 void* (*audio_init)(void *cls, int bits, int channels, int samplerate);
fda63ad4
JVH
35 void (*audio_process)(void *cls, void *session, const void *buffer, int buflen);
36 void (*audio_destroy)(void *cls, void *session);
37
38 /* Optional but recommended callback functions */
39 void (*audio_flush)(void *cls, void *session);
2340bcd3 40 void (*audio_set_volume)(void *cls, void *session, float volume);
b4cc5b07
JVH
41 void (*audio_set_metadata)(void *cls, void *session, const void *buffer, int buflen);
42 void (*audio_set_coverart)(void *cls, void *session, const void *buffer, int buflen);
2340bcd3
JVH
43};
44typedef struct raop_callbacks_s raop_callbacks_t;
45
72fe063c
JVH
46RAOP_API raop_t *raop_init(int max_clients, raop_callbacks_t *callbacks, const char *pemkey);
47RAOP_API raop_t *raop_init_from_keyfile(int max_clients, raop_callbacks_t *callbacks, const char *keyfile);
2340bcd3 48
fda63ad4 49RAOP_API void raop_set_log_level(raop_t *raop, int level);
2975b4b8 50RAOP_API void raop_set_log_callback(raop_t *raop, raop_log_callback_t callback, void *cls);
5a746b97 51
e4169f77 52RAOP_API int raop_start(raop_t *raop, unsigned short *port, const char *hwaddr, int hwaddrlen, const char *password);
fda63ad4 53RAOP_API int raop_is_running(raop_t *raop);
f21dfead 54RAOP_API void raop_stop(raop_t *raop);
2340bcd3 55
f21dfead 56RAOP_API void raop_destroy(raop_t *raop);
2340bcd3
JVH
57
58#ifdef __cplusplus
59}
60#endif
61#endif