diff options
author | hark <hark@puscii.nl> | 2016-03-25 03:33:09 +0000 |
---|---|---|
committer | hark <hark@puscii.nl> | 2016-03-25 03:33:09 +0000 |
commit | 2f5ca7693694fe917b9e322f6dc1692a5cbaacbf (patch) | |
tree | 46dc0cceb783ba5fac5fd30e9a631d6578abf233 /src/conversation/gnunet_gst_def.h | |
parent | 22d081dc59a8e94b41879606a6927c658cc76d29 (diff) | |
download | gnunet-2f5ca7693694fe917b9e322f6dc1692a5cbaacbf.tar.gz gnunet-2f5ca7693694fe917b9e322f6dc1692a5cbaacbf.zip |
experimental gstreamer audiobackend (not working)
Diffstat (limited to 'src/conversation/gnunet_gst_def.h')
-rw-r--r-- | src/conversation/gnunet_gst_def.h | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/src/conversation/gnunet_gst_def.h b/src/conversation/gnunet_gst_def.h new file mode 100644 index 000000000..2e6903db4 --- /dev/null +++ b/src/conversation/gnunet_gst_def.h | |||
@@ -0,0 +1,190 @@ | |||
1 | #include <getopt.h> | ||
2 | #include <string.h> | ||
3 | #include <stdio.h> | ||
4 | #include <ctype.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <unistd.h> | ||
7 | #include <time.h> | ||
8 | #include <regex.h> | ||
9 | |||
10 | |||
11 | #include "gnunet/platform.h" | ||
12 | #include "gnunet/gnunet_util_lib.h" | ||
13 | #include "gnunet/gnunet_protocols.h" | ||
14 | //#include "gnunet/conversation.h" doesn't get installed | ||
15 | #include "conversation.h" | ||
16 | #include "gnunet/gnunet_constants.h" | ||
17 | #include "gnunet/gnunet_core_service.h" | ||
18 | #include "gnunet/gnunet_common.h" | ||
19 | |||
20 | /* | ||
21 | #include <gst/gst.h> | ||
22 | #include <gst/audio/gstaudiobasesrc.h> | ||
23 | #include <gst/app/gstappsrc.h> | ||
24 | */ | ||
25 | |||
26 | /* huh | ||
27 | #include <glib-2.0/glib.h> | ||
28 | |||
29 | #include <gstreamer-1.0/gst/gst.h> | ||
30 | #include <gstreamer-1.0/gst/pbutils/pbutils.h> | ||
31 | #include <gstreamer-1.0/gst/video/videooverlay.h> | ||
32 | #include <gstreamer-1.0/gst/audio/gstaudiobasesrc.h> | ||
33 | #include <gstreamer-1.0/gst/app/gstappsrc.h> | ||
34 | */ | ||
35 | |||
36 | #include <gst/gst.h> | ||
37 | #include <gst/audio/gstaudiobasesrc.h> | ||
38 | #include <gst/app/gstappsrc.h> | ||
39 | #include <glib.h> | ||
40 | #include <gst/app/gstappsink.h> | ||
41 | |||
42 | // sockets | ||
43 | #include <netinet/in.h> | ||
44 | #include <sys/socket.h> | ||
45 | #include <fcntl.h> | ||
46 | #include <arpa/inet.h> | ||
47 | |||
48 | #include <sys/types.h> | ||
49 | #include <sys/socket.h> | ||
50 | #include <netdb.h> | ||
51 | |||
52 | |||
53 | //glib stuff | ||
54 | //#include <glib.h> | ||
55 | #include <glib-2.0/glib/gprintf.h> | ||
56 | #include <glib-unix.h> | ||
57 | |||
58 | // static struct AudioMessage *audio_message; | ||
59 | |||
60 | |||
61 | |||
62 | typedef struct GNUNET_gstData GNUNET_gstData; | ||
63 | struct GNUNET_gstData { | ||
64 | //general | ||
65 | GstPipeline *pipeline; | ||
66 | |||
67 | // things | ||
68 | struct AudioMessage *audio_message; | ||
69 | struct GNUNET_SERVER_MessageStreamTokenizer *stdin_mst; | ||
70 | GstElement *appsrc; | ||
71 | GstElement *appsink; | ||
72 | //settings | ||
73 | int audiobackend; | ||
74 | int dropsilence; | ||
75 | int usertp; | ||
76 | int pure_ogg; | ||
77 | char *jack_pp_in; | ||
78 | char *jack_pp_out; | ||
79 | }; | ||
80 | |||
81 | |||
82 | |||
83 | |||
84 | #define DEBUG_READ_PURE_OGG 1 | ||
85 | #define DEBUG_RECORD_PURE_OGG 1 | ||
86 | |||
87 | |||
88 | /** | ||
89 | * How much data to read in one go | ||
90 | */ | ||
91 | #define MAXLINE 4096 | ||
92 | |||
93 | /** | ||
94 | * Max number of microseconds to buffer in audiosink. | ||
95 | * Default is 1000 | ||
96 | */ | ||
97 | #define BUFFER_TIME 1000 | ||
98 | |||
99 | /** | ||
100 | * Min number of microseconds to buffer in audiosink. | ||
101 | * Default is 1000 | ||
102 | */ | ||
103 | #define LATENCY_TIME 1000 | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Number of channels. | ||
108 | * Must be one of the following (from libopusenc documentation): | ||
109 | * 1, 2 | ||
110 | */ | ||
111 | #define OPUS_CHANNELS 1 | ||
112 | |||
113 | /** | ||
114 | * Maximal size of a single opus packet. | ||
115 | */ | ||
116 | #define MAX_PAYLOAD_SIZE (1024 / OPUS_CHANNELS) | ||
117 | |||
118 | /** | ||
119 | * Size of a single frame fed to the encoder, in ms. | ||
120 | * Must be one of the following (from libopus documentation): | ||
121 | * 2.5, 5, 10, 20, 40 or 60 | ||
122 | */ | ||
123 | #define OPUS_FRAME_SIZE 40 | ||
124 | |||
125 | /** | ||
126 | * Expected packet loss to prepare for, in percents. | ||
127 | */ | ||
128 | #define PACKET_LOSS_PERCENTAGE 1 | ||
129 | |||
130 | /** | ||
131 | * Set to 1 to enable forward error correction. | ||
132 | * Set to 0 to disable. | ||
133 | */ | ||
134 | #define INBAND_FEC_MODE 1 | ||
135 | |||
136 | /** | ||
137 | * Max number of microseconds to buffer in audiosource. | ||
138 | * Default is 200000 | ||
139 | */ | ||
140 | #define BUFFER_TIME 1000 /* 1ms */ | ||
141 | |||
142 | /** | ||
143 | * Min number of microseconds to buffer in audiosource. | ||
144 | * Default is 10000 | ||
145 | */ | ||
146 | #define LATENCY_TIME 1000 /* 1ms */ | ||
147 | |||
148 | /** | ||
149 | * Maximum delay in multiplexing streams, in ns. | ||
150 | * Setting this to 0 forces page flushing, which | ||
151 | * decreases delay, but increases overhead. | ||
152 | */ | ||
153 | #define OGG_MAX_DELAY 0 | ||
154 | |||
155 | /** | ||
156 | * Maximum delay for sending out a page, in ns. | ||
157 | * Setting this to 0 forces page flushing, which | ||
158 | * decreases delay, but increases overhead. | ||
159 | */ | ||
160 | #define OGG_MAX_PAGE_DELAY 0 | ||
161 | |||
162 | #define SAMPLING_RATE 48000 | ||
163 | |||
164 | enum { | ||
165 | AUTO, | ||
166 | JACK, | ||
167 | ALSA, | ||
168 | FAKE, | ||
169 | TEST | ||
170 | }; | ||
171 | |||
172 | enum { | ||
173 | SOURCE, | ||
174 | SINK | ||
175 | }; | ||
176 | |||
177 | enum { | ||
178 | ENCODER, | ||
179 | DECODER | ||
180 | }; | ||
181 | |||
182 | enum { | ||
183 | FAIL, | ||
184 | OK | ||
185 | }; | ||
186 | |||
187 | enum { | ||
188 | SPEAKER, | ||
189 | MICROPHONE | ||
190 | }; | ||