Loading media/java/android/media/ExifInterface.java +49 −34 Original line number Diff line number Diff line Loading @@ -2564,15 +2564,33 @@ public class ExifInterface { }); } String hasImage = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_HAS_IMAGE); String hasVideo = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO); final String METADATA_HAS_VIDEO_VALUE_YES = "yes"; if (METADATA_HAS_VIDEO_VALUE_YES.equals(hasVideo)) { String width = retriever.extractMetadata( String width = null; String height = null; String rotation = null; final String METADATA_VALUE_YES = "yes"; // If the file has both image and video, prefer image info over video info. // App querying ExifInterface is most likely using the bitmap path which // picks the image first. if (METADATA_VALUE_YES.equals(hasImage)) { width = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_WIDTH); height = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_HEIGHT); rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_ROTATION); } else if (METADATA_VALUE_YES.equals(hasVideo)) { width = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); String height = retriever.extractMetadata( height = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); } if (width != null) { mAttributes[IFD_TYPE_PRIMARY].put(TAG_IMAGE_WIDTH, Loading @@ -2584,8 +2602,6 @@ public class ExifInterface { ExifAttribute.createUShort(Integer.parseInt(height), mExifByteOrder)); } String rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); if (rotation != null) { int orientation = ExifInterface.ORIENTATION_NORMAL; Loading @@ -2609,7 +2625,6 @@ public class ExifInterface { if (DEBUG) { Log.d(TAG, "Heif meta: " + width + "x" + height + ", rotation " + rotation); } } } finally { retriever.release(); } Loading Loading
media/java/android/media/ExifInterface.java +49 −34 Original line number Diff line number Diff line Loading @@ -2564,15 +2564,33 @@ public class ExifInterface { }); } String hasImage = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_HAS_IMAGE); String hasVideo = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO); final String METADATA_HAS_VIDEO_VALUE_YES = "yes"; if (METADATA_HAS_VIDEO_VALUE_YES.equals(hasVideo)) { String width = retriever.extractMetadata( String width = null; String height = null; String rotation = null; final String METADATA_VALUE_YES = "yes"; // If the file has both image and video, prefer image info over video info. // App querying ExifInterface is most likely using the bitmap path which // picks the image first. if (METADATA_VALUE_YES.equals(hasImage)) { width = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_WIDTH); height = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_HEIGHT); rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_IMAGE_ROTATION); } else if (METADATA_VALUE_YES.equals(hasVideo)) { width = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); String height = retriever.extractMetadata( height = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); } if (width != null) { mAttributes[IFD_TYPE_PRIMARY].put(TAG_IMAGE_WIDTH, Loading @@ -2584,8 +2602,6 @@ public class ExifInterface { ExifAttribute.createUShort(Integer.parseInt(height), mExifByteOrder)); } String rotation = retriever.extractMetadata( MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); if (rotation != null) { int orientation = ExifInterface.ORIENTATION_NORMAL; Loading @@ -2609,7 +2625,6 @@ public class ExifInterface { if (DEBUG) { Log.d(TAG, "Heif meta: " + width + "x" + height + ", rotation " + rotation); } } } finally { retriever.release(); } Loading