| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 const EXIF_MARK_SOI = 0xffd8; // Start of image data. | 5 const EXIF_MARK_SOI = 0xffd8; // Start of image data. |
| 6 const EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). | 6 const EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). |
| 7 const EXIF_MARK_EXIF = 0xffe1; // Start of exif block. | 7 const EXIF_MARK_EXIF = 0xffe1; // Start of exif block. |
| 8 | 8 |
| 9 const EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data. | 9 const EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data. |
| 10 const EXIF_ALIGN_BIG = 0x4d4d; // Indicates big endian exif data. | 10 const EXIF_ALIGN_BIG = 0x4d4d; // Indicates big endian exif data. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 | 243 |
| 244 switch (tag.format) { | 244 switch (tag.format) { |
| 245 case 1: // Byte | 245 case 1: // Byte |
| 246 case 7: // Undefined | 246 case 7: // Undefined |
| 247 safeRead(1); | 247 safeRead(1); |
| 248 break; | 248 break; |
| 249 | 249 |
| 250 case 2: // String | 250 case 2: // String |
| 251 safeRead(1); | 251 safeRead(1); |
| 252 tag.value = tag.value.map( | 252 if (tag.componentCount == 1) { |
| 253 function(v) { return String.fromCharCode(v) }); | 253 tag.value = String.fromCharCode(tag.value); |
| 254 tag.value = tag.value.join(''); | 254 } else { |
| 255 tag.value = String.fromCharCode.apply(null, tag.value); |
| 256 } |
| 255 break; | 257 break; |
| 256 | 258 |
| 257 case 3: // Short | 259 case 3: // Short |
| 258 safeRead(2); | 260 safeRead(2); |
| 259 break; | 261 break; |
| 260 | 262 |
| 261 case 4: // Long | 263 case 4: // Long |
| 262 safeRead(4); | 264 safeRead(4); |
| 263 break; | 265 break; |
| 264 | 266 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 283 ': ' + tag.format); | 285 ': ' + tag.format); |
| 284 safeRead(4); | 286 safeRead(4); |
| 285 break; | 287 break; |
| 286 } | 288 } |
| 287 | 289 |
| 288 this.vlog('Read tag: 0x' + tag.id.toString(16) + '/' + tag.format + ': ' + | 290 this.vlog('Read tag: 0x' + tag.id.toString(16) + '/' + tag.format + ': ' + |
| 289 tag.value); | 291 tag.value); |
| 290 }; | 292 }; |
| 291 | 293 |
| 292 MetadataDispatcher.registerParserClass(ExifParser); | 294 MetadataDispatcher.registerParserClass(ExifParser); |
| OLD | NEW |