diff options
author | Mike Lockwood <lockwood@android.com> | 2010-08-10 07:37:50 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-08-10 09:00:30 -0400 |
commit | 782aef17c9921a3bf401a0432878df5031f2328b (patch) | |
tree | 16990996aabf410d011704657f11bf3ec5cedd54 /media/mtp/MtpServer.cpp | |
parent | d7943b4cd2fa597581d1e29325adccc62dbf2939 (diff) | |
download | frameworks_av-782aef17c9921a3bf401a0432878df5031f2328b.zip frameworks_av-782aef17c9921a3bf401a0432878df5031f2328b.tar.gz frameworks_av-782aef17c9921a3bf401a0432878df5031f2328b.tar.bz2 |
MTP: Push queries for supported formats and properties up to Java.
Change-Id: I4f117090340e3916afda3d194521a6092a672ddc
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpServer.cpp')
-rw-r--r-- | media/mtp/MtpServer.cpp | 60 |
1 files changed, 14 insertions, 46 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp index 082d924..6d2eec3 100644 --- a/media/mtp/MtpServer.cpp +++ b/media/mtp/MtpServer.cpp @@ -78,46 +78,6 @@ static const MtpEventCode kSupportedEventCodes[] = { MTP_EVENT_OBJECT_REMOVED, }; -static const MtpObjectProperty kSupportedObjectProperties[] = { - MTP_PROPERTY_STORAGE_ID, - MTP_PROPERTY_OBJECT_FORMAT, - MTP_PROPERTY_OBJECT_SIZE, - MTP_PROPERTY_OBJECT_FILE_NAME, - MTP_PROPERTY_PARENT_OBJECT, -}; - -static const MtpObjectFormat kSupportedPlaybackFormats[] = { - // MTP_FORMAT_UNDEFINED, - MTP_FORMAT_ASSOCIATION, - // MTP_FORMAT_TEXT, - // MTP_FORMAT_HTML, - MTP_FORMAT_MP3, - //MTP_FORMAT_AVI, - MTP_FORMAT_MPEG, - // MTP_FORMAT_ASF, - MTP_FORMAT_EXIF_JPEG, - MTP_FORMAT_TIFF_EP, - // MTP_FORMAT_BMP, - MTP_FORMAT_GIF, - MTP_FORMAT_JFIF, - MTP_FORMAT_PNG, - MTP_FORMAT_TIFF, - MTP_FORMAT_WMA, - MTP_FORMAT_OGG, - MTP_FORMAT_AAC, - // MTP_FORMAT_FLAC, - // MTP_FORMAT_WMV, - MTP_FORMAT_MP4_CONTAINER, - MTP_FORMAT_MP2, - MTP_FORMAT_3GP_CONTAINER, - // MTP_FORMAT_ABSTRACT_AUDIO_ALBUM, - MTP_FORMAT_ABSTRACT_AV_PLAYLIST, - MTP_FORMAT_WPL_PLAYLIST, - MTP_FORMAT_M3U_PLAYLIST, - // MTP_FORMAT_MPL_PLAYLIST, - MTP_FORMAT_PLS_PLAYLIST, -}; - MtpServer::MtpServer(int fd, MtpDatabase* database, int fileGroup, int filePerm, int directoryPerm) : mFD(fd), @@ -354,6 +314,10 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { MtpStringBuffer string; char prop_value[PROPERTY_VALUE_MAX]; + MtpObjectFormatList* playbackFormats = mDatabase->getSupportedPlaybackFormats(); + MtpObjectFormatList* captureFormats = mDatabase->getSupportedCaptureFormats(); + MtpDevicePropertyList* deviceProperties = mDatabase->getSupportedDeviceProperties(); + // fill in device info mData.putUInt16(MTP_STANDARD_VERSION); mData.putUInt32(6); // MTP Vendor Extension ID @@ -365,10 +329,9 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { sizeof(kSupportedOperationCodes) / sizeof(uint16_t)); // Operations Supported mData.putAUInt16(kSupportedEventCodes, sizeof(kSupportedEventCodes) / sizeof(uint16_t)); // Events Supported - mData.putEmptyArray(); // Device Properties Supported - mData.putEmptyArray(); // Capture Formats - mData.putAUInt16(kSupportedPlaybackFormats, - sizeof(kSupportedPlaybackFormats) / sizeof(uint16_t)); // Playback Formats + mData.putAUInt16(deviceProperties); // Device Properties Supported + mData.putAUInt16(captureFormats); // Capture Formats + mData.putAUInt16(playbackFormats); // Playback Formats // FIXME string.set("Google, Inc."); mData.putString(string); // Manufacturer @@ -383,6 +346,10 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { string.set(prop_value); mData.putString(string); // Serial Number + delete playbackFormats; + delete captureFormats; + delete deviceProperties; + return MTP_RESPONSE_OK; } @@ -443,8 +410,9 @@ MtpResponseCode MtpServer::doGetObjectPropsSupported() { if (!mSessionOpen) return MTP_RESPONSE_SESSION_NOT_OPEN; MtpObjectFormat format = mRequest.getParameter(1); - mData.putAUInt16(kSupportedObjectProperties, - sizeof(kSupportedObjectProperties) / sizeof(uint16_t)); + MtpDevicePropertyList* properties = mDatabase->getSupportedObjectProperties(format); + mData.putAUInt16(properties); + delete[] properties; return MTP_RESPONSE_OK; } |