1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_1_ISTREAMOUT_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_1_ISTREAMOUT_H
3
4 #include <android/hardware/audio/7.0/IStreamOut.h>
5 #include <android/hardware/audio/7.0/types.h>
6 #include <android/hardware/audio/7.1/IStreamOutLatencyModeCallback.h>
7 #include <android/hardware/audio/7.1/types.h>
8
9 #include <android/hidl/manager/1.0/IServiceNotification.h>
10
11 #include <hidl/HidlSupport.h>
12 #include <hidl/MQDescriptor.h>
13 #include <hidl/Status.h>
14 #include <utils/NativeHandle.h>
15 #include <utils/misc.h>
16
17 namespace android {
18 namespace hardware {
19 namespace audio {
20 namespace V7_1 {
21
22 struct IStreamOut : public ::android::hardware::audio::V7_0::IStreamOut {
23 /**
24 * Type tag for use in template logic that indicates this is a 'pure' class.
25 */
26 typedef ::android::hardware::details::i_tag _hidl_tag;
27
28 /**
29 * Fully qualified interface name: "[email protected]::IStreamOut"
30 */
31 static const char* descriptor;
32
33 /**
34 * Returns whether this object's implementation is outside of the current process.
35 */
isRemoteIStreamOut36 virtual bool isRemote() const override { return false; }
37
38 /**
39 * Return the frame size (number of bytes per sample).
40 *
41 * @return frameSize frame size in bytes.
42 */
43 virtual ::android::hardware::Return<uint64_t> getFrameSize() override = 0;
44
45 /**
46 * Return the frame count of the buffer. Calling this method is equivalent
47 * to getting AUDIO_PARAMETER_STREAM_FRAME_COUNT on the legacy HAL.
48 *
49 * @return count frame count.
50 */
51 virtual ::android::hardware::Return<uint64_t> getFrameCount() override = 0;
52
53 /**
54 * Return the size of input/output buffer in bytes for this stream.
55 * It must be a multiple of the frame size.
56 *
57 * @return buffer buffer size in bytes.
58 */
59 virtual ::android::hardware::Return<uint64_t> getBufferSize() override = 0;
60
61 /**
62 * Return callback for getSupportedProfiles
63 */
64 using getSupportedProfiles_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::AudioProfile>& profiles)>;
65 /**
66 * Return supported audio profiles for this particular stream. This method
67 * is normally called for streams opened on devices that use dynamic
68 * profiles, e.g. HDMI and USB interfaces. Please note that supported
69 * profiles of the stream may differ from the capabilities of the connected
70 * physical device.
71 *
72 * For devices with fixed configurations, e.g. built-in audio devices, all
73 * the profiles are specified in the audio_policy_configuration.xml
74 * file. For such devices, this method must return the configuration from
75 * the config file, or NOT_SUPPORTED retval.
76 *
77 * @return retval operation completion status.
78 * @return formats supported audio profiles.
79 * Must be non empty if retval is OK.
80 */
81 virtual ::android::hardware::Return<void> getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) override = 0;
82
83 /**
84 * Return callback for getAudioProperties
85 */
86 using getAudioProperties_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::common::V7_0::AudioConfigBase& config)>;
87 /**
88 * Retrieves basic stream configuration: sample rate, audio format,
89 * channel mask.
90 *
91 * @return retval operation completion status.
92 * @return config basic stream configuration.
93 */
94 virtual ::android::hardware::Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override = 0;
95
96 /**
97 * Sets stream parameters. Only sets parameters that are specified.
98 *
99 * Optional method. If implemented, only called on a stopped stream.
100 *
101 * @param config basic stream configuration.
102 * @return retval operation completion status.
103 */
104 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setAudioProperties(const ::android::hardware::audio::common::V7_0::AudioConfigBaseOptional& config) override = 0;
105
106 /**
107 * Applies audio effect to the stream.
108 *
109 * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
110 * the effect to apply.
111 * @return retval operation completion status.
112 */
113 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> addEffect(uint64_t effectId) override = 0;
114
115 /**
116 * Stops application of the effect to the stream.
117 *
118 * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
119 * the effect to remove.
120 * @return retval operation completion status.
121 */
122 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> removeEffect(uint64_t effectId) override = 0;
123
124 /**
125 * Put the audio hardware input/output into standby mode.
126 * Driver must exit from standby mode at the next I/O operation.
127 *
128 * @return retval operation completion status.
129 */
130 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> standby() override = 0;
131
132 /**
133 * Return callback for getDevices
134 */
135 using getDevices_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::DeviceAddress>& devices)>;
136 /**
137 * Return the set of devices which this stream is connected to.
138 *
139 * Optional method
140 *
141 * @return retval operation completion status: OK or NOT_SUPPORTED.
142 * @return device set of devices which this stream is connected to.
143 */
144 virtual ::android::hardware::Return<void> getDevices(getDevices_cb _hidl_cb) override = 0;
145
146 /**
147 * Connects the stream to one or multiple devices.
148 *
149 * This method must only be used for HALs that do not support
150 * 'IDevice.createAudioPatch' method. Calling this method is
151 * equivalent to setting AUDIO_PARAMETER_STREAM_ROUTING preceded
152 * with a device address in the legacy HAL interface.
153 *
154 * @param address device to connect the stream to.
155 * @return retval operation completion status.
156 */
157 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setDevices(const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::DeviceAddress>& devices) override = 0;
158
159 /**
160 * Sets the HW synchronization source. Calling this method is equivalent to
161 * setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
162 *
163 * Optional method
164 *
165 * @param hwAvSync HW synchronization source
166 * @return retval operation completion status.
167 */
168 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setHwAvSync(uint32_t hwAvSync) override = 0;
169
170 /**
171 * Return callback for getParameters
172 */
173 using getParameters_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& parameters)>;
174 /**
175 * Generic method for retrieving vendor-specific parameter values.
176 * The framework does not interpret the parameters, they are passed
177 * in an opaque manner between a vendor application and HAL.
178 *
179 * Multiple parameters can be retrieved at the same time.
180 * The implementation should return as many requested parameters
181 * as possible, even if one or more is not supported
182 *
183 * @param context provides more information about the request
184 * @param keys keys of the requested parameters
185 * @return retval operation completion status.
186 * OK must be returned if keys is empty.
187 * NOT_SUPPORTED must be returned if at least one key is unknown.
188 * @return parameters parameter key value pairs.
189 * Must contain the value of all requested keys if retval == OK
190 */
191 virtual ::android::hardware::Return<void> getParameters(const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& context, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& keys, getParameters_cb _hidl_cb) override = 0;
192
193 /**
194 * Generic method for setting vendor-specific parameter values.
195 * The framework does not interpret the parameters, they are passed
196 * in an opaque manner between a vendor application and HAL.
197 *
198 * Multiple parameters can be set at the same time though this is
199 * discouraged as it make failure analysis harder.
200 *
201 * If possible, a failed setParameters should not impact the platform state.
202 *
203 * @param context provides more information about the request
204 * @param parameters parameter key value pairs.
205 * @return retval operation completion status.
206 * All parameters must be successfully set for OK to be returned
207 */
208 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setParameters(const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& context, const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& parameters) override = 0;
209
210 /**
211 * Called by the framework to start a stream operating in mmap mode.
212 * createMmapBuffer() must be called before calling start().
213 * Function only implemented by streams operating in mmap mode.
214 *
215 * @return retval OK in case the success.
216 * NOT_SUPPORTED on non mmap mode streams
217 * INVALID_STATE if called out of sequence
218 */
219 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> start() override = 0;
220
221 /**
222 * Called by the framework to stop a stream operating in mmap mode.
223 * Function only implemented by streams operating in mmap mode.
224 *
225 * @return retval OK in case the success.
226 * NOT_SUPPORTED on non mmap mode streams
227 * INVALID_STATE if called out of sequence
228 */
229 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> stop() override = 0;
230
231 /**
232 * Return callback for createMmapBuffer
233 */
234 using createMmapBuffer_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::V7_0::MmapBufferInfo& info)>;
235 /**
236 * Called by the framework to retrieve information on the mmap buffer used for audio
237 * samples transfer.
238 * Function only implemented by streams operating in mmap mode.
239 *
240 * @param minSizeFrames minimum buffer size requested. The actual buffer
241 * size returned in struct MmapBufferInfo can be larger.
242 * The size must be a positive value.
243 * @return retval OK in case the success.
244 * NOT_SUPPORTED on non mmap mode streams
245 * NOT_INITIALIZED in case of memory allocation error
246 * INVALID_ARGUMENTS if the requested buffer size is invalid
247 * INVALID_STATE if called out of sequence
248 * @return info a MmapBufferInfo struct containing information on the MMMAP buffer created.
249 */
250 virtual ::android::hardware::Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override = 0;
251
252 /**
253 * Return callback for getMmapPosition
254 */
255 using getMmapPosition_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::V7_0::MmapPosition& position)>;
256 /**
257 * Called by the framework to read current read/write position in the mmap buffer
258 * with associated time stamp.
259 * Function only implemented by streams operating in mmap mode.
260 *
261 * @return retval OK in case the success.
262 * NOT_SUPPORTED on non mmap mode streams
263 * INVALID_STATE if called out of sequence
264 * @return position a MmapPosition struct containing current HW read/write position in frames
265 * with associated time stamp.
266 */
267 virtual ::android::hardware::Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override = 0;
268
269 /**
270 * Called by the framework to deinitialize the stream and free up
271 * all currently allocated resources. It is recommended to close
272 * the stream on the client side as soon as it is becomes unused.
273 *
274 * The client must ensure that this function is not called while
275 * audio data is being transferred through the stream's message queues.
276 *
277 * @return retval OK in case the success.
278 * NOT_SUPPORTED if called on IStream instead of input or
279 * output stream interface.
280 * INVALID_STATE if the stream was already closed.
281 */
282 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> close() override = 0;
283
284 /**
285 * Return the audio hardware driver estimated latency in milliseconds.
286 *
287 * @return latencyMs latency in milliseconds.
288 */
289 virtual ::android::hardware::Return<uint32_t> getLatency() override = 0;
290
291 /**
292 * This method is used in situations where audio mixing is done in the
293 * hardware. This method serves as a direct interface with hardware,
294 * allowing to directly set the volume as apposed to via the framework.
295 * This method might produce multiple PCM outputs or hardware accelerated
296 * codecs, such as MP3 or AAC.
297 *
298 * Optional method
299 *
300 * @param left left channel attenuation, 1.0f is unity, 0.0f is zero.
301 * @param right right channel attenuation, 1.0f is unity, 0.0f is zero.
302 * @return retval operation completion status.
303 * If a volume is outside [0,1], return INVALID_ARGUMENTS
304 */
305 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setVolume(float left, float right) override = 0;
306
307 /**
308 * Called when the metadata of the stream's source has been changed.
309 *
310 * Optional method
311 *
312 * @param sourceMetadata Description of the audio that is played by the clients.
313 * @return retval operation completion status.
314 * If any of the metadata fields contains an invalid value,
315 * returns INVALID_ARGUMENTS.
316 * If method isn't supported by the HAL returns NOT_SUPPORTED.
317 */
318 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> updateSourceMetadata(const ::android::hardware::audio::common::V7_0::SourceMetadata& sourceMetadata) override = 0;
319
320 /**
321 * Return callback for prepareForWriting
322 */
323 using prepareForWriting_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::MQDescriptorSync<::android::hardware::audio::V7_0::IStreamOut::WriteCommand>& commandMQ, const ::android::hardware::MQDescriptorSync<uint8_t>& dataMQ, const ::android::hardware::MQDescriptorSync<::android::hardware::audio::V7_0::IStreamOut::WriteStatus>& statusMQ, int32_t threadId)>;
324 /**
325 * Set up required transports for passing audio buffers to the driver.
326 *
327 * The transport consists of three message queues:
328 * -- command queue is used to instruct the writer thread what operation
329 * to perform;
330 * -- data queue is used for passing audio data from the client
331 * to the driver;
332 * -- status queue is used for reporting operation status
333 * (e.g. amount of bytes actually written or error code).
334 *
335 * The driver operates on a dedicated thread. The client must ensure that
336 * the thread is given an appropriate priority and assigned to correct
337 * scheduler and cgroup. For this purpose, the method returns the identifier
338 * of the driver thread.
339 *
340 * @param frameSize the size of a single frame, in bytes.
341 * @param framesCount the number of frames in a buffer.
342 * @return retval OK if both message queues were created successfully.
343 * INVALID_STATE if the method was already called.
344 * INVALID_ARGUMENTS if there was a problem setting up
345 * the queues.
346 * @return commandMQ a message queue used for passing commands.
347 * @return dataMQ a message queue used for passing audio data in the format
348 * specified at the stream opening.
349 * @return statusMQ a message queue used for passing status from the driver
350 * using WriteStatus structures.
351 * @return threadId identifier of the driver's dedicated thread; the caller
352 * may adjust the thread priority to match the priority
353 * of the thread that provides audio data.
354 */
355 virtual ::android::hardware::Return<void> prepareForWriting(uint32_t frameSize, uint32_t framesCount, prepareForWriting_cb _hidl_cb) override = 0;
356
357 /**
358 * Return callback for getRenderPosition
359 */
360 using getRenderPosition_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, uint32_t dspFrames)>;
361 /**
362 * Return the number of audio frames written by the audio DSP to DAC since
363 * the output has exited standby.
364 *
365 * Optional method
366 *
367 * @return retval operation completion status.
368 * @return dspFrames number of audio frames written.
369 */
370 virtual ::android::hardware::Return<void> getRenderPosition(getRenderPosition_cb _hidl_cb) override = 0;
371
372 /**
373 * Return callback for getNextWriteTimestamp
374 */
375 using getNextWriteTimestamp_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, int64_t timestampUs)>;
376 /**
377 * Get the local time at which the next write to the audio driver will be
378 * presented. The units are microseconds, where the epoch is decided by the
379 * local audio HAL.
380 *
381 * Optional method
382 *
383 * @return retval operation completion status.
384 * @return timestampUs time of the next write.
385 */
386 virtual ::android::hardware::Return<void> getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb) override = 0;
387
388 /**
389 * Set the callback interface for notifying completion of non-blocking
390 * write and drain.
391 *
392 * Calling this function implies that all future 'write' and 'drain'
393 * must be non-blocking and use the callback to signal completion.
394 *
395 * 'clearCallback' method needs to be called in order to release the local
396 * callback proxy on the server side and thus dereference the callback
397 * implementation on the client side.
398 *
399 * @return retval operation completion status.
400 */
401 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setCallback(const ::android::sp<::android::hardware::audio::V7_0::IStreamOutCallback>& callback) override = 0;
402
403 /**
404 * Clears the callback previously set via 'setCallback' method.
405 *
406 * Warning: failure to call this method results in callback implementation
407 * on the client side being held until the HAL server termination.
408 *
409 * If no callback was previously set, the method should be a no-op
410 * and return OK.
411 *
412 * @return retval operation completion status: OK or NOT_SUPPORTED.
413 */
414 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> clearCallback() override = 0;
415
416 /**
417 * Set the callback interface for notifying about an output stream event.
418 *
419 * Calling this method with a null pointer will result in releasing
420 * the local callback proxy on the server side and thus dereference
421 * the callback implementation on the client side.
422 *
423 * @return retval operation completion status.
424 */
425 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setEventCallback(const ::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>& callback) override = 0;
426
427 /**
428 * Return callback for supportsPauseAndResume
429 */
430 using supportsPauseAndResume_cb = std::function<void(bool supportsPause, bool supportsResume)>;
431 /**
432 * Returns whether HAL supports pausing and resuming of streams.
433 *
434 * @return supportsPause true if pausing is supported.
435 * @return supportsResume true if resume is supported.
436 */
437 virtual ::android::hardware::Return<void> supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb) override = 0;
438
439 /**
440 * Notifies to the audio driver to stop playback however the queued buffers
441 * are retained by the hardware. Useful for implementing pause/resume. Empty
442 * implementation if not supported however must be implemented for hardware
443 * with non-trivial latency. In the pause state, some audio hardware may
444 * still be using power. Client code may consider calling 'suspend' after a
445 * timeout to prevent that excess power usage.
446 *
447 * Implementation of this function is mandatory for offloaded playback.
448 *
449 * @return retval operation completion status.
450 */
451 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> pause() override = 0;
452
453 /**
454 * Notifies to the audio driver to resume playback following a pause.
455 * Returns error INVALID_STATE if called without matching pause.
456 *
457 * Implementation of this function is mandatory for offloaded playback.
458 *
459 * @return retval operation completion status.
460 */
461 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> resume() override = 0;
462
463 /**
464 * Returns whether HAL supports draining of streams.
465 *
466 * @return supports true if draining is supported.
467 */
468 virtual ::android::hardware::Return<bool> supportsDrain() override = 0;
469
470 /**
471 * Requests notification when data buffered by the driver/hardware has been
472 * played. If 'setCallback' has previously been called to enable
473 * non-blocking mode, then 'drain' must not block, instead it must return
474 * quickly and completion of the drain is notified through the callback. If
475 * 'setCallback' has not been called, then 'drain' must block until
476 * completion.
477 *
478 * If 'type' is 'ALL', the drain completes when all previously written data
479 * has been played.
480 *
481 * If 'type' is 'EARLY_NOTIFY', the drain completes shortly before all data
482 * for the current track has played to allow time for the framework to
483 * perform a gapless track switch.
484 *
485 * Drain must return immediately on 'stop' and 'flush' calls.
486 *
487 * Implementation of this function is mandatory for offloaded playback.
488 *
489 * @param type type of drain.
490 * @return retval operation completion status.
491 */
492 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> drain(::android::hardware::audio::V7_0::AudioDrain type) override = 0;
493
494 /**
495 * Notifies to the audio driver to flush (that is, drop) the queued
496 * data. Stream must already be paused before calling 'flush'. For
497 * compressed and offload streams the frame count returned by
498 * 'getPresentationPosition' must reset after flush.
499 *
500 * Optional method
501 *
502 * Implementation of this function is mandatory for offloaded playback.
503 *
504 * @return retval operation completion status.
505 */
506 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> flush() override = 0;
507
508 /**
509 * Return callback for getPresentationPosition
510 */
511 using getPresentationPosition_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, uint64_t frames, const ::android::hardware::audio::V7_0::TimeSpec& timeStamp)>;
512 /**
513 * Return a recent count of the number of audio frames presented to an
514 * external observer. This excludes frames which have been written but are
515 * still in the pipeline. The count must not reset to zero when a PCM output
516 * enters standby. For compressed and offload streams it is recommended that
517 * HAL resets the frame count.
518 *
519 * This method also returns the value of CLOCK_MONOTONIC as of this
520 * presentation count. The returned count is expected to be 'recent', but
521 * does not need to be the most recent possible value. However, the
522 * associated time must correspond to whatever count is returned.
523 * Example: assume that N+M frames have been presented, where M is a 'small'
524 * number. Then it is permissible to return N instead of N+M, and the
525 * timestamp must correspond to N rather than N+M. The terms 'recent' and
526 * 'small' are not defined. They reflect the quality of the implementation.
527 *
528 * @return retval operation completion status.
529 * @return frames count of presented audio frames.
530 * @return timeStamp associated clock time.
531 */
532 virtual ::android::hardware::Return<void> getPresentationPosition(getPresentationPosition_cb _hidl_cb) override = 0;
533
534 /**
535 * Selects a presentation for decoding from a next generation media stream
536 * (as defined per ETSI TS 103 190-2) and a program within the presentation.
537 *
538 * Optional method
539 *
540 * @param presentationId selected audio presentation.
541 * @param programId refinement for the presentation.
542 * @return retval operation completion status.
543 */
544 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> selectPresentation(int32_t presentationId, int32_t programId) override = 0;
545
546 /**
547 * Return callback for getDualMonoMode
548 */
549 using getDualMonoMode_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, ::android::hardware::audio::V7_0::DualMonoMode mode)>;
550 /**
551 * Returns the Dual Mono mode presentation setting.
552 *
553 * Optional method
554 *
555 * @return retval operation completion status.
556 * @return mode current setting of Dual Mono mode.
557 */
558 virtual ::android::hardware::Return<void> getDualMonoMode(getDualMonoMode_cb _hidl_cb) override = 0;
559
560 /**
561 * Sets the Dual Mono mode presentation on the output device.
562 *
563 * The Dual Mono mode is generally applied to stereo audio streams
564 * where the left and right channels come from separate sources.
565 *
566 * Optional method
567 *
568 * @param mode selected Dual Mono mode.
569 * @return retval operation completion status.
570 */
571 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setDualMonoMode(::android::hardware::audio::V7_0::DualMonoMode mode) override = 0;
572
573 /**
574 * Return callback for getAudioDescriptionMixLevel
575 */
576 using getAudioDescriptionMixLevel_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, float leveldB)>;
577 /**
578 * Returns the Audio Description Mix level in dB.
579 *
580 * The level is applied to streams incorporating a secondary Audio
581 * Description stream. It specifies the relative level of mixing for
582 * the Audio Description with a reference to the Main Audio.
583 *
584 * Optional method
585 *
586 * The value of the relative level is in the range from negative infinity
587 * to +48.
588 *
589 * @return retval operation completion status.
590 * @return leveldB the current Audio Description Mix Level in dB.
591 */
592 virtual ::android::hardware::Return<void> getAudioDescriptionMixLevel(getAudioDescriptionMixLevel_cb _hidl_cb) override = 0;
593
594 /**
595 * Sets the Audio Description Mix level in dB.
596 *
597 * For streams incorporating a secondary Audio Description stream
598 * the relative level of mixing of the Audio Description to the Main Audio
599 * is controlled by this method.
600 *
601 * Optional method
602 *
603 * The value of the relative level must be in the range from negative
604 * infinity to +48.
605 *
606 * @param leveldB Audio Description Mix Level in dB
607 * @return retval operation completion status.
608 */
609 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setAudioDescriptionMixLevel(float leveldB) override = 0;
610
611 /**
612 * Return callback for getPlaybackRateParameters
613 */
614 using getPlaybackRateParameters_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::V7_0::PlaybackRate& playbackRate)>;
615 /**
616 * Retrieves current playback rate parameters.
617 *
618 * Optional method
619 *
620 * @return retval operation completion status.
621 * @return playbackRate current playback parameters
622 */
623 virtual ::android::hardware::Return<void> getPlaybackRateParameters(getPlaybackRateParameters_cb _hidl_cb) override = 0;
624
625 /**
626 * Sets the playback rate parameters that control playback behavior.
627 * This is normally used when playing encoded content and decoding
628 * is performed in hardware. Otherwise, the framework can apply
629 * necessary transformations.
630 *
631 * Optional method
632 *
633 * If the HAL supports setting the playback rate, it is recommended
634 * to support speed and pitch values at least in the range
635 * from 0.5f to 2.0f, inclusive (see the definition of PlaybackRate struct).
636 *
637 * @param playbackRate playback parameters
638 * @return retval operation completion status.
639 */
640 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setPlaybackRateParameters(const ::android::hardware::audio::V7_0::PlaybackRate& playbackRate) override = 0;
641
642 /**
643 * Indicates the requested latency mode for this output stream.
644 *
645 * The requested mode can be one of the modes returned by
646 * getRecommendedLatencyModes() API.
647 *
648 * Optional method.
649 * Mandated only on specific spatial audio streams indicated by
650 * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
651 *
652 * @return retval operation completion status.
653 */
654 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setLatencyMode(::android::hardware::audio::V7_1::LatencyMode mode) = 0;
655
656 /**
657 * Return callback for getRecommendedLatencyModes
658 */
659 using getRecommendedLatencyModes_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::V7_1::LatencyMode>& modes)>;
660 /**
661 * Indicates which latency modes are currently supported on this output stream.
662 * If the transport protocol (e.g Bluetooth A2DP) used by this output stream to reach
663 * the output device supports variable latency modes, the HAL indicates which
664 * modes are currently supported.
665 * The framework can then call setLatencyMode() with one of the supported modes to select
666 * the desired operation mode.
667 *
668 * Optional method.
669 * Mandated only on specific spatial audio streams indicated by
670 * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
671 *
672 * @return retval operation completion status.
673 * @return modes currrently supported latency modes.
674 */
675 virtual ::android::hardware::Return<void> getRecommendedLatencyModes(getRecommendedLatencyModes_cb _hidl_cb) = 0;
676
677 /**
678 * Set the callback interface for notifying changes in supported latency modes.
679 *
680 * Calling this method with a null pointer will result in releasing
681 * the callback.
682 *
683 * Optional method.
684 * Mandated only on specific spatial audio streams indicated by
685 * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
686 *
687 * @return retval operation completion status.
688 */
689 virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setLatencyModeCallback(const ::android::sp<::android::hardware::audio::V7_1::IStreamOutLatencyModeCallback>& callback) = 0;
690
691 /**
692 * Return callback for interfaceChain
693 */
694 using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
695 /*
696 * Provides run-time type information for this object.
697 * For example, for the following interface definition:
698 * package [email protected];
699 * interface IParent {};
700 * interface IChild extends IParent {};
701 * Calling interfaceChain on an IChild object must yield the following:
702 * ["[email protected]::IChild",
703 * "[email protected]::IParent"
704 * "[email protected]::IBase"]
705 *
706 * @return descriptors a vector of descriptors of the run-time type of the
707 * object.
708 */
709 virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
710
711 /*
712 * Emit diagnostic information to the given file.
713 *
714 * Optionally overriden.
715 *
716 * @param fd File descriptor to dump data to.
717 * Must only be used for the duration of this call.
718 * @param options Arguments for debugging.
719 * Must support empty for default debug information.
720 */
721 virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
722
723 /**
724 * Return callback for interfaceDescriptor
725 */
726 using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
727 /*
728 * Provides run-time type information for this object.
729 * For example, for the following interface definition:
730 * package [email protected];
731 * interface IParent {};
732 * interface IChild extends IParent {};
733 * Calling interfaceDescriptor on an IChild object must yield
734 * "[email protected]::IChild"
735 *
736 * @return descriptor a descriptor of the run-time type of the
737 * object (the first element of the vector returned by
738 * interfaceChain())
739 */
740 virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
741
742 /**
743 * Return callback for getHashChain
744 */
745 using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
746 /*
747 * Returns hashes of the source HAL files that define the interfaces of the
748 * runtime type information on the object.
749 * For example, for the following interface definition:
750 * package [email protected];
751 * interface IParent {};
752 * interface IChild extends IParent {};
753 * Calling interfaceChain on an IChild object must yield the following:
754 * [(hash of IChild.hal),
755 * (hash of IParent.hal)
756 * (hash of IBase.hal)].
757 *
758 * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
759 * according to SHA-256 standard.
760 *
761 * @return hashchain a vector of SHA-1 digests
762 */
763 virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
764
765 /*
766 * This method trigger the interface to enable/disable instrumentation based
767 * on system property hal.instrumentation.enable.
768 */
769 virtual ::android::hardware::Return<void> setHALInstrumentation() override;
770
771 /*
772 * Registers a death recipient, to be called when the process hosting this
773 * interface dies.
774 *
775 * @param recipient a hidl_death_recipient callback object
776 * @param cookie a cookie that must be returned with the callback
777 * @return success whether the death recipient was registered successfully.
778 */
779 virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
780
781 /*
782 * Provides way to determine if interface is running without requesting
783 * any functionality.
784 */
785 virtual ::android::hardware::Return<void> ping() override;
786
787 /**
788 * Return callback for getDebugInfo
789 */
790 using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
791 /*
792 * Get debug information on references on this interface.
793 * @return info debugging information. See comments of DebugInfo.
794 */
795 virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
796
797 /*
798 * This method notifies the interface that one or more system properties
799 * have changed. The default implementation calls
800 * (C++) report_sysprop_change() in libcutils or
801 * (Java) android.os.SystemProperties.reportSyspropChanged,
802 * which in turn calls a set of registered callbacks (eg to update trace
803 * tags).
804 */
805 virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
806
807 /*
808 * Unregisters the registered death recipient. If this service was registered
809 * multiple times with the same exact death recipient, this unlinks the most
810 * recently registered one.
811 *
812 * @param recipient a previously registered hidl_death_recipient callback
813 * @return success whether the death recipient was unregistered successfully.
814 */
815 virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
816
817 // cast static functions
818 /**
819 * This performs a checked cast based on what the underlying implementation actually is.
820 */
821 static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_1::IStreamOut>> castFrom(const ::android::sp<::android::hardware::audio::V7_1::IStreamOut>& parent, bool emitError = false);
822 /**
823 * This performs a checked cast based on what the underlying implementation actually is.
824 */
825 static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_1::IStreamOut>> castFrom(const ::android::sp<::android::hardware::audio::V7_0::IStreamOut>& parent, bool emitError = false);
826 /**
827 * This performs a checked cast based on what the underlying implementation actually is.
828 */
829 static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_1::IStreamOut>> castFrom(const ::android::sp<::android::hardware::audio::V7_0::IStream>& parent, bool emitError = false);
830 /**
831 * This performs a checked cast based on what the underlying implementation actually is.
832 */
833 static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_1::IStreamOut>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
834
835 // helper methods for interactions with the hwservicemanager
836 /**
837 * This gets the service of this type with the specified instance name. If the
838 * service is currently not available or not in the VINTF manifest on a Trebilized
839 * device, this will return nullptr. This is useful when you don't want to block
840 * during device boot. If getStub is true, this will try to return an unwrapped
841 * passthrough implementation in the same process. This is useful when getting an
842 * implementation from the same partition/compilation group.
843 *
844 * In general, prefer getService(std::string,bool)
845 */
846 static ::android::sp<IStreamOut> tryGetService(const std::string &serviceName="default", bool getStub=false);
847 /**
848 * Deprecated. See tryGetService(std::string, bool)
849 */
850 static ::android::sp<IStreamOut> tryGetService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return tryGetService(str, getStub); }
851 /**
852 * Deprecated. See tryGetService(std::string, bool)
853 */
854 static ::android::sp<IStreamOut> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return tryGetService(str, getStub); }
855 /**
856 * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
857 */
tryGetServiceIStreamOut858 static ::android::sp<IStreamOut> tryGetService(bool getStub) { return tryGetService("default", getStub); }
859 /**
860 * This gets the service of this type with the specified instance name. If the
861 * service is not in the VINTF manifest on a Trebilized device, this will return
862 * nullptr. If the service is not available, this will wait for the service to
863 * become available. If the service is a lazy service, this will start the service
864 * and return when it becomes available. If getStub is true, this will try to
865 * return an unwrapped passthrough implementation in the same process. This is
866 * useful when getting an implementation from the same partition/compilation group.
867 */
868 static ::android::sp<IStreamOut> getService(const std::string &serviceName="default", bool getStub=false);
869 /**
870 * Deprecated. See getService(std::string, bool)
871 */
872 static ::android::sp<IStreamOut> getService(const char serviceName[], bool getStub=false) { std::string str(serviceName ? serviceName : ""); return getService(str, getStub); }
873 /**
874 * Deprecated. See getService(std::string, bool)
875 */
876 static ::android::sp<IStreamOut> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false) { std::string str(serviceName.c_str()); return getService(str, getStub); }
877 /**
878 * Calls getService("default", bool). This is the recommended instance name for singleton services.
879 */
getServiceIStreamOut880 static ::android::sp<IStreamOut> getService(bool getStub) { return getService("default", getStub); }
881 /**
882 * Registers a service with the service manager. For Trebilized devices, the service
883 * must also be in the VINTF manifest.
884 */
885 __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
886 /**
887 * Registers for notifications for when a service is registered.
888 */
889 static bool registerForNotifications(
890 const std::string &serviceName,
891 const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> ¬ification);
892 };
893
894 //
895 // type declarations for package
896 //
897
898 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_1::IStreamOut>& o);
899
900 //
901 // type header definitions for package
902 //
903
toString(const::android::sp<::android::hardware::audio::V7_1::IStreamOut> & o)904 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_1::IStreamOut>& o) {
905 std::string os = "[class or subclass of ";
906 os += ::android::hardware::audio::V7_1::IStreamOut::descriptor;
907 os += "]";
908 os += o->isRemote() ? "@remote" : "@local";
909 return os;
910 }
911
912
913 } // namespace V7_1
914 } // namespace audio
915 } // namespace hardware
916 } // namespace android
917
918 //
919 // global type declarations for package
920 //
921
922
923 #endif // HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_1_ISTREAMOUT_H
924