diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-07-20 18:03:47 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-20 18:03:47 -0700 |
commit | 5da67f4f6918fccc4a89d4facd8642164c630c57 (patch) | |
tree | 9aa2121824836658cea16fa0f7f336ef30812ecd /include | |
parent | 5be70a8ec028947e4043544bac990c92cfcafc10 (diff) | |
parent | 2c70d4a372a8ce83163f19bbd6ae82483ffbe46b (diff) | |
download | frameworks_base-5da67f4f6918fccc4a89d4facd8642164c630c57.zip frameworks_base-5da67f4f6918fccc4a89d4facd8642164c630c57.tar.gz frameworks_base-5da67f4f6918fccc4a89d4facd8642164c630c57.tar.bz2 |
Merge "Untangle MediaScanner error handling. Bug: 5056917"
Diffstat (limited to 'include')
-rw-r--r-- | include/media/mediascanner.h | 40 | ||||
-rw-r--r-- | include/media/stagefright/StagefrightMediaScanner.h | 6 |
2 files changed, 31 insertions, 15 deletions
diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h index 765c039..803bffb 100644 --- a/include/media/mediascanner.h +++ b/include/media/mediascanner.h @@ -23,23 +23,33 @@ #include <utils/Errors.h> #include <pthread.h> +struct dirent; + namespace android { class MediaScannerClient; class StringArray; +enum MediaScanResult { + // This file or directory was scanned successfully. + MEDIA_SCAN_RESULT_OK, + // This file or directory was skipped because it was not found, could + // not be opened, was of an unsupported type, or was malfored in some way. + MEDIA_SCAN_RESULT_SKIPPED, + // The scan should be aborted due to a fatal error such as out of memory + // or an exception. + MEDIA_SCAN_RESULT_ERROR, +}; + struct MediaScanner { MediaScanner(); virtual ~MediaScanner(); - virtual status_t processFile( - const char *path, const char *mimeType, - MediaScannerClient &client) = 0; + virtual MediaScanResult processFile( + const char *path, const char *mimeType, MediaScannerClient &client) = 0; - typedef bool (*ExceptionCheck)(void* env); - virtual status_t processDirectory( - const char *path, MediaScannerClient &client, - ExceptionCheck exceptionCheck, void *exceptionEnv); + virtual MediaScanResult processDirectory( + const char *path, MediaScannerClient &client); void setLocale(const char *locale); @@ -53,9 +63,11 @@ private: // current locale (like "ja_JP"), created/destroyed with strdup()/free() char *mLocale; - status_t doProcessDirectory( - char *path, int pathRemaining, MediaScannerClient &client, - bool noMedia, ExceptionCheck exceptionCheck, void *exceptionEnv); + MediaScanResult doProcessDirectory( + char *path, int pathRemaining, MediaScannerClient &client, bool noMedia); + MediaScanResult doProcessDirectoryEntry( + char *path, int pathRemaining, MediaScannerClient &client, bool noMedia, + struct dirent* entry, char* fileSpot); MediaScanner(const MediaScanner &); MediaScanner &operator=(const MediaScanner &); @@ -68,13 +80,13 @@ public: virtual ~MediaScannerClient(); void setLocale(const char* locale); void beginFile(); - bool addStringTag(const char* name, const char* value); + status_t addStringTag(const char* name, const char* value); void endFile(); - virtual bool scanFile(const char* path, long long lastModified, + virtual status_t scanFile(const char* path, long long lastModified, long long fileSize, bool isDirectory, bool noMedia) = 0; - virtual bool handleStringTag(const char* name, const char* value) = 0; - virtual bool setMimeType(const char* mimeType) = 0; + virtual status_t handleStringTag(const char* name, const char* value) = 0; + virtual status_t setMimeType(const char* mimeType) = 0; protected: void convertValues(uint32_t encoding); diff --git a/include/media/stagefright/StagefrightMediaScanner.h b/include/media/stagefright/StagefrightMediaScanner.h index 108acb4..6510a59 100644 --- a/include/media/stagefright/StagefrightMediaScanner.h +++ b/include/media/stagefright/StagefrightMediaScanner.h @@ -26,7 +26,7 @@ struct StagefrightMediaScanner : public MediaScanner { StagefrightMediaScanner(); virtual ~StagefrightMediaScanner(); - virtual status_t processFile( + virtual MediaScanResult processFile( const char *path, const char *mimeType, MediaScannerClient &client); @@ -35,6 +35,10 @@ struct StagefrightMediaScanner : public MediaScanner { private: StagefrightMediaScanner(const StagefrightMediaScanner &); StagefrightMediaScanner &operator=(const StagefrightMediaScanner &); + + MediaScanResult processFileInternal( + const char *path, const char *mimeType, + MediaScannerClient &client); }; } // namespace android |