383 Commits

Author SHA1 Message Date
Dustin Oprea
79b37fc0e1 value_context.go: No longer support override for unit-count
It's never set to anything different.
2019-12-31 06:45:05 -05:00
Dustin Oprea
71b242c269 value_context.go: We now store the IFD-path and tag-ID on the value-context
This allows us to add an API for accessing an undefined-value/structure
directly on ValueContext.

- ifd_tag_entry.go: Fixed several methods on `IfdTagEntry` to be by-
  reference. It was a latent bug that they weren't.

- value_context.go: Added `newValueContextFromTag` to streamline
  the changes above.
2019-12-31 06:45:05 -05:00
Dustin Oprea
e6b94637a3 Eliminate unnecessary byte-order code verbosity 2019-12-29 21:20:40 -05:00
Dustin Oprea
e5cdeb0aa4 ifd_builder.go: Fix (*IfdBuilder).printTagTree() printing of child IFDs 2019-12-29 20:56:35 -05:00
Dustin Oprea
a4b93837a7 ifd_builder_encode_test.go: Bugfix for error-squashing in tests 2019-12-29 05:48:36 -05:00
Dustin Oprea
69821c417f value_context.go: ValueContext now embeds value processing
The upshot of this is that generating a list of type-correct slices or a
string from a tag's value is now stupidly easy.

- Broke parsing into an independent type (parser.go:Parser).

- Moved primary value-processing logic to `ValueContext` so that it
  coexists with the actual data (though as much basic functionality as
  possible is implemented independently and reused here). This
  eliminates extremely ridiculously obtuse usage procedure.

- Deprecated almost all existing TagType functionality (in order to
  distance us from this now-legacy usage pattern). Existing
  functionality maintained for now. We'll drop it when we do the next
  release major.

- `ValueContext` is now passed by reference.
2019-12-29 05:48:34 -05:00
Dustin Oprea
7fb09bbf9f value_context.go: ValueContext now wraps members in accessors
It also embeds the type and byte-order so the VC can materialize/process
values self-sufficiently.
2019-12-29 00:35:35 -05:00
Dustin Oprea
a69c3987eb type.go: Created TagTypePrimitive alias for uint16
Added a `Size()` method to it and decommissioned redundant
`TagTypeSize()` and `(TagType).Size()`.

- ifd_enumerate.go: Moved `ValueContext` definition to
  value_context.go .
2019-12-29 00:03:58 -05:00
Dustin Oprea
483dbacf14 type.go: Bugfix for math with embedded data. Add Format().
- ifd_builder.go
  - `BuilderTag` now embeds `ByteOrder`.
  - `BuilderTag` `String()` now prints value.

- type.go
  - `TagType` `ValueIsEmbedded()` renamed to `valueIsEmbedded()`.
  - Add `readRawEncoded()` method to `TagType`.
  - Add `Format()` method to `TagType` to isolate code for processing
    output strings for all types.
    - This will also print a suffixing ellipsis when `justFirst` is
      `true`.

  - Important bugfix for embedded values always being presented as
    four-bytes rather than being truncated to their reported unit-count
    bytes first. We tripped over this when some of our corresponding
    math was found to be wrong elsewhere.

- Minor reformatting.
2019-12-28 23:35:32 -05:00
Dustin Oprea
636417e4ae README.md: Add mention of philip-firstorder 2019-12-23 00:44:58 -05:00
Dustin Oprea
3dda8c2115 MakerNotes now print size and SHA1
- tags_unknown.go: Unhandled unknown values are now wrapped in a
  TagUnknownType_UnknownValue rather than returning an error. This is
  now used to print byte-counts and SHA1s for unhandled values.

- tags_unknown.go: UnparseableUnknownTagValuePlaceholder now has message
  "!UNKNOWN" rather than "!UNPARSEABLE".
2019-11-02 04:23:58 -04:00
Dustin Oprea
4802cf93f4 utility.go: Add GetFlatExifData for convenience to external 2019-11-02 03:44:37 -04:00
Dustin Oprea
3ce78807c9 Add license 2019-09-01 13:30:45 -04:00
Keith Woelke
12b8993a44 Change Ifd.GpsInfo() to calculate Degrees, Mintutes, and Seconds as float64 instead of int 2019-06-24 06:34:42 -04:00
Dustin Oprea
17eaca4233 TODO: Update list of to-do's for accuracy 2019-05-27 12:22:49 -04:00
Dustin Oprea
061c6b48d8 exif.go: Just return ErrNoExif without panicking
- For well-defined, high-level errors we prefer to not wrap them with
  stacktraces if the stacktraces add little value. It just makes it more
  labor-intensive to handle those errors effectively (especially
  external ones).
