diff options
author | Max Kellermann <max@duempel.org> | 2011-09-17 19:44:30 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-17 19:44:30 +0200 |
commit | 423ce9557a7d2068292a95ceedc6c57982a231a0 (patch) | |
tree | afc6106a903449f9dbe1d0f296f772d25fb4e4aa /src | |
parent | 947848ebf6eb4706e8b3a88e7506e893b01f9a07 (diff) | |
download | mpd-423ce9557a7d2068292a95ceedc6c57982a231a0.tar.gz mpd-423ce9557a7d2068292a95ceedc6c57982a231a0.tar.xz mpd-423ce9557a7d2068292a95ceedc6c57982a231a0.zip |
output/raop: don't expose internal structs in public header
Diffstat (limited to 'src')
-rw-r--r-- | src/output/raop_output_plugin.c | 93 | ||||
-rw-r--r-- | src/output/raop_output_plugin.h | 98 |
2 files changed, 95 insertions, 96 deletions
diff --git a/src/output/raop_output_plugin.c b/src/output/raop_output_plugin.c index 735aea976..c82dd3c1a 100644 --- a/src/output/raop_output_plugin.c +++ b/src/output/raop_output_plugin.c @@ -21,11 +21,14 @@ #include "output_api.h" #include "mixer_list.h" #include "raop_output_plugin.h" +#include "ntp_server.h" #include "rtsp_client.h" #include "glib_compat.h" #include <glib.h> #include <unistd.h> +#include <sys/time.h> +#include <openssl/aes.h> #include <openssl/err.h> #include <openssl/rand.h> #include <openssl/rsa.h> @@ -40,6 +43,96 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "raop" +struct play_state { + bool playing; + unsigned short seq_num; + unsigned int rtptime; + unsigned int sync_src; + unsigned int start_rtptime; + struct timeval start_time; + struct timeval last_send; +}; + +/*********************************************************************/ + +enum pause_state { + NO_PAUSE = 0, + OP_PAUSE, + NODATA_PAUSE, +}; + +#define MINIMUM_SAMPLE_SIZE 32 + +#define RAOP_FD_READ (1<<0) +#define RAOP_FD_WRITE (1<<1) + +/*********************************************************************/ + +struct encrypt_data { + AES_KEY ctx; + unsigned char iv[16]; // initialization vector for aes-cbc + unsigned char nv[16]; // next vector for aes-cbc + unsigned char key[16]; // key for aes-cbc +}; + +/*********************************************************************/ + +struct raop_data { + struct rtspcl_data *rtspcl; + const char *addr; // target host address + short rtsp_port; + struct sockaddr_in ctrl_addr; + struct sockaddr_in data_addr; + + bool is_master; + struct raop_data *next; + + unsigned volume; + + GMutex *control_mutex; + + bool started; + bool paused; +}; + +/*********************************************************************/ + +struct control_data { + unsigned short port; + int fd; +}; + +/*********************************************************************/ + +#define NUMSAMPLES 352 +#define RAOP_BUFFER_SIZE NUMSAMPLES * 4 +#define RAOP_HEADER_SIZE 12 +#define ALAC_MAX_HEADER_SIZE 8 +#define RAOP_MAX_PACKET_SIZE RAOP_BUFFER_SIZE + RAOP_HEADER_SIZE + ALAC_MAX_HEADER_SIZE + +// session +struct raop_session_data { + struct raop_data *raop_list; + struct ntp_server ntp; + struct control_data ctrl; + struct encrypt_data encrypt; + struct play_state play_state; + + int data_fd; + + unsigned char buffer[RAOP_BUFFER_SIZE]; + size_t bufferSize; + + unsigned char data[RAOP_MAX_PACKET_SIZE]; + int wblk_wsize; + int wblk_remsize; + + GMutex *data_mutex; + GMutex *list_mutex; +}; + +/*********************************************************************/ + static struct raop_session_data *raop_session = NULL; /** diff --git a/src/output/raop_output_plugin.h b/src/output/raop_output_plugin.h index 210237179..bdc1e1a75 100644 --- a/src/output/raop_output_plugin.h +++ b/src/output/raop_output_plugin.h @@ -20,105 +20,11 @@ #ifndef MPD_OUTPUT_RAOP_PLUGIN_H #define MPD_OUTPUT_RAOP_PLUGIN_H -#include "ntp_server.h" -#include "rtsp_client.h" - #include <glib.h> -#include <stdbool.h> -#include <sys/time.h> -#include <openssl/aes.h> - -struct play_state { - bool playing; - unsigned short seq_num; - unsigned int rtptime; - unsigned int sync_src; - unsigned int start_rtptime; - struct timeval start_time; - struct timeval last_send; -}; - -/*********************************************************************/ - -enum pause_state { - NO_PAUSE = 0, - OP_PAUSE, - NODATA_PAUSE, -}; - -#define MINIMUM_SAMPLE_SIZE 32 - -#define RAOP_FD_READ (1<<0) -#define RAOP_FD_WRITE (1<<1) - -/*********************************************************************/ - -struct encrypt_data { - AES_KEY ctx; - unsigned char iv[16]; // initialization vector for aes-cbc - unsigned char nv[16]; // next vector for aes-cbc - unsigned char key[16]; // key for aes-cbc -}; - -/*********************************************************************/ - -struct raop_data { - struct rtspcl_data *rtspcl; - const char *addr; // target host address - short rtsp_port; - struct sockaddr_in ctrl_addr; - struct sockaddr_in data_addr; - - bool is_master; - struct raop_data *next; - - unsigned volume; - GMutex *control_mutex; - - bool started; - bool paused; -}; - -/*********************************************************************/ - -struct control_data { - unsigned short port; - int fd; -}; - -/*********************************************************************/ - -#define NUMSAMPLES 352 -#define RAOP_BUFFER_SIZE NUMSAMPLES * 4 -#define RAOP_HEADER_SIZE 12 -#define ALAC_MAX_HEADER_SIZE 8 -#define RAOP_MAX_PACKET_SIZE RAOP_BUFFER_SIZE + RAOP_HEADER_SIZE + ALAC_MAX_HEADER_SIZE - -// session -struct raop_session_data { - struct raop_data *raop_list; - struct ntp_server ntp; - struct control_data ctrl; - struct encrypt_data encrypt; - struct play_state play_state; - - int data_fd; - - unsigned char buffer[RAOP_BUFFER_SIZE]; - size_t bufferSize; - - unsigned char data[RAOP_MAX_PACKET_SIZE]; - int wblk_wsize; - int wblk_remsize; - - GMutex *data_mutex; - GMutex *list_mutex; -}; - -//static struct raop_session_data *raop_session; +#include <stdbool.h> -/*********************************************************************/ +struct raop_data; bool raop_set_volume(struct raop_data *rd, unsigned volume, GError **error_r); |