Add defines and support for audio offload

- Add non-blocking write support, set_callback() function
- Add pause, resume, flush, drain functions to audio output stream
- Add audio parameter defines for compressed audio metadata
- Extend audio_config_t to include an audio_offload_info_t field
- Add is_offload_supported() function to test whether there is
    hardware decode support for a given compressed audio format
- Change audio_stream_frame_size() to handle offloaded streams.
    For an offloaded stream the size is always counted in bytes
    (frame size == 1) and the number of channels is irrelevant.

Change-Id: I5b82c3fdcfa1456502d0042888f166bf02d8d54b
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
diff --git a/include/hardware/audio_policy.h b/include/hardware/audio_policy.h
index c635ebf..4e75e02 100644
--- a/include/hardware/audio_policy.h
+++ b/include/hardware/audio_policy.h
@@ -133,7 +133,8 @@
                                     uint32_t samplingRate,
                                     audio_format_t format,
                                     audio_channel_mask_t channelMask,
-                                    audio_output_flags_t flags);
+                                    audio_output_flags_t flags,
+                                    const audio_offload_info_t *offloadInfo);
 
     /* indicates to the audio policy manager that the output starts being used
      * by corresponding stream. */
@@ -241,6 +242,10 @@
 
     /* dump state */
     int (*dump)(const struct audio_policy *pol, int fd);
+
+    /* check if offload is possible for given sample rate, bitrate, duration, ... */
+    bool (*is_offload_supported)(const struct audio_policy *pol,
+                                const audio_offload_info_t *info);
 };
 
 /* audio hw module handle used by load_hw_module(), open_output_on_module()
@@ -390,7 +395,8 @@
                                      audio_format_t *pFormat,
                                      audio_channel_mask_t *pChannelMask,
                                      uint32_t *pLatencyMs,
-                                     audio_output_flags_t flags);
+                                     audio_output_flags_t flags,
+                                     const audio_offload_info_t *offloadInfo);
 
     /* Opens an audio input on a particular HW module.
      *