Debian Codegraph @

src/validate-sound.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*
2 * Copyright © 2018 Red Hat, Inc
3 * Copyright © 2024 GNOME Foundation Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors:
19 * Matthias Clasen <[email protected]>
20 * Julian Sparber <[email protected]>
21 */
22
23 /* This is based on src/validate-icon.c */
24
25 #include <errno.h>
26 #include <fcntl.h>
27 #include <gst/gst.h>
28 #include <gst/pbutils/pbutils.h>
29 #include <glib/gstdio.h>
30 #include <unistd.h>
31
32 #ifdef __FreeBSD__
33 #define execvpe exect
34 #endif
35
36 #define SOUND_VALIDATOR_GROUPcxx . . $ `src/validate-sound.c:36:9`! "Sound Validator"
37
38 static int
39 validate_soundcxx . . $ validate_sound(7864480464b09eea). (int input_fd)
40 {
41 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GKeyFile) key_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
42 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *key_file_data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
43 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
44 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscoverer) discoverer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
45 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererInfo) info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
46 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) audio_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
47 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) stream_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
48 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstDiscovererStreamInfo) stream_next = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
49 GstDiscovererResultcxx . . $ GstDiscovererResult# result;
50 const gcharcxx . . $ gchar# *format = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
51 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! gcharcxx . . $ gchar# *uri = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
52
53 gst_initcxx . . $ gst_init(49aaaae07c8bf5c4). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
54
55 discoverer = gst_discoverer_newcxx . . $ gst_discoverer_new(b7f25ea108b972a). (GST_SECONDcxx . . $ `<external>/3702184213503130145/gstclock.h:103:9`!, &error);
56
57 if (!discoverer)
58 {
59 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Failed to create gstreamer discoverer: %s\n", error->messagecxx . . $ _GError#message.);
60 return 1;
61 }
62
63 uri = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("file:///proc/self/fd/%d", input_fd);
64 info = gst_discoverer_discover_uricxx . . $ gst_discoverer_discover_uri(98b6f2a378038219). (discoverer, uri, &error);
65 result = gst_discoverer_info_get_resultcxx . . $ gst_discoverer_info_get_result(f3e59416789bacc5). (info);
66
67 switch (result)
68 {
69 case GST_DISCOVERER_URI_INVALIDcxx . . $ GST_DISCOVERER_URI_INVALID.:
70 g_assert_not_reachedcxx . . $ `<external>/15287032793271088244/gtestutils.h:274:9`! ();
71 return 1;
72 case GST_DISCOVERER_ERRORcxx . . $ GST_DISCOVERER_ERROR.:
73 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: %s\n", error->messagecxx . . $ _GError#message.);
74 return 1;
75 case GST_DISCOVERER_TIMEOUTcxx . . $ GST_DISCOVERER_TIMEOUT.:
76 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Timeout\n");
77 return 1;
78 case GST_DISCOVERER_BUSYcxx . . $ GST_DISCOVERER_BUSY.:
79 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Busy\n");
80 return 1;
81 case GST_DISCOVERER_MISSING_PLUGINScxx . . $ GST_DISCOVERER_MISSING_PLUGINS.:
82 {
83 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
84
85 str = g_strjoinvcxx . . $ g_strjoinv(3bdede71480c687a). ("\n",
86 (char **) gst_discoverer_info_get_missing_elements_installer_detailscxx . . $ gst_discoverer_info_get_missing_elements_installer_details(af349c9f3ea70cc7). (info));
87
88 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Couldn't discover media type: Missing plugins: %s\n", str);
89 return 1;
90 }
91 case GST_DISCOVERER_OKcxx . . $ GST_DISCOVERER_OK.:
92 break;
93 }
94
95 stream_info = gst_discoverer_info_get_stream_infocxx . . $ gst_discoverer_info_get_stream_info(d66893dff2f671f). (info);
96 if (!stream_info)
97 {
98 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Contains a invalid stream\n");
99 return 1;
100 }
101
102 stream_next = gst_discoverer_stream_info_get_nextcxx . . $ gst_discoverer_stream_info_get_next(3efa1af951ec1519). (stream_info);
103 if (stream_next)
104 {
105 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Only a single stream is allowed\n");
106 return 1;
107 }
108
109 if (GST_IS_DISCOVERER_CONTAINER_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:99:9`! (stream_info))
110 {
111 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GList) streams = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
112 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstCaps) container_caps = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
113 GstStructurecxx . . $ GstStructure# *structure = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
114
115 container_caps = gst_discoverer_stream_info_get_capscxx . . $ gst_discoverer_stream_info_get_caps(41c52a77a1e96893). (stream_info);
116 structure = gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (container_caps, 0);
117
118 if (!gst_caps_is_fixedcxx . . $ gst_caps_is_fixed(53fdb5cb7412f113). (container_caps) || gst_caps_get_sizecxx . . $ gst_caps_get_size(ebfaf08f43e5a7fa). (container_caps) != 1)
119 {
120 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: The media format is to complex\n");
121 return 1;
122 }
123
124 if (!gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (structure, "audio/ogg"))
125 {
126 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Unsupported container format\n");
127 return 1;
128 }
129
130 streams = gst_discoverer_container_info_get_streamscxx . . $ gst_discoverer_container_info_get_streams(b01130eb53cf2406). (GST_DISCOVERER_CONTAINER_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:97:9`! (stream_info));
131
132 if (streams->nextcxx . . $ _GList#next.)
133 {
134 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Only a single stream is allowed\n");
135 return 1;
136 }
137
138 audio_info = gst_discoverer_stream_info_refcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:60:9`! (streams->data);
139 }
140 else
141 {
142 audio_info = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&stream_info);
143 }
144
145 if (GST_IS_DISCOVERER_AUDIO_INFOcxx . . $ `<external>/8989778625990710708/gstdiscoverer.h:123:9`! (audio_info))
146 {
147 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GstCaps) caps = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
148 GstStructurecxx . . $ GstStructure# *structure = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
149
150 caps = gst_discoverer_stream_info_get_capscxx . . $ gst_discoverer_stream_info_get_caps(41c52a77a1e96893). (audio_info);
151 structure = gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0);
152
153 if (!gst_caps_is_fixedcxx . . $ gst_caps_is_fixed(53fdb5cb7412f113). (caps) || gst_caps_get_sizecxx . . $ gst_caps_get_size(ebfaf08f43e5a7fa). (caps) != 1)
154 {
155 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Media format is to complex\n");
156 return 1;
157 }
158
159 if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (structure, "audio/x-wav"))
160 {
161 format = "wav/pcm";
162 }
163 else if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0), "audio/x-vorbis"))
164 {
165 format = "ogg/vorbis";
166 }
167 else if (gst_structure_has_namecxx . . $ gst_structure_has_name(c98256ceb658c9b4). (gst_caps_get_structurecxx . . $ gst_caps_get_structure(7bef9a7c814fa85d). (caps, 0), "audio/x-opus"))
168 {
169 format = "ogg/opus";
170 }
171 }
172
173 if (format == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
174 {
175 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("validate-sound: Unsupported sound format\n");
176 return 1;
177 }
178
179 key_file = g_key_file_newcxx . . $ g_key_file_new(9306a185df8cc356). ();
180 g_key_file_set_stringcxx . . $ g_key_file_set_string(c55395ecd37921cb). (key_file, SOUND_VALIDATOR_GROUPcxx . . $ `src/validate-sound.c:36:9`!, "format", format);
181 key_file_data = g_key_file_to_datacxx . . $ g_key_file_to_data(a45dc388ad4c0686). (key_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
182 g_printcxx . . $ g_print(326aeb464d16410c). ("%s", key_file_data);
183
184 closecxx . . $ close(7864480464b09eea). (input_fd);
185
186 return 0;
187 }
188
189 #ifdef HELPERcxx . . $ `<built-in>:416:9`!
190
191 G_GNUC_NULL_TERMINATEDcxx . . $ `<external>/12741050725406041920/gmacros.h:330:9`!
192 static void
193 add_argscxx . . $ add_args(aa30f7e23b4ff587). (GPtrArraycxx . . $ GPtrArray# *argv_array, ...)
194 {
195 va_listcxx . . $ va_list# args;
196 const char *arg;
197
198 va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`! (args, argv_array);
199 while ((arg = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`! (args, const gchar *)))
200 g_ptr_array_addcxx . . $ g_ptr_array_add(3cd73f70a4ada9). (argv_array, g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (arg));
201 va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`! (args);
202 }
203
204 static gbooleancxx . . $ gboolean#
205 path_is_usrmergedcxx . . $ path_is_usrmerged(5c4306d8553b3696). (const char *dir)
206 {
207 /* does /dir point to /usr/dir? */
208 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
209 GStatBufcxx . . $ GStatBuf# stat_buf_src, stat_buf_target;
210
211 if (g_statcxx . . $ `<external>/6704587548159124736/gstdio.h:77:9`! (dir, &stat_buf_src) < 0)
212 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
213
214 target = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/usr/%s", dir);
215
216 if (g_statcxx . . $ `<external>/6704587548159124736/gstdio.h:77:9`! (target, &stat_buf_target) < 0)
217 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
218
219 return (stat_buf_src.st_devcxx . . $ stat#st_dev. == stat_buf_target.st_devcxx . . $ stat#st_dev.) &&
220 (stat_buf_src.st_inocxx . . $ stat#st_ino. == stat_buf_target.st_inocxx . . $ stat#st_ino.);
221 }
222
223 const char *
224 flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (void)
225 {
226 const char *e = g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("FLATPAK_BWRAP");
227
228 if (e != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
229 return e;
230
231 return HELPERcxx . . $ `<built-in>:416:9`!;
232 }
233
234 static int
235 rerun_in_sandboxcxx . . $ rerun_in_sandbox(7864480464b09eea). (int input_fd)
236 {
237 const char * const usrmerged_dirs[] = { "bin", "lib32", "lib64", "lib", "sbin" };
238 int i;
239 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GPtrArray) args = g_ptr_array_new_with_free_funccxx . . $ g_ptr_array_new_with_free_func(e90788d6907589f2). (g_freecxx . . $ g_free(5d22bdacc48458e8).);
240 char validate_sound[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! + 1];
241 ssize_tcxx . . $ ssize_t# symlink_size;
242 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char* arg_input_fd = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
243
244 symlink_size = readlinkcxx . . $ readlink(373c9bd46766ee5). ("/proc/self/exe", validate_sound, sizeof (validate_sound) - 1);
245 if (symlink_size < 0 || (size_tcxx . . $ size_t#) symlink_size >= sizeof (validate_sound))
246 {
247 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: failed to read /proc/self/exe\n");
248 return 1;
249 }
250
251 validate_sound[symlink_size] = 0;
252
253 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args,
254 flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (),
255 "--unshare-ipc",
256 "--unshare-net",
257 "--unshare-pid",
258 "--tmpfs", "/tmp",
259 "--proc", "/proc",
260 "--dev", "/dev",
261 "--ro-bind", "/usr", "/usr",
262 "--ro-bind-try", "/etc/ld.so.cache", "/etc/ld.so.cache",
263 "--ro-bind", validate_sound, validate_sound,
264 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
265
266 /* These directories might be symlinks into /usr/... */
267 for (i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (usrmerged_dirs); i++)
268 {
269 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *absolute_dir = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/%s", usrmerged_dirs[i]);
270
271 if (!g_file_testcxx . . $ g_file_test(d991f72152d535bf). (absolute_dir, G_FILE_TEST_EXISTScxx . . $ G_FILE_TEST_EXISTS.))
272 continue;
273
274 if (path_is_usrmergedcxx . . $ path_is_usrmerged(5c4306d8553b3696). (absolute_dir))
275 {
276 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *symlink_target = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/usr/%s", absolute_dir);
277
278 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args,
279 "--symlink", symlink_target, absolute_dir,
280 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
281 }
282 else
283 {
284 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args,
285 "--ro-bind", absolute_dir, absolute_dir,
286 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
287 }
288 }
289
290 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args,
291 "--chdir", "/",
292 "--setenv", "GIO_USE_VFS", "local",
293 "--unsetenv", "TMPDIR",
294 "--die-with-parent",
295 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
296
297 if (g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_DEBUG"))
298 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, "--setenv", "G_MESSAGES_DEBUG", g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_DEBUG"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
299 if (g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_PREFIXED"))
300 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, "--setenv", "G_MESSAGES_PREFIXED", g_getenvcxx . . $ g_getenv(fb58d2e09a2a1ce6). ("G_MESSAGES_PREFIXED"), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
301
302
303 arg_input_fd = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%d", input_fd);
304 add_argscxx . . $ add_args(aa30f7e23b4ff587). (args, validate_sound, "--fd", arg_input_fd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
305 g_ptr_array_addcxx . . $ g_ptr_array_add(3cd73f70a4ada9). (args, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
306
307 execvpecxx . . $ execvpe(181eaca3a689d655). (flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (), (char **) args->pdatacxx . . $ _GPtrArray#pdata., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
308 /* If we get here, then execvpe() failed. */
309 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Sound validation: execvpe %s: %s\n", flatpak_get_bwrapcxx . . $ flatpak_get_bwrap(33a1f659e94feb42). (), g_strerrorcxx . . $ g_strerror(f7ae7e56280f18ae). (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
310 return 1;
311 }
312 #endif
313
314 static gbooleancxx . . $ gboolean# opt_sandboxcxx . . $ opt_sandbox.;
315 static gcharcxx . . $ gchar# *opt_pathcxx . . $ opt_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
316 static gintcxx . . $ gint# opt_fdcxx . . $ opt_fd. = -1;
317
318 static GOptionEntrycxx . . $ GOptionEntry# entriescxx . . $ entries.[] = {
319 { "sandbox", 0, 0, G_OPTION_ARG_NONEcxx . . $ G_OPTION_ARG_NONE., &opt_sandboxcxx . . $ opt_sandbox., "Run in a sandbox", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
320 { "path", 0, 0, G_OPTION_ARG_FILENAMEcxx . . $ G_OPTION_ARG_FILENAME., &opt_pathcxx . . $ opt_path., "Read sound data from given file path", "PATH" },
321 { "fd", 0, 0, G_OPTION_ARG_INTcxx . . $ G_OPTION_ARG_INT., &opt_fdcxx . . $ opt_fd., "Read sound data from given file descriptor", "FD" },
322 { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }
323 };
324
325 int
326 maincxx . . $ main(afcd3168fc1188a4). (int argc, char *argv[])
327 {
328 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GOptionContext) context = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
329 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
330
•331 g_log_writer_default_set_use_stderrcxx . . $ g_log_writer_default_set_use_stderr(d4f767463ce0a6b3). (TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
332
333 context = g_option_context_newcxx . . $ g_option_context_new(a696d53710071c45). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
334 g_option_context_add_main_entriescxx . . $ g_option_context_add_main_entries(2b8a7b3623c14603). (context, entriescxx . . $ entries., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
335 if (!g_option_context_parsecxx . . $ g_option_context_parse(e19b3ba917830101). (context, &argc, &argv, &error))
336 {
337 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: %s\n", error->messagecxx . . $ _GError#message.);
338 return 1;
339 }
340
341 if (opt_pathcxx . . $ opt_path. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && opt_fdcxx . . $ opt_fd. != -1)
342 {
343 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Only --path or --fd can be given\n");
344 return 1;
345 }
346
347 if (opt_pathcxx . . $ opt_path.)
348 {
349 opt_fdcxx . . $ opt_fd. = g_opencxx . . $ `<external>/6704587548159124736/gstdio.h:73:9`! (opt_pathcxx . . $ opt_path., O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!, 0);
350 if (opt_fdcxx . . $ opt_fd. == -1)
351 {
352 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Couldn't open file\n");
353 return 1;
354 }
355 }
356 else if (opt_fdcxx . . $ opt_fd. == -1)
357 {
358 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *help = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
359
360 help = g_option_context_get_helpcxx . . $ g_option_context_get_help(ff6b251d7c5b0c51). (context, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
361 g_printerrcxx . . $ g_printerr(326aeb464d16410c). ("Error: Either --path or --fd needs to be given\n\n%s", help);
362 return 1;
363 }
364
365 #ifdef HELPERcxx . . $ `<built-in>:416:9`!
366 if (opt_sandboxcxx . . $ opt_sandbox.)
367 return rerun_in_sandboxcxx . . $ rerun_in_sandbox(7864480464b09eea). (opt_fdcxx . . $ opt_fd.);
368 else
369 #endif
370 return validate_soundcxx . . $ validate_sound(7864480464b09eea). (opt_fdcxx . . $ opt_fd.);
371 }