-
Notifications
You must be signed in to change notification settings - Fork 40
/
mod_audio_stream.h
48 lines (40 loc) · 1.24 KB
/
mod_audio_stream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MOD_AUDIO_STREAM_H
#define MOD_AUDIO_STREAM_H
#include <switch.h>
#include <speex/speex_resampler.h>
#include "buffer/ringbuffer.h"
#define MY_BUG_NAME "audio_stream"
#define MAX_SESSION_ID (256)
#define MAX_WS_URI (4096)
#define MAX_METADATA_LEN (8192)
#define EVENT_CONNECT "mod_audio_stream::connect"
#define EVENT_DISCONNECT "mod_audio_stream::disconnect"
#define EVENT_ERROR "mod_audio_stream::error"
#define EVENT_JSON "mod_audio_stream::json"
#define EVENT_PLAY "mod_audio_stream::play"
typedef void (*responseHandler_t)(switch_core_session_t* session, const char* eventName, const char* json);
struct private_data {
switch_mutex_t *mutex;
char sessionId[MAX_SESSION_ID];
SpeexResamplerState *resampler;
responseHandler_t responseHandler;
void *pAudioStreamer;
char ws_uri[MAX_WS_URI];
int sampling;
int channels;
int audio_paused:1;
int close_requested:1;
char initialMetadata[8192];
RingBuffer *buffer;
switch_buffer_t *sbuffer;
uint8_t *data;
int rtp_packets;
};
typedef struct private_data private_t;
enum notifyEvent_t {
CONNECT_SUCCESS,
CONNECT_ERROR,
CONNECTION_DROPPED,
MESSAGE
};
#endif //MOD_AUDIO_STREAM_H