summaryrefslogtreecommitdiffstats
path: root/mtp
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2014-09-09 03:04:06 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-09-09 16:56:14 +0200
commit1812c89f394a057e8769cbb87e7b1499b5849ac0 (patch)
tree2c2d29baf71fffe71a0747ca0eecb91b887fd9cd /mtp
parentmktime_tz is blocking, don't use it (diff)
downloadandroid_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar.gz
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar.bz2
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar.lz
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar.xz
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.tar.zst
android_bootable_recovery-1812c89f394a057e8769cbb87e7b1499b5849ac0.zip
Diffstat (limited to 'mtp')
-rwxr-xr-xmtp/mtp_MtpDatabase.cpp66
-rwxr-xr-xmtp/mtp_MtpDatabase.hpp1
2 files changed, 34 insertions, 33 deletions
diff --git a/mtp/mtp_MtpDatabase.cpp b/mtp/mtp_MtpDatabase.cpp
index acdab523d..b5096fe76 100755
--- a/mtp/mtp_MtpDatabase.cpp
+++ b/mtp/mtp_MtpDatabase.cpp
@@ -57,6 +57,12 @@ MyMtpDatabase::~MyMtpDatabase() {
}
}
+int MyMtpDatabase::DEVICE_PROPERTIES[3] = {
+ MTP_DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER,
+ MTP_DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME,
+ MTP_DEVICE_PROPERTY_IMAGE_SIZE
+};
+
int MyMtpDatabase::FILE_PROPERTIES[10] = {
// NOTE must match beginning of AUDIO_PROPERTIES, VIDEO_PROPERTIES
// and IMAGE_PROPERTIES below
@@ -71,6 +77,7 @@ int MyMtpDatabase::FILE_PROPERTIES[10] = {
MTP_PROPERTY_NAME,
MTP_PROPERTY_DATE_ADDED
};
+
int MyMtpDatabase::AUDIO_PROPERTIES[19] = {
// NOTE must match FILE_PROPERTIES above
MTP_PROPERTY_STORAGE_ID,
@@ -268,55 +275,49 @@ MtpObjectFormatList* MyMtpDatabase::getSupportedCaptureFormats() {
MtpObjectPropertyList* MyMtpDatabase::getSupportedObjectProperties(MtpObjectFormat format) {
int* properties;
MtpObjectPropertyList* list = new MtpObjectPropertyList();
- properties = FILE_PROPERTIES;
- int length = sizeof(FILE_PROPERTIES);
- MTPD("MyMtpDatabase::getSupportedObjectProperties length is: %i, format: %x, sizeof: %i, forcing length to 10\n", length, format, sizeof(properties));
- for (int i = 0; i < length; i++) {
- MTPD("supported object property: %x\n", properties[i]);
- list->push(properties[i]);
- }
- return list;
-}
-
-MtpDevicePropertyList* MyMtpDatabase::getSupportedDeviceProperties() {
- int properties[] = {
- MTP_DEVICE_PROPERTY_SYNCHRONIZATION_PARTNER,
- MTP_DEVICE_PROPERTY_DEVICE_FRIENDLY_NAME,
- MTP_DEVICE_PROPERTY_IMAGE_SIZE,
- };
- MtpDevicePropertyList* list = new MtpDevicePropertyList();
- int length = sizeof(properties) / sizeof(int);
- MTPD("MyMtpDatabase::getSupportedDeviceProperties length was: %i, forcing to 3\n", length);
- length = 3;
- for (int i = 0; i < length; i++)
- list->push(properties[i]);
- return list;
-}
-
-int* MyMtpDatabase::getSupportedObjectProperties(int format) {
+ int length = 0;
switch (format) {
case MTP_FORMAT_MP3:
case MTP_FORMAT_WAV:
case MTP_FORMAT_WMA:
case MTP_FORMAT_OGG:
case MTP_FORMAT_AAC:
- return AUDIO_PROPERTIES;
+ properties = AUDIO_PROPERTIES;
+ length = sizeof(AUDIO_PROPERTIES) / sizeof(AUDIO_PROPERTIES[0]);
case MTP_FORMAT_MPEG:
case MTP_FORMAT_3GP_CONTAINER:
case MTP_FORMAT_WMV:
- return VIDEO_PROPERTIES;
+ properties = VIDEO_PROPERTIES;
+ length = sizeof(VIDEO_PROPERTIES) / sizeof(VIDEO_PROPERTIES[0]);
case MTP_FORMAT_EXIF_JPEG:
case MTP_FORMAT_GIF:
case MTP_FORMAT_PNG:
case MTP_FORMAT_BMP:
- return IMAGE_PROPERTIES;
+ properties = IMAGE_PROPERTIES;
+ length = sizeof(IMAGE_PROPERTIES) / sizeof(IMAGE_PROPERTIES[0]);
case 0:
- return ALL_PROPERTIES;
+ properties = ALL_PROPERTIES;
+ length = sizeof(ALL_PROPERTIES) / sizeof(ALL_PROPERTIES[0]);
default:
- return FILE_PROPERTIES;
+ properties = FILE_PROPERTIES;
+ length = sizeof(FILE_PROPERTIES) / sizeof(FILE_PROPERTIES[0]);
+ }
+ MTPD("MyMtpDatabase::getSupportedObjectProperties length is: %i, format: %x, sizeof: %i", length, format);
+ for (int i = 0; i < length; i++) {
+ MTPD("supported object property: %x\n", properties[i]);
+ list->push(properties[i]);
}
+ return list;
}
+MtpDevicePropertyList* MyMtpDatabase::getSupportedDeviceProperties() {
+ MtpDevicePropertyList* list = new MtpDevicePropertyList();
+ int length = sizeof(DEVICE_PROPERTIES) / sizeof(DEVICE_PROPERTIES[0]);
+ MTPD("MyMtpDatabase::getSupportedDeviceProperties length was: %i\n");
+ for (int i = 0; i < length; i++)
+ list->push(DEVICE_PROPERTIES[i]);
+ return list;
+}
MtpResponseCode MyMtpDatabase::getObjectPropertyValue(MtpObjectHandle handle,
MtpObjectProperty property,
MtpDataPacket& packet) {
@@ -656,7 +657,7 @@ void* MyMtpDatabase::getThumbnail(MtpObjectHandle handle, size_t& outThumbSize)
MtpResponseCode MyMtpDatabase::getObjectFilePath(MtpObjectHandle handle, MtpString& outFilePath, int64_t& outFileLength, MtpObjectFormat& outFormat) {
std::map<int, MtpStorage*>::iterator storit;
for (storit = storagemap.begin(); storit != storagemap.end(); storit++) {
- MTPD("MyMtpDatabase::getObjectFilePath calling getObhectFilePath\n");
+ MTPD("MyMtpDatabase::getObjectFilePath calling getObjectFilePath\n");
if (storit->second->getObjectFilePath(handle, outFilePath, outFileLength, outFormat) == 0) {
MTPD("MTP_RESPONSE_OK\n");
return MTP_RESPONSE_OK;
@@ -827,7 +828,6 @@ MtpProperty* MyMtpDatabase::getDevicePropertyDesc(MtpDeviceProperty property) {
// get current value
if (ret == MTP_RESPONSE_OK) {
- MTPD("here\n");
result->setCurrentValue('\0');
result->setDefaultValue('\0');
} else {
diff --git a/mtp/mtp_MtpDatabase.hpp b/mtp/mtp_MtpDatabase.hpp
index 2f5e931ba..cc8097be2 100755
--- a/mtp/mtp_MtpDatabase.hpp
+++ b/mtp/mtp_MtpDatabase.hpp
@@ -46,6 +46,7 @@ private:
int* getSupportedObjectProperties(int format);
static int FILE_PROPERTIES[10];
+ static int DEVICE_PROPERTIES[3];
static int AUDIO_PROPERTIES[19];
static int VIDEO_PROPERTIES[15];
static int IMAGE_PROPERTIES[12];