#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace android { class DevicesFactoryHalInterface; class AudioDumpExt { public: AudioDumpExt(); ~AudioDumpExt(); enum PROP_AUDIO_DUMP { PROP_AUDIO_DUMP_WRITER = 0, PROP_AUDIO_DUMP_TRACK, PROP_AUDIO_DUMP_OFFLOAD, PROP_AUDIO_DUMP_RESAMPLER, PROP_AUDIO_DUMP_MIXER, PROP_AUDIO_DUMP_RECORD, PROP_AUDIO_DUMP_EFFECT, PROP_AUDIO_DUMP_DRC, PROP_AUDIO_DUMP_LOG, PROP_AUDIO_DUMP_AAUDIO, PROP_AUDIO_DUMP_MAXNUM }; static void dump();//test static void threadDump(const char * path, void * buffer, int count, audio_format_t format, uint32_t sampleRate, uint32_t channelCount); static bool getProperty(AudioDumpExt::PROP_AUDIO_DUMP key); static unsigned long getDumpSize(const char * path); static String8 getDumpName(const char * path); static void updateKeys(int key); static bool checkIfNeedToDump(audio_format_t format); static int checkDumpVersion(); static int checkVendorVersion(); static void startDumpManagerThread(); static void startAudioDumpEmptyThread(); static const char * const keyAudioDumpWriter; static const char * const keyAudioDumpTrack; static const char * const keyAudioDumpOffload; static const char * const keyAudioDumpResampler; static const char * const keyAudioDumpMixer; static const char * const keyAudioDumpRecord; static const char * const keyAudioDumpEffect; static const char * const keyAudioDumpDrc; static const char * const keyAudioDumpLog; static const char * const keyAudioDumpAAudio; static const char *audioDumpPropertyStr[]; static const char * const keyAudioDumpLegacyWriter; static const char * const keyAudioDumpLegacyTrack; static const char * const keyAudioDumpLegacyOffload; static const char * const keyAudioDumpLegacyResampler; static const char * const keyAudioDumpLegacyMixer; static const char * const keyAudioDumpLegacyRecord; static const char * const keyAudioDumpLegacyEffect; static const char * const keyAudioDumpLegacyDrc; static const char * const keyAudioDumpLegacyLog; static const char * const keyAudioDumpLegacyAAudio; static const char *audioDumpLegacyPropertyStr[]; static const char * const af_track; static const char * const af_resampler; static const char * const af_drc; static const char * const af_mixer; static const char * const af_effect; static const char * const af_writer; static const char * const af_record; static const char * const af_ulconvert; static const char * const af_reader; static const char * const aaudio_share_dl; static const char * const aaudio_share_ul; static const char * const aaudio_exclusive_dl; static const char * const aaudio_exclusive_ul; class AudioDumpClip { public: AudioDumpClip(); //TODO:Delete struct AudioDumpParam{ char name[256]; int size; int channel; int samplerate; int format; }; static void dump();//test static void threadDump(const char * path, void * buffer, int count, audio_format_t format, uint32_t sampleRate, uint32_t channelCount); static bool getProperty(AudioDumpExt::PROP_AUDIO_DUMP key); static unsigned long getDumpSize(const char * path); static String8 getDumpName(const char * path); static int checkPath(const char * path); static void updateKeys(int key); static void startDumpManagerThread(); static int64_t getClipSize() { return mClipSize; } static void setClipSize(int64_t value) { mClipSize = value; } // For audio dump debug static const char * const keyAudioDumpWriter; static const char * const keyAudioDumpTrack; static const char * const keyAudioDumpOffload; static const char * const keyAudioDumpResampler; static const char * const keyAudioDumpMixer; static const char * const keyAudioDumpRecord; static const char * const keyAudioDumpEffect; static const char * const keyAudioDumpDrc; static const char * const keyAudioDumpLog; static const char * const keyAudioDumpAAudio; static const char *audioDumpPropertyStr[]; private: static void pushBufferInfo(const char * path, void * buffer, int count, audio_format_t format, uint32_t sampleRate, uint32_t channelCount); static int64_t mClipSize; }; private: static int mAPILevel; static int mDumpVersion; // 0 for invalid; 1 for legacy; 2 for dump2hal }; void startDumpManagerThreadInt(void); }