summaryrefslogtreecommitdiff
path: root/src/audio.h
blob: a54f269dd22d7b179bf1c3ab805768ac87283e1f (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
#ifndef _AUDIO_H_
#define _AUDIO_H_

#include <glib.h>

#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>

#include <celt/celt.h>
#include <celt/celt_header.h>

struct cmumble_audio {
	GstElement *record_pipeline;
	GstAppSink *sink;
	GstElement *src;
	GstElement *cutter;
	GstElement *enc;

	guint bus_watch_id;

	GstClockTime last_time;

	guint8 celt_header_packet[sizeof(CELTHeader)];
	CELTHeader celt_header;
	CELTMode *celt_mode;

	GQueue *buffer_queue;
	GQueue *silence_timestamps;

	gint32 celt_bitstream_version;
};

struct cmumble;
struct cmumble_user;

int
cmumble_audio_init(struct cmumble *cm);

int
cmumble_audio_fini(struct cmumble *cm);

int
cmumble_audio_create_playback_pipeline(struct cmumble *cm,
				       struct cmumble_user *user);

void
cmumble_audio_push(struct cmumble *cm, struct cmumble_user *user,
		   const guint8 *data, gsize size, gint64 sequence);

#endif /* _AUDIO_H_ */