aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/output/raop_output_plugin.c93
-rw-r--r--src/output/raop_output_plugin.h98
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);