Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
423ce955
Commit
423ce955
authored
Sep 17, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/raop: don't expose internal structs in public header
parent
947848eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
96 deletions
+95
-96
raop_output_plugin.c
src/output/raop_output_plugin.c
+93
-0
raop_output_plugin.h
src/output/raop_output_plugin.h
+2
-96
No files found.
src/output/raop_output_plugin.c
View file @
423ce955
...
...
@@ -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
;
/**
...
...
src/output/raop_output_plugin.h
View file @
423ce955
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment