blob: 53d50633d68fc2ad5998d54c537a6d585cca2836 [file] [log] [blame]
Mike Lockwoodfceef462010-05-14 15:35:17 -04001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _MTP_MEDIA_SCANNER_H
18#define _MTP_MEDIA_SCANNER_H
19
20struct stat;
21
22namespace android {
23
24class MtpDatabase;
25class SqliteStatement;
26class MediaScanner;
27class MtpMediaScannerClient;
28
29class MtpMediaScanner {
30private:
31 MtpStorageID mStorageID;
32 const char* mFilePath;
33 MtpDatabase* mDatabase;
34 MediaScanner* mMediaScanner;
35 MtpMediaScannerClient* mMediaScannerClient;
36
37 // for garbage collecting missing files
38 MtpObjectHandle* mFileList;
39 int mFileCount;
40
41public:
42 MtpMediaScanner(MtpStorageID id, const char* filePath, MtpDatabase* db);
43 virtual ~MtpMediaScanner();
44
45 bool scanFiles();
46
47private:
48 MtpObjectFormat getFileFormat(const char* path, uint32_t& table);
49 int scanDirectory(const char* path, MtpObjectHandle parent);
50 void scanFile(const char* path, MtpObjectHandle parent, struct stat& statbuf);
51 void markFile(MtpObjectHandle handle);
52};
53
54}; // namespace android
55
56#endif // _MTP_MEDIA_SCANNER_H