blob: 755ecc53ae55215624a25ab5984b0ef5852fe5c9 [file] [log] [blame]
Phil Burk44795232017-06-30 16:27:38 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef AAUDIO_EXAMPLE_ARGS_PARSER_H
18#define AAUDIO_EXAMPLE_ARGS_PARSER_H
19
Phil Burk67ed9da2017-09-06 16:26:52 -070020#define MAX_CHANNELS 8
21
Phil Burk4e98efa2018-02-05 18:41:55 -080022//#include <cctype>
23#include <dlfcn.h>
Phil Burk44795232017-06-30 16:27:38 -070024#include <unistd.h>
25#include <stdio.h>
26#include <stdlib.h>
27
28#include <aaudio/AAudio.h>
29#include <aaudio/AAudioTesting.h>
Phil Burka5222e22017-07-28 13:31:14 -070030
31#include "AAudioExampleUtils.h"
Phil Burk44795232017-06-30 16:27:38 -070032
Phil Burk4e98efa2018-02-05 18:41:55 -080033
34static void (*s_setUsage)(AAudioStreamBuilder* builder, aaudio_usage_t usage) = nullptr;
35static void (*s_setContentType)(AAudioStreamBuilder* builder,
36 aaudio_content_type_t contentType) = nullptr;
37static void (*s_setInputPreset)(AAudioStreamBuilder* builder,
38 aaudio_input_preset_t inputPreset) = nullptr;
Kevin Rocard68646ba2019-03-20 13:26:49 -070039static void (*s_setAllowedCapturePolicy)(AAudioStreamBuilder* builder,
40 aaudio_allowed_capture_policy_t usage) = nullptr;
Phil Burk4e98efa2018-02-05 18:41:55 -080041
42static bool s_loadAttempted = false;
43static aaudio_usage_t (*s_getUsage)(AAudioStream *stream) = nullptr;
44static aaudio_content_type_t (*s_getContentType)(AAudioStream *stream) = nullptr;
45static aaudio_input_preset_t (*s_getInputPreset)(AAudioStream *stream) = nullptr;
Kevin Rocard68646ba2019-03-20 13:26:49 -070046static aaudio_allowed_capture_policy_t (*s_getAllowedCapturePolicy)(AAudioStream *stream) = nullptr;
Phil Burk4e98efa2018-02-05 18:41:55 -080047
48// Link to test functions in shared library.
49static void loadFutureFunctions() {
50 if (s_loadAttempted) return; // only try once
51 s_loadAttempted = true;
52
53 void *handle = dlopen("libaaudio.so", RTLD_NOW);
54 if (handle != nullptr) {
55 s_setUsage = (void (*)(AAudioStreamBuilder *, aaudio_usage_t))
56 dlsym(handle, "AAudioStreamBuilder_setUsage");
57 if (s_setUsage == nullptr) goto error;
58
59 s_setContentType = (void (*)(AAudioStreamBuilder *, aaudio_content_type_t))
60 dlsym(handle, "AAudioStreamBuilder_setContentType");
61 if (s_setContentType == nullptr) goto error;
62
63 s_setInputPreset = (void (*)(AAudioStreamBuilder *, aaudio_input_preset_t))
64 dlsym(handle, "AAudioStreamBuilder_setInputPreset");
65 if (s_setInputPreset == nullptr) goto error;
66
Kevin Rocard68646ba2019-03-20 13:26:49 -070067 s_setAllowedCapturePolicy = (void (*)(AAudioStreamBuilder *, aaudio_input_preset_t))
68 dlsym(handle, "AAudioStreamBuilder_setAllowedCapturePolicy");
69 if (s_setAllowedCapturePolicy == nullptr) goto error;
70
Phil Burk4e98efa2018-02-05 18:41:55 -080071 s_getUsage = (aaudio_usage_t (*)(AAudioStream *))
72 dlsym(handle, "AAudioStream_getUsage");
73 if (s_getUsage == nullptr) goto error;
74
75 s_getContentType = (aaudio_content_type_t (*)(AAudioStream *))
76 dlsym(handle, "AAudioStream_getContentType");
77 if (s_getContentType == nullptr) goto error;
78
79 s_getInputPreset = (aaudio_input_preset_t (*)(AAudioStream *))
80 dlsym(handle, "AAudioStream_getInputPreset");
81 if (s_getInputPreset == nullptr) goto error;
Kevin Rocard68646ba2019-03-20 13:26:49 -070082
83 s_getAllowedCapturePolicy = (aaudio_input_preset_t (*)(AAudioStream *))
84 dlsym(handle, "AAudioStream_getAllowedCapturePolicy");
85 if (s_getAllowedCapturePolicy == nullptr) goto error;
Phil Burk4e98efa2018-02-05 18:41:55 -080086 }
87 return;
88
89error:
90 // prevent any calls to these functions
91 s_setUsage = nullptr;
92 s_setContentType = nullptr;
93 s_setInputPreset = nullptr;
94 s_getUsage = nullptr;
95 s_getContentType = nullptr;
96 s_getInputPreset = nullptr;
97 dlclose(handle);
98 return;
99}
100
Phil Burk44795232017-06-30 16:27:38 -0700101class AAudioParameters {
102public:
103
104 /**
105 * This is also known as samplesPerFrame.
106 */
107 int32_t getChannelCount() const {
108 return mChannelCount;
109 }
110
111 void setChannelCount(int32_t channelCount) {
Phil Burk67ed9da2017-09-06 16:26:52 -0700112 if (channelCount > MAX_CHANNELS) {
113 printf("Sorry, MAX of %d channels!\n", MAX_CHANNELS);
114 channelCount = MAX_CHANNELS;
115 }
Phil Burk44795232017-06-30 16:27:38 -0700116 mChannelCount = channelCount;
117 }
118
119 int32_t getSampleRate() const {
120 return mSampleRate;
121 }
122
123 void setSampleRate(int32_t sampleRate) {
124 mSampleRate = sampleRate;
125 }
126
127 aaudio_format_t getFormat() const {
128 return mFormat;
129 }
130
131 void setFormat(aaudio_format_t format) {
132 mFormat = format;
133 }
134
135 aaudio_sharing_mode_t getSharingMode() const {
136 return mSharingMode;
137 }
138
139 void setSharingMode(aaudio_sharing_mode_t sharingMode) {
140 mSharingMode = sharingMode;
141 }
142
143 int32_t getBufferCapacity() const {
144 return mBufferCapacity;
145 }
146
147 void setBufferCapacity(int32_t frames) {
148 mBufferCapacity = frames;
149 }
150
151 int32_t getPerformanceMode() const {
152 return mPerformanceMode;
153 }
154
155 void setPerformanceMode(aaudio_performance_mode_t performanceMode) {
156 mPerformanceMode = performanceMode;
157 }
158
Phil Burk6d6f3f62018-01-12 17:27:54 -0800159 aaudio_usage_t getUsage() const {
160 return mUsage;
161 }
162
163 void setUsage(aaudio_usage_t usage) {
164 mUsage = usage;
165 }
166
167 aaudio_content_type_t getContentType() const {
168 return mContentType;
169 }
170
171 void setContentType(aaudio_content_type_t contentType) {
172 mContentType = contentType;
173 }
174
175 aaudio_input_preset_t getInputPreset() const {
176 return mInputPreset;
177 }
178
179 void setInputPreset(aaudio_input_preset_t inputPreset) {
180 mInputPreset = inputPreset;
181 }
182
Kevin Rocard68646ba2019-03-20 13:26:49 -0700183 aaudio_allowed_capture_policy_t getAllowedCapturePolicy() const {
184 return mAllowedCapturePolicy;
185 }
186
187 void setAllowedCapturePolicy(aaudio_allowed_capture_policy_t policy) {
188 mAllowedCapturePolicy = policy;
189 }
190
Phil Burk44795232017-06-30 16:27:38 -0700191 int32_t getDeviceId() const {
192 return mDeviceId;
193 }
194
195 void setDeviceId(int32_t deviceId) {
196 mDeviceId = deviceId;
197 }
198
199 int32_t getNumberOfBursts() const {
200 return mNumberOfBursts;
201 }
202
203 void setNumberOfBursts(int32_t numBursts) {
204 mNumberOfBursts = numBursts;
205 }
206
Phil Burk10ffb192018-09-26 12:09:00 -0700207 int32_t getFramesPerCallback() const {
208 return mFramesPerCallback;
209 }
210 void setFramesPerCallback(int32_t size) {
211 mFramesPerCallback = size;
212 }
213
Phil Burk44795232017-06-30 16:27:38 -0700214 /**
215 * Apply these parameters to a stream builder.
216 * @param builder
217 */
218 void applyParameters(AAudioStreamBuilder *builder) const {
Phil Burke0a4d2a2018-11-05 11:40:36 -0800219 AAudioStreamBuilder_setBufferCapacityInFrames(builder, getBufferCapacity());
Phil Burk10ffb192018-09-26 12:09:00 -0700220 AAudioStreamBuilder_setChannelCount(builder, mChannelCount);
Phil Burk44795232017-06-30 16:27:38 -0700221 AAudioStreamBuilder_setDeviceId(builder, mDeviceId);
Phil Burk10ffb192018-09-26 12:09:00 -0700222 AAudioStreamBuilder_setFormat(builder, mFormat);
223 AAudioStreamBuilder_setFramesPerDataCallback(builder, mFramesPerCallback);
Phil Burk44795232017-06-30 16:27:38 -0700224 AAudioStreamBuilder_setPerformanceMode(builder, mPerformanceMode);
Phil Burk10ffb192018-09-26 12:09:00 -0700225 AAudioStreamBuilder_setSampleRate(builder, mSampleRate);
226 AAudioStreamBuilder_setSharingMode(builder, mSharingMode);
Phil Burk4e98efa2018-02-05 18:41:55 -0800227
228 // Call P functions if supported.
229 loadFutureFunctions();
230 if (s_setUsage != nullptr) {
231 s_setUsage(builder, mUsage);
232 } else if (mUsage != AAUDIO_UNSPECIFIED){
233 printf("WARNING: setUsage not supported");
234 }
235 if (s_setContentType != nullptr) {
236 s_setContentType(builder, mContentType);
237 } else if (mUsage != AAUDIO_UNSPECIFIED){
238 printf("WARNING: setContentType not supported");
239 }
240 if (s_setInputPreset != nullptr) {
241 s_setInputPreset(builder, mInputPreset);
242 } else if (mUsage != AAUDIO_UNSPECIFIED){
243 printf("WARNING: setInputPreset not supported");
244 }
Kevin Rocard68646ba2019-03-20 13:26:49 -0700245
246 // Call Q functions if supported.
247 if (s_setAllowedCapturePolicy != nullptr) {
248 s_setAllowedCapturePolicy(builder, mAllowedCapturePolicy);
249 } else if (mAllowedCapturePolicy != AAUDIO_UNSPECIFIED){
250 printf("WARNING: setAllowedCapturePolicy not supported");
251 }
Phil Burk44795232017-06-30 16:27:38 -0700252 }
253
254private:
255 int32_t mChannelCount = AAUDIO_UNSPECIFIED;
256 aaudio_format_t mFormat = AAUDIO_FORMAT_UNSPECIFIED;
257 int32_t mSampleRate = AAUDIO_UNSPECIFIED;
258
259 int32_t mBufferCapacity = AAUDIO_UNSPECIFIED;
260 int32_t mDeviceId = AAUDIO_UNSPECIFIED;
261 aaudio_sharing_mode_t mSharingMode = AAUDIO_SHARING_MODE_SHARED;
262 aaudio_performance_mode_t mPerformanceMode = AAUDIO_PERFORMANCE_MODE_NONE;
263
Phil Burk6d6f3f62018-01-12 17:27:54 -0800264 aaudio_usage_t mUsage = AAUDIO_UNSPECIFIED;
265 aaudio_content_type_t mContentType = AAUDIO_UNSPECIFIED;
266 aaudio_input_preset_t mInputPreset = AAUDIO_UNSPECIFIED;
Kevin Rocard68646ba2019-03-20 13:26:49 -0700267 aaudio_allowed_capture_policy_t mAllowedCapturePolicy = AAUDIO_UNSPECIFIED;
Phil Burk6d6f3f62018-01-12 17:27:54 -0800268
Phil Burkfcf9efd2017-07-14 08:25:08 -0700269 int32_t mNumberOfBursts = AAUDIO_UNSPECIFIED;
Phil Burk10ffb192018-09-26 12:09:00 -0700270 int32_t mFramesPerCallback = AAUDIO_UNSPECIFIED;
Phil Burk44795232017-06-30 16:27:38 -0700271};
272
273class AAudioArgsParser : public AAudioParameters {
274public:
275 AAudioArgsParser() = default;
276 ~AAudioArgsParser() = default;
277
278 enum {
279 DEFAULT_DURATION_SECONDS = 5
280 };
281
282 /**
283 * @param arg
284 * @return true if the argument was not handled
285 */
286 bool parseArg(const char *arg) {
287 bool unrecognized = false;
288 if (arg[0] == '-') {
289 char option = arg[1];
290 switch (option) {
291 case 'b':
292 setBufferCapacity(atoi(&arg[2]));
293 break;
294 case 'c':
295 setChannelCount(atoi(&arg[2]));
296 break;
Kevin Rocard68646ba2019-03-20 13:26:49 -0700297 case 'C':
298 setAllowedCapturePolicy(parseAllowedCapturePolicy(arg[2]));
299 break;
Phil Burk44795232017-06-30 16:27:38 -0700300 case 'd':
Phil Burke008d022017-08-23 12:56:15 -0700301 setDeviceId(atoi(&arg[2]));
302 break;
Phil Burkdd574ca2018-04-04 14:41:28 -0700303 case 'f':
304 setFormat(atoi(&arg[2]));
305 break;
Phil Burk6d6f3f62018-01-12 17:27:54 -0800306 case 'i':
307 setInputPreset(atoi(&arg[2]));
Phil Burk44795232017-06-30 16:27:38 -0700308 break;
Phil Burkfcf9efd2017-07-14 08:25:08 -0700309 case 'm': {
310 aaudio_policy_t policy = AAUDIO_POLICY_AUTO;
311 if (strlen(arg) > 2) {
312 policy = atoi(&arg[2]);
313 }
Phil Burke0a4d2a2018-11-05 11:40:36 -0800314 if (AAudio_setMMapPolicy(policy) != AAUDIO_OK) {
Kevin Rocard9dcd34f2018-06-13 16:19:36 -0700315 printf("ERROR: invalid MMAP policy mode %i\n", policy);
316 }
Phil Burkfcf9efd2017-07-14 08:25:08 -0700317 } break;
Phil Burk44795232017-06-30 16:27:38 -0700318 case 'n':
319 setNumberOfBursts(atoi(&arg[2]));
320 break;
321 case 'p':
322 setPerformanceMode(parsePerformanceMode(arg[2]));
323 break;
324 case 'r':
325 setSampleRate(atoi(&arg[2]));
326 break;
Phil Burk6d6f3f62018-01-12 17:27:54 -0800327 case 's':
328 mDurationSeconds = atoi(&arg[2]);
329 break;
330 case 'u':
331 setUsage(atoi(&arg[2]));
332 break;
Phil Burk44795232017-06-30 16:27:38 -0700333 case 'x':
334 setSharingMode(AAUDIO_SHARING_MODE_EXCLUSIVE);
335 break;
Phil Burk6d6f3f62018-01-12 17:27:54 -0800336 case 'y':
337 setContentType(atoi(&arg[2]));
338 break;
Phil Burk10ffb192018-09-26 12:09:00 -0700339 case 'z':
340 setFramesPerCallback(atoi(&arg[2]));
341 break;
Phil Burk44795232017-06-30 16:27:38 -0700342 default:
343 unrecognized = true;
344 break;
345 }
346 }
347 return unrecognized;
348 }
349
350 /**
351 *
352 * @param argc
353 * @param argv
354 * @return true if an unrecognized argument was passed
355 */
356 bool parseArgs(int argc, const char **argv) {
357 for (int i = 1; i < argc; i++) {
358 const char *arg = argv[i];
359 if (parseArg(arg)) {
360 usage();
361 return true;
362 }
363
364 }
365 return false;
366 }
367
368 static void usage() {
Phil Burk6d6f3f62018-01-12 17:27:54 -0800369 printf("-c{channels} -d{deviceId} -m{mmapPolicy} -n{burstsPerBuffer} -p{perfMode}");
370 printf(" -r{rate} -s{seconds} -x\n");
Phil Burk44795232017-06-30 16:27:38 -0700371 printf(" Default values are UNSPECIFIED unless otherwise stated.\n");
372 printf(" -b{bufferCapacity} frames\n");
373 printf(" -c{channels} for example 2 for stereo\n");
Kevin Rocard68646ba2019-03-20 13:26:49 -0700374 printf(" -C{a|s|n} set playback capture policy\n");
375 printf(" a = _ALL (default)\n");
376 printf(" s = _SYSTEM\n");
377 printf(" n = _NONE\n");
Phil Burke008d022017-08-23 12:56:15 -0700378 printf(" -d{deviceId} default is %d\n", AAUDIO_UNSPECIFIED);
Phil Burkdd574ca2018-04-04 14:41:28 -0700379 printf(" -f{0|1|2} set format\n");
380 printf(" 0 = UNSPECIFIED\n");
381 printf(" 1 = PCM_I16\n");
382 printf(" 2 = FLOAT\n");
Phil Burk6d6f3f62018-01-12 17:27:54 -0800383 printf(" -i{inputPreset} eg. 5 for AAUDIO_INPUT_PRESET_CAMCORDER\n");
Phil Burkfcf9efd2017-07-14 08:25:08 -0700384 printf(" -m{0|1|2|3} set MMAP policy\n");
Phil Burk6d6f3f62018-01-12 17:27:54 -0800385 printf(" 0 = _UNSPECIFIED, use aaudio.mmap_policy system property, default\n");
386 printf(" 1 = _NEVER, never use MMAP\n");
387 printf(" 2 = _AUTO, use MMAP if available, default for -m with no number\n");
388 printf(" 3 = _ALWAYS, use MMAP or fail\n");
Phil Burk44795232017-06-30 16:27:38 -0700389 printf(" -n{numberOfBursts} for setBufferSize\n");
390 printf(" -p{performanceMode} set output AAUDIO_PERFORMANCE_MODE*, default NONE\n");
391 printf(" n for _NONE\n");
392 printf(" l for _LATENCY\n");
393 printf(" p for _POWER_SAVING;\n");
394 printf(" -r{sampleRate} for example 44100\n");
Phil Burk6d6f3f62018-01-12 17:27:54 -0800395 printf(" -s{duration} in seconds, default is %d\n", DEFAULT_DURATION_SECONDS);
396 printf(" -u{usage} eg. 14 for AAUDIO_USAGE_GAME\n");
Phil Burk44795232017-06-30 16:27:38 -0700397 printf(" -x to use EXCLUSIVE mode\n");
Phil Burk6d6f3f62018-01-12 17:27:54 -0800398 printf(" -y{contentType} eg. 1 for AAUDIO_CONTENT_TYPE_SPEECH\n");
Phil Burk10ffb192018-09-26 12:09:00 -0700399 printf(" -z{callbackSize} or block size, in frames, default = 0\n");
Phil Burk44795232017-06-30 16:27:38 -0700400 }
401
Kevin Rocard68646ba2019-03-20 13:26:49 -0700402 static aaudio_performance_mode_t parseAllowedCapturePolicy(char c) {
403 aaudio_allowed_capture_policy_t policy = AAUDIO_ALLOW_CAPTURE_BY_ALL;
404 switch (c) {
405 case 'a':
406 policy = AAUDIO_ALLOW_CAPTURE_BY_ALL;
407 break;
408 case 's':
409 policy = AAUDIO_ALLOW_CAPTURE_BY_SYSTEM;
410 break;
411 case 'n':
412 policy = AAUDIO_ALLOW_CAPTURE_BY_NONE;
413 break;
414 default:
415 printf("ERROR: invalid playback capture policy %c\n", c);
416 break;
417 }
418 return policy;
419 }
420
Phil Burk44795232017-06-30 16:27:38 -0700421 static aaudio_performance_mode_t parsePerformanceMode(char c) {
422 aaudio_performance_mode_t mode = AAUDIO_PERFORMANCE_MODE_NONE;
423 switch (c) {
424 case 'n':
425 mode = AAUDIO_PERFORMANCE_MODE_NONE;
426 break;
427 case 'l':
428 mode = AAUDIO_PERFORMANCE_MODE_LOW_LATENCY;
429 break;
430 case 'p':
431 mode = AAUDIO_PERFORMANCE_MODE_POWER_SAVING;
432 break;
433 default:
Kevin Rocard9dcd34f2018-06-13 16:19:36 -0700434 printf("ERROR: invalid performance mode %c\n", c);
Phil Burk44795232017-06-30 16:27:38 -0700435 break;
436 }
437 return mode;
438 }
439
440 /**
441 * Print stream parameters in comparison with requested values.
442 * @param stream
443 */
Phil Burka5222e22017-07-28 13:31:14 -0700444 void compareWithStream(AAudioStream *stream) const {
Phil Burk44795232017-06-30 16:27:38 -0700445
446 printf(" DeviceId: requested = %d, actual = %d\n",
447 getDeviceId(), AAudioStream_getDeviceId(stream));
448
449 aaudio_stream_state_t state = AAudioStream_getState(stream);
450 printf(" State: %s\n", AAudio_convertStreamStateToText(state));
451
452 // Check to see what kind of stream we actually got.
453 printf(" SampleRate: requested = %d, actual = %d\n",
454 getSampleRate(), AAudioStream_getSampleRate(stream));
455
456 printf(" ChannelCount: requested = %d, actual = %d\n",
457 getChannelCount(), AAudioStream_getChannelCount(stream));
458
459 printf(" DataFormat: requested = %d, actual = %d\n",
460 getFormat(), AAudioStream_getFormat(stream));
461
462 int32_t framesPerBurst = AAudioStream_getFramesPerBurst(stream);
463 int32_t sizeFrames = AAudioStream_getBufferSizeInFrames(stream);
464 printf(" Buffer: burst = %d\n", framesPerBurst);
465 if (framesPerBurst > 0) {
466 printf(" Buffer: size = %d = (%d * %d) + %d\n",
467 sizeFrames,
468 (sizeFrames / framesPerBurst),
469 framesPerBurst,
470 (sizeFrames % framesPerBurst));
471 }
472 printf(" Capacity: requested = %d, actual = %d\n", getBufferCapacity(),
473 AAudioStream_getBufferCapacityInFrames(stream));
474
Phil Burk10ffb192018-09-26 12:09:00 -0700475 printf(" CallbackSize: requested = %d, actual = %d\n", getFramesPerCallback(),
476 AAudioStream_getFramesPerDataCallback(stream));
477
Phil Burk44795232017-06-30 16:27:38 -0700478 printf(" SharingMode: requested = %s, actual = %s\n",
479 getSharingModeText(getSharingMode()),
480 getSharingModeText(AAudioStream_getSharingMode(stream)));
481
482 printf(" PerformanceMode: requested = %d, actual = %d\n",
483 getPerformanceMode(), AAudioStream_getPerformanceMode(stream));
Phil Burk6d6f3f62018-01-12 17:27:54 -0800484
Phil Burk4e98efa2018-02-05 18:41:55 -0800485 loadFutureFunctions();
Phil Burk6d6f3f62018-01-12 17:27:54 -0800486
Phil Burk4e98efa2018-02-05 18:41:55 -0800487 if (s_setUsage != nullptr) {
488 printf(" Usage: requested = %d, actual = %d\n",
489 getUsage(), s_getUsage(stream));
490 }
491 if (s_getContentType != nullptr) {
492 printf(" ContentType: requested = %d, actual = %d\n",
493 getContentType(), s_getContentType(stream));
494 }
495
496 if (AAudioStream_getDirection(stream) == AAUDIO_DIRECTION_INPUT
497 && s_getInputPreset != nullptr) {
498 printf(" InputPreset: requested = %d, actual = %d\n",
499 getInputPreset(), s_getInputPreset(stream));
Phil Burk6d6f3f62018-01-12 17:27:54 -0800500 }
501
Phil Burk44795232017-06-30 16:27:38 -0700502 printf(" Is MMAP used? %s\n", AAudioStream_isMMapUsed(stream)
503 ? "yes" : "no");
504
Kevin Rocard68646ba2019-03-20 13:26:49 -0700505 if (s_getAllowedCapturePolicy != nullptr) {
506 printf(" ContentType: requested = %d, actual = %d\n",
507 getAllowedCapturePolicy(), s_getAllowedCapturePolicy(stream));
508 }
509
Phil Burk44795232017-06-30 16:27:38 -0700510 }
511
512 int32_t getDurationSeconds() const {
513 return mDurationSeconds;
514 }
515
516 void setDurationSeconds(int32_t seconds) {
517 mDurationSeconds = seconds;
518 }
519
520private:
521 int32_t mDurationSeconds = DEFAULT_DURATION_SECONDS;
522};
523
524#endif // AAUDIO_EXAMPLE_ARGS_PARSER_H