heif: add new file and mime types to MediaScanner
bug: 64077740
Change-Id: I6d36c2394a5ae527026c98c83786009e70b20958
(cherry picked from commit 6e18ccee2a)
This commit is contained in:
@@ -76,6 +76,9 @@ jstring encodedFormatToString(JNIEnv* env, SkEncodedImageFormat format) {
|
||||
case SkEncodedImageFormat::kWEBP:
|
||||
mimeType = "image/webp";
|
||||
break;
|
||||
case SkEncodedImageFormat::kHEIF:
|
||||
mimeType = "image/heif";
|
||||
break;
|
||||
case SkEncodedImageFormat::kWBMP:
|
||||
mimeType = "image/vnd.wap.wbmp";
|
||||
break;
|
||||
|
||||
@@ -80,8 +80,9 @@ public class MediaFile {
|
||||
public static final int FILE_TYPE_BMP = 34;
|
||||
public static final int FILE_TYPE_WBMP = 35;
|
||||
public static final int FILE_TYPE_WEBP = 36;
|
||||
public static final int FILE_TYPE_HEIF = 37;
|
||||
private static final int FIRST_IMAGE_FILE_TYPE = FILE_TYPE_JPEG;
|
||||
private static final int LAST_IMAGE_FILE_TYPE = FILE_TYPE_WEBP;
|
||||
private static final int LAST_IMAGE_FILE_TYPE = FILE_TYPE_HEIF;
|
||||
|
||||
// Raw image file types
|
||||
public static final int FILE_TYPE_DNG = 300;
|
||||
@@ -239,6 +240,8 @@ public class MediaFile {
|
||||
addFileType("BMP", FILE_TYPE_BMP, "image/x-ms-bmp", MtpConstants.FORMAT_BMP, true);
|
||||
addFileType("WBMP", FILE_TYPE_WBMP, "image/vnd.wap.wbmp", MtpConstants.FORMAT_DEFINED, false);
|
||||
addFileType("WEBP", FILE_TYPE_WEBP, "image/webp", MtpConstants.FORMAT_DEFINED, false);
|
||||
addFileType("HEIC", FILE_TYPE_HEIF, "image/heif", MtpConstants.FORMAT_HEIF, true);
|
||||
addFileType("HEIF", FILE_TYPE_HEIF, "image/heif", MtpConstants.FORMAT_HEIF, false);
|
||||
|
||||
addFileType("DNG", FILE_TYPE_DNG, "image/x-adobe-dng", MtpConstants.FORMAT_DNG, true);
|
||||
addFileType("CR2", FILE_TYPE_CR2, "image/x-canon-cr2", MtpConstants.FORMAT_TIFF, false);
|
||||
|
||||
@@ -211,6 +211,8 @@ public final class MtpConstants {
|
||||
public static final int FORMAT_JPX = 0x3810;
|
||||
/** Format code for DNG files */
|
||||
public static final int FORMAT_DNG = 0x3811;
|
||||
/** Format code for HEIF files {@hide} */
|
||||
public static final int FORMAT_HEIF = 0x3812;
|
||||
/** Format code for firmware files */
|
||||
public static final int FORMAT_UNDEFINED_FIRMWARE = 0xB802;
|
||||
/** Format code for Windows image files */
|
||||
|
||||
@@ -595,6 +595,7 @@ public class MtpDatabase implements AutoCloseable {
|
||||
MtpConstants.FORMAT_XML_DOCUMENT,
|
||||
MtpConstants.FORMAT_FLAC,
|
||||
MtpConstants.FORMAT_DNG,
|
||||
MtpConstants.FORMAT_HEIF,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -705,6 +706,7 @@ public class MtpDatabase implements AutoCloseable {
|
||||
case MtpConstants.FORMAT_PNG:
|
||||
case MtpConstants.FORMAT_BMP:
|
||||
case MtpConstants.FORMAT_DNG:
|
||||
case MtpConstants.FORMAT_HEIF:
|
||||
return IMAGE_PROPERTIES;
|
||||
default:
|
||||
return FILE_PROPERTIES;
|
||||
|
||||
@@ -849,6 +849,7 @@ MtpResponseCode MyMtpDatabase::getObjectInfo(MtpObjectHandle handle,
|
||||
// read EXIF data for thumbnail information
|
||||
switch (info.mFormat) {
|
||||
case MTP_FORMAT_EXIF_JPEG:
|
||||
case MTP_FORMAT_HEIF:
|
||||
case MTP_FORMAT_JFIF: {
|
||||
ExifData *exifdata = exif_data_new_from_file(path);
|
||||
if (exifdata) {
|
||||
@@ -906,6 +907,7 @@ void* MyMtpDatabase::getThumbnail(MtpObjectHandle handle, size_t& outThumbSize)
|
||||
if (getObjectFilePath(handle, path, length, format) == MTP_RESPONSE_OK) {
|
||||
switch (format) {
|
||||
case MTP_FORMAT_EXIF_JPEG:
|
||||
case MTP_FORMAT_HEIF:
|
||||
case MTP_FORMAT_JFIF: {
|
||||
ExifData *exifdata = exif_data_new_from_file(path);
|
||||
if (exifdata) {
|
||||
|
||||
Reference in New Issue
Block a user