From: hsgwon Date: Fri, 12 Apr 2019 09:28:20 +0000 (+0900) Subject: [MediaContent] Add missing description and its related code (#788) X-Git-Tag: submit/tizen/20190413.005205~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da724022fe27ef82fc6af2269cf42d2c4e41d299;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [MediaContent] Add missing description and its related code (#788) --- diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs index 9b9f6bef1..3a820bf90 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs @@ -954,6 +954,7 @@ namespace Tizen.Content.MediaContent /// /// /// Media in the external storage is not supported, with the exception of MMC. + /// Only JPEG, PNG, BMP images are supported. /// /// http://tizen.org/privilege/content.write /// http://tizen.org/feature/vision.face_recognition @@ -1018,6 +1019,14 @@ namespace Tizen.Content.MediaContent throw new UnsupportedContentException("Only image is supported."); } + // Native P/Invoke function also check below case, but it returns invalid operation error. + // So we check it here to throw more proper exception. + string mimeType = InteropHelper.GetString(handle, Interop.MediaInfo.GetMimeType); + if (!mimeType.Equals("image/jpeg") && !mimeType.Equals("image/png") && !mimeType.Equals("image/bmp")) + { + throw new UnsupportedContentException($"{mimeType} is not supported. Only JPEG, PNG, BMP is supported."); + } + var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); if (File.Exists(path) == false)