diff options
-rw-r--r-- | hardware.c | 14 | ||||
-rw-r--r-- | include/hardware/audio.h | 59 | ||||
-rw-r--r-- | include/hardware/hardware.h | 16 |
3 files changed, 87 insertions, 2 deletions
@@ -128,6 +128,10 @@ int hw_get_module_by_class(const char *class_id, const char *inst, char prop[PATH_MAX]; char path[PATH_MAX]; char name[PATH_MAX]; +#ifdef QCOM_HARDWARE + int is_mpq; + IS_TARGET_MPQ(is_mpq); +#endif if (inst) snprintf(name, PATH_MAX, "%s.%s", class_id, inst); @@ -151,6 +155,16 @@ int hw_get_module_by_class(const char *class_id, const char *inst, HAL_LIBRARY_PATH2, name, prop); if (access(path, R_OK) == 0) break; +#ifdef QCOM_HARDWARE + if ((!strncmp(name, "audio.primary", 13) || + !strncmp(name, "audio_policy", 12)) && + (is_mpq) && (!strncmp(prop, "msm8960", 7))) + { + strlcpy(prop, "mpq8064", 8); + ALOGE("setting prop to mpq8064"); + } +#endif + snprintf(path, sizeof(path), "%s/%s.%s.so", HAL_LIBRARY_PATH1, name, prop); if (access(path, R_OK) == 0) break; diff --git a/include/hardware/audio.h b/include/hardware/audio.h index 02031fc..1a4344a 100644 --- a/include/hardware/audio.h +++ b/include/hardware/audio.h @@ -294,7 +294,12 @@ struct audio_stream_out { int64_t *timestamp); #ifdef QCOM_HARDWARE /** - * EOS notification from HAL to Flinger + * return the current timestamp after quering to the driver + */ + int (*get_time_stamp)(const struct audio_stream_out *stream, + uint64_t *time_stamp); + /** + * EOS notification from HAL to Player */ int (*set_observer)(const struct audio_stream_out *stream, void *observer); @@ -304,6 +309,45 @@ struct audio_stream_out { }; typedef struct audio_stream_out audio_stream_out_t; +#ifdef QCOM_HARDWARE +/** + * audio_broadcast_stream is the abstraction interface for the + * audio output hardware. + * + * It provides information about various properties of the audio output + * hardware driver. + */ + +struct audio_broadcast_stream { + struct audio_stream common; + + /** + * return the audio hardware driver latency in milli seconds. + */ + uint32_t (*get_latency)(const struct audio_broadcast_stream *stream); + + /** + * Use this method in situations where audio mixing is done in the + * hardware. This method serves as a direct interface with hardware, + * allowing you to directly set the volume as apposed to via the framework. + * This method might produce multiple PCM outputs or hardware accelerated + * codecs, such as MP3 or AAC. + */ + int (*set_volume)(struct audio_broadcast_stream *stream, float left, float right); + + int (*mute)(struct audio_broadcast_stream *stream, bool mute); + + int (*start)(struct audio_broadcast_stream *stream, int64_t absTimeToStart); + /** + * write audio buffer to driver. Returns number of bytes written + */ + ssize_t (*write)(struct audio_broadcast_stream *stream, const void* buffer, + size_t bytes, int64_t timestamp, int audioType); + +}; +typedef struct audio_broadcast_stream audio_broadcast_stream_t; +#endif + struct audio_stream_in { struct audio_stream common; @@ -498,6 +542,19 @@ struct audio_hw_device { void (*close_output_stream)(struct audio_hw_device *dev, struct audio_stream_out* stream_out); +#ifdef QCOM_HARDWARE + /** This method creates and opens the audio hardware output + * for broadcast stream */ + int (*open_broadcast_stream)(struct audio_hw_device *dev, uint32_t devices, + int format, uint32_t channels, + uint32_t sample_rate, + uint32_t audio_source, + struct audio_broadcast_stream **out); + + void (*close_broadcast_stream)(struct audio_hw_device *dev, + struct audio_broadcast_stream *out); +#endif + /** This method creates and opens the audio hardware input stream */ #ifndef ICS_AUDIO_BLOB int (*open_input_stream)(struct audio_hw_device *dev, diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h index 78c4572..d00cbe2 100644 --- a/include/hardware/hardware.h +++ b/include/hardware/hardware.h @@ -33,7 +33,21 @@ __BEGIN_DECLS #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') - +#ifdef QCOM_HARDWARE +#define IS_TARGET_MPQ(status) \ +{ \ + int id = 0; \ + FILE *fp; \ + if ((fp = fopen("/sys/devices/system/soc/soc0/id", "r")) != NULL) { \ + fscanf(fp, "%d", &id); \ + fclose(fp); \ + } \ + if (id == 130) \ + status = 1; \ + else \ + status = 0;\ +} +#endif #define HARDWARE_MAKE_API_VERSION(maj,min) \ ((((maj) & 0xff) << 8) | ((min) & 0xff)) |