From 413f523afe96aff02d2b0a7459127b8f67b2b43c Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 3 Dec 2009 11:31:19 -0800 Subject: Refactor MediaScanner. Some steps on the way towards being able to build the tree without OpenCore. --- include/media/mediascanner.h | 47 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'include/media/mediascanner.h') diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h index cd0b86e..0d397ac 100644 --- a/include/media/mediascanner.h +++ b/include/media/mediascanner.h @@ -28,33 +28,40 @@ namespace android { class MediaScannerClient; class StringArray; -class MediaScanner -{ -public: +struct MediaScanner { MediaScanner(); - ~MediaScanner(); - + virtual ~MediaScanner(); + + virtual status_t processFile( + const char *path, const char *mimeType, + MediaScannerClient &client) = 0; + typedef bool (*ExceptionCheck)(void* env); + virtual status_t processDirectory( + const char *path, const char *extensions, + MediaScannerClient &client, + ExceptionCheck exceptionCheck, void *exceptionEnv); + + void setLocale(const char *locale); - status_t processFile(const char *path, const char *mimeType, MediaScannerClient& client); - status_t processDirectory(const char *path, const char* extensions, - MediaScannerClient& client, ExceptionCheck exceptionCheck, void* exceptionEnv); - void setLocale(const char* locale); - // extracts album art as a block of data - char* extractAlbumArt(int fd); - - static void uninitializeForThread(); + virtual char *extractAlbumArt(int fd) = 0; + +protected: + const char *locale() const; private: - status_t doProcessDirectory(char *path, int pathRemaining, const char* extensions, - MediaScannerClient& client, ExceptionCheck exceptionCheck, void* exceptionEnv); - void initializeForThread(); - // current locale (like "ja_JP"), created/destroyed with strdup()/free() - char* mLocale; -}; + char *mLocale; + status_t doProcessDirectory( + char *path, int pathRemaining, const char *extensions, + MediaScannerClient &client, ExceptionCheck exceptionCheck, + void *exceptionEnv); + + MediaScanner(const MediaScanner &); + MediaScanner &operator=(const MediaScanner &); +}; class MediaScannerClient { @@ -78,7 +85,7 @@ protected: // cached name and value strings, for native encoding support. StringArray* mNames; StringArray* mValues; - + // default encoding based on MediaScanner::mLocale string uint32_t mLocaleEncoding; }; -- cgit v1.1