blob: af8396a910e4d0a232154ead6924ff4e58a5a597 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#ifndef _CMUMBLE_H_
#define _CMUMBLE_H_
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappbuffer.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <celt/celt.h>
#include <celt/celt_header.h>
#include "mumble.pb-c.h"
#include "messages.h"
struct context {
GMainLoop *loop;
uint32_t session;
gboolean authenticated;
GSocketClient *sock_client;
GSocketConnection *conn;
GSocket *sock;
GPollableInputStream *input;
GOutputStream *output;
uint8_t celt_header_packet[sizeof(CELTHeader)];
CELTHeader celt_header;
CELTMode *celt_mode;
GstElement *record_pipeline;
GstAppSink *sink;
int64_t sequence;
GList *users;
};
struct user {
uint32_t session;
char *name;
uint32_t user_id;
GstElement *pipeline;
GstAppSrc *src;
};
enum udp_message_type {
udp_voice_celt_alpha,
udp_ping,
udp_voice_speex,
udp_voice_celt_beta
};
enum mumble_message {
#define MUMBLE_MSG(a,b) a,
MUMBLE_MSGS
#undef MUMBLE_MSG
};
struct mumble_callbacks {
#define MUMBLE_MSG(a,b) void (* a)(MumbleProto__##a *, struct context *);
MUMBLE_MSGS
#undef MUMBLE_MSG
};
typedef void (*callback_t)(ProtobufCMessage *msg, struct context *);
void
send_msg(struct context *ctx, ProtobufCMessage *msg);
int
recv_msg(struct context *ctx, const struct mumble_callbacks *callbacks);
#endif
|