diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2014-05-28 18:42:37 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2014-07-10 15:37:26 -0700 |
commit | 4510de26e5361f3a9f07057ec6f26483c888c1fa (patch) | |
tree | 5a474839318779c1e6eff96a4f98e3e1f74ef85a /media/img_utils/src/Input.cpp | |
parent | 5c68f959eaa2e02fed5643c78e281fff42bcc0a2 (diff) | |
download | frameworks_av-4510de26e5361f3a9f07057ec6f26483c888c1fa.zip frameworks_av-4510de26e5361f3a9f07057ec6f26483c888c1fa.tar.gz frameworks_av-4510de26e5361f3a9f07057ec6f26483c888c1fa.tar.bz2 |
DNG: Update TiffWriter to handle thumbnails and SubIfds.
- Fix SubIfd handling.
- Add StripSources, convenience functions for writing image strips.
- Update Input classes to use with JNI.
- Add skip method.
- Add tag definitions for GPS tags.
- Add name string to tag definitions.
Bug: 15112503
Change-Id: I9535b21261027f6c06a041c1621de8f865a0ad32
Diffstat (limited to 'media/img_utils/src/Input.cpp')
-rw-r--r-- | media/img_utils/src/Input.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/media/img_utils/src/Input.cpp b/media/img_utils/src/Input.cpp index 1e51e10..3782014 100644 --- a/media/img_utils/src/Input.cpp +++ b/media/img_utils/src/Input.cpp @@ -20,9 +20,37 @@ namespace android { namespace img_utils { Input::~Input() {} + status_t Input::open() { return OK; } + status_t Input::close() { return OK; } +ssize_t Input::skip(size_t count) { + const size_t SKIP_BUF_SIZE = 1024; + uint8_t skipBuf[SKIP_BUF_SIZE]; + + size_t remaining = count; + while (remaining > 0) { + size_t amt = (SKIP_BUF_SIZE > remaining) ? remaining : SKIP_BUF_SIZE; + ssize_t ret = read(skipBuf, 0, amt); + if (ret < 0) { + if(ret == NOT_ENOUGH_DATA) { + // End of file encountered + if (remaining == count) { + // Read no bytes, return EOF + return NOT_ENOUGH_DATA; + } else { + // Return num bytes read + return count - remaining; + } + } + // Return error code. + return ret; + } + remaining -= ret; + } + return count; +} } /*namespace img_utils*/ } /*namespace android*/ |