Skip to content

Instantly share code, notes, and snippets.

@markus2120
Created July 27, 2018 08:21
Show Gist options
  • Save markus2120/78f98c2960bd9bac4836f750be87a23b to your computer and use it in GitHub Desktop.
Save markus2120/78f98c2960bd9bac4836f750be87a23b to your computer and use it in GitHub Desktop.
src/com/android/camera/exif/ExifOutputStream.java
diff --git src/com/android/camera/exif/ExifOutputStream.java src/com/android/camera/exif/ExifOutputStream.java
index d7c8320..5887269 100644
--- src/com/android/camera/exif/ExifOutputStream.java
+++ src/com/android/camera/exif/ExifOutputStream.java
@@ -207,37 +207,7 @@ class ExifOutputStream extends FilterOutputStream {
}
private void writeExifData() throws IOException {
- if (mExifData == null) {
return;
- }
- if (DEBUG) {
- Log.v(TAG, "Writing exif data...");
- }
- ArrayList<ExifTag> nullTags = stripNullValueTags(mExifData);
- createRequiredIfdAndTag();
- int exifSize = calculateAllOffset();
- if (exifSize + 8 > MAX_EXIF_SIZE) {
- throw new IOException("Exif header is too large (>64Kb)");
- }
- OrderedDataOutputStream dataOutputStream = new OrderedDataOutputStream(out);
- dataOutputStream.setByteOrder(ByteOrder.BIG_ENDIAN);
- dataOutputStream.writeShort(JpegHeader.APP1);
- dataOutputStream.writeShort((short) (exifSize + 8));
- dataOutputStream.writeInt(EXIF_HEADER);
- dataOutputStream.writeShort((short) 0x0000);
- if (mExifData.getByteOrder() == ByteOrder.BIG_ENDIAN) {
- dataOutputStream.writeShort(TIFF_BIG_ENDIAN);
- } else {
- dataOutputStream.writeShort(TIFF_LITTLE_ENDIAN);
- }
- dataOutputStream.setByteOrder(mExifData.getByteOrder());
- dataOutputStream.writeShort(TIFF_HEADER);
- dataOutputStream.writeInt(8);
- writeAllTags(dataOutputStream);
- writeThumbnail(dataOutputStream);
- for (ExifTag t : nullTags) {
- mExifData.addTag(t);
- }
}
private ArrayList<ExifTag> stripNullValueTags(ExifData data) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment