summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-07-20 16:38:43 -0700
committerJeff Brown <jeffbrown@google.com>2011-07-20 17:33:13 -0700
commit2c70d4a372a8ce83163f19bbd6ae82483ffbe46b (patch)
treea0ce5a726ee27ce434e925ff2d8963d8a2f47580 /include
parentcf4cfc6fc88f204e2e496e37337f7e70809bbf6f (diff)
downloadframeworks_base-2c70d4a372a8ce83163f19bbd6ae82483ffbe46b.zip
frameworks_base-2c70d4a372a8ce83163f19bbd6ae82483ffbe46b.tar.gz
frameworks_base-2c70d4a372a8ce83163f19bbd6ae82483ffbe46b.tar.bz2
Untangle MediaScanner error handling.
Bug: 5056917 Change-Id: I1a7a73579e3ba4e9709459329fc1901a28b0f4b1
Diffstat (limited to 'include')
-rw-r--r--include/media/mediascanner.h40
-rw-r--r--include/media/stagefright/StagefrightMediaScanner.h6
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