1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAMOUTEVENTCALLBACK_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAMOUTEVENTCALLBACK_H
3 
4 #include <android/hidl/base/1.0/IBase.h>
5 
6 #include <android/hidl/manager/1.0/IServiceNotification.h>
7 
8 #include <hidl/HidlSupport.h>
9 #include <hidl/MQDescriptor.h>
10 #include <hidl/Status.h>
11 #include <utils/NativeHandle.h>
12 #include <utils/misc.h>
13 
14 namespace android {
15 namespace hardware {
16 namespace audio {
17 namespace V7_0 {
18 
19 /**
20  * Asynchronous stream out event callback interface. The interface provides
21  * a way for the HAL to notify platform when there are changes, e.g. codec
22  * format change, from the lower layer.
23  */
24 struct IStreamOutEventCallback : public ::android::hidl::base::V1_0::IBase {
25     /**
26      * Type tag for use in template logic that indicates this is a 'pure' class.
27      */
28     typedef ::android::hardware::details::i_tag _hidl_tag;
29 
30     /**
31      * Fully qualified interface name: "[email protected]::IStreamOutEventCallback"
32      */
33     static const char* descriptor;
34 
35     /**
36      * Returns whether this object's implementation is outside of the current process.
37      */
isRemoteIStreamOutEventCallback38     virtual bool isRemote() const override { return false; }
39 
40     /**
41      * Codec format changed.
42      *
43      * onCodecFormatChanged returns an AudioMetadata object in read-only ByteString format.
44      * It represents the most recent codec format decoded by a HW audio decoder.
45      *
46      * Codec format is an optional message from HW audio decoders. It serves to
47      * notify the application about the codec format and audio objects contained
48      * within the compressed audio stream for control, informational,
49      * and display purposes.
50      *
51      * audioMetadata ByteString is convertible to an AudioMetadata object through
52      * both a C++ and a C API present in Metadata.h [1], or through a Java API present
53      * in AudioMetadata.java [2].
54      *
55      * The ByteString format is a stable format used for parcelling (marshalling) across
56      * JNI, AIDL, and HIDL interfaces.  The test for R compatibility for native marshalling
57      * is TEST(metadata_tests, compatibility_R) [3].  The test for R compatibility for JNI
58      * marshalling is android.media.cts.AudioMetadataTest#testCompatibilityR [4].
59      *
60      * R (audio HAL 6.0) defined keys are as follows [2]:
61      * "bitrate", int32
62      * "channel-mask", int32
63      * "mime", string
64      * "sample-rate", int32
65      * "bit-width", int32
66      * "has-atmos", int32
67      * "audio-encoding", int32
68      *
69      * S (audio HAL 7.0) in addition adds the following keys:
70      * "presentation-id", int32
71      * "program-id", int32
72      * "presentation-content-classifier", int32
73      *    presentation-content-classifier key values can be referenced from
74      *    frameworks/base/media/java/android/media/AudioPresentation.java
75      *    i.e AudioPresentation.ContentClassifier
76      *    It can contain any of the below values
77      *    CONTENT_UNKNOWN   = -1,
78      *    CONTENT_MAIN      =  0,
79      *    CONTENT_MUSIC_AND_EFFECTS = 1,
80      *    CONTENT_VISUALLY_IMPAIRED = 2,
81      *    CONTENT_HEARING_IMPAIRED  = 3,
82      *    CONTENT_DIALOG = 4,
83      *    CONTENT_COMMENTARY = 5,
84      *    CONTENT_EMERGENCY = 6,
85      *    CONTENT_VOICEOVER = 7
86      * "presentation-language", string  // represents ISO 639-2 (three letter code)
87      *
88      * Parceling Format:
89      * All values are native endian order. [1]
90      *
91      * using type_size_t = uint32_t;
92      * using index_size_t = uint32_t;
93      * using datum_size_t = uint32_t;
94      *
95      * Permitted type indexes are
96      * TYPE_NONE = 0, // Reserved
97      * TYPE_INT32 = 1,
98      * TYPE_INT64 = 2,
99      * TYPE_FLOAT = 3,
100      * TYPE_DOUBLE = 4,
101      * TYPE_STRING = 5,
102      * TYPE_DATA = 6,  // A data table of <String, Datum>
103      *
104      * Datum = {
105      *           (type_size_t)  Type (the type index from type_as_value<T>.)
106      *           (datum_size_t) Size (size of the Payload)
107      *           (byte string)  Payload<Type>
108      *         }
109      *
110      * The data is specified in native endian order.
111      * Since the size of the Payload is always present, unknown types may be skipped.
112      *
113      * Payload<Fixed-size Primitive_Value>
114      * [ sizeof(Primitive_Value) in raw bytes ]
115      *
116      * Example of Payload<Int32> of 123:
117      * Payload<Int32>
118      * [ value of 123                   ] =  0x7b 0x00 0x00 0x00       123
119      *
120      * Payload<String>
121      * [ (index_size_t) length, not including zero terminator.]
122      * [ (length) raw bytes ]
123      *
124      * Example of Payload<String> of std::string("hi"):
125      * [ (index_size_t) length          ] = 0x02 0x00 0x00 0x00        2 strlen("hi")
126      * [ raw bytes "hi"                 ] = 0x68 0x69                  "hi"
127      *
128      * Payload<Data>
129      * [ (index_size_t) entries ]
130      * [ raw bytes   (entry 1) Key   (Payload<String>)
131      *                         Value (Datum)
132      *                ...  (until #entries) ]
133      *
134      * Example of Payload<Data> of {{"hello", "world"},
135      *                              {"value", (int32_t)1000}};
136      * [ (index_size_t) #entries        ] = 0x02 0x00 0x00 0x00        2 entries
137      *    Key (Payload<String>)
138      *    [ index_size_t length         ] = 0x05 0x00 0x00 0x00        5 strlen("hello")
139      *    [ raw bytes "hello"           ] = 0x68 0x65 0x6c 0x6c 0x6f   "hello"
140      *    Value (Datum)
141      *    [ (type_size_t) type          ] = 0x05 0x00 0x00 0x00        5 (TYPE_STRING)
142      *    [ (datum_size_t) size         ] = 0x09 0x00 0x00 0x00        sizeof(index_size_t) +
143      *                                                                 strlen("world")
144      *       Payload<String>
145      *       [ (index_size_t) length    ] = 0x05 0x00 0x00 0x00        5 strlen("world")
146      *       [ raw bytes "world"        ] = 0x77 0x6f 0x72 0x6c 0x64   "world"
147      *    Key (Payload<String>)
148      *    [ index_size_t length         ] = 0x05 0x00 0x00 0x00        5 strlen("value")
149      *    [ raw bytes "value"           ] = 0x76 0x61 0x6c 0x75 0x65   "value"
150      *    Value (Datum)
151      *    [ (type_size_t) type          ] = 0x01 0x00 0x00 0x00        1 (TYPE_INT32)
152      *    [ (datum_size_t) size         ] = 0x04 0x00 0x00 0x00        4 sizeof(int32_t)
153      *        Payload<Int32>
154      *        [ raw bytes 1000          ] = 0xe8 0x03 0x00 0x00        1000
155      *
156      * The contents of audioMetadata is a Payload<Data>.
157      * An implementation dependent detail is that the Keys are always
158      * stored sorted, so the byte string representation generated is unique.
159      *
160      * Vendor keys are allowed for informational and debugging purposes.
161      * Vendor keys should consist of the vendor company name followed
162      * by a dot; for example, "vendorCompany.someVolume" [2].
163      *
164      * [1] system/media/audio_utils/include/audio_utils/Metadata.h
165      * [2] frameworks/base/media/java/android/media/AudioMetadata.java
166      * [3] system/media/audio_utils/tests/metadata_tests.cpp
167      * [4] cts/tests/tests/media/src/android/media/cts/AudioMetadataTest.java
168      *
169      * @param audioMetadata is a buffer containing decoded format changes
170      *     reported by codec. The buffer contains data that can be transformed
171      *     to audio metadata, which is a C++ object based map.
172      */
173     virtual ::android::hardware::Return<void> onCodecFormatChanged(const ::android::hardware::hidl_vec<uint8_t>& audioMetadata) = 0;
174 
175     /**
176      * Return callback for interfaceChain
177      */
178     using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
179     /*
180      * Provides run-time type information for this object.
181      * For example, for the following interface definition:
182      *     package [email protected];
183      *     interface IParent {};
184      *     interface IChild extends IParent {};
185      * Calling interfaceChain on an IChild object must yield the following:
186      *     ["[email protected]::IChild",
187      *      "[email protected]::IParent"
188      *      "[email protected]::IBase"]
189      *
190      * @return descriptors a vector of descriptors of the run-time type of the
191      *         object.
192      */
193     virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
194 
195     /*
196      * Emit diagnostic information to the given file.
197      *
198      * Optionally overriden.
199      *
200      * @param fd      File descriptor to dump data to.
201      *                Must only be used for the duration of this call.
202      * @param options Arguments for debugging.
203      *                Must support empty for default debug information.
204      */
205     virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
206 
207     /**
208      * Return callback for interfaceDescriptor
209      */
210     using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
211     /*
212      * Provides run-time type information for this object.
213      * For example, for the following interface definition:
214      *     package [email protected];
215      *     interface IParent {};
216      *     interface IChild extends IParent {};
217      * Calling interfaceDescriptor on an IChild object must yield
218      *     "[email protected]::IChild"
219      *
220      * @return descriptor a descriptor of the run-time type of the
221      *         object (the first element of the vector returned by
222      *         interfaceChain())
223      */
224     virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
225 
226     /**
227      * Return callback for getHashChain
228      */
229     using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
230     /*
231      * Returns hashes of the source HAL files that define the interfaces of the
232      * runtime type information on the object.
233      * For example, for the following interface definition:
234      *     package [email protected];
235      *     interface IParent {};
236      *     interface IChild extends IParent {};
237      * Calling interfaceChain on an IChild object must yield the following:
238      *     [(hash of IChild.hal),
239      *      (hash of IParent.hal)
240      *      (hash of IBase.hal)].
241      *
242      * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
243      * according to SHA-256 standard.
244      *
245      * @return hashchain a vector of SHA-1 digests
246      */
247     virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
248 
249     /*
250      * This method trigger the interface to enable/disable instrumentation based
251      * on system property hal.instrumentation.enable.
252      */
253     virtual ::android::hardware::Return<void> setHALInstrumentation() override;
254 
255     /*
256      * Registers a death recipient, to be called when the process hosting this
257      * interface dies.
258      *
259      * @param recipient a hidl_death_recipient callback object
260      * @param cookie a cookie that must be returned with the callback
261      * @return success whether the death recipient was registered successfully.
262      */
263     virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
264 
265     /*
266      * Provides way to determine if interface is running without requesting
267      * any functionality.
268      */
269     virtual ::android::hardware::Return<void> ping() override;
270 
271     /**
272      * Return callback for getDebugInfo
273      */
274     using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
275     /*
276      * Get debug information on references on this interface.
277      * @return info debugging information. See comments of DebugInfo.
278      */
279     virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
280 
281     /*
282      * This method notifies the interface that one or more system properties
283      * have changed. The default implementation calls
284      * (C++)  report_sysprop_change() in libcutils or
285      * (Java) android.os.SystemProperties.reportSyspropChanged,
286      * which in turn calls a set of registered callbacks (eg to update trace
287      * tags).
288      */
289     virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
290 
291     /*
292      * Unregisters the registered death recipient. If this service was registered
293      * multiple times with the same exact death recipient, this unlinks the most
294      * recently registered one.
295      *
296      * @param recipient a previously registered hidl_death_recipient callback
297      * @return success whether the death recipient was unregistered successfully.
298      */
299     virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
300 
301     // cast static functions
302     /**
303      * This performs a checked cast based on what the underlying implementation actually is.
304      */
305     static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>> castFrom(const ::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>& parent, bool emitError = false);
306     /**
307      * This performs a checked cast based on what the underlying implementation actually is.
308      */
309     static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
310 
311     // helper methods for interactions with the hwservicemanager
312     /**
313      * This gets the service of this type with the specified instance name. If the
314      * service is currently not available or not in the VINTF manifest on a Trebilized
315      * device, this will return nullptr. This is useful when you don't want to block
316      * during device boot. If getStub is true, this will try to return an unwrapped
317      * passthrough implementation in the same process. This is useful when getting an
318      * implementation from the same partition/compilation group.
319      *
320      * In general, prefer getService(std::string,bool)
321      */
322     static ::android::sp<IStreamOutEventCallback> tryGetService(const std::string &serviceName="default", bool getStub=false);
323     /**
324      * Deprecated. See tryGetService(std::string, bool)
325      */
326     static ::android::sp<IStreamOutEventCallback> tryGetService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return tryGetService(str, getStub); }
327     /**
328      * Deprecated. See tryGetService(std::string, bool)
329      */
330     static ::android::sp<IStreamOutEventCallback> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return tryGetService(str, getStub); }
331     /**
332      * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
333      */
tryGetServiceIStreamOutEventCallback334     static ::android::sp<IStreamOutEventCallback> tryGetService(bool getStub) { return tryGetService("default", getStub); }
335     /**
336      * This gets the service of this type with the specified instance name. If the
337      * service is not in the VINTF manifest on a Trebilized device, this will return
338      * nullptr. If the service is not available, this will wait for the service to
339      * become available. If the service is a lazy service, this will start the service
340      * and return when it becomes available. If getStub is true, this will try to
341      * return an unwrapped passthrough implementation in the same process. This is
342      * useful when getting an implementation from the same partition/compilation group.
343      */
344     static ::android::sp<IStreamOutEventCallback> getService(const std::string &serviceName="default", bool getStub=false);
345     /**
346      * Deprecated. See getService(std::string, bool)
347      */
348     static ::android::sp<IStreamOutEventCallback> getService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return getService(str, getStub); }
349     /**
350      * Deprecated. See getService(std::string, bool)
351      */
352     static ::android::sp<IStreamOutEventCallback> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return getService(str, getStub); }
353     /**
354      * Calls getService("default", bool). This is the recommended instance name for singleton services.
355      */
getServiceIStreamOutEventCallback356     static ::android::sp<IStreamOutEventCallback> getService(bool getStub) { return getService("default", getStub); }
357     /**
358      * Registers a service with the service manager. For Trebilized devices, the service
359      * must also be in the VINTF manifest.
360      */
361     __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
362     /**
363      * Registers for notifications for when a service is registered.
364      */
365     static bool registerForNotifications(
366             const std::string &serviceName,
367             const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> &notification);
368 };
369 
370 //
371 // type declarations for package
372 //
373 
374 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>& o);
375 
376 //
377 // type header definitions for package
378 //
379 
toString(const::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback> & o)380 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_0::IStreamOutEventCallback>& o) {
381     std::string os = "[class or subclass of ";
382     os += ::android::hardware::audio::V7_0::IStreamOutEventCallback::descriptor;
383     os += "]";
384     os += o->isRemote() ? "@remote" : "@local";
385     return os;
386 }
387 
388 
389 }  // namespace V7_0
390 }  // namespace audio
391 }  // namespace hardware
392 }  // namespace android
393 
394 //
395 // global type declarations for package
396 //
397 
398 
399 #endif  // HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAMOUTEVENTCALLBACK_H
400