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;
|
|
|
|
};
|
|
|
|
|
2014-05-18 11:19:50 -04:00
|
|
|
/* Keep in sync with raop_devtype[] in player.c */
|
2010-10-07 13:37:05 -04:00
|
|
|
enum raop_devtype {
|
2014-05-18 11:19:50 -04:00
|
|
|
RAOP_DEV_APEX1_80211G,
|
|
|
|
RAOP_DEV_APEX2_80211N,
|
|
|
|
RAOP_DEV_APEX3_80211N,
|
2010-10-07 13:37:05 -04:00
|
|
|
RAOP_DEV_APPLETV,
|
2014-05-18 11:19:50 -04:00
|
|
|
RAOP_DEV_OTHER,
|
2010-10-07 13:37:05 -04:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2014-05-18 11:19:50 -04:00
|
|
|
unsigned encrypt:1;
|
2013-11-23 05:25:30 -05:00
|
|
|
unsigned wants_metadata:1;
|
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-11-19 16:51:46 -05:00
|
|
|
int relvol;
|
2010-05-02 05:32:16 -04:00
|
|
|
struct raop_session *session;
|
|
|
|
|
|
|
|
struct raop_device *next;
|
|
|
|
};
|
|
|
|
|
2015-03-31 17:05:24 -04:00
|
|
|
struct raop_metadata_arg
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
uint64_t rtptime;
|
|
|
|
uint64_t offset;
|
|
|
|
int startup;
|
|
|
|
};
|
|
|
|
|
2010-05-02 05:32:16 -04:00
|
|
|
/* 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);
|
|
|
|
|
|
|
|
|
2011-03-08 16:04:48 -05:00
|
|
|
void
|
|
|
|
raop_metadata_purge(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
raop_metadata_prune(uint64_t rtptime);
|
|
|
|
|
|
|
|
|
2010-05-02 05:32:16 -04:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
2011-03-08 16:04:48 -05:00
|
|
|
void
|
2015-03-31 17:05:24 -04:00
|
|
|
raop_metadata_send(struct raop_metadata_arg *rma);
|
2011-03-08 16:04:48 -05:00
|
|
|
|
2010-05-02 05:32:16 -04:00
|
|
|
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
|
2011-03-15 12:55:57 -04:00
|
|
|
raop_init(int *v6enabled);
|
2010-05-02 05:32:16 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
raop_deinit(void);
|
|
|
|
|
|
|
|
#endif /* !__RAOP_H__ */
|