diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/conversation/microphone.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/conversation/microphone.c')
-rw-r--r-- | src/conversation/microphone.c | 115 |
1 files changed, 56 insertions, 59 deletions
diff --git a/src/conversation/microphone.c b/src/conversation/microphone.c index 57588f05a..01f8adb1e 100644 --- a/src/conversation/microphone.c +++ b/src/conversation/microphone.c | |||
@@ -1,19 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2013 GNUnet e.V. | 3 | Copyright (C) 2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
@@ -34,9 +34,7 @@ | |||
34 | /** | 34 | /** |
35 | * Internal data structures for the microphone. | 35 | * Internal data structures for the microphone. |
36 | */ | 36 | */ |
37 | struct Microphone | 37 | struct Microphone { |
38 | { | ||
39 | |||
40 | /** | 38 | /** |
41 | * Our configuration. | 39 | * Our configuration. |
42 | */ | 40 | */ |
@@ -56,7 +54,6 @@ struct Microphone | |||
56 | * Closure for @e rdc. | 54 | * Closure for @e rdc. |
57 | */ | 55 | */ |
58 | void *rdc_cls; | 56 | void *rdc_cls; |
59 | |||
60 | }; | 57 | }; |
61 | 58 | ||
62 | 59 | ||
@@ -70,21 +67,21 @@ struct Microphone | |||
70 | * #GNUNET_SYSERR to stop further processing with error | 67 | * #GNUNET_SYSERR to stop further processing with error |
71 | */ | 68 | */ |
72 | static int | 69 | static int |
73 | process_record_messages (void *cls, | 70 | process_record_messages(void *cls, |
74 | const struct GNUNET_MessageHeader *msg) | 71 | const struct GNUNET_MessageHeader *msg) |
75 | { | 72 | { |
76 | struct Microphone *mic = cls; | 73 | struct Microphone *mic = cls; |
77 | const struct AudioMessage *am; | 74 | const struct AudioMessage *am; |
78 | 75 | ||
79 | if (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO) | 76 | if (ntohs(msg->type) != GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO) |
80 | { | 77 | { |
81 | GNUNET_break (0); | 78 | GNUNET_break(0); |
82 | return GNUNET_SYSERR; | 79 | return GNUNET_SYSERR; |
83 | } | 80 | } |
84 | am = (const struct AudioMessage *) msg; | 81 | am = (const struct AudioMessage *)msg; |
85 | mic->rdc (mic->rdc_cls, | 82 | mic->rdc(mic->rdc_cls, |
86 | ntohs (msg->size) - sizeof (struct AudioMessage), | 83 | ntohs(msg->size) - sizeof(struct AudioMessage), |
87 | &am[1]); | 84 | &am[1]); |
88 | return GNUNET_OK; | 85 | return GNUNET_OK; |
89 | } | 86 | } |
90 | 87 | ||
@@ -97,9 +94,9 @@ process_record_messages (void *cls, | |||
97 | * @param rdc_cls closure for @a dc | 94 | * @param rdc_cls closure for @a dc |
98 | */ | 95 | */ |
99 | static int | 96 | static int |
100 | enable (void *cls, | 97 | enable(void *cls, |
101 | GNUNET_MICROPHONE_RecordedDataCallback rdc, | 98 | GNUNET_MICROPHONE_RecordedDataCallback rdc, |
102 | void *rdc_cls) | 99 | void *rdc_cls) |
103 | { | 100 | { |
104 | struct Microphone *mic = cls; | 101 | struct Microphone *mic = cls; |
105 | static char * const record_helper_argv[] = | 102 | static char * const record_helper_argv[] = |
@@ -110,17 +107,17 @@ enable (void *cls, | |||
110 | 107 | ||
111 | mic->rdc = rdc; | 108 | mic->rdc = rdc; |
112 | mic->rdc_cls = rdc_cls; | 109 | mic->rdc_cls = rdc_cls; |
113 | mic->record_helper = GNUNET_HELPER_start (GNUNET_NO, | 110 | mic->record_helper = GNUNET_HELPER_start(GNUNET_NO, |
114 | "gnunet-helper-audio-record", | 111 | "gnunet-helper-audio-record", |
115 | record_helper_argv, | 112 | record_helper_argv, |
116 | &process_record_messages, | 113 | &process_record_messages, |
117 | NULL, mic); | 114 | NULL, mic); |
118 | if (NULL == mic->record_helper) | 115 | if (NULL == mic->record_helper) |
119 | { | 116 | { |
120 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 117 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
121 | _("Could not start record audio helper\n")); | 118 | _("Could not start record audio helper\n")); |
122 | return GNUNET_SYSERR; | 119 | return GNUNET_SYSERR; |
123 | } | 120 | } |
124 | return GNUNET_OK; | 121 | return GNUNET_OK; |
125 | } | 122 | } |
126 | 123 | ||
@@ -131,18 +128,18 @@ enable (void *cls, | |||
131 | * @param cls clsoure | 128 | * @param cls clsoure |
132 | */ | 129 | */ |
133 | static void | 130 | static void |
134 | disable (void *cls) | 131 | disable(void *cls) |
135 | { | 132 | { |
136 | struct Microphone *mic = cls; | 133 | struct Microphone *mic = cls; |
137 | 134 | ||
138 | if (NULL == mic->record_helper) | 135 | if (NULL == mic->record_helper) |
139 | { | 136 | { |
140 | GNUNET_break (0); | 137 | GNUNET_break(0); |
141 | return; | 138 | return; |
142 | } | 139 | } |
143 | GNUNET_break (GNUNET_OK == | 140 | GNUNET_break(GNUNET_OK == |
144 | GNUNET_HELPER_kill (mic->record_helper, GNUNET_NO)); | 141 | GNUNET_HELPER_kill(mic->record_helper, GNUNET_NO)); |
145 | GNUNET_HELPER_destroy (mic->record_helper); | 142 | GNUNET_HELPER_destroy(mic->record_helper); |
146 | mic->record_helper = NULL; | 143 | mic->record_helper = NULL; |
147 | } | 144 | } |
148 | 145 | ||
@@ -153,12 +150,12 @@ disable (void *cls) | |||
153 | * @param cls clsoure | 150 | * @param cls clsoure |
154 | */ | 151 | */ |
155 | static void | 152 | static void |
156 | destroy (void *cls) | 153 | destroy(void *cls) |
157 | { | 154 | { |
158 | struct Microphone *mic = cls; | 155 | struct Microphone *mic = cls; |
159 | 156 | ||
160 | if (NULL != mic->record_helper) | 157 | if (NULL != mic->record_helper) |
161 | disable (mic); | 158 | disable(mic); |
162 | } | 159 | } |
163 | 160 | ||
164 | 161 | ||
@@ -170,14 +167,14 @@ destroy (void *cls) | |||
170 | * @return NULL on error | 167 | * @return NULL on error |
171 | */ | 168 | */ |
172 | struct GNUNET_MICROPHONE_Handle * | 169 | struct GNUNET_MICROPHONE_Handle * |
173 | GNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg) | 170 | GNUNET_MICROPHONE_create_from_hardware(const struct GNUNET_CONFIGURATION_Handle *cfg) |
174 | { | 171 | { |
175 | struct GNUNET_MICROPHONE_Handle *microphone; | 172 | struct GNUNET_MICROPHONE_Handle *microphone; |
176 | struct Microphone *mic; | 173 | struct Microphone *mic; |
177 | 174 | ||
178 | mic = GNUNET_new (struct Microphone); | 175 | mic = GNUNET_new(struct Microphone); |
179 | mic->cfg = cfg; | 176 | mic->cfg = cfg; |
180 | microphone = GNUNET_new (struct GNUNET_MICROPHONE_Handle); | 177 | microphone = GNUNET_new(struct GNUNET_MICROPHONE_Handle); |
181 | microphone->cls = mic; | 178 | microphone->cls = mic; |
182 | microphone->enable_microphone = &enable; | 179 | microphone->enable_microphone = &enable; |
183 | microphone->disable_microphone = &disable; | 180 | microphone->disable_microphone = &disable; |
@@ -192,10 +189,10 @@ GNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle | |||
192 | * @param microphone microphone to destroy | 189 | * @param microphone microphone to destroy |
193 | */ | 190 | */ |
194 | void | 191 | void |
195 | GNUNET_MICROPHONE_destroy (struct GNUNET_MICROPHONE_Handle *microphone) | 192 | GNUNET_MICROPHONE_destroy(struct GNUNET_MICROPHONE_Handle *microphone) |
196 | { | 193 | { |
197 | microphone->destroy_microphone (microphone->cls); | 194 | microphone->destroy_microphone(microphone->cls); |
198 | GNUNET_free (microphone); | 195 | GNUNET_free(microphone); |
199 | } | 196 | } |
200 | 197 | ||
201 | /* end of microphone.c */ | 198 | /* end of microphone.c */ |