blob: eabd9937311f86d6f2db60d061b880be12308d47 [file] [log] [blame]
Mike Lockwood16864ba2010-05-11 17:16:59 -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
Mike Lockwoodb14e5882010-06-29 18:11:52 -040017#define LOG_TAG "MtpDatabase"
18
19#include "MtpDebug.h"
Mike Lockwood16864ba2010-05-11 17:16:59 -040020#include "MtpDatabase.h"
Mike Lockwood02503612010-07-02 14:03:31 -040021#include "MtpTypes.h"
22#include "mtp.h"
Mike Lockwood16864ba2010-05-11 17:16:59 -040023
Mike Lockwood7850ef92010-05-14 10:10:36 -040024namespace android {
25
Mike Lockwood16864ba2010-05-11 17:16:59 -040026MtpDatabase::~MtpDatabase() {
27}
28
Mike Lockwoodfceef462010-05-14 15:35:17 -040029uint32_t MtpDatabase::getTableForFile(MtpObjectFormat format) {
30 switch (format) {
31 case MTP_FORMAT_AIFF:
32 case MTP_FORMAT_WAV:
33 case MTP_FORMAT_MP3:
34 case MTP_FORMAT_FLAC:
35 case MTP_FORMAT_UNDEFINED_AUDIO:
36 case MTP_FORMAT_WMA:
37 case MTP_FORMAT_OGG:
38 case MTP_FORMAT_AAC:
39 case MTP_FORMAT_AUDIBLE:
40 return kObjectHandleTableAudio;
41 case MTP_FORMAT_AVI:
42 case MTP_FORMAT_MPEG:
43 case MTP_FORMAT_ASF:
44 case MTP_FORMAT_UNDEFINED_VIDEO:
45 case MTP_FORMAT_WMV:
46 case MTP_FORMAT_MP4_CONTAINER:
47 case MTP_FORMAT_MP2:
48 case MTP_FORMAT_3GP_CONTAINER:
49 return kObjectHandleTableVideo;
50 case MTP_FORMAT_DEFINED:
51 case MTP_FORMAT_EXIF_JPEG:
52 case MTP_FORMAT_TIFF_EP:
53 case MTP_FORMAT_FLASHPIX:
54 case MTP_FORMAT_BMP:
55 case MTP_FORMAT_CIFF:
56 case MTP_FORMAT_GIF:
57 case MTP_FORMAT_JFIF:
58 case MTP_FORMAT_CD:
59 case MTP_FORMAT_PICT:
60 case MTP_FORMAT_PNG:
61 case MTP_FORMAT_TIFF:
62 case MTP_FORMAT_TIFF_IT:
63 case MTP_FORMAT_JP2:
64 case MTP_FORMAT_JPX:
65 case MTP_FORMAT_WINDOWS_IMAGE_FORMAT:
66 return kObjectHandleTableImage;
67 case MTP_FORMAT_ABSTRACT_AUDIO_PLAYLIST:
68 case MTP_FORMAT_ABSTRACT_AV_PLAYLIST:
69 case MTP_FORMAT_ABSTRACT_VIDEO_PLAYLIST:
70 case MTP_FORMAT_WPL_PLAYLIST:
71 case MTP_FORMAT_M3U_PLAYLIST:
72 case MTP_FORMAT_MPL_PLAYLIST:
73 case MTP_FORMAT_ASX_PLAYLIST:
74 case MTP_FORMAT_PLS_PLAYLIST:
75 return kObjectHandleTablePlaylist;
76 default:
77 return kObjectHandleTableFile;
78 }
79}
80
Mike Lockwood7850ef92010-05-14 10:10:36 -040081} // namespace android