Commit Graph

25 Commits (d21ac8e2de85274733c163a2e1f62d8bb239c31d)

Author SHA1 Message Date
Dustin Oprea bc34ca087b exif-read-tool/main_test.go: Bugfix for missing error check 2020-01-25 23:30:30 -05:00
Felix Kaiser 3a4fc51e30 exif-read-tool/main.go: exit 1 on panic (#23) 2020-01-01 11:13:14 -05:00
Dustin Oprea 8fd2b91cd6 Modulize project 2020-01-01 11:10:01 -05:00
Dustin Oprea 9aa2497f7b Revert "type.go: Deinegrated `ErrUnhandledUnknownTypedTag`"
This reverts commit 4f2f9044e6.

Reintroduces errors from `UndefinedValue()` when the undefined-type is
unhandled.

- We now just return it rather than panic with it so that we can check
  for it directly rather than use `log.Is()`.

- We've updated the checks across the code accordingly.
2020-01-01 09:05:06 -05:00
Dustin Oprea 4f2f9044e6 type.go: Deinegrated `ErrUnhandledUnknownTypedTag`
Not actually used anywhere.
2019-12-31 07:39:41 -05:00
Dustin Oprea fb1db098b9 value_context.go: Add and integrate `(*ValueContext).Undefined()` method 2019-12-31 06:45:05 -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 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 f2396f7fc7 exif-read-tool/main.go: Can now enable verbosity. 2018-12-25 19:46:00 -05: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 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 7745cfe74c exif: Deimplemented IsExif().
- exif
  - Began deconstructing Exif type in favor of just defining those
    methods as functions.
  - Added additional tests.
2018-06-06 04:37:43 -04:00
Dustin Oprea 0a561e98ed Fixed tests for recent changes. 2018-05-29 00:55:43 -04:00
Dustin Oprea e3c96766ca tests: Fixed tests for recent changes. One remaining. 2018-05-22 09:39:03 -04:00
Dustin Oprea cf17cf4aa6 ifd: Can now resolve its own tags' values.
- Adjustments to argument naming.
2018-05-06 16:19:20 -04:00
Dustin Oprea b18da0cc3d ifd_tag_entry: Added full test coverage.
- bytes are now stringified to a hex-byte representation.
2018-05-04 18:34:01 -04:00
Dustin Oprea 51fdf33590 exif-read-tool: Added JSON support. 2018-05-02 13:11:23 -04:00
Dustin Oprea cebf021131 exif-read-tool: Added unit-test and minimum documentation. 2018-05-02 04:11:46 -04:00
Dustin Oprea f4cb06d79d type: Renamed ValueString() to ResolveAsString(). 2018-05-02 02:21:06 -04:00
Dustin Oprea f1f23dca82 General intuitivity refactor. Imp'd (IfdTagEntry).ValueBytes().
- Added some assertions and constants. Renamed from variable so it'd be easy to
  tell if the byte-arrays, even though they come directly from the EXIF, which
  specific offsets they start at (so no remove for confusion during enumeration
  and building).
2018-04-21 20:54:56 -04:00
Dustin Oprea acbda6d1e1 ifd_enumerate: Refactored for reusability from a collector loop. 2018-04-18 06:28:12 -04:00
Dustin Oprea f1521d4bac documentation: Added documentation and reader-tool for testing. 2018-04-16 01:57:30 -04:00