diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/conversation/gnunet_gst.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/conversation/gnunet_gst.c')
-rw-r--r-- | src/conversation/gnunet_gst.c | 1115 |
1 files changed, 569 insertions, 546 deletions
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c index 5db0d350c..7703215bb 100644 --- a/src/conversation/gnunet_gst.c +++ b/src/conversation/gnunet_gst.c | |||
@@ -31,33 +31,33 @@ static struct GNUNET_CONFIGURATION_Handle *cfg; | |||
31 | 31 | ||
32 | 32 | ||
33 | void | 33 | void |
34 | dump_buffer(unsigned n, const unsigned char* buf) | 34 | dump_buffer (unsigned n, const unsigned char*buf) |
35 | { | 35 | { |
36 | const unsigned char *p, *end; | 36 | const unsigned char *p, *end; |
37 | unsigned i, j; | 37 | unsigned i, j; |
38 | 38 | ||
39 | end = buf + n; | 39 | end = buf + n; |
40 | 40 | ||
41 | for (i = 0; ; i += 16) | 41 | for (i = 0;; i += 16) |
42 | { | ||
43 | p = buf + i; | ||
44 | for (j = 0; j < 16; j++) | ||
42 | { | 45 | { |
43 | p = buf + i; | 46 | fprintf (stderr, "%02X ", p[j]); |
44 | for (j = 0; j < 16; j++) | 47 | if (p + j >= end) |
45 | { | 48 | goto BREAKOUT; |
46 | fprintf(stderr, "%02X ", p[j]); | 49 | } |
47 | if (p + j >= end) | 50 | fprintf (stderr, " "); |
48 | goto BREAKOUT; | 51 | p = buf + i; |
49 | } | 52 | for (j = 0; j < 16; j++) |
50 | fprintf(stderr, " "); | 53 | { |
51 | p = buf + i; | 54 | fprintf (stderr, "%c", isprint (p[j]) ? p[j] : |
52 | for (j = 0; j < 16; j++) | 55 | '.'); |
53 | { | 56 | if (p + j >= end) |
54 | fprintf(stderr, "%c", isprint(p[j]) ? p[j] : | 57 | goto BREAKOUT; |
55 | '.'); | ||
56 | if (p + j >= end) | ||
57 | goto BREAKOUT; | ||
58 | } | ||
59 | fprintf(stderr, "\n"); | ||
60 | } | 58 | } |
59 | fprintf (stderr, "\n"); | ||
60 | } | ||
61 | BREAKOUT: | 61 | BREAKOUT: |
62 | return; | 62 | return; |
63 | } | 63 | } |
@@ -66,102 +66,108 @@ BREAKOUT: | |||
66 | * load gnunet configuration | 66 | * load gnunet configuration |
67 | */ | 67 | */ |
68 | void | 68 | void |
69 | gg_load_configuration(GNUNET_gstData * d) | 69 | gg_load_configuration (GNUNET_gstData *d) |
70 | { | 70 | { |
71 | char *audiobackend_string; | 71 | char *audiobackend_string; |
72 | 72 | ||
73 | cfg = GNUNET_CONFIGURATION_create(); | 73 | cfg = GNUNET_CONFIGURATION_create (); |
74 | GNUNET_CONFIGURATION_load(cfg, "mediahelper.conf"); | 74 | GNUNET_CONFIGURATION_load (cfg, "mediahelper.conf"); |
75 | 75 | ||
76 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_IN", &d->jack_pp_in); | 76 | GNUNET_CONFIGURATION_get_value_string (cfg, "MEDIAHELPER", "JACK_PP_IN", |
77 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_OUT", &d->jack_pp_out); | 77 | &d->jack_pp_in); |
78 | GNUNET_CONFIGURATION_get_value_string (cfg, "MEDIAHELPER", "JACK_PP_OUT", | ||
79 | &d->jack_pp_out); | ||
78 | 80 | ||
79 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "AUDIOBACKEND", &audiobackend_string); | 81 | GNUNET_CONFIGURATION_get_value_string (cfg, "MEDIAHELPER", "AUDIOBACKEND", |
82 | &audiobackend_string); | ||
80 | 83 | ||
81 | // printf("abstring: %s \n", audiobackend_string); | 84 | // printf("abstring: %s \n", audiobackend_string); |
82 | 85 | ||
83 | if (0 == strcasecmp(audiobackend_string, "AUTO")) | 86 | if (0 == strcasecmp (audiobackend_string, "AUTO")) |
84 | { | 87 | { |
85 | d->audiobackend = AUTO; | 88 | d->audiobackend = AUTO; |
86 | } | 89 | } |
87 | else if (0 == strcasecmp(audiobackend_string, "JACK")) | 90 | else if (0 == strcasecmp (audiobackend_string, "JACK")) |
88 | { | 91 | { |
89 | d->audiobackend = JACK; | 92 | d->audiobackend = JACK; |
90 | } | 93 | } |
91 | else if (0 == strcasecmp(audiobackend_string, "ALSA")) | 94 | else if (0 == strcasecmp (audiobackend_string, "ALSA")) |
92 | { | 95 | { |
93 | d->audiobackend = ALSA; | 96 | d->audiobackend = ALSA; |
94 | } | 97 | } |
95 | else if (0 == strcasecmp(audiobackend_string, "FAKE")) | 98 | else if (0 == strcasecmp (audiobackend_string, "FAKE")) |
96 | { | 99 | { |
97 | d->audiobackend = FAKE; | 100 | d->audiobackend = FAKE; |
98 | } | 101 | } |
99 | else if (0 == strcasecmp(audiobackend_string, "TEST")) | 102 | else if (0 == strcasecmp (audiobackend_string, "TEST")) |
100 | { | 103 | { |
101 | d->audiobackend = TEST; | 104 | d->audiobackend = TEST; |
102 | } | 105 | } |
103 | else | 106 | else |
104 | { | 107 | { |
105 | d->audiobackend = AUTO; | 108 | d->audiobackend = AUTO; |
106 | } | 109 | } |
107 | 110 | ||
108 | if (GNUNET_CONFIGURATION_get_value_yesno(cfg, "MEDIAHELPER", "REMOVESILENCE") == GNUNET_YES) | 111 | if (GNUNET_CONFIGURATION_get_value_yesno (cfg, "MEDIAHELPER", |
109 | { | 112 | "REMOVESILENCE") == GNUNET_YES) |
110 | d->dropsilence = TRUE; | 113 | { |
111 | } | 114 | d->dropsilence = TRUE; |
115 | } | ||
112 | else | 116 | else |
113 | { | 117 | { |
114 | d->dropsilence = FALSE; | 118 | d->dropsilence = FALSE; |
115 | } | 119 | } |
116 | 120 | ||
117 | if (GNUNET_CONFIGURATION_get_value_yesno(cfg, "MEDIAHELPER", "NO_GN_HEADERS") == GNUNET_YES) | 121 | if (GNUNET_CONFIGURATION_get_value_yesno (cfg, "MEDIAHELPER", |
118 | { | 122 | "NO_GN_HEADERS") == GNUNET_YES) |
119 | d->pure_ogg = TRUE; | 123 | { |
120 | } | 124 | d->pure_ogg = TRUE; |
125 | } | ||
121 | else | 126 | else |
122 | { | 127 | { |
123 | d->pure_ogg = FALSE; | 128 | d->pure_ogg = FALSE; |
124 | } | 129 | } |
125 | 130 | ||
126 | 131 | ||
127 | if (GNUNET_CONFIGURATION_get_value_yesno(cfg, "MEDIAHELPER", "USERTP") == GNUNET_YES) | 132 | if (GNUNET_CONFIGURATION_get_value_yesno (cfg, "MEDIAHELPER", "USERTP") == |
128 | { | 133 | GNUNET_YES) |
129 | d->usertp = TRUE; | 134 | { |
130 | } | 135 | d->usertp = TRUE; |
136 | } | ||
131 | else | 137 | else |
132 | { | 138 | { |
133 | d->usertp = FALSE; | 139 | d->usertp = FALSE; |
134 | } | 140 | } |
135 | 141 | ||
136 | // GNUNET_CONFIGURATION_write(cfg, "mediahelper.conf"); | 142 | // GNUNET_CONFIGURATION_write(cfg, "mediahelper.conf"); |
137 | } | 143 | } |
138 | 144 | ||
139 | static void | 145 | static void |
140 | write_data(const char *ptr, size_t msg_size) | 146 | write_data (const char *ptr, size_t msg_size) |
141 | { | 147 | { |
142 | ssize_t ret; | 148 | ssize_t ret; |
143 | size_t off; | 149 | size_t off; |
144 | 150 | ||
145 | off = 0; | 151 | off = 0; |
146 | while (off < msg_size) | 152 | while (off < msg_size) |
153 | { | ||
154 | ret = write (1, &ptr[off], msg_size - off); | ||
155 | if (0 >= ret) | ||
147 | { | 156 | { |
148 | ret = write(1, &ptr[off], msg_size - off); | 157 | if (-1 == ret) |
149 | if (0 >= ret) | 158 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "write"); |
150 | { | ||
151 | if (-1 == ret) | ||
152 | GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, "write"); | ||
153 | // quit (2); | 159 | // quit (2); |
154 | } | ||
155 | off += ret; | ||
156 | } | 160 | } |
161 | off += ret; | ||
162 | } | ||
157 | } | 163 | } |
158 | 164 | ||
159 | 165 | ||
160 | 166 | ||
161 | extern GstFlowReturn | 167 | extern GstFlowReturn |
162 | on_appsink_new_sample(GstElement * element, GNUNET_gstData * d) | 168 | on_appsink_new_sample (GstElement *element, GNUNET_gstData *d) |
163 | { | 169 | { |
164 | //size of message including gnunet header | 170 | // size of message including gnunet header |
165 | size_t msg_size; | 171 | size_t msg_size; |
166 | 172 | ||
167 | GstSample *s; | 173 | GstSample *s; |
@@ -175,48 +181,48 @@ on_appsink_new_sample(GstElement * element, GNUNET_gstData * d) | |||
175 | char *caps_str; | 181 | char *caps_str; |
176 | */ | 182 | */ |
177 | 183 | ||
178 | if (gst_app_sink_is_eos(GST_APP_SINK(element))) | 184 | if (gst_app_sink_is_eos (GST_APP_SINK (element))) |
179 | return GST_FLOW_OK; | 185 | return GST_FLOW_OK; |
180 | 186 | ||
181 | //pull sample from appsink | 187 | // pull sample from appsink |
182 | s = gst_app_sink_pull_sample(GST_APP_SINK(element)); | 188 | s = gst_app_sink_pull_sample (GST_APP_SINK (element)); |
183 | 189 | ||
184 | if (s == NULL) | 190 | if (s == NULL) |
185 | return GST_FLOW_OK; | 191 | return GST_FLOW_OK; |
186 | 192 | ||
187 | if (!GST_IS_SAMPLE(s)) | 193 | if (! GST_IS_SAMPLE (s)) |
188 | return GST_FLOW_OK; | 194 | return GST_FLOW_OK; |
189 | 195 | ||
190 | b = gst_sample_get_buffer(s); | 196 | b = gst_sample_get_buffer (s); |
191 | 197 | ||
192 | GST_WARNING("caps are %" GST_PTR_FORMAT, gst_sample_get_caps(s)); | 198 | GST_WARNING ("caps are %" GST_PTR_FORMAT, gst_sample_get_caps (s)); |
193 | 199 | ||
194 | 200 | ||
195 | 201 | ||
196 | gst_buffer_map(b, &map, GST_MAP_READ); | 202 | gst_buffer_map (b, &map, GST_MAP_READ); |
197 | 203 | ||
198 | size_t len; | 204 | size_t len; |
199 | len = map.size; | 205 | len = map.size; |
200 | if (len > UINT16_MAX - sizeof(struct AudioMessage)) | 206 | if (len > UINT16_MAX - sizeof(struct AudioMessage)) |
201 | { | 207 | { |
202 | // this should never happen? | 208 | // this should never happen? |
203 | printf("GSTREAMER sample too big! \n"); | 209 | printf ("GSTREAMER sample too big! \n"); |
204 | exit(20); | 210 | exit (20); |
205 | len = UINT16_MAX - sizeof(struct AudioMessage); | 211 | len = UINT16_MAX - sizeof(struct AudioMessage); |
206 | } | 212 | } |
207 | 213 | ||
208 | msg_size = sizeof(struct AudioMessage) + len; | 214 | msg_size = sizeof(struct AudioMessage) + len; |
209 | 215 | ||
210 | // copy the data into audio_message | 216 | // copy the data into audio_message |
211 | GNUNET_memcpy(((char *)&(d->audio_message)[1]), map.data, len); | 217 | GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len); |
212 | (d->audio_message)->header.size = htons((uint16_t)msg_size); | 218 | (d->audio_message)->header.size = htons ((uint16_t) msg_size); |
213 | if (d->pure_ogg) | 219 | if (d->pure_ogg) |
214 | // write the audio_message without the gnunet headers | 220 | // write the audio_message without the gnunet headers |
215 | write_data((const char *)&(d->audio_message)[1], len); | 221 | write_data ((const char *) &(d->audio_message)[1], len); |
216 | else | 222 | else |
217 | write_data((const char *)d->audio_message, msg_size); | 223 | write_data ((const char *) d->audio_message, msg_size); |
218 | 224 | ||
219 | gst_sample_unref(s); | 225 | gst_sample_unref (s); |
220 | return GST_FLOW_OK; | 226 | return GST_FLOW_OK; |
221 | } | 227 | } |
222 | 228 | ||
@@ -224,13 +230,17 @@ on_appsink_new_sample(GstElement * element, GNUNET_gstData * d) | |||
224 | * Dump a pipeline graph | 230 | * Dump a pipeline graph |
225 | */ | 231 | */ |
226 | extern void | 232 | extern void |
227 | pl_graph(GstElement * pipeline) | 233 | pl_graph (GstElement *pipeline) |
228 | { | 234 | { |
229 | #ifdef IS_SPEAKER | 235 | #ifdef IS_SPEAKER |
230 | gst_debug_bin_to_dot_file_with_ts(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "playback_helper.dot"); | 236 | gst_debug_bin_to_dot_file_with_ts (GST_BIN (pipeline), |
237 | GST_DEBUG_GRAPH_SHOW_ALL, | ||
238 | "playback_helper.dot"); | ||
231 | #endif | 239 | #endif |
232 | #ifdef IS_MIC | 240 | #ifdef IS_MIC |
233 | gst_debug_bin_to_dot_file_with_ts(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "record_helper.dot"); | 241 | gst_debug_bin_to_dot_file_with_ts (GST_BIN (pipeline), |
242 | GST_DEBUG_GRAPH_SHOW_ALL, | ||
243 | "record_helper.dot"); | ||
234 | #endif | 244 | #endif |
235 | 245 | ||
236 | 246 | ||
@@ -240,121 +250,121 @@ pl_graph(GstElement * pipeline) | |||
240 | 250 | ||
241 | 251 | ||
242 | extern gboolean | 252 | extern gboolean |
243 | gnunet_gst_bus_call(GstBus *bus, GstMessage *msg, gpointer data) | 253 | gnunet_gst_bus_call (GstBus *bus, GstMessage *msg, gpointer data) |
244 | { | 254 | { |
245 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
246 | "Bus message\n"); | 256 | "Bus message\n"); |
247 | switch (GST_MESSAGE_TYPE(msg)) | 257 | switch (GST_MESSAGE_TYPE (msg)) |
248 | { | 258 | { |
249 | case GST_MESSAGE_EOS: | 259 | case GST_MESSAGE_EOS: |
250 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 260 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
251 | "End of stream\n"); | 261 | "End of stream\n"); |
252 | exit(10); | 262 | exit (10); |
253 | break; | 263 | break; |
254 | 264 | ||
255 | case GST_MESSAGE_ERROR: | 265 | case GST_MESSAGE_ERROR: |
256 | { | 266 | { |
257 | gchar *debug; | 267 | gchar *debug; |
258 | GError *error; | 268 | GError *error; |
259 | 269 | ||
260 | gst_message_parse_error(msg, &error, &debug); | 270 | gst_message_parse_error (msg, &error, &debug); |
261 | g_free(debug); | 271 | g_free (debug); |
262 | 272 | ||
263 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 273 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
264 | "Error: %s\n", | 274 | "Error: %s\n", |
265 | error->message); | 275 | error->message); |
266 | g_error_free(error); | 276 | g_error_free (error); |
267 | 277 | ||
268 | exit(10); | 278 | exit (10); |
269 | break; | 279 | break; |
270 | } | 280 | } |
271 | 281 | ||
272 | default: | 282 | default: |
273 | break; | 283 | break; |
274 | } | 284 | } |
275 | 285 | ||
276 | return TRUE; | 286 | return TRUE; |
277 | } | 287 | } |
278 | 288 | ||
279 | /* called when pipeline changes state */ | 289 | /* called when pipeline changes state */ |
280 | extern void | 290 | extern void |
281 | state_changed_cb(GstBus * bus, GstMessage * msg, GNUNET_gstData * d) | 291 | state_changed_cb (GstBus *bus, GstMessage *msg, GNUNET_gstData *d) |
282 | { | 292 | { |
283 | GstState old_state, new_state, pending_state; | 293 | GstState old_state, new_state, pending_state; |
284 | 294 | ||
285 | gst_message_parse_state_changed(msg, &old_state, &new_state, | 295 | gst_message_parse_state_changed (msg, &old_state, &new_state, |
286 | &pending_state); | 296 | &pending_state); |
287 | switch (new_state) | 297 | switch (new_state) |
288 | { | 298 | { |
289 | case GST_STATE_READY: | 299 | case GST_STATE_READY: |
290 | // printf("ready.... \n"); | 300 | // printf("ready.... \n"); |
291 | //pl_graph(GST_ELEMENT(d->pipeline)); | 301 | // pl_graph(GST_ELEMENT(d->pipeline)); |
292 | break; | 302 | break; |
293 | 303 | ||
294 | case GST_STATE_PLAYING: | 304 | case GST_STATE_PLAYING: |
295 | 305 | ||
296 | //GST_LOG ("caps are %" GST_PTR_FORMAT, caps); | 306 | // GST_LOG ("caps are %" GST_PTR_FORMAT, caps); |
297 | 307 | ||
298 | // printf("Playing.... \n"); | 308 | // printf("Playing.... \n"); |
299 | pl_graph(GST_ELEMENT(d->pipeline)); | 309 | pl_graph (GST_ELEMENT (d->pipeline)); |
300 | break; | 310 | break; |
301 | 311 | ||
302 | case GST_STATE_VOID_PENDING: | 312 | case GST_STATE_VOID_PENDING: |
303 | // printf("void_pending.... \n"); | 313 | // printf("void_pending.... \n"); |
304 | //pl_graph(GST_ELEMENT(d->pipeline)); | 314 | // pl_graph(GST_ELEMENT(d->pipeline)); |
305 | break; | 315 | break; |
306 | 316 | ||
307 | case GST_STATE_NULL: | 317 | case GST_STATE_NULL: |
308 | // printf("null.... \n"); | 318 | // printf("null.... \n"); |
309 | //pl_graph(GST_ELEMENT(d->pipeline)); | 319 | // pl_graph(GST_ELEMENT(d->pipeline)); |
310 | break; | 320 | break; |
311 | 321 | ||
312 | case GST_STATE_PAUSED: | 322 | case GST_STATE_PAUSED: |
313 | // printf("paused.... \n"); | 323 | // printf("paused.... \n"); |
314 | //pl_graph(GST_ELEMENT(d->pipeline)); | 324 | // pl_graph(GST_ELEMENT(d->pipeline)); |
315 | break; | 325 | break; |
316 | } | 326 | } |
317 | } | 327 | } |
318 | 328 | ||
319 | static void | 329 | static void |
320 | application_cb(GstBus * bus, GstMessage * msg, GNUNET_gstData * data) | 330 | application_cb (GstBus *bus, GstMessage *msg, GNUNET_gstData *data) |
321 | { | 331 | { |
322 | // printf("application cb"); | 332 | // printf("application cb"); |
323 | return; | 333 | return; |
324 | } | 334 | } |
325 | 335 | ||
326 | static void | 336 | static void |
327 | error_cb(GstBus * bus, GstMessage * msg, GNUNET_gstData * data) | 337 | error_cb (GstBus *bus, GstMessage *msg, GNUNET_gstData *data) |
328 | { | 338 | { |
329 | // printf("error cb"); | 339 | // printf("error cb"); |
330 | return; | 340 | return; |
331 | } | 341 | } |
332 | 342 | ||
333 | static void | 343 | static void |
334 | eos_cb(GstBus * bus, GstMessage * msg, GNUNET_gstData * data) | 344 | eos_cb (GstBus *bus, GstMessage *msg, GNUNET_gstData *data) |
335 | { | 345 | { |
336 | // printf("eos cb"); | 346 | // printf("eos cb"); |
337 | return; | 347 | return; |
338 | } | 348 | } |
339 | 349 | ||
340 | extern void | 350 | extern void |
341 | gg_setup_gst_bus(GNUNET_gstData * d) | 351 | gg_setup_gst_bus (GNUNET_gstData *d) |
342 | { | 352 | { |
343 | GstBus *bus; | 353 | GstBus *bus; |
344 | 354 | ||
345 | bus = gst_element_get_bus(GST_ELEMENT(d->pipeline)); | 355 | bus = gst_element_get_bus (GST_ELEMENT (d->pipeline)); |
346 | gst_bus_add_signal_watch(bus); | 356 | gst_bus_add_signal_watch (bus); |
347 | g_signal_connect(G_OBJECT(bus), "message::error", (GCallback)error_cb, | 357 | g_signal_connect (G_OBJECT (bus), "message::error", (GCallback) error_cb, |
348 | d); | 358 | d); |
349 | g_signal_connect(G_OBJECT(bus), "message::eos", (GCallback)eos_cb, | 359 | g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback) eos_cb, |
350 | d); | 360 | d); |
351 | g_signal_connect(G_OBJECT(bus), "message::state-changed", | 361 | g_signal_connect (G_OBJECT (bus), "message::state-changed", |
352 | (GCallback)state_changed_cb, d); | 362 | (GCallback) state_changed_cb, d); |
353 | g_signal_connect(G_OBJECT(bus), "message::application", | 363 | g_signal_connect (G_OBJECT (bus), "message::application", |
354 | (GCallback)application_cb, d); | 364 | (GCallback) application_cb, d); |
355 | g_signal_connect(G_OBJECT(bus), "message::about-to-finish", | 365 | g_signal_connect (G_OBJECT (bus), "message::about-to-finish", |
356 | (GCallback)application_cb, d); | 366 | (GCallback) application_cb, d); |
357 | gst_object_unref(bus); | 367 | gst_object_unref (bus); |
358 | } | 368 | } |
359 | 369 | ||
360 | /* | 370 | /* |
@@ -478,57 +488,57 @@ gg_setup_gst_bus(GNUNET_gstData * d) | |||
478 | 488 | ||
479 | 489 | ||
480 | extern int | 490 | extern int |
481 | feed_buffer_to_gst(const char *audio, size_t b_len, GNUNET_gstData * d) | 491 | feed_buffer_to_gst (const char *audio, size_t b_len, GNUNET_gstData *d) |
482 | { | 492 | { |
483 | GstBuffer *b; | 493 | GstBuffer *b; |
484 | gchar *bufspace; | 494 | gchar *bufspace; |
485 | GstFlowReturn flow; | 495 | GstFlowReturn flow; |
486 | 496 | ||
487 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 497 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
488 | "Feeding %u bytes to GStreamer\n", | 498 | "Feeding %u bytes to GStreamer\n", |
489 | (unsigned int)b_len); | 499 | (unsigned int) b_len); |
490 | 500 | ||
491 | bufspace = g_memdup(audio, b_len); | 501 | bufspace = g_memdup (audio, b_len); |
492 | b = gst_buffer_new_wrapped(bufspace, b_len); | 502 | b = gst_buffer_new_wrapped (bufspace, b_len); |
493 | if (NULL == b) | 503 | if (NULL == b) |
494 | { | 504 | { |
495 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 505 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
496 | "Failed to wrap a buffer\n"); | 506 | "Failed to wrap a buffer\n"); |
497 | g_free(bufspace); | 507 | g_free (bufspace); |
498 | return GNUNET_SYSERR; | 508 | return GNUNET_SYSERR; |
499 | } | 509 | } |
500 | if (GST_APP_SRC(d->appsrc) == NULL) | 510 | if (GST_APP_SRC (d->appsrc) == NULL) |
501 | exit(10); | 511 | exit (10); |
502 | flow = gst_app_src_push_buffer(GST_APP_SRC(d->appsrc), b); | 512 | flow = gst_app_src_push_buffer (GST_APP_SRC (d->appsrc), b); |
503 | /* They all return GNUNET_OK, because currently player stops when | 513 | /* They all return GNUNET_OK, because currently player stops when |
504 | * data stops coming. This might need to be changed for the player | 514 | * data stops coming. This might need to be changed for the player |
505 | * to also stop when pipeline breaks. | 515 | * to also stop when pipeline breaks. |
506 | */ | 516 | */ |
507 | switch (flow) | 517 | switch (flow) |
508 | { | 518 | { |
509 | case GST_FLOW_OK: | 519 | case GST_FLOW_OK: |
510 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
511 | "Fed %u bytes to the pipeline\n", | 521 | "Fed %u bytes to the pipeline\n", |
512 | (unsigned int)b_len); | 522 | (unsigned int) b_len); |
513 | break; | 523 | break; |
514 | 524 | ||
515 | case GST_FLOW_FLUSHING: | 525 | case GST_FLOW_FLUSHING: |
516 | /* buffer was dropped, because pipeline state is not PAUSED or PLAYING */ | 526 | /* buffer was dropped, because pipeline state is not PAUSED or PLAYING */ |
517 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 527 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
518 | "Dropped a buffer\n"); | 528 | "Dropped a buffer\n"); |
519 | break; | 529 | break; |
520 | 530 | ||
521 | case GST_FLOW_EOS: | 531 | case GST_FLOW_EOS: |
522 | /* end of stream */ | 532 | /* end of stream */ |
523 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 533 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
524 | "EOS\n"); | 534 | "EOS\n"); |
525 | break; | 535 | break; |
526 | 536 | ||
527 | default: | 537 | default: |
528 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 538 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
529 | "Unexpected push result\n"); | 539 | "Unexpected push result\n"); |
530 | break; | 540 | break; |
531 | } | 541 | } |
532 | return GNUNET_OK; | 542 | return GNUNET_OK; |
533 | } | 543 | } |
534 | 544 | ||
@@ -538,22 +548,23 @@ feed_buffer_to_gst(const char *audio, size_t b_len, GNUNET_gstData * d) | |||
538 | * debug making elements | 548 | * debug making elements |
539 | */ | 549 | */ |
540 | extern GstElement * | 550 | extern GstElement * |
541 | gst_element_factory_make_debug(gchar *factoryname, gchar *name) | 551 | gst_element_factory_make_debug (gchar *factoryname, gchar *name) |
542 | { | 552 | { |
543 | GstElement *element; | 553 | GstElement *element; |
544 | 554 | ||
545 | element = gst_element_factory_make(factoryname, name); | 555 | element = gst_element_factory_make (factoryname, name); |
546 | 556 | ||
547 | if (element == NULL) | 557 | if (element == NULL) |
548 | { | 558 | { |
549 | printf("\n Failed to create element - type: %s name: %s \n", factoryname, name); | 559 | printf ("\n Failed to create element - type: %s name: %s \n", factoryname, |
550 | exit(10); | 560 | name); |
551 | return element; | 561 | exit (10); |
552 | } | 562 | return element; |
563 | } | ||
553 | else | 564 | else |
554 | { | 565 | { |
555 | return element; | 566 | return element; |
556 | } | 567 | } |
557 | } | 568 | } |
558 | 569 | ||
559 | /* | 570 | /* |
@@ -568,104 +579,106 @@ gst_element_factory_make_debug(gchar *factoryname, gchar *name) | |||
568 | gst_element_link_many_debug(__VA_ARGS__) | 579 | gst_element_link_many_debug(__VA_ARGS__) |
569 | */ | 580 | */ |
570 | extern void | 581 | extern void |
571 | lf(char * msg) | 582 | lf (char *msg) |
572 | { | 583 | { |
573 | printf("linking elements failed: %s", msg); | 584 | printf ("linking elements failed: %s", msg); |
574 | exit(10); | 585 | exit (10); |
575 | } | 586 | } |
576 | 587 | ||
577 | /*** | 588 | /*** |
578 | * used to set properties on autoaudiosink's chosen sink | 589 | * used to set properties on autoaudiosink's chosen sink |
579 | */ | 590 | */ |
580 | static void | 591 | static void |
581 | autoaudiosink_child_added(GstChildProxy *child_proxy, | 592 | autoaudiosink_child_added (GstChildProxy *child_proxy, |
582 | GObject *object, | 593 | GObject *object, |
583 | gchar *name, | 594 | gchar *name, |
584 | gpointer user_data) | 595 | gpointer user_data) |
585 | { | 596 | { |
586 | if (GST_IS_AUDIO_BASE_SRC(object)) | 597 | if (GST_IS_AUDIO_BASE_SRC (object)) |
587 | g_object_set(object, | 598 | g_object_set (object, |
588 | "buffer-time", (gint64)BUFFER_TIME, | 599 | "buffer-time", (gint64) BUFFER_TIME, |
589 | "latency-time", (gint64)LATENCY_TIME, | 600 | "latency-time", (gint64) LATENCY_TIME, |
590 | NULL); | 601 | NULL); |
591 | } | 602 | } |
592 | 603 | ||
593 | /*** | 604 | /*** |
594 | * used to set properties on autoaudiosource's chosen sink | 605 | * used to set properties on autoaudiosource's chosen sink |
595 | */ | 606 | */ |
596 | static void | 607 | static void |
597 | autoaudiosource_child_added(GstChildProxy *child_proxy, GObject *object, gchar *name, gpointer user_data) | 608 | autoaudiosource_child_added (GstChildProxy *child_proxy, GObject *object, |
609 | gchar *name, gpointer user_data) | ||
598 | { | 610 | { |
599 | if (GST_IS_AUDIO_BASE_SRC(object)) | 611 | if (GST_IS_AUDIO_BASE_SRC (object)) |
600 | g_object_set(object, "buffer-time", (gint64)BUFFER_TIME, "latency-time", (gint64)LATENCY_TIME, NULL); | 612 | g_object_set (object, "buffer-time", (gint64) BUFFER_TIME, "latency-time", |
613 | (gint64) LATENCY_TIME, NULL); | ||
601 | } | 614 | } |
602 | 615 | ||
603 | 616 | ||
604 | GstElement * | 617 | GstElement * |
605 | get_pipeline(GstElement *element) | 618 | get_pipeline (GstElement *element) |
606 | { | 619 | { |
607 | GstPipeline *p; | 620 | GstPipeline *p; |
608 | 621 | ||
609 | p = GST_PIPELINE(gst_object_get_parent(GST_OBJECT(element))); | 622 | p = GST_PIPELINE (gst_object_get_parent (GST_OBJECT (element))); |
610 | 623 | ||
611 | return GST_ELEMENT(p); | 624 | return GST_ELEMENT (p); |
612 | } | 625 | } |
613 | 626 | ||
614 | static void | 627 | static void |
615 | decoder_ogg_pad_added(GstElement *element, | 628 | decoder_ogg_pad_added (GstElement *element, |
616 | GstPad *pad, | 629 | GstPad *pad, |
617 | gpointer data) | 630 | gpointer data) |
618 | { | 631 | { |
619 | GstPad *sinkpad; | 632 | GstPad *sinkpad; |
620 | GstElement *decoder = (GstElement *)data; | 633 | GstElement *decoder = (GstElement *) data; |
621 | 634 | ||
622 | printf("==== ogg pad added callback \n"); | 635 | printf ("==== ogg pad added callback \n"); |
623 | /* We can now link this pad with the opus-decoder sink pad */ | 636 | /* We can now link this pad with the opus-decoder sink pad */ |
624 | // pl_graph(get_pipeline(element)); | 637 | // pl_graph(get_pipeline(element)); |
625 | sinkpad = gst_element_get_static_pad(decoder, "sink"); | 638 | sinkpad = gst_element_get_static_pad (decoder, "sink"); |
626 | 639 | ||
627 | gst_pad_link(pad, sinkpad); | 640 | gst_pad_link (pad, sinkpad); |
628 | gst_element_link_many(element, decoder, NULL); | 641 | gst_element_link_many (element, decoder, NULL); |
629 | gst_object_unref(sinkpad); | 642 | gst_object_unref (sinkpad); |
630 | } | 643 | } |
631 | 644 | ||
632 | 645 | ||
633 | int | 646 | int |
634 | gnunet_read(GNUNET_gstData * d) | 647 | gnunet_read (GNUNET_gstData *d) |
635 | { | 648 | { |
636 | char readbuf[MAXLINE]; | 649 | char readbuf[MAXLINE]; |
637 | int ret; | 650 | int ret; |
638 | 651 | ||
639 | printf("read \n"); | 652 | printf ("read \n"); |
640 | ret = read(0, readbuf, sizeof(readbuf)); | 653 | ret = read (0, readbuf, sizeof(readbuf)); |
641 | if (0 > ret) | 654 | if (0 > ret) |
642 | { | 655 | { |
643 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 656 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
644 | _("Read error from STDIN: %d %s\n"), | 657 | _ ("Read error from STDIN: %d %s\n"), |
645 | ret, strerror(errno)); | 658 | ret, strerror (errno)); |
646 | return FAIL; | 659 | return FAIL; |
647 | } | 660 | } |
648 | //toff += ret; | 661 | // toff += ret; |
649 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 662 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
650 | "Received %d bytes of audio data\n", | 663 | "Received %d bytes of audio data\n", |
651 | (int)ret); | 664 | (int) ret); |
652 | if (0 == ret) | 665 | if (0 == ret) |
653 | return FAIL; | 666 | return FAIL; |
654 | //#ifdef DEBUG_READ_PURE_OGG | 667 | // #ifdef DEBUG_READ_PURE_OGG |
655 | 668 | ||
656 | if (d->pure_ogg) | 669 | if (d->pure_ogg) |
657 | { | 670 | { |
658 | feed_buffer_to_gst(readbuf, ret, d); | 671 | feed_buffer_to_gst (readbuf, ret, d); |
659 | } | 672 | } |
660 | else | 673 | else |
661 | { | 674 | { |
662 | //#endif | 675 | // #endif |
663 | GNUNET_MST_from_buffer(d->stdin_mst, | 676 | GNUNET_MST_from_buffer (d->stdin_mst, |
664 | readbuf, | 677 | readbuf, |
665 | ret, | 678 | ret, |
666 | GNUNET_NO, | 679 | GNUNET_NO, |
667 | GNUNET_NO); | 680 | GNUNET_NO); |
668 | } | 681 | } |
669 | return 0; | 682 | return 0; |
670 | } | 683 | } |
671 | 684 | ||
@@ -678,127 +691,130 @@ gnunet_read(GNUNET_gstData * d) | |||
678 | * #GNUNET_SYSERR to stop further processing due to error | 691 | * #GNUNET_SYSERR to stop further processing due to error |
679 | */ | 692 | */ |
680 | static int | 693 | static int |
681 | stdin_receiver(void *cls, | 694 | stdin_receiver (void *cls, |
682 | const struct GNUNET_MessageHeader *msg) | 695 | const struct GNUNET_MessageHeader *msg) |
683 | { | 696 | { |
684 | struct AudioMessage *audio; | 697 | struct AudioMessage *audio; |
685 | size_t b_len; | 698 | size_t b_len; |
686 | 699 | ||
687 | printf("stdin receiver \n "); | 700 | printf ("stdin receiver \n "); |
688 | dump_buffer(sizeof(msg), | 701 | dump_buffer (sizeof(msg), |
689 | (const unsigned char *)msg); | 702 | (const unsigned char *) msg); |
690 | 703 | ||
691 | switch (ntohs(msg->type)) | 704 | switch (ntohs (msg->type)) |
692 | { | 705 | { |
693 | case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO: | 706 | case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO: |
694 | audio = (struct AudioMessage *)msg; | 707 | audio = (struct AudioMessage *) msg; |
695 | 708 | ||
696 | b_len = ntohs(audio->header.size) - sizeof(struct AudioMessage); | 709 | b_len = ntohs (audio->header.size) - sizeof(struct AudioMessage); |
697 | printf("feeding buffer to gst \n "); | 710 | printf ("feeding buffer to gst \n "); |
698 | feed_buffer_to_gst((const char *)&audio[1], b_len, cls); | 711 | feed_buffer_to_gst ((const char *) &audio[1], b_len, cls); |
699 | break; | 712 | break; |
700 | 713 | ||
701 | default: | 714 | default: |
702 | printf("No audio message: %u \n ", ntohs(msg->type)); | 715 | printf ("No audio message: %u \n ", ntohs (msg->type)); |
703 | break; | 716 | break; |
704 | } | 717 | } |
705 | return GNUNET_OK; | 718 | return GNUNET_OK; |
706 | } | 719 | } |
707 | 720 | ||
708 | 721 | ||
709 | GstBin * | 722 | GstBin * |
710 | get_app(GNUNET_gstData *d, int type) | 723 | get_app (GNUNET_gstData *d, int type) |
711 | { | 724 | { |
712 | GstBin *bin; | 725 | GstBin *bin; |
713 | GstPad *pad, *ghostpad; | 726 | GstPad *pad, *ghostpad; |
714 | 727 | ||
715 | if (type == SOURCE) | 728 | if (type == SOURCE) |
716 | { | 729 | { |
717 | bin = GST_BIN(gst_bin_new("Gnunet appsrc")); | 730 | bin = GST_BIN (gst_bin_new ("Gnunet appsrc")); |
718 | 731 | ||
719 | 732 | ||
720 | GNUNET_assert(GNUNET_OK == | 733 | GNUNET_assert (GNUNET_OK == |
721 | GNUNET_log_setup("gnunet-helper-audio-playback", | 734 | GNUNET_log_setup ("gnunet-helper-audio-playback", |
722 | "WARNING", | 735 | "WARNING", |
723 | NULL)); | 736 | NULL)); |
724 | 737 | ||
725 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 738 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
726 | "Audio playback starts\n"); | 739 | "Audio playback starts\n"); |
727 | printf(" creating appsrc \n "); | 740 | printf (" creating appsrc \n "); |
728 | //d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); | 741 | // d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); |
729 | 742 | ||
730 | // d->audio_message = GNUNET_malloc (UINT16_MAX); | 743 | // d->audio_message = GNUNET_malloc (UINT16_MAX); |
731 | // d->audio_message = (AudioMessage*)malloc(sizeof(struct AudioMessage)); | 744 | // d->audio_message = (AudioMessage*)malloc(sizeof(struct AudioMessage)); |
732 | // d->audio_message = GNUNET_malloc(sizeof(struct AudioMessage)); | 745 | // d->audio_message = GNUNET_malloc(sizeof(struct AudioMessage)); |
733 | 746 | ||
734 | 747 | ||
735 | //d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); | 748 | // d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); |
736 | 749 | ||
737 | 750 | ||
738 | d->stdin_mst = GNUNET_MST_create(&stdin_receiver, d); | 751 | d->stdin_mst = GNUNET_MST_create (&stdin_receiver, d); |
739 | 752 | ||
740 | if (d->stdin_mst == NULL) | 753 | if (d->stdin_mst == NULL) |
741 | printf("stdin_mst = NULL"); | 754 | printf ("stdin_mst = NULL"); |
742 | 755 | ||
743 | d->appsrc = gst_element_factory_make("appsrc", "appsrc"); | 756 | d->appsrc = gst_element_factory_make ("appsrc", "appsrc"); |
744 | 757 | ||
745 | gst_bin_add_many(bin, d->appsrc, NULL); | 758 | gst_bin_add_many (bin, d->appsrc, NULL); |
746 | // gst_element_link_many ( encoder, muxer, NULL); | 759 | // gst_element_link_many ( encoder, muxer, NULL); |
747 | 760 | ||
748 | pad = gst_element_get_static_pad(d->appsrc, "src"); | 761 | pad = gst_element_get_static_pad (d->appsrc, "src"); |
749 | ghostpad = gst_ghost_pad_new("src", pad); | 762 | ghostpad = gst_ghost_pad_new ("src", pad); |
750 | } | 763 | } |
751 | if (type == SINK) | 764 | if (type == SINK) |
752 | { | 765 | { |
753 | bin = GST_BIN(gst_bin_new("Gnunet appsink")); | 766 | bin = GST_BIN (gst_bin_new ("Gnunet appsink")); |
754 | 767 | ||
755 | 768 | ||
756 | GNUNET_assert(GNUNET_OK == | 769 | GNUNET_assert (GNUNET_OK == |
757 | GNUNET_log_setup("gnunet-helper-audio-record", | 770 | GNUNET_log_setup ("gnunet-helper-audio-record", |
758 | "WARNING", | 771 | "WARNING", |
759 | NULL)); | 772 | NULL)); |
760 | 773 | ||
761 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 774 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
762 | "Audio source starts\n"); | 775 | "Audio source starts\n"); |
763 | 776 | ||
764 | d->appsink = gst_element_factory_make("appsink", "appsink"); | 777 | d->appsink = gst_element_factory_make ("appsink", "appsink"); |
765 | 778 | ||
766 | // Move this out of here! | 779 | // Move this out of here! |
767 | d->audio_message = GNUNET_malloc(UINT16_MAX); | 780 | d->audio_message = GNUNET_malloc (UINT16_MAX); |
768 | (d->audio_message)->header.type = htons(GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); | 781 | (d->audio_message)->header.type = htons ( |
769 | g_object_set(G_OBJECT(d->appsink), "emit-signals", TRUE, "sync", TRUE, NULL); | 782 | GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); |
783 | g_object_set (G_OBJECT (d->appsink), "emit-signals", TRUE, "sync", TRUE, | ||
784 | NULL); | ||
770 | 785 | ||
771 | g_signal_connect(d->appsink, "new-sample", | 786 | g_signal_connect (d->appsink, "new-sample", |
772 | G_CALLBACK(on_appsink_new_sample), &d); | 787 | G_CALLBACK (on_appsink_new_sample), &d); |
773 | 788 | ||
774 | gst_bin_add_many(bin, d->appsink, NULL); | 789 | gst_bin_add_many (bin, d->appsink, NULL); |
775 | // gst_element_link_many ( encoder, muxer, NULL); | 790 | // gst_element_link_many ( encoder, muxer, NULL); |
776 | 791 | ||
777 | pad = gst_element_get_static_pad(d->appsink, "sink"); | 792 | pad = gst_element_get_static_pad (d->appsink, "sink"); |
778 | ghostpad = gst_ghost_pad_new("sink", pad); | 793 | ghostpad = gst_ghost_pad_new ("sink", pad); |
779 | } | 794 | } |
780 | 795 | ||
781 | /* set the bin pads */ | 796 | /* set the bin pads */ |
782 | gst_pad_set_active(ghostpad, TRUE); | 797 | gst_pad_set_active (ghostpad, TRUE); |
783 | gst_element_add_pad(GST_ELEMENT(bin), ghostpad); | 798 | gst_element_add_pad (GST_ELEMENT (bin), ghostpad); |
784 | 799 | ||
785 | gst_object_unref(pad); | 800 | gst_object_unref (pad); |
786 | 801 | ||
787 | return bin; | 802 | return bin; |
788 | } | 803 | } |
789 | 804 | ||
790 | extern GstBin * | 805 | extern GstBin * |
791 | get_coder(GNUNET_gstData *d, int type) | 806 | get_coder (GNUNET_gstData *d, int type) |
792 | { | 807 | { |
793 | GstBin *bin; | 808 | GstBin *bin; |
794 | GstPad *srcpad, *sinkpad, *srcghostpad, *sinkghostpad; | 809 | GstPad *srcpad, *sinkpad, *srcghostpad, *sinkghostpad; |
795 | GstCaps *rtpcaps; | 810 | GstCaps *rtpcaps; |
796 | GstElement *encoder, *muxer, *decoder, *demuxer, *jitterbuffer, *rtpcapsfilter; | 811 | GstElement *encoder, *muxer, *decoder, *demuxer, *jitterbuffer, |
812 | *rtpcapsfilter; | ||
797 | 813 | ||
798 | if (d->usertp == TRUE) | 814 | if (d->usertp == TRUE) |
799 | { | 815 | { |
800 | /* | 816 | /* |
801 | * application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)OPUS, sprop-maxcapturerate=(string)48000, sprop-stereo=(string)0, payload=(int)96, encoding-params=(string)2, ssrc=(uint)630297634, timestamp-offset=(uint)678334141, seqnum-offset=(uint)16938 */ | 817 | * application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)OPUS, sprop-maxcapturerate=(string)48000, sprop-stereo=(string)0, payload=(int)96, encoding-params=(string)2, ssrc=(uint)630297634, timestamp-offset=(uint)678334141, seqnum-offset=(uint)16938 */ |
802 | /* | 818 | /* |
803 | rtpcaps = gst_caps_new_simple ("application/x-rtp", | 819 | rtpcaps = gst_caps_new_simple ("application/x-rtp", |
804 | "media", G_TYPE_STRING, "audio", | 820 | "media", G_TYPE_STRING, "audio", |
@@ -809,109 +825,112 @@ get_coder(GNUNET_gstData *d, int type) | |||
809 | "encoding-params", G_TYPE_STRING, "2", | 825 | "encoding-params", G_TYPE_STRING, "2", |
810 | NULL); | 826 | NULL); |
811 | */ | 827 | */ |
812 | rtpcaps = gst_caps_new_simple("application/x-rtp", | 828 | rtpcaps = gst_caps_new_simple ("application/x-rtp", |
813 | "media", G_TYPE_STRING, "audio", | 829 | "media", G_TYPE_STRING, "audio", |
814 | "clock-rate", G_TYPE_INT, SAMPLING_RATE, | 830 | "clock-rate", G_TYPE_INT, SAMPLING_RATE, |
815 | "encoding-name", G_TYPE_STRING, "OPUS", | 831 | "encoding-name", G_TYPE_STRING, "OPUS", |
816 | "payload", G_TYPE_INT, 96, | 832 | "payload", G_TYPE_INT, 96, |
817 | "sprop-stereo", G_TYPE_STRING, "0", | 833 | "sprop-stereo", G_TYPE_STRING, "0", |
818 | "encoding-params", G_TYPE_STRING, "2", | 834 | "encoding-params", G_TYPE_STRING, "2", |
819 | NULL); | 835 | NULL); |
820 | |||
821 | |||
822 | rtpcapsfilter = gst_element_factory_make("capsfilter", "rtpcapsfilter"); | ||
823 | |||
824 | g_object_set(G_OBJECT(rtpcapsfilter), | ||
825 | "caps", rtpcaps, | ||
826 | NULL); | ||
827 | gst_caps_unref(rtpcaps); | ||
828 | } | ||
829 | 836 | ||
830 | 837 | ||
831 | if (type == ENCODER) | 838 | rtpcapsfilter = gst_element_factory_make ("capsfilter", "rtpcapsfilter"); |
832 | { | 839 | |
833 | bin = GST_BIN(gst_bin_new("Gnunet audioencoder")); | 840 | g_object_set (G_OBJECT (rtpcapsfilter), |
841 | "caps", rtpcaps, | ||
842 | NULL); | ||
843 | gst_caps_unref (rtpcaps); | ||
844 | } | ||
834 | 845 | ||
835 | encoder = gst_element_factory_make("opusenc", "opus-encoder"); | ||
836 | if (d->usertp == TRUE) | ||
837 | { | ||
838 | muxer = gst_element_factory_make("rtpopuspay", "rtp-payloader"); | ||
839 | } | ||
840 | else | ||
841 | { | ||
842 | muxer = gst_element_factory_make("oggmux", "ogg-muxer"); | ||
843 | } | ||
844 | g_object_set(G_OBJECT(encoder), | ||
845 | /* "bitrate", 64000, */ | ||
846 | /* "bandwidth", OPUS_BANDWIDTH_FULLBAND, */ | ||
847 | "inband-fec", INBAND_FEC_MODE, | ||
848 | "packet-loss-percentage", PACKET_LOSS_PERCENTAGE, | ||
849 | "max-payload-size", MAX_PAYLOAD_SIZE, | ||
850 | "audio", TRUE, /* VoIP, not audio */ | ||
851 | "frame-size", OPUS_FRAME_SIZE, | ||
852 | NULL); | ||
853 | |||
854 | if (d->usertp != TRUE) | ||
855 | { | ||
856 | g_object_set(G_OBJECT(muxer), | ||
857 | "max-delay", OGG_MAX_DELAY, | ||
858 | "max-page-delay", OGG_MAX_PAGE_DELAY, | ||
859 | NULL); | ||
860 | } | ||
861 | 846 | ||
862 | gst_bin_add_many(bin, encoder, muxer, NULL); | 847 | if (type == ENCODER) |
863 | gst_element_link_many(encoder, muxer, NULL); | 848 | { |
864 | sinkpad = gst_element_get_static_pad(encoder, "sink"); | 849 | bin = GST_BIN (gst_bin_new ("Gnunet audioencoder")); |
865 | sinkghostpad = gst_ghost_pad_new("sink", sinkpad); | ||
866 | 850 | ||
867 | srcpad = gst_element_get_static_pad(muxer, "src"); | 851 | encoder = gst_element_factory_make ("opusenc", "opus-encoder"); |
868 | srcghostpad = gst_ghost_pad_new("src", srcpad); | 852 | if (d->usertp == TRUE) |
853 | { | ||
854 | muxer = gst_element_factory_make ("rtpopuspay", "rtp-payloader"); | ||
869 | } | 855 | } |
870 | if (type == DECODER) | 856 | else |
857 | { | ||
858 | muxer = gst_element_factory_make ("oggmux", "ogg-muxer"); | ||
859 | } | ||
860 | g_object_set (G_OBJECT (encoder), | ||
861 | /* "bitrate", 64000, */ | ||
862 | /* "bandwidth", OPUS_BANDWIDTH_FULLBAND, */ | ||
863 | "inband-fec", INBAND_FEC_MODE, | ||
864 | "packet-loss-percentage", PACKET_LOSS_PERCENTAGE, | ||
865 | "max-payload-size", MAX_PAYLOAD_SIZE, | ||
866 | "audio", TRUE, /* VoIP, not audio */ | ||
867 | "frame-size", OPUS_FRAME_SIZE, | ||
868 | NULL); | ||
869 | |||
870 | if (d->usertp != TRUE) | ||
871 | { | 871 | { |
872 | bin = GST_BIN(gst_bin_new("Gnunet audiodecoder")); | 872 | g_object_set (G_OBJECT (muxer), |
873 | "max-delay", OGG_MAX_DELAY, | ||
874 | "max-page-delay", OGG_MAX_PAGE_DELAY, | ||
875 | NULL); | ||
876 | } | ||
873 | 877 | ||
874 | // decoder | 878 | gst_bin_add_many (bin, encoder, muxer, NULL); |
875 | if (d->usertp == TRUE) | 879 | gst_element_link_many (encoder, muxer, NULL); |
876 | { | 880 | sinkpad = gst_element_get_static_pad (encoder, "sink"); |
877 | demuxer = gst_element_factory_make("rtpopusdepay", "ogg-demuxer"); | 881 | sinkghostpad = gst_ghost_pad_new ("sink", sinkpad); |
878 | jitterbuffer = gst_element_factory_make("rtpjitterbuffer", "rtpjitterbuffer"); | ||
879 | } | ||
880 | else | ||
881 | { | ||
882 | demuxer = gst_element_factory_make("oggdemux", "ogg-demuxer"); | ||
883 | } | ||
884 | decoder = gst_element_factory_make("opusdec", "opus-decoder"); | ||
885 | 882 | ||
886 | if (d->usertp == TRUE) | 883 | srcpad = gst_element_get_static_pad (muxer, "src"); |
887 | { | 884 | srcghostpad = gst_ghost_pad_new ("src", srcpad); |
888 | gst_bin_add_many(bin, rtpcapsfilter, jitterbuffer, demuxer, decoder, NULL); | 885 | } |
889 | gst_element_link_many(rtpcapsfilter, jitterbuffer, demuxer, decoder, NULL); | 886 | if (type == DECODER) |
890 | sinkpad = gst_element_get_static_pad(rtpcapsfilter, "sink"); | 887 | { |
891 | } | 888 | bin = GST_BIN (gst_bin_new ("Gnunet audiodecoder")); |
892 | else | ||
893 | { | ||
894 | gst_bin_add_many(bin, demuxer, decoder, NULL); | ||
895 | 889 | ||
896 | g_signal_connect(demuxer, | 890 | // decoder |
897 | "pad-added", | 891 | if (d->usertp == TRUE) |
898 | G_CALLBACK(decoder_ogg_pad_added), | 892 | { |
899 | decoder); | 893 | demuxer = gst_element_factory_make ("rtpopusdepay", "ogg-demuxer"); |
894 | jitterbuffer = gst_element_factory_make ("rtpjitterbuffer", | ||
895 | "rtpjitterbuffer"); | ||
896 | } | ||
897 | else | ||
898 | { | ||
899 | demuxer = gst_element_factory_make ("oggdemux", "ogg-demuxer"); | ||
900 | } | ||
901 | decoder = gst_element_factory_make ("opusdec", "opus-decoder"); | ||
900 | 902 | ||
901 | sinkpad = gst_element_get_static_pad(demuxer, "sink"); | 903 | if (d->usertp == TRUE) |
902 | } | 904 | { |
903 | sinkghostpad = gst_ghost_pad_new("sink", sinkpad); | 905 | gst_bin_add_many (bin, rtpcapsfilter, jitterbuffer, demuxer, decoder, |
906 | NULL); | ||
907 | gst_element_link_many (rtpcapsfilter, jitterbuffer, demuxer, decoder, | ||
908 | NULL); | ||
909 | sinkpad = gst_element_get_static_pad (rtpcapsfilter, "sink"); | ||
910 | } | ||
911 | else | ||
912 | { | ||
913 | gst_bin_add_many (bin, demuxer, decoder, NULL); | ||
914 | |||
915 | g_signal_connect (demuxer, | ||
916 | "pad-added", | ||
917 | G_CALLBACK (decoder_ogg_pad_added), | ||
918 | decoder); | ||
904 | 919 | ||
905 | srcpad = gst_element_get_static_pad(decoder, "src"); | 920 | sinkpad = gst_element_get_static_pad (demuxer, "sink"); |
906 | srcghostpad = gst_ghost_pad_new("src", srcpad); | ||
907 | } | 921 | } |
922 | sinkghostpad = gst_ghost_pad_new ("sink", sinkpad); | ||
923 | |||
924 | srcpad = gst_element_get_static_pad (decoder, "src"); | ||
925 | srcghostpad = gst_ghost_pad_new ("src", srcpad); | ||
926 | } | ||
908 | 927 | ||
909 | // add pads to the bin | 928 | // add pads to the bin |
910 | gst_pad_set_active(sinkghostpad, TRUE); | 929 | gst_pad_set_active (sinkghostpad, TRUE); |
911 | gst_element_add_pad(GST_ELEMENT(bin), sinkghostpad); | 930 | gst_element_add_pad (GST_ELEMENT (bin), sinkghostpad); |
912 | 931 | ||
913 | gst_pad_set_active(srcghostpad, TRUE); | 932 | gst_pad_set_active (srcghostpad, TRUE); |
914 | gst_element_add_pad(GST_ELEMENT(bin), srcghostpad); | 933 | gst_element_add_pad (GST_ELEMENT (bin), srcghostpad); |
915 | 934 | ||
916 | 935 | ||
917 | return bin; | 936 | return bin; |
@@ -919,7 +938,7 @@ get_coder(GNUNET_gstData *d, int type) | |||
919 | 938 | ||
920 | 939 | ||
921 | extern GstBin * | 940 | extern GstBin * |
922 | get_audiobin(GNUNET_gstData *d, int type) | 941 | get_audiobin (GNUNET_gstData *d, int type) |
923 | { | 942 | { |
924 | GstBin *bin; | 943 | GstBin *bin; |
925 | GstElement *sink, *source, *queue, *conv, *resampler, *removesilence, *filter; | 944 | GstElement *sink, *source, *queue, *conv, *resampler, *removesilence, *filter; |
@@ -927,72 +946,74 @@ get_audiobin(GNUNET_gstData *d, int type) | |||
927 | GstCaps *caps; | 946 | GstCaps *caps; |
928 | 947 | ||
929 | if (type == SINK) | 948 | if (type == SINK) |
930 | { | 949 | { |
931 | bin = GST_BIN(gst_bin_new("Gnunet audiosink")); | 950 | bin = GST_BIN (gst_bin_new ("Gnunet audiosink")); |
932 | 951 | ||
933 | /* Create all the elements */ | 952 | /* Create all the elements */ |
934 | if (d->dropsilence == TRUE) | 953 | if (d->dropsilence == TRUE) |
935 | { | 954 | { |
936 | queue = gst_element_factory_make("queue", "queue"); | 955 | queue = gst_element_factory_make ("queue", "queue"); |
937 | removesilence = gst_element_factory_make("removesilence", "removesilence"); | 956 | removesilence = gst_element_factory_make ("removesilence", |
938 | } | 957 | "removesilence"); |
958 | } | ||
939 | 959 | ||
940 | conv = gst_element_factory_make("audioconvert", "converter"); | 960 | conv = gst_element_factory_make ("audioconvert", "converter"); |
941 | resampler = gst_element_factory_make("audioresample", "resampler"); | 961 | resampler = gst_element_factory_make ("audioresample", "resampler"); |
942 | 962 | ||
943 | if (d->audiobackend == AUTO) | 963 | if (d->audiobackend == AUTO) |
944 | { | 964 | { |
945 | sink = gst_element_factory_make("autoaudiosink", "audiosink"); | 965 | sink = gst_element_factory_make ("autoaudiosink", "audiosink"); |
946 | g_signal_connect(sink, "child-added", G_CALLBACK(autoaudiosink_child_added), NULL); | 966 | g_signal_connect (sink, "child-added", G_CALLBACK ( |
947 | } | 967 | autoaudiosink_child_added), NULL); |
968 | } | ||
948 | 969 | ||
949 | if (d->audiobackend == ALSA) | 970 | if (d->audiobackend == ALSA) |
950 | { | 971 | { |
951 | sink = gst_element_factory_make("alsaaudiosink", "audiosink"); | 972 | sink = gst_element_factory_make ("alsaaudiosink", "audiosink"); |
952 | } | 973 | } |
953 | 974 | ||
954 | if (d->audiobackend == JACK) | 975 | if (d->audiobackend == JACK) |
955 | { | 976 | { |
956 | sink = gst_element_factory_make("jackaudiosink", "audiosink"); | 977 | sink = gst_element_factory_make ("jackaudiosink", "audiosink"); |
957 | 978 | ||
958 | g_object_set(G_OBJECT(sink), "client-name", "gnunet", NULL); | 979 | g_object_set (G_OBJECT (sink), "client-name", "gnunet", NULL); |
959 | 980 | ||
960 | if (g_object_class_find_property | 981 | if (g_object_class_find_property |
961 | (G_OBJECT_GET_CLASS(sink), "port-pattern")) | 982 | (G_OBJECT_GET_CLASS (sink), "port-pattern")) |
962 | { | 983 | { |
963 | // char *portpattern = "system"; | 984 | // char *portpattern = "system"; |
964 | 985 | ||
965 | g_object_set(G_OBJECT(sink), "port-pattern", d->jack_pp_out, | 986 | g_object_set (G_OBJECT (sink), "port-pattern", d->jack_pp_out, |
966 | NULL); | 987 | NULL); |
967 | } | 988 | } |
968 | } | 989 | } |
969 | 990 | ||
970 | if (d->audiobackend == FAKE) | 991 | if (d->audiobackend == FAKE) |
971 | { | 992 | { |
972 | sink = gst_element_factory_make("fakesink", "audiosink"); | 993 | sink = gst_element_factory_make ("fakesink", "audiosink"); |
973 | } | 994 | } |
974 | 995 | ||
975 | g_object_set(sink, | 996 | g_object_set (sink, |
976 | "buffer-time", (gint64)BUFFER_TIME, | 997 | "buffer-time", (gint64) BUFFER_TIME, |
977 | "latency-time", (gint64)LATENCY_TIME, | 998 | "latency-time", (gint64) LATENCY_TIME, |
978 | NULL); | 999 | NULL); |
979 | 1000 | ||
980 | if (d->dropsilence == TRUE) | 1001 | if (d->dropsilence == TRUE) |
981 | { | 1002 | { |
982 | // Do not remove silence by default | 1003 | // Do not remove silence by default |
983 | g_object_set(removesilence, "remove", FALSE, NULL); | 1004 | g_object_set (removesilence, "remove", FALSE, NULL); |
984 | g_object_set(queue, "max-size-buffers", 12, NULL); | 1005 | g_object_set (queue, "max-size-buffers", 12, NULL); |
985 | /* | 1006 | /* |
986 | g_signal_connect (source, | 1007 | g_signal_connect (source, |
987 | "need-data", | 1008 | "need-data", |
988 | G_CALLBACK(appsrc_need_data), | 1009 | G_CALLBACK(appsrc_need_data), |
989 | NULL); | 1010 | NULL); |
990 | 1011 | ||
991 | g_signal_connect (source, | 1012 | g_signal_connect (source, |
992 | "enough-data", | 1013 | "enough-data", |
993 | G_CALLBACK(appsrc_enough_data), | 1014 | G_CALLBACK(appsrc_enough_data), |
994 | NULL); | 1015 | NULL); |
995 | */ | 1016 | */ |
996 | /* | 1017 | /* |
997 | g_signal_connect (queue, | 1018 | g_signal_connect (queue, |
998 | "notify::current-level-bytes", | 1019 | "notify::current-level-bytes", |
@@ -1019,109 +1040,111 @@ get_audiobin(GNUNET_gstData *d, int type) | |||
1019 | G_CALLBACK(queue_pushing), | 1040 | G_CALLBACK(queue_pushing), |
1020 | NULL); | 1041 | NULL); |
1021 | */ | 1042 | */ |
1022 | } | 1043 | } |
1023 | |||
1024 | 1044 | ||
1025 | 1045 | ||
1026 | 1046 | ||
1027 | 1047 | ||
1028 | gst_bin_add_many(bin, conv, resampler, sink, NULL); | ||
1029 | gst_element_link_many(conv, resampler, sink, NULL); | ||
1030 | 1048 | ||
1031 | if (d->dropsilence == TRUE) | 1049 | gst_bin_add_many (bin, conv, resampler, sink, NULL); |
1032 | { | 1050 | gst_element_link_many (conv, resampler, sink, NULL); |
1033 | gst_bin_add_many(bin, queue, removesilence, NULL); | ||
1034 | 1051 | ||
1035 | if (!gst_element_link_many(queue, removesilence, conv, NULL)) | 1052 | if (d->dropsilence == TRUE) |
1036 | lf("queue, removesilence, conv "); | 1053 | { |
1054 | gst_bin_add_many (bin, queue, removesilence, NULL); | ||
1037 | 1055 | ||
1038 | pad = gst_element_get_static_pad(queue, "sink"); | 1056 | if (! gst_element_link_many (queue, removesilence, conv, NULL)) |
1039 | } | 1057 | lf ("queue, removesilence, conv "); |
1040 | else | ||
1041 | { | ||
1042 | pad = gst_element_get_static_pad(conv, "sink"); | ||
1043 | } | ||
1044 | 1058 | ||
1045 | ghostpad = gst_ghost_pad_new("sink", pad); | 1059 | pad = gst_element_get_static_pad (queue, "sink"); |
1046 | } | 1060 | } |
1047 | else | 1061 | else |
1048 | { | 1062 | { |
1049 | // SOURCE | 1063 | pad = gst_element_get_static_pad (conv, "sink"); |
1064 | } | ||
1050 | 1065 | ||
1051 | bin = GST_BIN(gst_bin_new("Gnunet audiosource")); | 1066 | ghostpad = gst_ghost_pad_new ("sink", pad); |
1067 | } | ||
1068 | else | ||
1069 | { | ||
1070 | // SOURCE | ||
1052 | 1071 | ||
1053 | // source = gst_element_factory_make("audiotestsrc", "audiotestsrcbla"); | 1072 | bin = GST_BIN (gst_bin_new ("Gnunet audiosource")); |
1054 | 1073 | ||
1055 | if (d->audiobackend == AUTO) | 1074 | // source = gst_element_factory_make("audiotestsrc", "audiotestsrcbla"); |
1056 | { | ||
1057 | source = gst_element_factory_make("autoaudiosrc", "audiosource"); | ||
1058 | } | ||
1059 | if (d->audiobackend == ALSA) | ||
1060 | { | ||
1061 | source = gst_element_factory_make("alsasrc", "audiosource"); | ||
1062 | } | ||
1063 | if (d->audiobackend == JACK) | ||
1064 | { | ||
1065 | source = gst_element_factory_make("jackaudiosrc", "audiosource"); | ||
1066 | } | ||
1067 | if (d->audiobackend == TEST) | ||
1068 | { | ||
1069 | source = gst_element_factory_make("audiotestsrc", "audiosource"); | ||
1070 | } | ||
1071 | 1075 | ||
1072 | filter = gst_element_factory_make("capsfilter", "filter"); | 1076 | if (d->audiobackend == AUTO) |
1073 | conv = gst_element_factory_make("audioconvert", "converter"); | 1077 | { |
1074 | resampler = gst_element_factory_make("audioresample", "resampler"); | 1078 | source = gst_element_factory_make ("autoaudiosrc", "audiosource"); |
1079 | } | ||
1080 | if (d->audiobackend == ALSA) | ||
1081 | { | ||
1082 | source = gst_element_factory_make ("alsasrc", "audiosource"); | ||
1083 | } | ||
1084 | if (d->audiobackend == JACK) | ||
1085 | { | ||
1086 | source = gst_element_factory_make ("jackaudiosrc", "audiosource"); | ||
1087 | } | ||
1088 | if (d->audiobackend == TEST) | ||
1089 | { | ||
1090 | source = gst_element_factory_make ("audiotestsrc", "audiosource"); | ||
1091 | } | ||
1075 | 1092 | ||
1076 | if (d->audiobackend == AUTO) | 1093 | filter = gst_element_factory_make ("capsfilter", "filter"); |
1077 | { | 1094 | conv = gst_element_factory_make ("audioconvert", "converter"); |
1078 | g_signal_connect(source, "child-added", G_CALLBACK(autoaudiosource_child_added), NULL); | 1095 | resampler = gst_element_factory_make ("audioresample", "resampler"); |
1079 | } | 1096 | |
1080 | else | 1097 | if (d->audiobackend == AUTO) |
1098 | { | ||
1099 | g_signal_connect (source, "child-added", G_CALLBACK ( | ||
1100 | autoaudiosource_child_added), NULL); | ||
1101 | } | ||
1102 | else | ||
1103 | { | ||
1104 | if (GST_IS_AUDIO_BASE_SRC (source)) | ||
1105 | g_object_set (source, "buffer-time", (gint64) BUFFER_TIME, | ||
1106 | "latency-time", (gint64) LATENCY_TIME, NULL); | ||
1107 | if (d->audiobackend == JACK) | ||
1108 | { | ||
1109 | g_object_set (G_OBJECT (source), "client-name", "gnunet", NULL); | ||
1110 | if (g_object_class_find_property | ||
1111 | (G_OBJECT_GET_CLASS (source), "port-pattern")) | ||
1081 | { | 1112 | { |
1082 | if (GST_IS_AUDIO_BASE_SRC(source)) | 1113 | char *portpattern = "moc"; |
1083 | g_object_set(source, "buffer-time", (gint64)BUFFER_TIME, "latency-time", (gint64)LATENCY_TIME, NULL); | 1114 | |
1084 | if (d->audiobackend == JACK) | 1115 | g_object_set (G_OBJECT (source), "port-pattern", portpattern, |
1085 | { | 1116 | NULL); |
1086 | g_object_set(G_OBJECT(source), "client-name", "gnunet", NULL); | ||
1087 | if (g_object_class_find_property | ||
1088 | (G_OBJECT_GET_CLASS(source), "port-pattern")) | ||
1089 | { | ||
1090 | char *portpattern = "moc"; | ||
1091 | |||
1092 | g_object_set(G_OBJECT(source), "port-pattern", portpattern, | ||
1093 | NULL); | ||
1094 | } | ||
1095 | } | ||
1096 | } | 1117 | } |
1118 | } | ||
1119 | } | ||
1097 | 1120 | ||
1098 | caps = gst_caps_new_simple("audio/x-raw", | 1121 | caps = gst_caps_new_simple ("audio/x-raw", |
1099 | /* "format", G_TYPE_STRING, "S16LE", */ | 1122 | /* "format", G_TYPE_STRING, "S16LE", */ |
1100 | /* "rate", G_TYPE_INT, SAMPLING_RATE,*/ | 1123 | /* "rate", G_TYPE_INT, SAMPLING_RATE,*/ |
1101 | "channels", G_TYPE_INT, OPUS_CHANNELS, | 1124 | "channels", G_TYPE_INT, OPUS_CHANNELS, |
1102 | /* "layout", G_TYPE_STRING, "interleaved",*/ | 1125 | /* "layout", G_TYPE_STRING, "interleaved",*/ |
1103 | NULL); | 1126 | NULL); |
1104 | 1127 | ||
1105 | g_object_set(G_OBJECT(filter), | 1128 | g_object_set (G_OBJECT (filter), |
1106 | "caps", caps, | 1129 | "caps", caps, |
1107 | NULL); | 1130 | NULL); |
1108 | gst_caps_unref(caps); | 1131 | gst_caps_unref (caps); |
1109 | 1132 | ||
1110 | gst_bin_add_many(bin, source, filter, conv, resampler, NULL); | 1133 | gst_bin_add_many (bin, source, filter, conv, resampler, NULL); |
1111 | gst_element_link_many(source, filter, conv, resampler, NULL); | 1134 | gst_element_link_many (source, filter, conv, resampler, NULL); |
1112 | 1135 | ||
1113 | pad = gst_element_get_static_pad(resampler, "src"); | 1136 | pad = gst_element_get_static_pad (resampler, "src"); |
1114 | 1137 | ||
1115 | 1138 | ||
1116 | /* pads */ | 1139 | /* pads */ |
1117 | ghostpad = gst_ghost_pad_new("src", pad); | 1140 | ghostpad = gst_ghost_pad_new ("src", pad); |
1118 | } | 1141 | } |
1119 | 1142 | ||
1120 | /* set the bin pads */ | 1143 | /* set the bin pads */ |
1121 | gst_pad_set_active(ghostpad, TRUE); | 1144 | gst_pad_set_active (ghostpad, TRUE); |
1122 | gst_element_add_pad(GST_ELEMENT(bin), ghostpad); | 1145 | gst_element_add_pad (GST_ELEMENT (bin), ghostpad); |
1123 | 1146 | ||
1124 | gst_object_unref(pad); | 1147 | gst_object_unref (pad); |
1125 | 1148 | ||
1126 | return bin; | 1149 | return bin; |
1127 | } | 1150 | } |