Commit 3f920fef authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[quickview] Teach <files-metadata-box> about RAW file ifd data

Update the <files-metadata-box> ifd property to process RAW image file
ifd data: cameraModel, aperture, exposureTime, and so on.

Bug: 965370
Change-Id: Ibad7731889919d576e0f6c61e39bc5c9b98b72c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695743Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676240}
parent 3582475b
...@@ -215,7 +215,9 @@ var FilesMetadataBox = Polymer({ ...@@ -215,7 +215,9 @@ var FilesMetadataBox = Polymer({
return ''; return '';
} }
// TODO(noel): add ifd.raw cameraModel support. if (ifd['raw']) {
return ifd['raw']['cameraModel'] || '';
}
const id = 272; const id = 272;
const model = (ifd.image && ifd.image[id] && ifd.image[id].value) || ''; const model = (ifd.image && ifd.image[id] && ifd.image[id].value) || '';
...@@ -274,9 +276,9 @@ var FilesMetadataBox = Polymer({ ...@@ -274,9 +276,9 @@ var FilesMetadataBox = Polymer({
deviceSettings_: function(ifd) { deviceSettings_: function(ifd) {
let result = ''; let result = '';
// TODO(noel): add ifd.raw device settings support. if (ifd && ifd['raw']) {
result = this.rawDeviceSettings_(ifd['raw']);
if (ifd) { } else if (ifd) {
result = this.ifdDeviceSettings_(ifd); result = this.ifdDeviceSettings_(ifd);
} }
...@@ -284,7 +286,39 @@ var FilesMetadataBox = Polymer({ ...@@ -284,7 +286,39 @@ var FilesMetadataBox = Polymer({
}, },
/** /**
* @param {Object} ifd * @param {!Object} raw
* @return {string}
*
* @private
*/
rawDeviceSettings_: function(raw) {
let result = '';
const aperture = raw['aperture'] || 0;
if (aperture) {
result += 'f/' + aperture + ' ';
}
const exposureTime = raw['exposureTime'] || 0;
if (exposureTime) {
result += exposureTime + ' ';
}
const focalLength = raw['focalLength'] || 0;
if (focalLength) {
result += focalLength + 'mm ';
}
const isoSpeed = raw['isoSpeed'] || 0;
if (isoSpeed) {
result += 'ISO' + isoSpeed + ' ';
}
return result.trimEnd();
},
/**
* @param {!Object} ifd
* @return {string} * @return {string}
* *
* @private * @private
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment