diff options
author | James Dong <jdong@google.com> | 2011-01-06 11:31:58 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-01-06 11:36:47 -0800 |
commit | e2491be44bb894d2c11e5836c8c399811edc074c (patch) | |
tree | 7ca4292ca07e0d63d1d3fc4957358b4fb9dc66fe /src/com/android/camera | |
parent | 3fb71ef60beceda51a3459d8f6ca480a17a10cb0 (diff) | |
download | Gallery-e2491be44bb894d2c11e5836c8c399811edc074c.tar.gz |
Don't use the retriever to get the unsupported meta data in Gallery
o Anyway, my understanding is that we will completely remove Gallery in the future.
This patch allows me to get rid of some of the unsupported metadata keys from
the metadata retriever.
Change-Id: I5153454a4906260be72dc57297202f857123ef8d
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/MenuHelper.java | 119 |
1 files changed, 9 insertions, 110 deletions
diff --git a/src/com/android/camera/MenuHelper.java b/src/com/android/camera/MenuHelper.java index 937f9da..3a3a881 100644 --- a/src/com/android/camera/MenuHelper.java +++ b/src/com/android/camera/MenuHelper.java @@ -394,6 +394,15 @@ public class MenuHelper { .findViewById(R.id.details_file_size_value)) .setText(lengthString); + d.findViewById(R.id.details_frame_rate_row) + .setVisibility(View.GONE); + d.findViewById(R.id.details_bit_rate_row) + .setVisibility(View.GONE); + d.findViewById(R.id.details_format_row) + .setVisibility(View.GONE); + d.findViewById(R.id.details_codec_row) + .setVisibility(View.GONE); + int dimensionWidth = 0; int dimensionHeight = 0; if (ImageManager.isImage(image)) { @@ -402,116 +411,6 @@ public class MenuHelper { dimensionHeight = image.getHeight(); d.findViewById(R.id.details_duration_row) .setVisibility(View.GONE); - d.findViewById(R.id.details_frame_rate_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_bit_rate_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_format_row) - .setVisibility(View.GONE); - d.findViewById(R.id.details_codec_row) - .setVisibility(View.GONE); - } else { - MediaMetadataRetriever retriever - = new MediaMetadataRetriever(); - try { - retriever.setMode(MediaMetadataRetriever - .MODE_GET_METADATA_ONLY); - retriever.setDataSource(image.getDataPath()); - try { - dimensionWidth = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_WIDTH)); - dimensionHeight = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_HEIGHT)); - } catch (NumberFormatException e) { - dimensionWidth = 0; - dimensionHeight = 0; - } - - try { - int durationMs = Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_DURATION)); - String durationValue = formatDuration( - activity, durationMs); - ((TextView) d.findViewById( - R.id.details_duration_value)) - .setText(durationValue); - } catch (NumberFormatException e) { - d.findViewById( - R.id.details_frame_rate_row) - .setVisibility(View.GONE); - } - - try { - String frameRate = String.format( - activity.getString(R.string.details_fps), - Integer.parseInt( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_FRAME_RATE))); - ((TextView) d.findViewById( - R.id.details_frame_rate_value)) - .setText(frameRate); - } catch (NumberFormatException e) { - d.findViewById( - R.id.details_frame_rate_row) - .setVisibility(View.GONE); - } - - try { - long bitRate = Long.parseLong( - retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_BIT_RATE)); - String bps; - if (bitRate < 1000000) { - bps = String.format( - activity.getString( - R.string.details_kbps), - bitRate / 1000); - } else { - bps = String.format( - activity.getString( - R.string.details_mbps), - (bitRate) / 1000000.0); - } - ((TextView) d.findViewById( - R.id.details_bit_rate_value)) - .setText(bps); - } catch (NumberFormatException e) { - d.findViewById(R.id.details_bit_rate_row) - .setVisibility(View.GONE); - } - - String format = retriever.extractMetadata( - MediaMetadataRetriever - .METADATA_KEY_VIDEO_FORMAT); - ((TextView) d.findViewById( - R.id.details_format_value)) - .setText(format); - - String codec = retriever.extractMetadata( - MediaMetadataRetriever.METADATA_KEY_CODEC); - if (codec != null) { - setDetailsValue(d, codec, R.id.details_codec_value); - } else { - hideDetailsRow(d, R.id.details_codec_row); - } - - } catch (RuntimeException ex) { - // Assume this is a corrupt video file. - } finally { - try { - retriever.release(); - } catch (RuntimeException ex) { - // Ignore failures while cleaning up. - } - } } String value = null; |