2010-05-02 05:32:16 -04:00
|
|
|
|
|
|
|
#ifndef __RAOP_H__
|
|
|
|
#define __RAOP_H__
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
#include <event.h>
|
|
|
|
#include "evrtsp/evrtsp.h"
|
|
|
|
|
|
|
|
|
|
|
|
union sockaddr_all
|
|
|
|
{
|
|
|
|
struct sockaddr_in sin;
|
2010-05-14 11:37:55 -04:00
|
|
|
struct sockaddr_in6 sin6;
|
2010-05-02 05:32:16 -04:00
|
|
|
struct sockaddr sa;
|
|
|
|
struct sockaddr_storage ss;
|
|
|
|
};
|
|
|
|
|
2010-10-07 13:37:05 -04:00
|
|
|
enum raop_devtype {
|
|
|
|
RAOP_DEV_APEX_80211G,
|
|
|
|
RAOP_DEV_APEX_80211N,
|
|
|
|
RAOP_DEV_APPLETV,
|
|
|
|
};
|
|
|
|
|
2010-05-02 05:32:16 -04:00
|
|
|
struct raop_session;
|
|
|
|
|
|
|
|
struct raop_device
|
|
|
|
{
|
|
|
|
uint64_t id;
|
|
|
|
char *name;
|
|
|
|
|
2010-05-14 11:37:55 -04:00
|
|
|
char *v4_address;
|
|
|
|
char *v6_address;
|
|
|
|
short v4_port;
|
|
|
|
short v6_port;
|
2010-05-02 05:32:16 -04:00
|
|
|
|
2010-10-07 13:37:05 -04:00
|
|
|
enum raop_devtype devtype;
|
|
|
|
|
2010-07-30 13:05:42 -04:00
|
|
|
unsigned selected:1;
|
|
|
|
unsigned advertised:1;
|
2010-05-02 05:32:16 -04:00
|
|
|
|
2010-07-30 13:05:42 -04:00
|
|
|
unsigned has_password:1;
|
2010-05-02 05:32:16 -04:00
|
|
|
const char *password;
|
|
|
|
|
2010-11-19 15:22:55 -05:00
|
|
|
int volume;
|
2010-05-02 05:32:16 -04:00
|
|
|
struct raop_session *session;
|
|
|
|
|
|
|
|
struct raop_device *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* RAOP session state */
|
|
|
|
|
|
|
|
/* Session is starting up */
|
|
|
|
#define RAOP_F_STARTUP (1 << 15)
|
|
|
|
|
|
|
|
/* Streaming is up (connection established) */
|
|
|
|
#define RAOP_F_CONNECTED (1 << 16)
|
|
|
|
|
|
|
|
enum raop_session_state
|
|
|
|
{
|
|
|
|
RAOP_STOPPED = 0,
|
|
|
|
|
|
|
|
/* Session startup */
|
|
|
|
RAOP_OPTIONS = RAOP_F_STARTUP | 0x01,
|
|
|
|
RAOP_ANNOUNCE = RAOP_F_STARTUP | 0x02,
|
|
|
|
RAOP_SETUP = RAOP_F_STARTUP | 0x03,
|
|
|
|
RAOP_RECORD = RAOP_F_STARTUP | 0x04,
|
|
|
|
|
|
|
|
/* Session established
|
|
|
|
* - streaming ready (RECORD sent and acked, connection established)
|
|
|
|
* - commands (SET_PARAMETER) are possible
|
|
|
|
*/
|
|
|
|
RAOP_CONNECTED = RAOP_F_CONNECTED,
|
|
|
|
|
|
|
|
/* Audio data is being sent */
|
|
|
|
RAOP_STREAMING = RAOP_F_CONNECTED | 0x01,
|
|
|
|
|
|
|
|
/* Session is failed, couldn't startup or error occurred */
|
|
|
|
RAOP_FAILED = -1,
|
|
|
|
|
|
|
|
/* Password issue: unknown password or bad password */
|
|
|
|
RAOP_PASSWORD = -2,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*raop_status_cb)(struct raop_device *dev, struct raop_session *rs, enum raop_session_state status);
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
raop_device_probe(struct raop_device *rd, raop_status_cb cb);
|
|
|
|
|
|
|
|
int
|
|
|
|
raop_device_start(struct raop_device *rd, raop_status_cb cb, uint64_t rtptime);
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_device_stop(struct raop_session *rs);
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_playback_start(uint64_t next_pkt, struct timespec *ts);
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_playback_stop(void);
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2010-11-19 15:49:17 -05:00
|
|
|
raop_set_volume_one(struct raop_session *rs, int volume, raop_status_cb cb);
|
2010-05-02 05:32:16 -04:00
|
|
|
|
|
|
|
int
|
|
|
|
raop_flush(raop_status_cb cb, uint64_t rtptime);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_set_status_cb(struct raop_session *rs, raop_status_cb cb);
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_v2_write(uint8_t *buf, uint64_t rtptime);
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
raop_init(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_deinit(void);
|
|
|
|
|
|
|
|
#endif /* !__RAOP_H__ */
|