35 Commits

Author SHA1 Message Date
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
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
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
dfbe003c0e Reorganized to not require GOPATH unless testing. 2018-06-16 09:49:14 -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
Dustin Oprea
235b1a5936 exif: Renamed ErrNotExif to ErrNoExif. 2018-06-13 05:51:28 -04:00
Dustin Oprea
1ce5b771db ifd_enumerate: Can now elect to not resolve tag value.
- To support testing.
2018-06-08 00:41:28 -04:00
Dustin Oprea
92f24ca51b header: Fixed-bytes now determined by byte-order. 2018-06-06 06:53:54 -04:00
Dustin Oprea
2eb57331ff exif: Dropped requirement for incorrect/non-standard EXIF prefix. 2018-06-06 05:32:14 -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
f1b0dd3a32 exif: Streamlined header-builder.
- The ParseExifHeader() function is now completely responsible for
  header decomposition and offset information.
2018-06-06 04:56:18 -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
32664e6098 exif: Streamlined EXIF header parse. Made to behave like IsExif().
- We're prepping to deimplement IsExif() because it's just a lame
  duplication of ParseExifHeader().
  - Transitional step to being able to fix incorrect-header problem.
2018-06-06 03:42:18 -04:00
Dustin Oprea
88cb7331cf documentation: Added examples.
- Renamed DefaultEncodeByteOrder to EncodeDefaultByteOrder.
2018-05-01 10:57:55 -04:00
Dustin Oprea
98620a7d84 exif: Added function descriptions. 2018-05-01 10:18:52 -04:00
Dustin Oprea
2fca65a8ea ifd_builder_encoder: Added method to package full EXIF.
- Moved the EXIF-parsing being done in the tests to reusable code.
2018-05-01 03:29:42 -04:00
Dustin Oprea
89cfa38cfc exif: Reorganized. No-op changes. 2018-04-30 01:33:13 -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
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
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
33e3f2e4eb ifd: Renamed Ifd to IfdEnumerate. 2018-04-17 07:51:34 -04:00
Dustin Oprea
917e288adf Refactored byte-ordering to use standard binary.ByteOrder .
- ..rather than unnecessary custom implementation.
2018-04-17 06:18:31 -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
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