Commit Graph

30 Commits (3c1c668a9fa1759fd23a6e6901ad21acc21e79ea)

Author SHA1 Message Date
Dustin Oprea 3c1c668a9f encode: We now encode child IFDs as they occur.
- ..rather than after the normal tags.
2018-05-28 20:04:02 -04:00
Dustin Oprea 75ff008365 thumbnails: Reimplemented to use normal decode flow.
- We added a trick to overcome the fact that the tag is a slice of longs
  rather than bytes (and would usually cause check errors and alignment
  problems), but this allows us to use the normal allocation and
  decoding flows that are used by normal tags.
  - Made things simpler, but we're still mis-encoding the
    thumbnail, somehow/somewhere.
2018-05-25 21:12:24 -04:00
Dustin Oprea d7ff9ccbbe Tag dumps now include indices. 2018-05-24 03:19:46 -04:00
Dustin Oprea 843976865e ifdBuilder.dumpToStrings: Fixed usage of II.
- We were ambiguously treating it as both the parent II in some places
  and the child II in others. It's supposed to be the parent II.
2018-05-24 01:58:58 -04:00
Dustin Oprea 3cee9b956b ifd_builder_encoder: Fixed subtle but detrimental bugs.
- ifd_builder_encode
  - Bugfix: We were assigning the "next" IFD in correctly (so, chaining
    was broken).
  - Bugfix: We weren't using the right value when *writing* the "next"
    IFD offset (so, chaining was, again, broken).
    - The same IFD was showing as both a child and a sibling, so we were
      seeing the EXIF IFD also being chained-to by the first root IFD
      instead of the *actual* sibling, but only after encoding and then
      decoding (so, this had to be tracked down in the encoding
      semantics, which was non-trivial).

  - Added a test for the stuff that we fixed.
  - Implemented journaling, where we can dump a hierarchically-formatted
    list of operations involved in a completed encode.

- ifd_enumerate: Added (Ifd).TagValueBytes() to return the raw tag-
  value's bytes (rather than just having (Ifd).TagValue(), which returns
  the value marshaled into a string). Good for comparing raw encoded
  and decoded values without imposing interpretation (which gets us into
  trouble with unknown-type tags whose values are non-standard and
  undocumentedand, therefore, not actually parseable).

- Rewired a lot of print and dump functions.
  - For naming-specificity as well as functionality.

- Removed from debugging.
2018-05-21 13:14:42 -04:00
Dustin Oprea 6207bd6200 Checkpoint. 2018-05-12 23:12:53 -04:00
Dustin Oprea 75b2c75c5a ifd_builder_encode: Added tests for encoding child IBs to EXIF.
- Big step. This is the most complicated thing we can do.
- ifd_builder_encode: Need to debug encoding linked IFDs to EXIF.
- ifd_builder: Renamed `SetNextIfd()` to `SetNextIb()`.
- ifd_builder: Bugfix to size assertion on return of
  (IfdBuilderEncode).encodeIfdToBytes().
- ifd_enumerate: Rename PrintNode() to PrintTree().
- ifd_enumerate: Added DumpTree() (to return a list of strings).
2018-05-03 12:43:06 -04:00
Dustin Oprea b75f980bc4 ifd_enumerate: Create II when `Ifd` is constructed.
- ..rather than on-the-fly. Now efficient, especially now that it's used
  for find operations.
2018-05-03 11:13:34 -04:00
Dustin Oprea 8c09d04212 ifd_enumerate: Added find-by-id and find-by-name to tags in `ifd`.
- Made `(Ifd).Entries` a slice of pointers ([]*IfdTagEntry).
2018-05-03 04:09:06 -04:00
Dustin Oprea 35ddc4f803 ifd_builder_encode: Fixed tests from previous change.
- Simplified `builderTag` use.
2018-05-02 07:04:47 -04:00
Dustin Oprea 16586eb8cb ifd_builder: Now embed type in `builderTag`.
- We were automatically looking this up but this will prevent users from
  having a mechanism to use custom tags.
2018-05-02 06:40:36 -04:00
Dustin Oprea b748843a75 tags_unknown: Seeded a first test for encode/decode.
- type_encode: `EncodeWithType` can now encode TypeAsciiNoNul.
- Resolved/removed a bunch of to-do's.
2018-05-02 06:04:14 -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 bbc7f976af ifd_builder: Added test for encoding a complete IFD. 2018-04-29 01:51:12 -04:00
Dustin Oprea 18d527eb72 ifd_builder_encode: Added tests for child-IFD encoding and allocation.
- ifd_enumerate: Added utility functions to parse individual, encoded
  IFDs and tags.
- ifd_builder: Corrected `NewBuilderTagFromConfig()` to automatically
  encode whichever type of value-argument it gets.
2018-04-28 19:22:13 -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 cabbc2fca1 ifd_builder: Added tests for ancillary builder logic. 2018-04-25 04:32:58 -04:00
Dustin Oprea 04631a36c3 ifd_builder: Wrote encoding and allocation logic.
- All of the major design considerations have been covered (unless we
  overlooked something).

- Completely untested.
2018-04-24 05:12:30 -04:00
Dustin Oprea d035d20098 ifd_builder: value is now guaranteed to be a byte-slice or child-IFD.
- Using an interface{} required us to validate the encapsulated type or
  risk forgetting to.

- AddTagsFromExisting now just copies the bytes verbatim if no value-
  resolver provided.
2018-04-23 23:58:37 -04:00
Dustin Oprea 1107496d3c ifd_builder: AddChildIb now validates not previously added. 2018-04-23 21:59:42 -04:00
Dustin Oprea 4bea09dc78 ifd_builder: Can now build a complete chain from existing EXIF.
- ifd_builder:
  - We now validate that `builderTag` instances are either a byte array
    or a child Ifd before allowing to add.
  - Renamed `builderTag.valueBytes` to `builderTag.value` (it's not
    necessarily bytes).
  - `builderTag` now gets the child IFD name if representing a child
    IFD.
  - Added ability to dump structure to string slice.
  - Added NewIfdBuilderFromExistingChain to reconstruct whole chain
    from a read IFD chain (collection).
  - Wrote IB dumper.
  - Added structural tests.
  - Moved ifd_tag_entry types to separate file.

- tags_unknown: Unknown-type tags can now satisfy the `UnknownTagValue`
interface to return `[]byte`.
  - `IfdTagEntry.ValueBytes` automatically uses this. Else, error if not
    `[]byte` or `string`.

- ifd_enumerate
  - Now embed `ByteOrder` in `Ifd` (we otherwise require it to be passed
    a bit too often).

- Renamed some occurences of "IFD" to "IB" where an actual IB in order
  to not be confusing.
2018-04-23 04:53:51 -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 00a5a5ad5b ifd_builder: Fixed so will compile. 2018-04-21 00:24:54 -04:00
Dustin Oprea 83c4834547 ifd_builder: Renamings. 2018-04-20 11:54:42 -04:00
Dustin Oprea d4740ae5b5 Added TODOs. 2018-04-20 11:52:06 -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 f9267550eb ifd_builder: Added renaming tests. 2018-04-20 04:16:48 -04:00
Dustin Oprea b5299427bc ifd_builder: Added tests for creating and adding. 2018-04-19 04:04:19 -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