From c39d2e3c012fb96999991e30659a474f9f30f789 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Sun, 20 Sep 2009 10:42:13 -0700 Subject: Music visualizer support hack. This currently assumes 44k stereo (won't crash on other formats, but won't give the correct results either), and links statically with libspeex to get FFT data, increasing the size of libmedia by about 45kb. --- include/media/IMediaPlayerService.h | 4 ++++ include/media/mediaplayer.h | 1 + 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h index 39b5e57..303444c 100644 --- a/include/media/IMediaPlayerService.h +++ b/include/media/IMediaPlayerService.h @@ -43,6 +43,10 @@ public: virtual sp decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; virtual sp decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; virtual sp createOMX() = 0; + + // Take a peek at currently playing audio, for visualization purposes. + // This returns a buffer of 16 bit mono PCM data, or NULL if no visualization buffer is currently available. + virtual sp snoop() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 26b054bd..b91b47e 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -153,6 +153,7 @@ public: void notify(int msg, int ext1, int ext2); static sp decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat); static sp decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat); + static int snoop(short *data, int len, int kind); status_t invoke(const Parcel& request, Parcel *reply); status_t setMetadataFilter(const Parcel& filter); status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata); -- cgit v1.1