Commit Graph

43 Commits (208788de28150f1ceba5fbfa2f3fc5f191ac3258)

Author SHA1 Message Date
Dustin Oprea bf3bc4e542 Refactor undefined-type tag processing 2020-01-12 18:56:35 -05:00
Dustin Oprea c8c0acaebc Use global for name of test image
- Moved logic from common_test.go to testing_common.go . That was legacy
  naming.
2020-01-01 10:05:56 -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 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 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 235b1a5936 exif: Renamed ErrNotExif to ErrNoExif. 2018-06-13 05:51:28 -04:00
Dustin Oprea f4db9f31af tags: We now use a singleton TagIndex internally.
- We now embed the tags data so that we can be used in single,
  distributable binaries..
2018-06-07 05:15:51 -04:00
Dustin Oprea 4c58c1c84b exif: Eliminated an offset constant. Just used for tests.
- Will simplify fixing the header issues we have. It's relative, any way
  (won't be affected by the imminent changes to the header).
2018-06-06 05:17:56 -04:00
Dustin Oprea 1d7239382b testing: Moved common testing code to test_common.
- Tweaked comments to be more concise.
2018-06-06 05:11:07 -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 7fa077bb78 exif: Added test for ParseExifHeader.
- Tweaked the test names for correctness.
2018-06-06 03:52:26 -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 6207bd6200 Checkpoint. 2018-05-12 23:12:53 -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 7518b0882a exif: Bugfix to message in test.
- Put Travis badges in documentation.
2018-05-02 15:14:21 -04:00
Dustin Oprea f4cb06d79d type: Renamed ValueString() to ResolveAsString(). 2018-05-02 02:21:06 -04:00
Dustin Oprea 54e4cb73eb IfdBuilder: Added AddFromConfigWithName().
- IfdBuilder: Added NewBuilderTagFromConfigWithName().
- TagIndex: Added GetWithName().
- IfdByteEncoder: Updated example to use names.
2018-05-01 12:22:48 -04:00
Dustin Oprea 88cb7331cf documentation: Added examples.
- Renamed DefaultEncodeByteOrder to EncodeDefaultByteOrder.
2018-05-01 10:57:55 -04:00
Dustin Oprea 81079a77d6 exif: Added EXIF header builder and unit-test. 2018-04-29 02:48:52 -04:00
Dustin Oprea d06a3c8963 ifd_builder: Implemented NewBuilderTagFromConfig() BT factory for testing.
- Updated IfdByteEncoder tests to use it instead of hacking-together
  their own BT's (makes for more standardized, consistent testing).

- Universally refactored all core IFD knowledge implemented upon a
  single IFD name to instead work with IfdIdentity instances, instead,
  in order to validate that we only recognize the IFDs only in the
  context of the correct parents in the hierarchy.

- Implemented standard testing byte-order (assigned to
  TestDefaultByteOrder).
2018-04-27 03:42:59 -04:00
Dustin Oprea 50eafa98d6 ifd_enumerate: Added tests.
- Refactored (IfdTagEntry).ValueBytes() to handle managed undefined
  values.
2018-04-22 02:35:33 -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 a909226514 type_decode: Implemented immediate remaining 'unknown'-type tags.
- Except for MakerNote. We're just going to have to skip that when
  writing, for now.
2018-04-21 03:40:33 -04:00
Dustin Oprea 00a5a5ad5b ifd_builder: Fixed so will compile. 2018-04-21 00:24:54 -04:00
Dustin Oprea 88333d9088 ifd_builder: Added main flow and allocation.
- We still need to implement the size calculations and tag encoding.
2018-04-20 11:45:32 -04:00
Dustin Oprea f99faad160 builder: Added full IFD-building functionality.
- There are still some placeholders for things that we need to figure
  out.

- Still needs tests.
2018-04-19 02:43:17 -04:00
Dustin Oprea 52dafd070a collect: Added a massive test for collected structure. 2018-04-19 01:02:03 -04:00
Dustin Oprea 679ea19d6c ifd_enumerate. The IFD tree and content can now be collected.
- Collected into a static structure in addition to scanned (which is
- only a visitor pattern).
- Test still has be finished.
2018-04-18 07:58:05 -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
Dustin Oprea 42e678f6c2 type: Implemented workflow for undefined-type tags.
- Implemented for the straightforward tags. Noted what had to be done
  for the rest.
2018-04-16 00:30:39 -04:00
Dustin Oprea 172013e0f0 ifd: Implemented recursion. Refactored IFD seeking.
- tags.yaml: Uncommented previously-unhandleable tags.
2018-04-15 23:13:25 -04:00
Dustin Oprea 1511788a4e ifd: Implemented several layers of value processing. Done.
- It's going to be laborious to write unit-tests for, though.
2018-04-15 01:25:30 -04:00
Dustin Oprea 315ca60f03 ifd: Formalized visitor implementation. 2018-04-14 20:32:02 -04:00
Dustin Oprea 05fe72f929 Added tag lookup. Only a minimal number of tags are currently known. 2018-04-14 20:04:35 -04:00
Dustin Oprea 685d801489 Initial commit.
- Parsing works.
- Not yet resolving values.
- Not yet resolving the actual IDs.
- Not yet able to make changes.
2018-04-14 14:38:35 -04:00