2019-04-21 16:43:29 -04:00
Dustin Oprea
5b56a02e0a ifd_enumerate.go: Re-enable 2.3.0.0 support 2019-04-05 03:17:39 -04:00
Dustin Oprea
1578ce09d3 ifd_enumerate.go: Any missing functional GPS info returns no-GPS 2019-04-05 02:46:24 -04:00
Dustin Oprea
4ff0938c41 ifd_enumerate.go: Allow GPS version to not exist
- Also, log when we're not processing GPS due to incompatible version.
2019-04-02 11:48:48 -04:00
Kirill Motkov
3f9a27433f readme: add missing "go" marker 2019-03-14 15:07:01 -04:00
Dustin Oprea
089999187e Merge pull request #3 from kszafran/patch-1
Fixed example in README
2019-03-14 15:06:55 -04:00
Dustin Oprea
e1cf486e31 README.md: Add reference to JPEG example
- People are confused.
2019-03-07 21:18:44 -05:00
Dustin Oprea
d9ab04aa47 utility.go: Add ExifFullTimestampString
- Added time examples.
- Added comments.
2019-03-06 11:58:49 -05:00
Dustin Oprea
ef77760c37 README.md: Added additional usage instructions 2019-03-06 11:34:34 -05:00
Dustin Oprea
8dfa922c47 ifd_builder_test.go: Simplified example. 2019-02-26 12:58:27 -05:00
Dustin Oprea
467b10f9db fd_builder_test.go: Add writer example
Closes #9
2019-02-26 12:23:39 -05:00
Dustin Oprea
38a16c885e ifd_builder.go: Add NextIb() so can access sibling IBs 2019-02-26 12:23:16 -05:00
Dustin Oprea
0dfac8434c ifd_tag_entry.go: Add needed value getter 2019-02-26 12:16:32 -05:00
Dustin Oprea
a30f27f681 gps.go: Fix known S2 mishandling that can lead to an invalid cell 2019-02-26 12:15:29 -05:00
Dustin Oprea
8d79b03fc5 utility.go: Added function comment. Formatted file. 2019-01-03 19:31:17 -05:00
Dustin Oprea
eb7eb2b610 ifd_enumerate.go: Skip tags with invalid types.
Fixes #4.
2019-01-03 19:20:55 -05:00
Dustin Oprea
d480165b94 utility: Added function to parse timestamps. 2019-01-01 22:55:30 -05:00
Dustin Oprea
bb29f78ee7 ifd_enumerate_test.go: Added example for reading a single tag. 2019-01-01 01:34:56 -05:00
Dustin Oprea
f2396f7fc7 exif-read-tool/main.go: Can now enable verbosity. 2018-12-25 19:46:00 -05:00
Dustin Oprea
dda14b2db8 exif.go: Tightened length checks for brute-force search. 2018-12-25 19:45:46 -05:00
Dustin Oprea
bf0b550eff exif.go: Check for a long-enough EXIF header when searching. 2018-12-25 18:58:44 -05:00
Dustin Oprea
5409475851
Fixed wording in comment. 2018-11-13 01:58:33 -05:00
Dustin Oprea
a5784ff653
Update README.md
Replaced call to obsolete IsExif() with SearchAndExtractExif().
2018-11-13 01:47:46 -05:00
Dustin Oprea
ab09051aaa ifd_enumerate: Bugfix for incorrect read semantics.
- ...to make sure we get the right number of bytes.
2018-09-16 03:42:48 -04:00
Dustin Oprea
811286316f Updated documentation for recent changes. 2018-08-01 13:10:51 -04:00
Dustin Oprea
5fcfbfd359 ci: Removed S2-incompatible, earlier versions from testing. 2018-08-01 08:44:10 -04:00
Dustin Oprea
9068786204 Rewired to use IFD-path strings instead of IfdIdentities.
- These are absolute representations of where an IFD is positioned with
  respect to the other IFDs. There is a more-specific, "fully-qualified"
  form of the IFD-path that allows you to express indices in order to
  refer to specific siblings.

- Eliminates issues with IFDs at different levels potentially having the
  same name (if that's what is required with a certain dataset/
  datasource).

- There is a specific IFD registry that controls the heirarchy of IFDs
  that we recognize and the tags associated with the child IFDs. This
  allows custom hierarchies replacing even the TIFF specification for
  which are expected in an image (so we can read other types of images
  or any potential IFD hierarchy, even non-image ones).

- IFD and IB instances embed the IFD-path and FQ IFD-path that they were
  found or built for.
2018-08-01 08:35:21 -04:00
Dustin Oprea
15cf52b558 ifd: Imp'd notion of IFD paths. 2018-07-28 17:00:47 -04:00
Dustin Oprea
840d133d71 ifd: Added formal IFD index.
- Used to browser and validate tag trees, while also allowing for custom/non-
  standard IFDs. Will be used instead of the hard-coded IFDs.

- Not to be confused with the IFD-index we establish with the IFDs for a
  particular image file.
2018-07-27 17:21:27 -04:00
Dustin Oprea
d3b45fae77 We now have to pass a specific tag-index in from the top.
- This will allow us to handle custom tags and, with a little more work,
  custom IFDs.
2018-07-26 22:45:43 -04:00
Dustin Oprea
d8cdf29fa6 TagIndex: Refactored to prepare for custom tags.
- More specifically, to prepare the way to register non-standard IFDs
  and tags.
2018-07-26 03:08:03 -04:00
Dustin Oprea
2349792faa assets: Attached PNG standards documents to project. 2018-06-18 00:43:27 -04:00
Dustin Oprea
dfbe003c0e Reorganized to not require GOPATH unless testing. 2018-06-16 09:49:14 -04:00
Dustin Oprea
7a8e5b005e ifd: Added enumeration example. 2018-06-14 04:04:31 -04:00
Dustin Oprea
86422559be ifd: Added recursive tag enumerator.
- We now embed a child-IFD index on the `Ifd`.
2018-06-14 03:52:12 -04:00